@charset "UTF-8";

:root {
  color-scheme: light;
  --white: #fff;
  --canvas: #c8c8c8;
  --surface: #dedede;
  --surface-hover: #cecece;
  --ink: #202020;
  --muted: #515151;
  --accent: #f0782b;
  --accent-hover: #e8691d;
  --accent-ink: #aa4008;
  --accent-soft: #ffd0ae;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.75 var(--sans); }
button, input { font: inherit; }
button { transition: background-color 180ms ease, color 180ms ease; }
button { border: 0; color: inherit; cursor: pointer; }
button svg { width: 21px; height: 21px; flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
button, a, input, summary { outline: none; }
button:focus-visible, a:focus-visible { background-color: var(--accent-soft); }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 10; padding: 12px; border-radius: 12px; background: var(--ink); color: var(--white); }
.skip-link:focus { top: 12px; background: var(--ink); }

.shell { max-width: 480px; margin: auto; overflow: hidden; background: var(--white); }
.workspace { position: relative; height: 100dvh; display: flex; flex-direction: column; min-width: 0; background: var(--canvas); }
.workspace::before { content: ""; position: absolute; z-index: 0; inset: -4px; background: url("./chat-background.png") 62% center / cover no-repeat; opacity: .22; filter: saturate(.3) blur(2px); pointer-events: none; }
.topbar { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 10px; padding-top: max(12px, env(safe-area-inset-top)); flex-shrink: 0; background: var(--white); }
.brand { display: flex; align-items: center; gap: 11px; border-radius: 10px; }
.brand-title { font: 600 19px var(--serif); letter-spacing: .1em; }
.menu-button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 14px; background: transparent; color: var(--accent-ink); cursor: pointer; }
.menu-button svg { width: 24px; height: 24px; }
.menu-button:hover, .menu-button:focus-visible, .menu-button[aria-expanded="true"] { background: var(--accent-soft); }
.menu-items { position: absolute; top: calc(100% - 4px); left: 18px; display: grid; gap: 6px; width: min(240px, calc(100% - 36px)); padding: 10px; border-radius: 22px; background: var(--white); box-shadow: 0 12px 32px #20202026; }
.menu-items button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 14px; border-radius: 14px; background: var(--surface); font-size: 13px; text-align: left; }
.menu-items button.active { background: var(--accent-soft); }
.menu-items button:hover, .menu-items button:focus-visible { background: var(--accent-soft); }
.nav-badge { display: flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin-left: auto; padding: 0 6px; border-radius: 50%; background: var(--accent); color: var(--ink); font-size: 11px; }
.icon-button, .composer-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: transparent; }
.icon-button:hover, .icon-button:focus-visible { background: var(--surface); }
.icon-button svg { width: 21px; height: 21px; }
.hint-button { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 14px; background: transparent; font-size: 11px; white-space: nowrap; }
.hint-button svg { width: 23px; height: 23px; color: var(--accent-ink); }
.hint-button:hover, .hint-button:focus-visible { background: var(--accent-soft); }

