:root {
  color-scheme: light;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  color: #23313a;
  background: #f4efe4;
  --paper: #fffdf8;
  --ink: #23313a;
  --muted: #6c777c;
  --line: #d9d2c5;
  --accent: #d64f3f;
  --accent-dark: #a8372d;
  --blue: #476d7c;
  --gold: #e6b85c;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f4efe4; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; }
button { font: inherit; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(28px + var(--safe-bottom));
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 8%, rgba(230,184,92,.25), transparent 28%),
    linear-gradient(160deg, #f7f2e8 0%, #ebe4d7 100%);
}

.title-card {
  width: min(100%, 760px);
  background: var(--paper);
  border: 1px solid rgba(35,49,58,.12);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(63,54,43,.16);
  overflow: hidden;
}

.office-illustration {
  position: relative;
  min-height: 245px;
  overflow: hidden;
  background: #d9c7a8 url("./assets/illustrations/title-april.jpg") center 49% / cover no-repeat;
}

.title-copy { padding: 28px clamp(22px, 6vw, 58px) 38px; }
.eyebrow { margin: 0 0 12px; color: var(--accent-dark); font-size: .78rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1 { margin: 0; color: var(--ink); font-size: clamp(1.72rem, 6vw, 3rem); line-height: 1.45; letter-spacing: -.02em; font-weight: 800; }
h1 .perfect { display: inline-block; margin: 5px 0; padding: 0 .16em; color: var(--accent-dark); background: linear-gradient(transparent 62%, rgba(230,184,92,.55) 62%); }
.subtitle { margin: 18px 0 26px; color: var(--muted); font-size: .98rem; line-height: 1.9; }
.primary-button {
  width: 100%; min-height: 58px; border: 0; border-radius: 16px;
  color: white; background: var(--accent); font-weight: 800; letter-spacing: .04em;
  box-shadow: 0 8px 0 var(--accent-dark); cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.primary-button:hover { background: #df5949; }
.primary-button:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--accent-dark); }
.primary-button:focus-visible { outline: 4px solid rgba(71,109,124,.35); outline-offset: 3px; }
.microcopy { margin: 18px 0 0; text-align: center; color: #8a8e8c; font-size: .75rem; }

.story-card, .chapter-card, .settlement-card {
  width: min(100%, 760px); padding: clamp(28px, 7vw, 64px); border-radius: 28px;
  background: var(--paper); border: 1px solid rgba(35,49,58,.12); box-shadow: 0 24px 70px rgba(63,54,43,.14);
}
.scene-label, .event-id, .section-kicker, .delta-label { margin: 0 0 12px; color: var(--accent-dark); font-size: .74rem; font-weight: 800; letter-spacing: .18em; }
.story-card h2 { margin: 0 0 28px; font-family: "Zen Kurenaido", sans-serif; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.55; }
.prose { margin: 0 0 34px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prose p, .event-body p, .result-prose p { margin: 0 0 1em; font-size: clamp(1rem, 2vw, 1.08rem); line-height: 2; }
.prose p:last-child, .event-body p:last-child, .result-prose p:last-child { margin-bottom: 0; }

.chapter-screen { transition: background-color .3s; }
.chapter-screen.spring { background: #f1ebe1; }
.chapter-screen.summer { background: #dfecef; }
.chapter-screen.autumn { background: #eee1d2; }
.chapter-screen.winter { background: #e5e9ec; }
.chapter-card { text-align: center; overflow: hidden; }
.chapter-card h2 { margin: 18px 0 0; font-size: clamp(2.2rem, 7vw, 3.7rem); letter-spacing: .08em; }
.chapter-months { margin: 8px 0 22px; color: var(--accent-dark); font-size: 1.35rem; font-weight: 800; }
.chapter-line { margin: 0 auto 30px; color: var(--muted); line-height: 1.9; }
.quarter-art { position: relative; height: 185px; margin: calc(clamp(28px, 7vw, 64px) * -1) calc(clamp(28px, 7vw, 64px) * -1) 34px; overflow: hidden; background-position: center 52%; background-size: cover; background-repeat: no-repeat; }
.spring .quarter-art { background-image: url("./assets/illustrations/quarter-1-spring.jpg"); }
.summer .quarter-art { background-image: url("./assets/illustrations/quarter-2-summer.jpg"); }
.autumn .quarter-art { background-image: url("./assets/illustrations/quarter-3-autumn.jpg"); }
.winter .quarter-art { background-image: url("./assets/illustrations/quarter-4-winter.jpg"); }

.game-shell { width: min(100%, 920px); min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px calc(36px + var(--safe-bottom)); }
.game-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.period { margin: 0 0 2px; font-size: 1.15rem; font-weight: 800; }
.step { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .08em; }
.stat-panel { display: grid; grid-template-columns: repeat(5, auto); gap: 6px; }
.stat-chip { min-width: 64px; padding: 5px 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,253,248,.78); }
.stat-chip span { font-size: .65rem; color: var(--muted); white-space: nowrap; }
.rank { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 7px; background: #60727a; color: white; font-size: .8rem; }
.rank-s { background: #b48222; } .rank-a { background: #bc4a3e; } .rank-b { background: #486f7d; }
.progress-track { height: 5px; margin: 0 0 18px; border-radius: 999px; overflow: hidden; background: #ddd6c9; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.event-card { padding: clamp(24px, 6vw, 54px); border: 1px solid rgba(35,49,58,.12); border-radius: 24px; background: var(--paper); box-shadow: 0 18px 45px rgba(63,54,43,.1); }
.event-card h1 { margin: 0 0 28px; font-size: clamp(1.8rem, 5vw, 2.7rem); line-height: 1.45; }
.event-body { margin-bottom: 30px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.choices { display: grid; gap: 13px; }
.choice-button { min-height: 72px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; color: var(--ink); border: 1.5px solid #b9b4aa; border-radius: 15px; background: white; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.choice-button span { font-weight: 700; line-height: 1.55; }
.choice-button small { flex: 0 0 auto; color: var(--muted); font-size: .68rem; }
.choice-button:hover { transform: translateY(-2px); border-color: var(--accent); background: #fffaf4; }
.choice-button:focus-visible, .reveal-button:focus-visible { outline: 4px solid rgba(71,109,124,.32); outline-offset: 2px; }
.choice-button:disabled { cursor: default; opacity: .55; transform: none; }

.result-shell { padding-top: 32px; }
.result-card { max-width: 760px; margin: 0 auto; }
.result-prose { margin-bottom: 26px; }
.result-prose p + p { color: #5d5145; padding-left: 17px; border-left: 3px solid var(--gold); }
.delta-box { margin: 28px 0; padding: 20px; border-radius: 16px; background: #f2eee6; }
.delta-list { display: flex; flex-wrap: wrap; gap: 10px; }
.delta-list span { min-width: 124px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 10px; background: white; }
.delta-list b { font-size: .82rem; }
.delta-list strong { font-size: 1.25rem; letter-spacing: -.2em; padding-right: .2em; }
.delta-up { color: #b34338; } .delta-down { color: #3f6e82; }
.no-change { margin: 0; font-weight: 700; }

.settlement-screen { padding-top: max(28px, env(safe-area-inset-top)); padding-bottom: calc(44px + var(--safe-bottom)); }
.settlement-card { text-align: center; overflow: hidden; }
.settlement-art { position: relative; height: 155px; margin: calc(clamp(28px, 7vw, 64px) * -1) calc(clamp(28px, 7vw, 64px) * -1) 38px; background: #d9c7a8 url("./assets/illustrations/settlement-spring.jpg") center 55% / cover no-repeat; overflow: hidden; }
.settlement-card > h1 { margin: 8px 0 26px; font-size: clamp(3.4rem, 12vw, 6rem); letter-spacing: .2em; }
.settlement-card > h1 span { color: var(--accent); }
.final-stats { grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 36px; }
.final-stats .stat-chip { min-width: 0; padding: 12px 9px; flex-direction: column; }
.final-stats .stat-chip span { font-size: .72rem; }
.final-stats .rank { width: 38px; height: 38px; font-size: 1.15rem; }
.title-result { padding: 32px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.title-result h2 { margin: 0 0 12px; color: var(--accent-dark); font-size: clamp(1.65rem, 5vw, 2.6rem); line-height: 1.5; }
.catchphrase { margin: 0 0 23px; font-weight: 800; font-size: 1.08rem; }
.title-description { margin: 0 auto 22px; max-width: 590px; text-align: left; line-height: 1.95; }
.punchline { margin: 0; padding: 18px; border-radius: 12px; background: #f2eee6; font-weight: 600; line-height: 1.8; }
.company-reveal { padding-top: 32px; }
.reveal-button { min-height: 54px; padding: 0 22px; border: 1.5px solid var(--ink); border-radius: 14px; color: var(--ink); background: transparent; font-weight: 800; cursor: pointer; }
.reveal-button:hover { background: var(--ink); color: white; }
.reveal-lead { margin: 0 0 14px; color: var(--muted); line-height: 1.8; }
.company-name { margin: 0 0 16px; font-size: clamp(1.85rem, 6vw, 2.9rem); font-weight: 800; letter-spacing: .08em; }
.company-comment { margin: 0 auto 26px; max-width: 560px; line-height: 1.8; }
.restart-button { margin-top: 10px; }

@media (max-width: 520px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .title-card { border-radius: 22px; }
  .office-illustration { min-height: 205px; }
  .title-copy { padding: 24px 22px 32px; }
  h1 { font-size: clamp(1.55rem, 7.2vw, 2rem); }
  .story-card, .chapter-card, .settlement-card { border-radius: 20px; }
  .game-shell { padding-left: 12px; padding-right: 12px; }
  .game-header { display: block; }
  .stat-panel { width: 100%; margin-top: 12px; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .stat-chip { min-width: 0; padding: 5px 4px; flex-direction: column; gap: 3px; }
  .stat-chip span { font-size: .56rem; }
  .rank { width: 27px; height: 24px; }
  .event-card { padding: 25px 20px; border-radius: 19px; }
  .event-card h1 { margin-bottom: 20px; }
  .event-body { padding: 19px 0; margin-bottom: 22px; }
  .choice-button { min-height: 76px; padding: 14px 16px; }
  .choice-button small { display: none; }
  .delta-list { display: grid; grid-template-columns: 1fr 1fr; }
  .delta-list span { min-width: 0; }
  .final-stats { margin-bottom: 28px; }
  .final-stats .stat-chip { padding: 9px 3px; }
  .final-stats .stat-chip span { font-size: .55rem; }
  .final-stats .rank { width: 32px; height: 32px; }
  .settlement-art { height: 130px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .screen { padding-top: 12px; padding-bottom: calc(18px + var(--safe-bottom)); }
  .title-card { display: grid; grid-template-columns: .78fr 1.22fr; }
  .office-illustration { min-height: 100%; }
  .title-copy { padding: 20px 25px 25px; }
  h1 { font-size: 1.25rem; }
  .subtitle { margin: 10px 0 15px; line-height: 1.6; }
  .primary-button { min-height: 48px; }
  .microcopy { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
