@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@400;500;600;700;800;900&display=swap");

:root {
  color-scheme: dark;
  --bg: #05070b;
  --bg-2: #080c13;
  --panel: #0d121c;
  --panel-2: #111a29;
  --panel-3: #172234;
  --field: #090d15;
  --field-2: #121c2b;
  --border: #243247;
  --border-bright: #315072;
  --text: #f7fbff;
  --muted: #9daabe;
  --soft: #c8d8ee;
  --blue: #2563eb;
  --blue-2: #0891b2;
  --cyan: #22d3ee;
  --violet: #6d28d9;
  --yellow: #facc15;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 24px 80px rgb(0 0 0 / 42%);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Outfit", var(--font-sans);
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgb(34 211 238 / 10%), transparent 26rem),
    linear-gradient(180deg, #05070b 0%, #080c13 58%, #05070b 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 10px 26px rgb(37 99 235 / 18%);
}

button:hover {
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field-2);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 3%);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgb(34 211 238 / 10%);
}

input,
select {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 66px;
  padding: 11px 12px;
  resize: vertical;
}

.locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  position: relative;
  width: min(620px, 100%);
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--cyan);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgb(17 26 41 / 96%), rgb(9 13 21 / 96%)),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-card::before,
.shell::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 50px;
  background: rgb(3 5 8 / 88%);
  border-bottom: 1px solid rgb(255 255 255 / 7%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.65rem, 3vw, 2.28rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}

.naka-logo {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgb(59 130 246 / 50%);
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgb(37 99 235 / 42%), rgb(34 211 238 / 20%)),
    #0a1020;
  color: #f8fbff;
  box-shadow: 0 0 22px rgb(34 211 238 / 14%);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgb(34 211 238 / 28%);
  border-radius: 8px;
  background: rgb(8 13 22 / 72%);
  color: #8bdcff;
  font-family: var(--font-display);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0;
}

.auth-card h1 {
  max-width: 440px;
  font-size: clamp(1.72rem, 3vw, 2.15rem);
}

.auth-subtitle,
.topbar p:not(.eyebrow),
.api-panel p,
.section-head p,
.auth-box p,
.mode-note span {
  color: var(--soft);
  line-height: 1.45;
}

.auth-subtitle {
  margin: 8px 0 18px;
  font-size: 0.9rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.auth-grid.request-only {
  grid-template-columns: minmax(0, 100%);
  max-width: 480px;
}

.auth-box {
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #111a29, #0d1422);
}

.auth-box h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
}

.auth-box p {
  min-height: 0;
  margin: 0 0 14px;
  font-size: 0.86rem;
}

.auth-box input {
  margin-bottom: 10px;
}

.auth-box button {
  width: 100%;
}

.auth-message {
  margin: 14px 0 0;
  color: #dcecff;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.shell {
  position: relative;
  width: min(1440px, calc(100% - 34px));
  margin: 0 auto;
  padding: 72px 0 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--cyan);
  border-radius: 14px;
  background: linear-gradient(180deg, rgb(13 18 28 / 98%), rgb(8 12 19 / 98%));
  box-shadow: var(--shadow);
}

.topbar::before {
  content: "NAKA PROMPT";
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 7px;
  background: #111827;
  color: #e5f6ff;
  font-size: 0.72rem;
  font-weight: 900;
  font-family: var(--font-display);
}

.topbar::after {
  content: "PORT: 3001 (LOCAL_NET)";
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 2;
  padding: 4px 8px;
  border: 1px solid rgb(34 211 238 / 18%);
  border-radius: 7px;
  background: #05070b;
  color: #e5f6ff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
}

