:root {
  color-scheme: dark;
  --bg: #0b110b;
  --bg-top: #111911;
  --surface: rgba(9, 18, 10, 0.84);
  --surface-strong: rgba(8, 15, 8, 0.9);
  --surface-muted: rgba(13, 24, 13, 0.72);
  --surface-soft: rgba(18, 32, 18, 0.52);
  --text: #eef4e6;
  --text-soft: #a8b699;
  --text-faint: #7f8b76;
  --primary: #8fbe4a;
  --primary-hover: #9fcc5c;
  --border: rgba(155, 221, 66, 0.18);
  --border-strong: rgba(155, 221, 66, 0.34);
  --danger: #ff9a73;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", Arial, sans-serif;
  background:
    radial-gradient(circle at top center, rgba(116, 190, 42, 0.12), transparent 18%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(155, 221, 66, 0.08), transparent 20%),
    radial-gradient(circle at 84% 72%, rgba(155, 221, 66, 0.06), transparent 22%),
    linear-gradient(rgba(155, 221, 66, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 221, 66, 0.055) 1px, transparent 1px);
  background-size: auto, auto, 96px 96px, 96px 96px;
  pointer-events: none;
  opacity: 0.42;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center top, rgba(155, 221, 66, 0.05), transparent 36%),
    radial-gradient(circle at center center, rgba(2, 6, 2, 0), rgba(2, 6, 2, 0.45) 72%);
  pointer-events: none;
}

.app-shell {
  min-height: 100vh;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 80px;
  position: relative;
  z-index: 1;
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

.card {
  position: relative;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 36px;
  background: linear-gradient(180deg, rgba(10, 19, 10, 0.9) 0%, rgba(5, 11, 5, 0.92) 100%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(155, 221, 66, 0.22) 18%,
    rgba(155, 221, 66, 0.52) 50%,
    rgba(155, 221, 66, 0.22) 82%,
    transparent 100%
  );
}

.hero-card,
.result-card,
.debug-card {
  padding: 32px;
}

.debug-header,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-chip,
.badge,
.prompt-label,
.transcript-field span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-chip,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
}

.hero-chip,
.badge {
  color: var(--text);
  background: rgba(20, 35, 18, 0.55);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 30px;
  align-items: start;
  margin-bottom: 28px;
}

.hero-copy {
  display: grid;
  max-width: none;
  margin-bottom: 22px;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-small {
  margin-bottom: 12px;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
}

.hero-copy .eyebrow {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: clamp(1.35rem, 2.1vw, 1.9rem);
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.05em;
  line-height: 0.94;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.75rem, 5.8vw, 4.4rem);
  font-weight: 800;
  max-width: 8ch;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(2.15rem, 3.3vw, 3.25rem);
  font-weight: 800;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.4rem;
  font-weight: 700;
}

.lead {
  margin-bottom: 0;
  color: var(--text-soft);
  line-height: 1.75;
  font-size: 1.05rem;
  max-width: 58ch;
}

.auth-card {
  width: min(560px, 100%);
  padding: 40px;
}

.scenario-screen-card {
  width: min(720px, 100%);
  padding: 40px;
}

.scenario-screen-card .section-heading {
  margin-bottom: 30px;
}

.scenario-screen-card h1 {
  max-width: 10ch;
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 24px;
  margin-top: 36px;
}

.auth-field {
  display: grid;
  gap: 12px;
}

.auth-field span {
  color: var(--text);
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 68px;
  padding: 0 24px;
  border-radius: 28px;
  border: 1px solid rgba(155, 221, 66, 0.14);
  background: rgba(3, 8, 3, 0.94);
  color: var(--text);
  font: inherit;
}

.auth-card h1 {
  max-width: none;
  margin-top: 16px;
  font-size: clamp(3.1rem, 7vw, 5rem);
}

.auth-form .button-submit {
  min-height: 78px;
  margin-top: 6px;
}

.auth-field input:focus {
  outline: none;
  border-color: rgba(155, 221, 66, 0.45);
  box-shadow: 0 0 0 4px rgba(155, 221, 66, 0.07);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
}

.user-actions .badge,
.user-actions .button {
  width: auto;
  flex: 1 1 0;
  min-height: 44px;
  padding: 0 16px;
}

