:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  color: #1F2937;
  background: #FAFAFC;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --brand: #1F3A8A;
  --blue: #3882F6;
  --text: #1F2937;
  --muted: #64748B;
  --border: #E5E7EB;
  --pale-blue: #EEF4FF;
  --surface: #FFFFFF;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #FAFAFC; }
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { width: min(100%, 560px); min-height: 100vh; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }
.screen { min-height: calc(100vh - max(12px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom))); display: flex; flex-direction: column; }
.header { min-height: 44px; display: flex; align-items: center; justify-content: flex-start; }
.brand-link { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.brand-link:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.brand { color: var(--brand); font-size: 18px; font-weight: 800; letter-spacing: 1.5px; }
.eyebrow { margin: 18px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 1.2px; }
.prompt-card { margin-top: 14px; padding: 20px; border-radius: 16px; background: var(--pale-blue); }
.prompt-text { margin: 0; color: var(--brand); font-size: 20px; font-weight: 700; line-height: 1.5; }
.answer-group { margin-top: 28px; }
.question { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--text); font-size: 16px; font-weight: 700; line-height: 24px; }
.question-icon { width: 22px; height: 22px; color: var(--blue); flex: 0 0 auto; }
.answer-input { display: block; width: 100%; min-height: 128px; resize: vertical; padding: 16px; border: 1px solid var(--border); border-radius: 12px; outline: none; background: var(--surface); color: var(--text); font-size: 17px; line-height: 1.55; }
.answer-input::placeholder { color: var(--muted); opacity: 1; }
.answer-input:focus { border: 2px solid var(--blue); padding: 15px; box-shadow: 0 0 0 3px rgb(56 130 246 / 15%); }
.reveal-row { min-height: 44px; display: grid; place-items: center; margin-top: 16px; }
.text-button { min-height: 44px; padding: 8px 12px; border: 0; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.key-phrase { margin: 4px 0 0; color: var(--brand); font-size: 18px; font-weight: 700; text-align: center; }
.primary-button, .again-button, .next-button, .retry-button { min-height: 56px; border-radius: 12px; cursor: pointer; font-weight: 700; }
.primary-button { width: 100%; min-height: 72px; margin-top: 22px; padding: 16px 20px; border: 0; background: var(--blue); color: #fff; font-size: 16px; }
.primary-button:not(:disabled) { box-shadow: 0 5px 16px rgb(56 130 246 / 18%); }
button:disabled { cursor: not-allowed; }
.primary-button:disabled, .again-button:disabled, .next-button:disabled { background: #CBD5E1; border-color: #CBD5E1; color: #fff; box-shadow: none; }
button:focus-visible { outline: 3px solid #1F3A8A; outline-offset: 3px; }
.entry-screen, .error-screen { justify-content: center; align-items: center; text-align: center; }
.complete-screen { justify-content: center; align-items: center; gap: 8px; text-align: center; }
.loading-screen { justify-content: initial; align-items: stretch; text-align: left; }
.loading-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 44px; text-align: center; }
.loading-indicator { width: 34px; height: 34px; margin-bottom: 16px; border: 3px solid #DCEBFF; border-top-color: var(--blue); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-copy { margin: 0; color: var(--text); font-size: 16px; line-height: 1.5; }
.status-copy:focus, .notice:focus, .acquisition-status:focus, .key-phrase:focus, .result-label:focus, .entry-title:focus, .error-title:focus { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 2px; }
.entry-title, .error-title { margin: 0 0 12px; color: var(--brand); font-size: 24px; line-height: 1.35; }
.entry-copy, .error-copy { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.entry-button { width: 100%; max-width: 320px; margin-top: 24px; padding: 14px 20px; border: 0; background: var(--blue); color: #fff; font-size: 16px; }
.notice { margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--muted); font-size: 14px; line-height: 1.55; }
.eval-screen { padding-bottom: 12px; }
.eval-content { flex: 1; }
.eval-result { margin-top: 24px; padding: 20px; border-radius: 16px; }
.eval-result.perfect { background: #E8F7EB; --result-color: #16733B; --result-divider: #BFE5C8; }
.eval-result.almost { background: #FFF5D9; --result-color: #B76F00; --result-divider: #F0D99C; }
.eval-result.not-yet { background: #FDECEF; --result-color: #C7435D; --result-divider: #F1C8D1; }
.result-identity { display: flex; align-items: center; justify-content: center; gap: 16px; }
.result-icon { flex: 0 0 auto; color: var(--result-color); font-size: 42px; line-height: 1; }
.result-label { margin: 0; color: var(--result-color); font-size: 24px; font-weight: 700; line-height: 30px; }
.supportive-copy { margin: 2px 0 0; color: var(--result-color); font-size: 14px; font-weight: 600; line-height: 20px; }
.result-divider { height: 1px; margin: 16px 0; background: var(--result-divider); }
.result-summary { margin: 0; color: var(--brand); font-size: 16px; line-height: 24px; text-align: center; white-space: pre-line; }
.review-card { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.review-section { display: grid; gap: 8px; }
.review-heading { margin: 0; color: var(--brand); font-size: 14px; font-weight: 700; line-height: 20px; }
.content-surface, .learning-surface { padding: 12px 14px; border-radius: 10px; background: #F5F7FB; }
.content-surface p, .learning-surface p { margin: 0; color: var(--text); font-size: 15px; line-height: 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.natural-surface { background: var(--pale-blue); }
.natural-surface p { color: var(--brand); font-size: 16px; font-weight: 600; }
.learning-surface { display: grid; gap: 10px; background: #F5F6FF; }
.phrase-chip { justify-self: start; padding: 4px 10px; border-radius: 999px; background: #DCEBFF; color: var(--brand); font-size: 13px; font-weight: 700; line-height: 20px; }
.review-divider { height: 1px; margin: 14px 0; background: var(--border); }
.choice-footer { display: grid; gap: 12px; padding-top: 12px; }
.choice-row { display: grid; grid-template-columns: 6fr 4fr; gap: 12px; }
.completion-choice-row { grid-template-columns: 1fr 1fr; }
.again-button, .next-button { width: 100%; min-height: 64px; padding: 10px 14px; border: 1px solid var(--blue); background: #fff; }
.again-button { display: flex; align-items: center; justify-content: center; gap: 9px; background: var(--blue); color: #fff; text-align: left; }
.again-icon { font-size: 22px; }
.again-copy { display: grid; gap: 2px; }
.again-title, .next-title { font-size: 16px; font-weight: 700; }
.again-subtitle { color: rgb(255 255 255 / 84%); font-size: 12px; line-height: 17px; }
.next-button { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--brand); }
.install-button { width: 100%; min-height: 48px; padding: 10px 16px; border: 1px solid #C9D7F2; border-radius: 12px; background: #fff; color: var(--brand); font-size: 14px; font-weight: 600; cursor: pointer; }
.practice-screen > .install-button { margin-top: 12px; }
.install-button:disabled { cursor: not-allowed; color: var(--muted); }
.install-complete-button { min-height: 64px; border-color: var(--blue); font-size: 16px; font-weight: 700; }
.complete-artwork { position: relative; width: min(100%, 420px); aspect-ratio: 941 / 1672; margin: auto; flex: 0 0 auto; }
.complete-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.completion-install-cta { position: absolute; z-index: 1; left: 50%; bottom: clamp(40px, 7%, 72px); width: 88%; min-height: clamp(56px, 15vw, 64px); padding: 12px 14px; transform: translateX(-50%); border: 0; border-radius: 9999px; background: #159FFF; color: #fff; font-size: clamp(14px, 4.1vw, 18px); font-weight: 800; line-height: 1.2; white-space: nowrap; box-shadow: 0 8px 22px rgb(21 159 255 / 32%); transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease; }
.completion-install-cta:not(:disabled):hover { transform: translateX(-50%) translateY(-1px); box-shadow: 0 10px 24px rgb(21 159 255 / 38%); }
.completion-install-cta:not(:disabled):active { transform: translateX(-50%) scale(.985); }
.completion-install-cta:disabled { cursor: not-allowed; background: #CBD5E1; color: #fff; box-shadow: none; }
.acquisition-status { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
.acquisition-status[hidden] { display: none; }
.retry-button { margin-top: 22px; padding: 14px 20px; border: 0; background: var(--blue); color: #fff; }
.entry-screen .header, .error-screen .header { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 20px; right: 20px; }
.entry-screen, .error-screen { position: relative; }
.footer-space { height: 8px; }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); padding: 28px 24px; border: 1px solid #F0F1F4; border-radius: 22px; box-shadow: 0 14px 44px rgb(31 41 55 / 6%); }
  .screen { min-height: calc(100vh - 104px); }
  .complete-artwork { width: min(100%, 420px, calc((100vh - 128px) * 941 / 1672)); }
  .entry-screen .header, .error-screen .header { top: 28px; left: 24px; right: 24px; }
}

@media (max-width: 360px) {
  .completion-install-cta { width: 90%; padding-right: 8px; padding-left: 8px; font-size: 14px; }
}

@media (max-width: 380px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .prompt-card { padding: 18px 16px; }
  .choice-row { grid-template-columns: 1fr 0.78fr; gap: 8px; }
  .again-button, .next-button { padding-left: 9px; padding-right: 9px; }
  .again-subtitle { font-size: 11px; }
}

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