:root {
  color-scheme: light;
  --ground: #f5f5fa;
  --surface: #ffffff;
  --ink: #252536;
  --muted: #68677a;
  --line: #e1e0ea;
  --accent: #5344a4;
  --accent-hover: #413382;
  --accent-soft: #eeebf8;
  --warning: #77551c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #beb9d1 transparent; }
body { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
::selection { color: var(--ink); background: #d9d3f1; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.app { display: flex; flex-direction: column; width: 100%; max-width: 480px; height: 100dvh; height: var(--app-height, 100dvh); margin: 0 auto; background: var(--surface); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); overflow: hidden; }
.toolbar { display: flex; justify-content: flex-end; flex: none; min-height: 60px; padding: 8px 14px; }
.toolbar button { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; }
.toolbar button:hover { background: var(--ground); color: var(--accent); }
.conversation { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.transcript { flex: 1; overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 18px 22px 28px; scroll-behavior: smooth; }
.message { max-width: 100%; margin: 0 0 28px; overflow-wrap: anywhere; }
.message:last-child { margin-bottom: 0; }
.message p { margin: 0; font-size: 16px; line-height: 1.75; white-space: pre-wrap; }
.message.user { margin-left: auto; max-width: 90%; }
.message.user p { background: var(--accent-soft); padding: 10px 15px; border-radius: 14px 14px 3px 14px; color: #3c326e; }
.thinking { margin: 0; padding: 0 24px 8px; color: var(--muted); font-size: 24px; line-height: 1; letter-spacing: .12em; }
.thinking > span:first-child { animation: thinking 1.5s ease-in-out infinite; }
.notice { margin: 0 20px 8px; color: var(--warning); font-size: 14px; line-height: 1.5; max-height: 30dvh; overflow-y: auto; }
.notice button { min-height: 44px; padding: 8px; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.composer { flex: none; padding: 8px 14px 14px; }
.input-wrap { display: flex; align-items: flex-end; gap: 6px; border: 1px solid #c9c5d7; border-radius: 16px; padding: 6px; }
.input-wrap:focus-within { border-color: var(--accent); outline: 1px solid var(--accent); }
textarea { flex: 1; min-width: 0; min-height: 44px; max-height: min(120px, 25dvh); resize: none; border: 0; background: transparent; color: var(--ink); padding: 10px 8px; font-size: 16px; line-height: 24px; caret-color: var(--accent); }
textarea::placeholder { color: var(--muted); opacity: 1; }
textarea:focus { outline: 0; }
.send-button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 11px; background: var(--accent); color: white; }
.send-button:hover:not(:disabled) { background: var(--accent-hover); }
.send-button:disabled { background: var(--ground); color: #80788f; }
.notebook { flex: 1; min-height: 0; padding: 18px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
#empty-notes { color: var(--muted); margin: 0; }
.step-list { list-style: none; padding: 0; margin: 0; }
.step-item { padding: 0 0 24px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.step-item:last-child { border-bottom: 0; }
.step-item h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.step-item p { margin: 0; font-size: 16px; color: var(--muted); }
.completed { flex: none; padding: 8px 20px 20px; }
.completed button { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface); color: var(--accent); }
.completed button:hover { background: var(--ground); }
noscript { display: block; padding: 20px; text-align: center; }
@keyframes thinking { 50% { opacity: .3; } }
@media (max-height: 480px) { .toolbar { min-height: 48px; padding-top: 2px; padding-bottom: 2px; } .transcript { padding-top: 8px; } .composer { padding-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

#notes-toggle { margin-left: auto; }
.toolbar button:disabled { opacity: .5; cursor: default; }
.welcome { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding: 28px; }
.welcome-content { margin: auto 0; }
.welcome h1 { margin: 0 0 20px; font-size: 28px; font-weight: 600; line-height: 1.2; }
.welcome p { margin: 0 0 20px; font-size: 16px; line-height: 1.75; }
.welcome p + p { color: var(--muted); }
#start-game { width: 100%; min-height: 48px; margin-top: 12px; padding: 12px 16px; border: 0; border-radius: 12px; color: var(--surface); background: var(--accent); }
#start-game:hover { background: var(--accent-hover); }
