:root {
  color-scheme: light;
  --ink: #201d21;
  --paper: #fffcf1;
  --ground: #eeece4;
  --violet: #b9a0eb;
  --lime: #e1f557;
  --line: 2px solid var(--ink);
  --latin: "Archivo Black", "Arial Black", "Arial", sans-serif;
  font: 100%/1.6 "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box }
body {
  min-height: 100svh; margin: 0; padding: 0 0 max(1rem,env(safe-area-inset-bottom));
  background-image: radial-gradient(#938b7b55 .7px,transparent .8px);
  background-size: 7px 7px;
}
[hidden] { display: none !important }
button, a { color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation }
button { font: inherit; cursor: pointer }
:is(button,a):focus-visible { outline: 3px solid #473493; outline-offset: 5px }
.wrap { width: min(1060px,calc(100% - 7rem)); margin-inline: auto }
.mast,.footer,.rail,.brand,.help,.speaker,.trading-card figcaption { display: flex; align-items: center }
.mast,.footer,.rail,.trading-card figcaption { justify-content: space-between }
.mast { min-height: 86px; padding: .7rem 0; border-bottom: var(--line); gap: .6rem }
.mast-brand,.byline { display: flex; align-items: center }
.mast-brand { gap: 1rem }
.byline { gap: .3rem; min-height: 32px; font: 700 .75rem/1.3 var(--latin); white-space: nowrap }
.byline,.footer a { color: #4c3a69; text-decoration: none }
.byline:hover,.footer a:hover { color: #633f9c }
.brand { gap: .55rem; font: 1000 clamp(1.2rem,2.1vw,1.62rem)/1 var(--latin); letter-spacing: -.065em }
.brand img { object-fit: contain; transform: rotate(-7deg) }
.brand-dot { color: #72519c }
.help,.back { background: transparent; border: 0; min-height: 44px; font-weight: 700 }
.help { gap: .45rem; padding: .2rem .1rem .2rem .7rem; font-size: .92rem }
.help span { display: grid; place-items: center; border: var(--line); width: 1.35rem; height: 1.35rem; border-radius: 50%; font: 900 .85rem/1 var(--latin) }
.help:hover,.back:hover,.extra:hover { text-decoration: underline; text-underline-offset: .22em }
main { margin-top: clamp(1.5rem,4.3vh,3.25rem) }
.sheet, dialog { border: var(--line); background: var(--paper); box-shadow: 6px 7px 0 var(--ink) }
.rail { background: var(--ink); color: var(--paper); gap: .65rem; min-height: 37px; padding: .5rem clamp(.9rem,2.8vw,2.1rem); font-size: .8rem; font-weight: 650; letter-spacing: .08em; line-height: 1.35 }
.rail-title { color: var(--lime); font: 800 .81rem/1.3 "Courier New",monospace; letter-spacing: .15em }
.poster { display: grid; grid-template-columns: 1.08fr 1fr; grid-template-rows: auto auto; column-gap: 2%; align-items: center; padding: clamp(2rem,3.5vw,3rem) clamp(2rem,5.8vw,4.65rem) 2.55rem }
h1,h2,p,figure,dl,dd { margin: 0 }
h1 { grid-area: 1/1; position: relative; z-index: 1; font-size: clamp(3.05rem,6.45vw,5.2rem); font-weight: 950; line-height: 1.08; letter-spacing: -.075em }
h1 span { display: block }
h1 em { display: inline-block; margin: .035em .055em .035em -.035em; padding: 0 .12em .03em .065em; background: var(--violet); font: italic 1000 1.18em/.87 var(--latin); letter-spacing: -.10em; transform: rotate(-4deg); border: var(--line) }
.invitation { grid-area: 2/1; align-self: start; margin-top: 1.1rem }
.invitation p { font-weight: 630; line-height: 1.65 }
.key { display: inline-flex; justify-content: center; align-items: center; gap: .65rem; padding: .5rem 1rem; min-height: 52px; border: var(--line); border-radius: 5px; text-decoration: none; color: var(--ink); background: var(--paper); font-family: inherit; font-weight: 850; font-size: 1.05rem; line-height: 1.4; box-shadow: 3px 4px 0 var(--ink); transition: transform .12s,box-shadow .12s; cursor: pointer }
.key.primary { background: var(--lime) }
.key.violet { background: var(--violet) }
.key.start { width: min(280px,100%); margin-top: 1.15rem; min-height: 55px; letter-spacing: .08em }
@media (hover:hover) { .key:not([aria-disabled=true]):hover { transform: translate(-1px,-2px); box-shadow: 4px 6px 0 var(--ink) } }
.key:not([aria-disabled=true]):active { transform: translate(2px,3px); box-shadow: 1px 1px 0 var(--ink) }
.trading-card { grid-area: 1/2/3/3; position: relative; isolation: isolate; width: min(100%,346px); justify-self: center; align-self: center; transform: rotate(4deg); background: var(--paper); border: var(--line); box-shadow: 3px 4px 0 var(--ink); padding: .56rem .56rem .2rem }
.trading-card::before { content: ""; position: absolute; z-index: -2; inset: .1rem; background: var(--violet) repeating-linear-gradient(135deg,transparent 0 6px,#302636 6px 7px); border: var(--line); transform: rotate(-9deg) translate(-4%,1%); box-shadow: 2px 3px 0 var(--ink) }
.trading-card::after { content: ""; position: absolute; inset: -2px; z-index: -1; border: var(--line); background: var(--paper) }
.art { border: var(--line); overflow: hidden; aspect-ratio: 1; background: var(--violet) }
.art img { display: block; width: 100%; height: 100%; object-fit: cover }
.trading-card figcaption { padding: .45rem .1rem .35rem; gap: .3rem; line-height: 1.15 }
.trading-card figcaption span { font: 900 clamp(.75rem,1.6vw,1.12rem)/1 var(--latin); letter-spacing: -.04em }
.trading-card figcaption b { font-size: .82rem }
.stats { display: grid; grid-template-columns: 1fr 1.6fr 1fr; border-top: var(--line); background: #f1eedd; padding: .95rem clamp(1rem,4.6vw,3.4rem) }
.stats div { display: flex; align-items: center; justify-content: center; gap: clamp(.4rem,1.6vw,1.1rem); padding: .15rem }
.stats div+div { border-left: 1px solid #79756c }
.stats dt { font-size: .82rem; font-weight: 750; letter-spacing: .03em }
.stats dd { font-weight: 700; font-size: .84rem; white-space: nowrap }
.stats .answer-options { white-space: normal; text-align: center; line-height: 1.4 }
.answer-options span { display: inline-block }
.stats dd b { font: 900 1.65rem/1 var(--latin); letter-spacing: -.07em }
.footer { margin-top: 1.6rem; padding: .25rem 0; color: #58534f; gap: 1rem; font-size: .77rem }
.footer span:first-child { font: 800 .78rem/1.2 "Courier New",monospace; letter-spacing: .085em }
.footer a { display: inline-flex; align-items: center; gap: .25rem; min-height: 44px; font-weight: 700 }
/* Keep the quiz controls in a stable position as the question changes. */
.game-body { max-width: 820px; margin: auto; padding: clamp(1.5rem,4.5vw,3.4rem) clamp(1.2rem,4.5vw,3.5rem) clamp(2rem,5vw,3.8rem) }
.progress { display: flex; gap: 5px; margin-bottom: clamp(1.8rem,4vw,2.7rem) }
.progress span { height: 8px; flex: 1; background: #dedacf; border-radius: 1px }
.progress .done { background: var(--ink) }
.progress .current { background: var(--violet); outline: 1px solid var(--ink) }
.speaker { gap: .5rem; font-size: .85rem; font-weight: 750 }
.speaker img { object-fit: contain }
.game h2,.dialog-body h2 { font-weight: 930; line-height: 1.35; letter-spacing: -.045em; overflow-wrap: anywhere; line-break: strict }
.game h2 { display: flex; align-items: center; font-size: clamp(1.9rem,4.2vw,3.2rem); min-height: 3em; margin: .38rem 0 1.2rem }
.game h2:focus { outline: none }
.game[data-phase="guess"] h2,.game[data-phase="result"] h2 { min-height: auto; margin: 1rem 0 .5rem }
.scene-note { font-weight: 650; margin: 0 0 1.8rem; line-height: 1.75 }
.answers,.end-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem }
.answers .key { min-height: 64px }
.answers .key span { font-family: Arial,sans-serif; font-weight: 800; font-size: 1.4rem }
.answers .unknown { grid-column: 1/-1; min-height: 48px; box-shadow: 2px 3px 0 var(--ink) }
.back { display: block; margin: 1.1rem auto 0; font-size: .9rem; color: #534c53; text-decoration: underline; text-underline-offset: .23em }
.share[aria-disabled=true] { color: #615c5a; background: #eae7dc; box-shadow: none; border-color: #a29a94; cursor: default }
.small { font-size: .83rem; color: #5f5853; margin: .8rem 0 0 }
.extra { display: inline-block; margin-top: 1rem; padding: .7rem 0; font-weight: 700; text-underline-offset: .2em }
.text-action { border: 0; background: transparent; color: #553778; font: inherit; text-align: left; cursor: pointer }
.ending .extra,.text-action { color: #553778; min-height: 44px; text-decoration: none }
.ending .extra:hover,.text-action:hover { color: #6a429d }
.scene-note { white-space: pre-line }
#model-form label { display: block; margin: 1rem 0 .25rem; font-weight: 700 }
#model-name { width: 100%; min-height: 44px; margin-bottom: 1rem; padding: .5rem; border: var(--line); font: inherit }
#answer-dialog .back { margin: .5rem 0 0 auto }
dialog { width: min(440px,calc(100% - 2.5rem)); max-height: calc(100svh - 3rem); color: var(--ink); padding: 0 }
dialog::backdrop { background: #201d2180 }
.dialog-body { padding: 1.5rem }
.dialog-body h2 { font-size: 1.65rem }
.dialog-body p { margin: .8rem 0 }
.dialog-body ol { padding-left: 1.6rem }
.dialog-body li { padding: .3rem 0 .3rem .15rem }
.dialog-body li::marker { font-weight: 850 }
.dialog-body .key { width: 100%; margin-top: .45rem }
.case-portrait { width: 100%; height: auto; aspect-ratio: 1; border: var(--line); padding: 4px; background: white; transform: rotate(4deg); box-shadow: 2px 3px 0 var(--ink) }
.game:not([data-phase=question]) .case-head { display: grid; grid-template-columns: minmax(0,1fr) minmax(75px,20%); column-gap: 1rem; margin-bottom: 1.6rem }
.case-head .speaker,.case-head h2,.case-head .scene-note { grid-column: 1 }
.case-head .case-portrait { grid-area: 1/2/4/3; align-self: center }
.game:not([data-phase=question]) .scene-note { margin: 0 }
@media (max-width: 760px) {
  .wrap { width: calc(100% - 2.6rem) }
  .mast { min-height: 67px }
  .poster { padding-inline: clamp(1.2rem,5vw,2rem) }
  .trading-card { width: 90% }
  .stats { padding-inline: .45rem }
  .stats div { flex-direction: column; gap: .3rem }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 2rem) }
  .mast { min-height: 60px }
  .brand img { width: 33px; height: 33px }
  .mast-brand { flex-direction: column; align-items: flex-start; gap: 0 }
  .byline { margin-left: 1px; min-height: 26px }
  main { margin-top: 1.2rem }
  .sheet { box-shadow: 4px 5px 0 var(--ink) }
  .rail { padding: .55rem .8rem; min-height: 34px; font-size: .72rem; letter-spacing: .025em }
  .rail-title { font-size: .73rem; letter-spacing: .09em }
  .poster { grid-template-columns: 1.1fr .94fr; gap: 0; padding: 1.85rem 1.1rem 1.55rem }
  h1 { font-size: clamp(2.15rem,9.6vw,3.35rem); line-height: 1.14 }
  .trading-card { grid-area: 1/2; width: 96%; padding: .25rem .25rem .14rem; align-self: center }
  .trading-card figcaption { padding: .33rem .08rem .16rem; justify-content: center }
  .trading-card figcaption span { display: none }
  .trading-card figcaption b { font-size: .72rem }
  .invitation { grid-area: 2/1/3/3; margin-top: 1.25rem }
  .invitation p { font-size: 1rem }
  .key.start { width: 100%; margin-top: 1rem }
  .stats { padding: .8rem .1rem }
  .stats dt { font-size: .72rem; letter-spacing: 0 }
  .stats .answer-options { font-size: .75rem }
  .stats dd b { font-size: 1.4rem }
  .game-body { padding: 1.3rem 1rem 1.65rem }
  .game h2 { font-size: clamp(1.7rem,7.1vw,2.45rem); min-height: 3.9em; margin-bottom: 1rem }
  .progress { gap: 3px; margin-bottom: 1.55rem }
  .answers,.end-actions { gap: .75rem }
  .answers .key { min-height: 58px }
  .answers .unknown { min-height: 47px }
  .footer { margin-top: 1.1rem }
  .game[data-phase=result] .case-head .case-portrait { grid-area: 1/2/3/3 }
  .game[data-phase=result] .case-head .scene-note { grid-column: 1/-1; margin-top: .75rem }
}
@media (max-width: 360px) {
  .brand { gap: .3rem; font-size: 1rem; white-space: nowrap }
  .help { padding-left: .2rem; font-size: .82rem; white-space: nowrap }
  .poster { padding-inline: .85rem }
  h1 { font-size: 8.9vw }
  .invitation p { font-size: .91rem }
  .stats dt { font-size: .66rem; white-space: nowrap }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition: none !important; animation: none !important } }
