:root { color-scheme: light; --bg: #f7f4ed; --text: #263d36; --muted: #6f766d; --panel: #fffcf6; --line: #e2dfd4; --primary: #2d6056; --primary-text: #fff; --accent: #b45b36; --radius: 12px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.app-header { max-width: 1160px; margin: auto; padding: max(24px, env(safe-area-inset-top)) 32px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 750; letter-spacing: -1px; text-decoration: none; color: var(--text); }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; background: var(--primary); color: white; border-radius: 11px; font-family: Georgia, serif; font-size: 30px; line-height: 1; padding-bottom: 6px; }
.brand-accent { color: var(--accent); }
.brand-caption { color: var(--muted); font-size: 13px; }
.app-shell { max-width: 1160px; min-height: calc(100svh - 167px); margin: auto; padding: 56px 32px; }
.screen { display: none; max-width: 580px; margin: 0 auto; }
.screen.is-active { display: block; }
#home-screen { max-width: none; }
#home-screen.is-active { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 64px; align-items: center; }
.home-intro h1 { max-width: 530px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(36px, 4vw, 52px); letter-spacing: -1.8px; line-height: 1.12; margin: 22px 0; }
.home-intro h1 em { color: var(--accent); font-weight: 400; }
.intro { color: var(--muted); line-height: 1.75; font-size: 16px; max-width: 400px; }
.reading-art { display: block; width: min(100%, 380px); margin: 20px auto 0; }
.intro-footnote { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0; }
.reading-picker { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: 0 14px 40px #263d3606; }
.topbar { padding-bottom: 12px; }
.topbar:has(.profile-login), .topbar:has(.active-profile) { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; letter-spacing: 1.8px; font-weight: 750; }
h1 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 20px; font-size: 38px; font-weight: 400; line-height: 1.2; }
h2 { margin: 28px 0 12px; font-size: 17px; font-weight: 650; }
.picker-title { font-family: Georgia, serif; font-size: 29px; font-weight: 400; margin: 0; letter-spacing: -.7px; }
.choice-heading { display: flex; gap: 9px; align-items: center; margin: 24px 0 13px; font-size: 14px; font-weight: 650; }
.choice-heading span { color: var(--accent); font-size: 10px; border: 1px solid var(--line); border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; }
.control-group, .control-grid, .action-row { display: grid; gap: 10px; }
.control-group { grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); }
.control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice, .secondary-action, .primary-action, .link-button { min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--text); padding: 10px 12px; }
.choice { font-size: 14px; }
.choice:hover { border-color: var(--primary); background: #eef2e9; }
.choice.is-selected { border-color: var(--primary); background: #e8efe7; color: var(--primary); font-weight: 700; box-shadow: inset 0 0 0 1px var(--primary); }
.choice[data-genre] { min-height: 74px; display: flex; align-items: center; gap: 12px; text-align: left; }
.choice[data-genre]::before { content: '❧'; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-family: Georgia, serif; font-size: 23px; color: var(--accent); background: #f2e9d9; flex-shrink: 0; }
.choice[data-genre="Mystery"]::before { content: '⌕'; }
.choice[data-genre="Humor"]::before { content: '☺'; }
.choice[data-genre="Surprise"]::before { content: '✧'; }
.primary-action { width: 100%; margin-top: 28px; border-color: var(--primary); background: var(--primary); color: var(--primary-text); font-weight: 650; min-height: 52px; }
.primary-action:hover:enabled { background: #224e44; transform: translateY(-1px); }
.primary-action span { padding-left: 14px; font-size: 20px; }
.secondary-action { font-weight: 650; }
.link-button { width: auto; min-height: 40px; padding: 8px 12px; font-size: 13px; }
.link-button:hover { background: #eae9df; }
.profile-login { white-space: nowrap; }
.picker-note { margin: 14px 0 0; font-size: 11px; color: var(--muted); text-align: center; }
.duration-hint { color: var(--accent); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }
.duration-hint:empty { display: none; }
.status { color: var(--muted); font-size: 14px; line-height: 1.6; }
.status:empty { display: none; }
.resume-panel { padding: 16px; border: 1px solid var(--line); background: #f1f3eb; border-radius: var(--radius); margin: 12px 0; }
.resume-panel h2 { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.resume-title { margin: 0 0 4px; font-weight: 650; }
.resume-meta { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.resume-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.active-profile { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.active-profile span { overflow-wrap: anywhere; }
.field-label { display: block; margin: 20px 0 8px; font-size: 14px; font-weight: 600; }
.text-input { display: block; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
#login-screen, #rating-screen, #proposal-screen { padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; }
.story-proposal { margin: 24px 0; }
.story-ornament { font-size: 54px; color: var(--accent); margin-bottom: 22px; }
.story-proposal p { color: var(--muted); line-height: 1.8; }
.story-proposal .eyebrow { color: var(--accent); }
.action-row { grid-template-columns: 1fr 1fr; }
.action-row .primary-action { margin-top: 0; }
.reader-toolbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.reader.screen.is-active { height: calc(100dvh - 225px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 14px 20px; max-width: 700px; }
#reader-progress-bar { width: min(45%, 260px); height: 6px; accent-color: var(--primary); }
#reader-progress { font-size: 12px; color: var(--muted); }
.reader-body { font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.9; white-space: pre-wrap; }
.reader h1 { font-size: 42px; margin-bottom: 28px; }
.score-label { display: block; margin-top: 26px; font-weight: 650; }
#score-input { width: 100%; margin-top: 18px; accent-color: var(--primary); }
.score-value { margin-top: 8px; color: var(--muted); }
.app-footer { max-width: 1096px; margin: auto; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 22px 0 max(22px, env(safe-area-inset-bottom)); font-size: 11px; color: var(--muted); }
@media (max-width: 900px) {
  #home-screen.is-active { gap: 30px; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); }
  .home-intro h1 { font-size: 38px; }
  .reading-picker { padding: 24px; }
  .choice[data-genre] { gap: 8px; padding: 10px; }
  .app-footer { margin-inline: 32px; }
}
@media (max-width: 720px) {
  .app-header { padding: max(18px, env(safe-area-inset-top)) 22px 18px; }
  .brand { font-size: 23px; }
  .brand-caption { font-size: 11px; }
  .app-shell { padding: 30px 20px; min-height: calc(100svh - 143px); }
  #home-screen.is-active { display: block; max-width: 480px; }
  .home-intro { margin-bottom: 28px; }
  .home-intro h1 { font-size: 35px; letter-spacing: -1px; margin: 15px 0; }
  .home-intro .intro { font-size: 14px; margin-bottom: 0; }
  .reading-art, .intro-footnote { display: none; }
  .reading-picker { border-radius: 18px; padding: 22px; }
  .picker-title { font-size: 26px; }
  .choice-heading { margin-top: 20px; }
  .choice[data-genre] { min-height: 62px; font-size: 13px; }
  .choice[data-genre]::before { width: 26px; height: 26px; }
  .app-footer { margin-inline: 22px; flex-wrap: wrap; padding-block: 18px; }
  #login-screen, #rating-screen, #proposal-screen { padding: 24px; }
  h1 { font-size: 31px; }
  .reader.screen.is-active { height: calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding-inline: 4px; }
  .reader h1 { font-size: 33px; }
  .reader-body { font-size: 19px; line-height: 1.8; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
