@font-face {
  font-family: 'CustomFont';
  src: url('../fonts/font.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --page-bg-start: #fcad72;
  --page-bg-end: #736fa3;
  --surface: rgba(255, 255, 255, 0.12);
  --surface-strong: rgba(255, 255, 255, 0.16);
  --surface-border: rgba(255, 255, 255, 0.12);
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.74);
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  margin: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
}

body.landing-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(to bottom left, #FCAD72, #736FA3);
  color: white;
  font-family: 'CustomFont', Arial, sans-serif;
  font-size: 8em;
  text-align: center;
}

body.app-page {
  background: linear-gradient(to bottom left, #FCAD72, #736FA3);
  color: var(--text-main);
  font-family: 'CustomFont', Arial, sans-serif;
}

.logo,
.animated-text {
  opacity: 0;
  animation: fadeIn 15s ease forwards;
}

.logo {
  width: 450px;
  height: auto;
  margin-bottom: 0;
}

.animated-text {
  margin-top: 0;
}

.flash-stack {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: grid;
  gap: 0.75rem;
  max-width: min(28rem, calc(100vw - 2rem));
}

.flash-message {
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow);
  color: var(--text-main);
  font-size: 1rem;
  backdrop-filter: blur(12px);
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card,
.panel-card,
.settings-card {
  width: min(100%, 34rem);
  background: var(--surface);
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-card {
  width: min(100%, 28rem);
  padding: 1.75rem;
}

.panel-card,
.settings-card {
  width: min(100%, 56rem);
  padding: 2rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
}

.section-copy {
  margin: 0.75rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.field-label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.field-label span {
  color: var(--text-muted);
}

.text-input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.82rem 0.9rem;
  background: var(--surface-strong);
  color: var(--text-main);
  font: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.text-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.text-input::placeholder {
  color: rgba(255, 255, 255, 0.54);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1.1rem;
  border-radius: 0.75rem;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.button {
  background: rgba(255, 255, 255, 0.88);
  color: #2d2d2d;
  font-weight: 500;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
}

.button-auth {
  width: 100%;
}

.dashboard-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 2rem 0;
}

.info-tile {
  padding: 1.25rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
}

.info-tile h2 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
}

.info-tile p,
.settings-list li {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.settings-list {
  margin: 1.5rem 0 2rem;
  padding-left: 1.3rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(24rem, 1fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1.6rem;
}

.settings-panel-full {
  grid-column: 1 / -1;
}

.settings-panel {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  align-self: start;
  padding: 1rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.1);
}

.settings-panel-head {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.settings-panel-head > div {
  display: grid;
  gap: 0.2rem;
}

.settings-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.settings-panel-head p,
.settings-empty,
.token-created-banner p,
.usage-window,
.api-hint,
.api-hint code {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.settings-icon {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
}

.settings-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  font-size: 0.84rem;
}

.token-summary-block {
  display: grid;
  gap: 0.8rem;
}

.usage-block {
  display: grid;
  gap: 0.55rem;
}

.usage-copy-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.usage-copy-row-muted {
  color: var(--text-muted);
}

.usage-progress {
  width: 100%;
  height: 0.6rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

.usage-progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.usage-progress::-webkit-progress-value {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
}

.usage-progress::-moz-progress-bar {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
}

.token-created-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.14);
}

.settings-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.settings-action {
  gap: 0.55rem;
  width: auto;
  align-self: flex-start;
}

.settings-copy-button {
  flex-shrink: 0;
  gap: 0.55rem;
}

.api-hint {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem 0.95rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
}

.api-hint-head {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.api-hint code {
  white-space: normal;
  word-break: break-word;
  font-family: Consolas, monospace;
}

.settings-footer-actions {
  margin-top: 1.4rem;
}

.settings-inline-form {
  display: flex;
  gap: 0.8rem;
  align-items: end;
  flex-wrap: wrap;
}

.settings-inline-field {
  flex: 1 1 14rem;
}

.rights-table-wrap {
  overflow-x: auto;
}

.rights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.rights-table th,
.rights-table td {
  padding: 0.7rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rights-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.rights-empty {
  color: var(--text-muted);
}

.rights-toggle {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  cursor: pointer;
}

.rights-toggle-active {
  background: rgba(255, 255, 255, 0.88);
  color: #2d2d2d;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.32);
  z-index: 30;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 42rem);
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.modal-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 500;
}

.modal-output {
  margin: 0;
  padding: 1rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .page-shell {
    padding: 1rem;
  }

  .auth-card,
  .panel-card,
  .settings-card {
    padding: 1.4rem;
  }

  .button-row {
    flex-direction: column;
  }

  .button,
  .button-secondary {
    width: 100%;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-action {
    width: 100%;
  }

  .token-created-banner {
    align-items: stretch;
    flex-direction: column;
  }
}

.preprompt-form-fields {
  display: grid;
  gap: 0.9rem;
}

.preprompt-top-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.preprompt-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.preprompt-compose-column,
.preprompt-test-column {
  min-width: 0;
}

.preprompt-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field-help {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.preprompt-textarea {
  min-height: 10rem;
  resize: vertical;
  font-family: Consolas, monospace;
}

.preprompt-textarea-large {
  min-height: 18rem;
}

.preprompt-test-input {
  min-height: 9rem;
}

.preprompt-text-preview {
  color: var(--text-muted);
  font-size: 0.88rem;
  word-break: break-word;
}

.token-inline-stack {
  display: grid;
  gap: 0.3rem;
}

.preprompt-token-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  word-break: break-word;
}

.preprompt-test-column {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
}

.preprompt-test-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.preprompt-test-meta {
  min-height: 2.5rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  line-height: 1.5;
}

.preprompt-test-output-wrap {
  display: grid;
  gap: 0.9rem;
}

.preprompt-inline-output {
  min-height: 12rem;
  max-height: 18rem;
}

.preprompt-inline-output-raw {
  min-height: 10rem;
}

.napobox-sync-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.napobox-token-banner {
  align-items: flex-start;
}

.napobox-token-view {
  min-height: 8rem;
  word-break: break-all;
}

@media (max-width: 640px) {
  .preprompt-inline-grid,
  .preprompt-top-grid,
  .preprompt-workbench,
  .napobox-sync-grid {
    grid-template-columns: 1fr;
  }
}