.answer-problem { margin: 20px 0 24px; }
.answer-problem p { margin: 0; font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-entry-label { margin: 0 0 8px; font-size: 12px; font-weight: 600; }

.chat-area { position: relative; z-index: 1; flex: 1; min-height: 0; overflow: auto; padding: 22px 18px calc(120px + env(safe-area-inset-bottom)); scrollbar-width: thin; overscroll-behavior: contain; scroll-padding-bottom: 15px; }
.messages { display: grid; gap: 22px; }
.message { display: flex; align-items: flex-start; gap: 9px; }
.avatar { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 29px; height: 29px; margin-top: 22px; border-radius: 50%; background: var(--accent); font: 12px var(--serif); }
.message-body { max-width: calc(100% - 38px); min-width: 0; }
.speaker { display: flex; align-items: center; gap: 9px; width: fit-content; margin-bottom: 6px; padding: 2px 8px; border-radius: 999px; background: var(--white); color: var(--muted); font-size: 10px; }
.speaker small { font-size: 9px; }
.bubble { padding: 13px 15px; border-radius: 18px; background: var(--white); font-size: 13px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; }
.own { justify-content: flex-end; }
.own .message-body { max-width: 85%; }
.own .speaker { justify-content: flex-end; margin-left: auto; }
.own .bubble { background: var(--ink); color: var(--white); }
.retry .bubble { background: var(--accent-soft); }
.milestone { display: flex; align-items: center; gap: 8px; margin-left: 38px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; }
.milestone svg { width: 15px; height: 15px; }
.branch-options { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; padding-left: 38px; }
.branch-options button { display: flex; align-items: center; gap: 13px; min-height: 44px; padding: 10px 14px; border-radius: 999px; background: var(--accent-soft); font-size: 12px; }
.branch-options button:hover, .branch-options button:focus-visible { background: #ffbd8d; }
.branch-options svg { width: 15px; height: 15px; color: var(--accent-ink); }
.chapter-end { margin-top: 20px; color: var(--muted); font-size: 11px; text-align: center; }
.chapter-end > span { display: inline-block; padding: 8px 12px; border-radius: 14px; background: var(--white); }

.composer-area { position: absolute; z-index: 3; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); max-height: min(75dvh, 620px); overflow: auto; overscroll-behavior: contain; padding: 16px 20px 20px; border-radius: 24px; background: var(--white); box-shadow: 0 12px 32px #20202026; }
.answer-composer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; margin-bottom: 14px; }
.answer-composer-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 600; }
.answer-composer-heading .question-tag { flex-shrink: 0; background: var(--accent); font-size: 11px; }
.composer-close { width: 40px; height: 40px; flex-shrink: 0; background: var(--surface); }
.composer-close:hover, .composer-close:focus-visible { background: var(--surface-hover); }
.composer-close svg { width: 19px; height: 19px; }
.text-composer { display: flex; align-items: center; gap: 8px; padding: 7px 7px 7px 12px; border-radius: 18px; background: var(--surface); }
.text-composer:focus-within { background: var(--surface-hover); }
.text-composer input { flex: 1; min-width: 0; padding: 7px 5px; border: 0; background: transparent; color: var(--ink); font-size: 16px; }
.text-composer input::placeholder { color: var(--muted); font-size: 13px; }
.send-button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.send-button:hover, .send-button:focus-visible { background: var(--accent-hover); }
.composer-meta { margin-top: 8px; color: var(--muted); font-size: 11px; }
.feedback { margin-top: 8px; color: var(--accent-ink); font-size: 11px; }
.feedback:empty { display: none; }
.primary-button, .secondary-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 11px 16px; border-radius: 14px; background: var(--accent); font-size: 12px; }
.primary-button:hover, .primary-button:focus-visible { background: var(--accent-hover); }
.primary-button svg { width: 17px; height: 17px; }
.secondary-button { background: var(--surface); }
.secondary-button:hover, .secondary-button:focus-visible { background: var(--surface-hover); }
.solved-composer { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 54px; }
.solved-label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.solved-label svg { width: 16px; height: 16px; color: var(--accent-ink); }
.muted { color: var(--muted); font-size: 12px; }
.answer-options { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; border: 0; }
.option { display: flex; align-items: center; gap: 7px; min-height: 48px; padding: 10px 9px; border-radius: 14px; background: var(--surface); font-size: 12px; line-height: 1.6; cursor: pointer; }
.option:has(input:checked) { background: var(--accent); }
.option:has(input:focus-visible) { background: var(--surface-hover); }
.option:has(input:checked:focus-visible) { background: var(--accent-hover); }
.option input, .evidence-card input { appearance: none; display: grid; place-items: center; width: 18px; height: 18px; margin: 0; border: 0; border-radius: 6px; background: #bfbfbf; flex-shrink: 0; cursor: pointer; }
.option input[type="radio"] { border-radius: 50%; }
.option input:checked, .evidence-card input:checked { background: var(--ink); }
.option input:checked::after, .evidence-card input:checked::after { content: "✓"; color: var(--white); font-size: 13px; line-height: 1; }
.answer-options:has(input[type="checkbox"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.answer-options:has(input[type="checkbox"]) .option:nth-of-type(odd):last-of-type { grid-column: 1 / -1; }
.answer-options .primary-button { grid-column: 1 / -1; width: 100%; margin-top: 2px; }
.answer-fab { position: absolute; z-index: 2; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 20px; border-radius: 999px; background: var(--accent); font-size: 13px; font-weight: 600; }
.answer-fab svg { width: 20px; height: 20px; }
.answer-fab:hover, .answer-fab:focus-visible { background: var(--accent-hover); }

dialog { position: fixed; inset: auto 0 0; width: 100%; max-width: 480px; max-height: 85dvh; min-height: 260px; margin: 0 auto; padding: 0; overflow: auto; border: 0; border-radius: 26px 26px 0 0; background: var(--canvas); color: var(--ink); box-shadow: none; }
dialog::backdrop { background: #20202080; animation: backdrop-in 260ms ease both; }
dialog.is-closing::backdrop { animation: backdrop-out 180ms ease both; }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes content-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.answer-reveal[open] > p, .log-entry[open] > .history-messages { animation: content-in 260ms cubic-bezier(.2,.8,.2,1) both; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 23px 18px; background: var(--white); }
.panel-header h2 { margin: 6px 0 0; font: 21px var(--serif); letter-spacing: .09em; }
.eyebrow { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.panel-body { padding: 22px 23px max(28px, env(safe-area-inset-bottom)); }
.panel-intro { margin: 0 0 21px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.hint-card, .finding { margin-bottom: 12px; padding: 16px; border-radius: 18px; background: var(--white); }
.hint-card p, .finding p { margin: 7px 0 0; font-size: 13px; line-height: 1.95; }
.full { width: 100%; justify-content: space-between; }
.answer-reveal { margin-top: 20px; padding: 4px 16px; border-radius: 18px; background: var(--white); }
.answer-reveal summary { min-height: 44px; padding-block: 10px; border-radius: 12px; color: var(--accent-ink); font-size: 12px; cursor: pointer; }
.answer-reveal summary:focus-visible { background: var(--accent-soft); }
.answer-reveal p { padding: 16px; border-radius: 14px; background: var(--accent-soft); font-size: 13px; white-space: pre-wrap; }
.empty-state { margin-bottom: 20px; padding: 28px 12px; border-radius: 18px; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 2; text-align: center; }
.log-entry { margin-bottom: 14px; padding: 6px 16px 16px; border-radius: 18px; background: var(--white); }
.log-entry > summary { min-height: 44px; padding-block: 10px; border-radius: 12px; font: 16px var(--serif); cursor: pointer; }
.log-entry > summary:focus-visible { background: var(--surface); }
.question-tag { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--accent); font-size: 10px; }
.log-entry > summary .question-tag { margin-right: 10px; font-family: var(--sans); }
.history-messages { display: grid; gap: 15px; margin-top: 12px; }
.history-messages .milestone { margin-left: 0; }
.history-messages .bubble { background: var(--canvas); font-size: 12px; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.card-grid > .empty-state { grid-column: 1 / -1; }
.evidence-card { position: relative; display: flex; flex-direction: column; padding: 16px; border-radius: 18px; background: var(--white); cursor: pointer; }
.evidence-card:has(input:checked) { background: var(--accent-soft); }
.evidence-card:has(input:focus-visible) { background: #ffbd8d; }
.evidence-card input { position: absolute; top: 11px; right: 11px; }
.card-code { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.card-mark { color: var(--accent-ink); font: 64px var(--serif); line-height: 1.6; text-align: center; }
.evidence-card strong { font: 15px var(--serif); }
.card-copy { margin-top: 9px; color: var(--muted); font-size: 11px; }
.finding { margin-top: 20px; }
.finding h3 { margin: 7px 0; font: 18px var(--serif); }
#combine-feedback { margin-top: 12px; color: var(--accent-ink); font-size: 12px; }
.help-copy { font-size: 13px; line-height: 2; }
.help-copy h3 { margin: 22px 0 9px; font: 16px var(--serif); }
.help-copy p { margin: 0 0 12px; }
.demo-note { margin-top: 20px; padding: 16px; border-radius: 18px; background: var(--surface); color: var(--muted); font-size: 12px; }
.reset-link { width: 100%; min-height: 44px; margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 12px; text-align: left; }
.reset-link:hover, .reset-link:focus-visible { background: #ffbd8d; }
.reset-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

@media (min-width: 600px) {
  .shell { margin: 16px auto; border-radius: 26px; }
  .workspace { height: calc(100dvh - 34px); }
  dialog { bottom: 16px; border-radius: 26px; }
}
@media (max-width: 350px) {
  .topbar { padding-inline: 14px; }
  .chat-area { padding-inline: 14px; }
  .brand-title { font-size: 18px; }
  .bubble { padding: 12px; font-size: 12px; }
  .composer-area { left: 8px; right: 8px; padding-inline: 12px; }
  .answer-fab { right: 14px; }
  .option { padding-inline: 6px; font-size: 11px; }
  .solved-composer .primary-button { padding-inline: 12px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } dialog::backdrop { animation: none !important; } }