.topbar p:not(.eyebrow) {
  max-width: 760px;
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.lang-switch {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-switch button {
  min-width: 44px;
  background: #1f2937;
  box-shadow: none;
}

.lang-switch button.active {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
}

.logout-button {
  background: #374151;
}

.api-panel,
.builder,
.output-card,
.mode-note div {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgb(17 26 41 / 98%), rgb(12 18 29 / 98%));
  box-shadow: 0 16px 46px rgb(0 0 0 / 25%);
}

.api-panel {
  width: min(620px, 100%);
  margin: 16px auto;
  padding: 16px;
}

.api-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.api-panel label,
.controls span,
.custom-field span,
.provider-field span {
  display: block;
  margin-bottom: 7px;
  color: #69b7ff;
  font-size: 0.78rem;
  font-weight: 900;
}

.api-head label {
  margin-bottom: 0;
  color: var(--yellow);
}

.provider-field {
  display: block;
  margin-top: 12px;
}

.api-actions {
  display: flex;
  gap: 9px;
  margin-top: 10px;
}

.ghost-button {
  background: #374151;
  box-shadow: none;
}

.api-panel p {
  margin: 10px 0 0;
  font-size: 0.84rem;
}

.api-panel .api-message {
  color: #dbeafe;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #1f2937;
  color: #dbeafe;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.checking {
  background: #3a2f12;
  border-color: #7c5e12;
  color: #fde68a;
}

.status-badge.online {
  background: #0f2d20;
  border-color: #166534;
  color: #86efac;
}

.status-badge.failed {
  background: #3a1217;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.builder {
  margin-top: 14px;
  padding: 18px;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(220px, 0.62fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.section-head h2,
.card-head h2 {
  margin: 0;
  font-size: clamp(1.08rem, 1.4vw, 1.35rem);
}

.section-head p {
  margin: 0;
  font-size: 0.88rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 13px 16px;
  align-items: end;
}

.audio-controls {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.custom-field {
  display: block;
  margin-top: 13px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.surprise {
  min-height: 42px;
  background: linear-gradient(135deg, #2563eb, #db2777);
}

.surprise.alt {
  background: linear-gradient(135deg, #6d28d9, #0891b2);
}

.mode-note {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.mode-note div {
  min-height: 58px;
  padding: 12px 14px;
}

.mode-note b,
.mode-note span {
  display: block;
}

.mode-note b {
  margin-bottom: 4px;
  color: var(--yellow);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.mode-note span {
  font-size: 0.84rem;
}

.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.output-card {
  padding: 18px;
}

.output-card.sound {
  border-color: #304d7a;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.enhance-button {
  background: linear-gradient(135deg, var(--violet), #2563eb);
}

pre {
  margin: 14px 0 0;
  min-height: 330px;
  max-height: min(56vh, 560px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgb(9 13 21 / 95%), rgb(6 9 15 / 95%)),
    var(--field);
  color: #f5f9ff;
  font-family: var(--font-mono);
  font-size: 0.79rem;
  line-height: 1.52;
  white-space: pre-wrap;
}

.sound pre {
  border-color: #304d7a;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 20;
  translate: -50% 18px;
  opacity: 0;
  pointer-events: none;
  padding: 11px 16px;
  border: 1px solid rgb(34 211 238 / 24%);
  border-radius: 10px;
  background: #dcecff;
  color: #07111f;
  box-shadow: 0 16px 44px rgb(0 0 0 / 38%);
  transition: 180ms ease;
  font-weight: 900;
}

.toast.show {
  opacity: 1;
  translate: -50% 0;
}

@media (max-width: 1180px) {
  .controls,
  .audio-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  pre {
    min-height: 280px;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 12.5px;
  }

  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 62px;
  }

  .topbar,
  .section-head,
  .card-head,
  .api-head,
  .auth-grid,
  .mode-note,
  .actions,
  .controls,
  .audio-controls {
    grid-template-columns: 1fr;
  }

  .topbar,
  .card-head,
  .api-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar::after {
    display: none;
  }

  .lang-switch,
  .api-actions,
  .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .logout-button,
  .card-actions button,
  .api-actions button {
    width: 100%;
  }

  .auth-card,
  .api-panel,
  .builder,
  .output-card {
    padding: 16px;
  }

  .auth-box {
    min-height: auto;
  }

  .auth-box p {
    min-height: 0;
  }

  pre {
    min-height: 240px;
    max-height: 460px;
  }
}

@media (max-width: 480px) {
  .auth-screen {
    padding: 12px;
  }

  .shell {
    width: min(100% - 14px, 1440px);
  }

  h1,
  .auth-card h1 {
    font-size: 1.5rem;
  }

  .lang-switch {
    grid-template-columns: 1fr 1fr 1fr;
  }

  input,
  select {
    min-height: 38px;
  }
}
