:root {
  --ink: #303438;
  --muted: #687078;
  --blue: #0b3d5c;
  --accent: #0788c9;
  --focus: #9ed9f4;
  --line: #dfe4e7;
  --soft: #f5f8f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 18px/1.72 Georgia, "Times New Roman", serif;
}

body:has(.guide-panel:not([hidden])) { overflow: hidden; }

button,
input,
textarea { font: inherit; }

button,
input,
textarea,
a { border-radius: 2px; }

a { color: var(--blue); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.pilot-header,
.guide {
  width: min(100% - 40px, 760px);
  margin-inline: auto;
}

.pilot-header { padding-top: 28px; }

.pilot-brand {
  color: var(--blue);
  font: 700 1.15rem/1 Arial, sans-serif;
  letter-spacing: .12em;
  text-decoration: none;
}

.guide { padding: 28px 0 40px; }

h1,
h2 {
  color: var(--blue);
  font-weight: 400;
  line-height: 1.2;
}

h1 {
  margin: 0 0 28px;
  font-size: clamp(2.15rem, 7vw, 3rem);
}

h2 { margin-top: 0; }

.entry { max-width: 620px; }

.access-form { margin-top: 34px; }

label,
legend { color: var(--blue); }

input[type="password"],
textarea {
  display: block;
  width: 100%;
  border: 1px solid #9aa5ab;
  background: #fff;
  color: var(--ink);
}

input[type="password"] {
  max-width: 340px;
  margin: 7px 0 28px;
  padding: 9px 11px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  display: block;
  margin: 11px 0;
  color: var(--ink);
}

.choice input { margin-right: 8px; }

.age-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .86rem;
}

.guardian-note {
  margin: 22px 0;
  padding: 18px 20px;
  border-left: 3px solid var(--accent);
  background: var(--soft);
}

.guardian-note p { margin-top: 0; }

button[type="submit"],
#send {
  min-height: 44px;
  padding: 8px 22px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}

button:disabled { cursor: wait; opacity: .65; }

.guide-panel {
  height: calc(100dvh - 68px);
  min-height: 500px;
  display: grid;
  grid-template-rows: auto auto minmax(72px, 1fr) auto auto auto auto;
  align-content: stretch;
  gap: 8px;
  padding-top: 12px;
  overflow: hidden;
  text-align: center;
}

.guide-panel[hidden] { display: none; }

.guide-panel > h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 4vh, 2.25rem);
}

.zero-wrap {
  position: relative;
  width: min(118px, 26vw, 15vh);
  margin: 0 auto;
}

.zero {
  display: block;
  width: 100%;
  height: auto;
  transform: none;
}

.zero-eyelid {
  position: absolute;
  display: block;
  background: rgba(255, 254, 245, .98);
  border-bottom: 2px solid #20242b;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.zero-eyelid--left {
  top: 8.2%;
  left: 28.5%;
  width: 36%;
  height: 18.5%;
}

.zero-eyelid--right {
  top: 8.3%;
  left: 61.5%;
  width: 32%;
  height: 18%;
}

.guide-panel[data-state="listening"] .zero-eyelid {
  animation: zero-blink 360ms ease-in-out both;
}

.guide-panel[data-state="responding"] .zero-eyelid {
  animation: zero-blink 420ms ease-in-out both;
}

@keyframes zero-blink {
  0%, 100% { opacity: 0; transform: scaleY(.08); }
  42%, 58% { opacity: 1; transform: scaleY(1); }
}

.conversation {
  min-height: 0;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
  padding: 4px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
}

.conversation p { margin: 0 0 20px; }

.conversation .from-guide {
  color: var(--blue);
  font-size: 1.08rem;
}

.conversation .from-guide p { margin-bottom: 16px; }
.conversation .from-guide p:last-child { margin-bottom: 0; }
.conversation .from-guide strong { color: #062f49; font-weight: 600; }

.quiet-opening {
  color: var(--muted);
  text-align: center;
}

.conversation-starters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}

.conversation-starters[hidden] { display: none; }

.conversation-starters button {
  width: 100%;
  min-height: 48px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--blue);
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
}

.conversation-starters button:hover {
  border-color: var(--accent);
  background: var(--soft);
}

@media (min-width: 601px) {
  .conversation-starters { margin: -14px auto 14px; }
}

.message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  max-width: 620px;
  margin: auto;
}

textarea {
  min-height: 46px;
  max-height: 76px;
  padding: 8px 11px;
  resize: none;
}

.form-message {
  min-height: 1.25em;
  margin: 0;
  color: #7a2f2f;
  font-size: .9rem;
}

.guide-actions {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 0;
  font-size: .92rem;
}

.text-button,
.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: .18em;
  cursor: pointer;
}

.small-notice {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
}

dialog {
  width: min(100% - 32px, 620px);
  max-height: min(86vh, 720px);
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
}

dialog::backdrop { background: rgba(20, 31, 38, .34); }

.dialog-content {
  padding: 28px;
  overflow: auto;
}

.dialog-content form { margin-top: 28px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .pilot-header,
  .guide { width: min(100% - 32px, 760px); }
  .pilot-header { padding-top: 22px; }
  .guide { padding: 12px 0; }
  .guide-panel { height: calc(100dvh - 24px); min-height: 460px; gap: 6px; padding-top: 0; }
  .message-form { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .conversation-starters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .conversation-starters button { min-height: 44px; padding: 6px 8px; font-size: .86rem; }
  .small-notice { font-size: .68rem; line-height: 1.25; }
  .dialog-content { padding: 22px; }
}

@media (max-height: 620px) {
  .guide-panel { min-height: 0; }
  .guide-panel > h1 { font-size: 1.45rem; }
  .zero-wrap { width: min(84px, 14vh); }
  .conversation-starters button { min-height: 40px; padding-block: 4px; }
  .guide-actions { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .zero-eyelid { animation: none !important; opacity: 0 !important; }
}
