:root {
  color-scheme: light;
  --yellow: #ffd51f;
  --yellow-light: #ffe76a;
  --yellow-dark: #e9b900;
  --blue: #15589a;
  --blue-dark: #0a315d;
  --blue-light: #2778bd;
  --ink: #07162b;
  --paper: #fff6b6;
  --red: #d33f49;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, var(--yellow-light), transparent 52%),
    var(--yellow);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  content: "";
  opacity: .13;
  background-image:
    linear-gradient(rgba(7, 22, 43, .18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 22, 43, .18) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
}

.overalls-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.overall-strap {
  position: absolute;
  top: -14vh;
  width: clamp(110px, 14vw, 210px);
  height: 78vh;
  background:
    linear-gradient(90deg, rgba(255,255,255,.1), transparent 18% 82%, rgba(0,0,0,.13)),
    var(--blue);
  border: 4px solid var(--blue-dark);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.1);
}

.strap-left { left: -3vw; transform: rotate(-13deg); }
.strap-right { right: -3vw; transform: rotate(13deg); }

.overall-bib {
  position: absolute;
  right: -5vw;
  bottom: -20vh;
  left: -5vw;
  height: 47vh;
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(255,255,255,.035) 7px 8px),
    var(--blue);
  border-top: 7px solid var(--blue-dark);
  transform: rotate(-1.5deg);
}

.stitch-line {
  position: absolute;
  top: 18px;
  right: 3vw;
  left: 3vw;
  border-top: 3px dashed rgba(255, 213, 31, .72);
}

.overall-pocket {
  position: absolute;
  top: 70px;
  left: 50%;
  width: min(260px, 38vw);
  height: 130px;
  border: 4px solid var(--blue-dark);
  border-top: 0;
  border-radius: 0 0 60px 60px;
  transform: translateX(-50%);
  box-shadow: inset 0 -5px 0 rgba(255,255,255,.08);
}

.overall-button {
  position: absolute;
  top: 26vh;
  width: 42px;
  height: 42px;
  background: var(--ink);
  border: 8px double var(--yellow);
  border-radius: 50%;
  box-shadow: 0 4px 0 rgba(0,0,0,.2);
}

.button-left { left: clamp(44px, 9vw, 130px); }
.button-right { right: clamp(44px, 9vw, 130px); }

.terminal-shell {
  display: flex;
  flex-direction: column;
  width: min(1040px, calc(100% - 40px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 0 18px;
}

.disclaimer-banner {
  margin: 12px 0;
  padding: 7px 12px;
  color: var(--blue-dark);
  background: rgba(255, 246, 182, .66);
  border: 2px dashed var(--blue-dark);
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
}

.terminal-window {
  display: grid;
  flex: 1;
  grid-template-rows: auto minmax(260px, 1fr) auto auto auto auto;
  min-height: 0;
  overflow: hidden;
  background: rgba(255, 246, 182, .96);
  border: 5px solid var(--ink);
  box-shadow: 14px 14px 0 var(--blue-dark);
}

.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: white;
  background: var(--blue-dark);
  border-bottom: 4px solid var(--ink);
  font-size: .68rem;
}

.window-status { color: var(--yellow); }

.messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
  scrollbar-color: var(--blue) var(--paper);
  scroll-behavior: smooth;
}

.message-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  animation: terminal-in 150ms steps(3, end) both;
}

.terminal-prefix {
  padding-top: 3px;
  color: var(--blue);
  font-size: .76rem;
  font-weight: 900;
}