body:not(.is-authenticated) .state-panel-shell {
  display: none;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.prompt-box,
.voice-panel,
.result-block,
.session-card {
  border: 1px solid rgba(155, 221, 66, 0.12);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(12, 23, 12, 0.72) 0%, rgba(8, 16, 8, 0.78) 100%);
}

.prompt-box {
  margin: 0;
  min-height: 100%;
  padding: 28px;
}

.prompt-label {
  margin-bottom: 18px;
  color: var(--text);
}

.prompt-box ol,
.result-list {
  margin: 0;
  padding-left: 22px;
}

.prompt-box li,
.result-list li {
  margin-bottom: 12px;
  color: var(--text-soft);
  line-height: 1.65;
}

.form-shell {
  gap: 22px;
}

.chat-panel {
  display: grid;
  gap: 18px;
}

.chat-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
}

.badge-column {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.badge-soft {
  background: rgba(12, 22, 11, 0.32);
  border-color: rgba(155, 221, 66, 0.14);
  color: var(--text-soft);
}

.badge-warning {
  color: #ffd2bf;
  background: rgba(124, 47, 33, 0.28);
  border-color: rgba(255, 154, 115, 0.3);
}

.voice-panel {
  padding: 22px;
}

.scenario-list {
  display: grid;
  gap: 14px;
}

.scenario-card {
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 220px;
  padding: 24px;
  border: 1px solid rgba(155, 221, 66, 0.18);
  border-radius: 28px;
  background: rgba(3, 8, 3, 0.72);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scenario-card-active {
  border-color: rgba(155, 221, 66, 0.58);
  background: rgba(155, 221, 66, 0.1);
}

.scenario-name {
  font-size: 1.35rem;
  font-weight: 800;
}

.scenario-description,
.scenario-question {
  color: var(--text-soft);
  line-height: 1.65;
}

.scenario-meta {
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.scenario-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--primary);
  color: #071003;
  font-weight: 800;
}

.scenario-user-actions {
  margin-top: 24px;
}

.voice-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.voice-panel-header h2 {
  margin-bottom: 0;
}

.voice-panel-header p {
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 1.02rem;
}

.voice-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 14px;
}

.voice-actions .button {
  flex: 0 1 auto;
  width: auto;
  min-width: 128px;
  min-height: 52px;
  padding: 0 18px;
}

.transcript-field {
  display: grid;
  gap: 10px;
}

.transcript-field span {
  color: var(--text);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 16px 18px;
  border-radius: 26px;
  border: 1px solid rgba(155, 221, 66, 0.14);
  background: rgba(3, 8, 3, 0.94);
  color: var(--text);
  font: inherit;
  line-height: 1.7;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

textarea::placeholder {
  color: var(--text-faint);
}

textarea:focus {
  outline: none;
  border-color: rgba(155, 221, 66, 0.45);
  box-shadow: 0 0 0 4px rgba(155, 221, 66, 0.07);
}

.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #071003;
}

.button-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button-secondary {
  border-color: rgba(155, 221, 66, 0.3);
  background: rgba(18, 31, 17, 0.2);
}

.button-secondary:hover {
  background: rgba(18, 31, 17, 0.42);
}

.button-submit {
  width: 100%;
  min-height: 64px;
  margin-top: 0;
}

.composer-actions {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 4px;
}

.composer-actions .button-submit {
  flex: 1;
  width: auto;
}

.composer-shell {
  display: grid;
  gap: 14px;
}

.session-badges {
  order: 1;
}

.voice-panel {
  order: 2;
}

.composer-actions {
  order: 3;
}

.session-footer {
  order: 4;
  display: grid;
  gap: 12px;
}

.usage-summary {
  margin: 0;
  padding: 0 4px;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.composer-shell-active .voice-panel {
  order: 1;
}

.composer-shell-active .session-badges {
  order: 3;
}

.message {
  margin: 0;
  padding: 16px 18px;
  border-radius: 22px;
}

.message-error {
  color: var(--danger);
  background: rgba(124, 47, 33, 0.28);
  border: 1px solid rgba(255, 154, 115, 0.22);
}

.message-warning {
  color: #ffd2bf;
  background: rgba(124, 47, 33, 0.2);
  border: 1px solid rgba(255, 154, 115, 0.2);
}

.message-info {
  color: var(--text-soft);
  background: rgba(18, 31, 17, 0.68);
  border: 1px solid rgba(155, 221, 66, 0.1);
}

.section-heading {
  max-width: 660px;
}

.section-heading .lead {
  margin-top: 8px;
}

.result-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.result-grid-compact {
  margin-top: 0;
}

.result-block {
  padding: 24px;
}

.result-list {
  display: grid;
  gap: 10px;
}

.result-list li {
  margin-bottom: 0;
  color: var(--text);
}

.transcript-preview {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text-soft);
}