.user-row .terminal-prefix { color: #745d00; }

.message { max-width: 720px; }
.message p { margin: 0; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; }

.bot-message p { color: var(--blue-dark); font-weight: 750; }
.user-message p { color: var(--ink); }

.message-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.message time { color: #796f39; font-size: .55rem; }

.speak-button {
  width: 27px;
  height: 22px;
  padding: 0;
  color: var(--yellow);
  background: var(--blue-dark);
  border: 0;
  font-size: .52rem;
  cursor: pointer;
}

.speak-button:hover, .speak-button.is-playing { color: white; background: var(--blue); }
.speak-button.is-loading { animation: blink 500ms steps(1) infinite; }

.typing {
  display: flex;
  gap: 5px;
  padding-top: 6px;
}

.typing span {
  width: 7px;
  height: 13px;
  background: var(--blue);
  animation: blink 700ms steps(1) infinite;
}
.typing span:nth-child(2) { animation-delay: 150ms; }
.typing span:nth-child(3) { animation-delay: 300ms; }

.suggestions {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  overflow-x: auto;
  border-top: 2px dashed rgba(10, 49, 93, .28);
  scrollbar-width: none;
}
.suggestions::-webkit-scrollbar { display: none; }

.suggestions button {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--blue-dark);
  background: transparent;
  border: 0;
  font-size: .65rem;
  font-weight: 900;
  cursor: pointer;
}
.suggestions button:hover { color: var(--yellow); background: var(--blue-dark); }

.composer {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  margin: 0 16px;
  padding: 9px 10px;
  background: var(--ink);
  border: 3px solid var(--blue);
}

.command-prompt { color: var(--yellow); font-weight: 900; }

.composer textarea {
  width: 100%;
  max-height: 96px;
  padding: 7px 2px;
  color: #f9f2c9;
  background: transparent;
  border: 0;
  outline: 0;
  line-height: 1.35;
  resize: none;
}
.composer textarea::placeholder { color: #8ba4bd; }

.composer button {
  display: grid;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  cursor: pointer;
  place-items: center;
}

.composer .voice-button { width: 34px; height: 34px; }
.composer .send-button { min-width: 50px; height: 34px; padding: 0 9px; font-size: .65rem; font-weight: 900; }
.composer button:hover:not(:disabled) { color: white; background: var(--blue); }
.composer button:disabled { cursor: wait; opacity: .48; }
.composer .voice-button.is-recording { color: white; background: var(--red); animation: record-pulse 700ms infinite alternate; }
.composer svg { width: 18px; fill: currentColor; }

.voice-status {
  min-height: 18px;
  margin: 6px 18px 0;
  color: var(--blue-dark);
  font-size: .6rem;
  font-weight: 800;
}
.voice-status::before { content: "VOICE_IO> "; }
.voice-status.voice-error { color: #a51f29; }

.terminal-footer {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 18px 12px;
  color: #6f6534;
  font-size: .53rem;
}
.terminal-footer a { color: var(--blue); font-weight: 900; text-decoration: none; }

.fan-note {
  margin: 12px auto 0;
  color: var(--yellow);
  font-size: .56rem;
  text-align: center;
}

.error-message { color: #9f1f28; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes blink { 50% { opacity: .15; } }
@keyframes record-pulse { to { box-shadow: 0 0 0 6px rgba(211, 63, 73, .24); } }
@keyframes terminal-in { from { opacity: 0; transform: translateX(-5px); } }

@media (max-width: 650px) {
  .terminal-shell { width: calc(100% - 12px); padding: 6px 0 8px; }
  .disclaimer-banner { margin: 8px 0; padding: 5px 7px; font-size: .48rem; }
  .overall-strap { width: 72px; opacity: .78; }
  .overall-button { top: 21vh; width: 32px; height: 32px; }
  .button-left { left: 16px; }
  .button-right { right: 16px; }
  .terminal-window { min-height: 0; border-width: 4px; box-shadow: 5px 6px 0 var(--blue-dark); }
  .window-bar { font-size: .56rem; }
  .messages { padding: 18px 12px; }
  .message-row { grid-template-columns: 58px minmax(0, 1fr); gap: 7px; }
  .terminal-prefix { font-size: .65rem; }
  .message p { font-size: .78rem; }
  .composer { margin: 0 8px; }
  .command-prompt { display: none; }
  .composer { grid-template-columns: auto minmax(0, 1fr) auto; }
  .terminal-footer { gap: 5px; padding-right: 10px; padding-left: 10px; font-size: .46rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