.messages-list {
  display: grid;
  gap: 14px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 4px;
}

.messages-list:empty {
  display: none;
}

.chat-message {
  max-width: min(92%, 760px);
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(155, 221, 66, 0.12);
  background: linear-gradient(180deg, rgba(12, 23, 12, 0.72) 0%, rgba(8, 16, 8, 0.78) 100%);
}

.chat-message-user {
  justify-self: end;
  background: linear-gradient(180deg, rgba(88, 132, 37, 0.28) 0%, rgba(47, 79, 18, 0.42) 100%);
  border-color: rgba(155, 221, 66, 0.24);
}

.chat-message-assistant {
  justify-self: start;
}

.chat-message-role {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-message-text {
  margin-bottom: 0;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

.debug-panel {
  margin-top: 34px;
}

.debug-header {
  align-items: flex-end;
  margin-bottom: 26px;
}

.sessions-list {
  display: grid;
  gap: 16px;
}

.session-card {
  padding: 22px 24px;
}

.session-card h3,
.session-card p:last-child {
  margin-bottom: 0;
}

.session-meta {
  margin-bottom: 10px;
  color: var(--text-faint);
  font-size: 0.94rem;
}

.session-summary {
  font-weight: 600;
  color: var(--text);
}

.session-json {
  margin-top: 8px;
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(3, 8, 3, 0.94);
  color: var(--text-soft);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
}

.session-details {
  margin-top: 16px;
}

.session-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.session-message-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--text-soft);
  line-height: 1.6;
}

.result-list-compact {
  margin-top: 16px;
}

.generic-results-list {
  display: grid;
  gap: 18px;
}

.generic-result-item {
  display: grid;
  gap: 8px;
}

.generic-result-item h4 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 9ch;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding: 14px 0 40px;
  }

  .hero-card,
  .result-card,
  .debug-card,
  .scenario-screen-card,
  .auth-card {
    padding: 22px;
    border-radius: 28px;
  }

  .voice-panel-header,
  .chat-topbar,
  .debug-header,
  .result-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .badge-column {
    justify-items: start;
  }

  .hero-topbar {
    margin-bottom: 28px;
  }

  h1 {
    font-size: 2.75rem;
  }

  .auth-card h1 {
    font-size: 3.35rem;
  }

  .scenario-screen-card h1 {
    font-size: 3rem;
  }

  .auth-form {
    gap: 20px;
    margin-top: 30px;
  }

  .auth-field input {
    min-height: 66px;
  }

  .voice-panel,
  .prompt-box,
  .result-block,
  .session-card,
  .chat-message {
    padding: 20px;
    border-radius: 24px;
  }

  .hero-copy {
    margin-bottom: 16px;
  }

  .user-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .chat-panel {
    gap: 16px;
  }

  .voice-panel-header {
    margin-bottom: 12px;
  }

  .voice-actions {
    margin-bottom: 12px;
  }

  .voice-actions .button {
    min-width: 0;
    flex: 1 1 0;
  }

  textarea {
    min-height: 88px;
  }

  .button {
    width: 100%;
  }

  .composer-actions {
    flex-direction: column;
  }
}

.quick-replies-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-replies-row .quick-reply-button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  padding: 0 4px;
  border-radius: 12px;
  border: 1px solid var(--accent, #c9ff84);
  background: transparent;
  color: var(--text, #f4f5ee);
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 80ms ease;
}

.quick-replies-row .quick-reply-button,
.quick-replies-row .quick-reply-button:hover,
.quick-replies-row .quick-reply-button:focus,
.quick-replies-row .quick-reply-button:active,
.quick-replies-row .quick-reply-button:visited {
  background: transparent;
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .quick-replies-row .quick-reply-button:hover {
    background-color: rgba(201, 255, 132, 0.12);
  }
}

.quick-replies-row .quick-reply-button:active {
  transform: scale(0.97);
}

.quick-replies-row .quick-reply-button:focus-visible {
  outline: 2px solid var(--accent, #c9ff84);
  outline-offset: 2px;
}

.quick-replies-row .quick-reply-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
