:root {
  color-scheme: dark;
  --bg: #101715;
  --surface: #19221e;
  --line: #3a473d;
  --paper: #f2eddc;
  --muted: #b5bdae;
  --dim: #909c8d;
  --orange: #ffbc54;
  --mint: #a7e5c5;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: system-ui, "Yu Gothic", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; color: var(--paper); background: radial-gradient(ellipse at 68% -22%, #253b31 0, transparent 56%), var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
button, canvas { -webkit-tap-highlight-color: transparent; }
button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.site-bar { min-height: 58px; padding: 0 max(20px, calc((100% - 1110px) / 2)); border-bottom: 1px solid #364239; display: flex; justify-content: space-between; align-items: center; background: #151e19e6; }
.site-brand, .site-actions { display: flex; gap: 12px; align-items: center; }
.site-brand { font-size: 13px; font-weight: 750; letter-spacing: .06em; white-space: nowrap; }
.brand-mark { width: 25px; height: 25px; border: 1px solid #a2b2a3; border-radius: 4px; display: flex; justify-content: center; align-items: center; gap: 2px; }
.brand-mark i { display: block; width: 3px; height: 3px; background: var(--mint); }
.brand-mark i:nth-child(2) { transform: translateY(3px); }
.brand-divider { height: 16px; border-left: 1px solid var(--line); }
.bar-caption { color: var(--muted); font-size: 11px; font-weight: 500; }
.site-actions { gap: 7px; }
.quiet { border: 1px solid #3d4b41; background: #1e2a23; color: var(--paper); padding: 0 10px; height: 38px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; font-size: 12px; font-weight: 650; }
.quiet:hover, .report-button:hover, .control:hover { background: #2c3b30; }
.quiet svg { width: 16px; height: 16px; }
.help-icon { font: 800 12px var(--mono); border-radius: 50%; border: 1px solid #a7b5a7; width: 16px; height: 16px; line-height: 14px; text-align: center; }
main { width: min(1110px, calc(100% - 40px)); margin: 0 auto; }
.masthead { display: flex; align-items: end; justify-content: space-between; padding: 27px 1px 21px; gap: 10px; }
.eyebrow { margin: 0 0 5px; color: var(--orange); font-size: 11px; font-weight: 760; letter-spacing: .14em; }
.eyebrow > span:first-child { display: inline-block; width: 7px; height: 7px; background: var(--orange); transform: rotate(45deg); margin: 0 6px 1px 2px; }
.slash { color: var(--dim); margin: 0 4px; font-weight: 400; }
h1 { font-size: clamp(32px, 5vw, 59px); font-weight: 950; letter-spacing: -.055em; line-height: 1.04; margin: 0; white-space: nowrap; }
h1 > span { font-size: .43em; letter-spacing: -.075em; color: #c5c9b7; margin-left: 6px; }
.mast-note { margin: 0; color: var(--dim); text-align: right; font-size: 11px; letter-spacing: .11em; line-height: 1.6; }
.mast-note strong { color: var(--paper); font-size: 14px; }
.shell { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; align-items: start; }
.station, .files { min-width: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.station-top { display: flex; align-items: center; gap: 12px; padding: 11px 13px; }
.stage-code { border: 1px solid #a18046; color: var(--orange); background: #3b3423; min-width: 54px; text-align: center; padding: 7px 6px; border-radius: 4px; font: 750 14px var(--mono); }
.stage-heading { min-width: 0; font-size: 14px; font-weight: 830; }
.micro { color: var(--dim); font: 10px var(--mono); letter-spacing: .07em; white-space: nowrap; }
.stage-count { margin-left: auto; color: var(--muted); font: 12px var(--mono); white-space: nowrap; }
.stage-count strong { color: var(--paper); font-size: 17px; }
.viewport { position: relative; width: 100%; aspect-ratio: 2.15; border-top: 1px solid #54604c; border-bottom: 1px solid #756038; overflow: hidden; background: #243d36; }
canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.game-overlay { position: absolute; inset: 0; display: flex; align-items: center; padding: clamp(12px, 4%, 32px); background: linear-gradient(90deg, #111915e8, #1119158a 45%, transparent 90%); }
.game-overlay[hidden] { display: none; }
.game-card { width: min(100%, 370px); color: var(--paper); border: 1px solid #717d67; border-radius: 6px; background: #16201cf5; padding: clamp(12px, 3%, 22px); box-shadow: 0 8px 24px #07100c8c; border-left: 3px solid var(--orange); }
.game-card[data-tone="done"] { border-left-color: var(--mint); }
.card-tag { margin: 0 0 4px; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
[data-tone="done"] .card-tag { color: var(--mint); }
.game-card h2 { margin: 0 0 6px; font-size: clamp(20px, 3.4vw, 30px); line-height: 1.15; letter-spacing: -.055em; font-weight: 900; }
.card-text { margin: 0 0 13px; color: #d8dfd3; font-size: 13px; line-height: 1.55; }
.primary { min-height: 44px; min-width: 115px; background: var(--orange); color: #251908; border: 1px solid #fbd07d; border-radius: 4px; padding: 6px 12px; font-weight: 850; font-size: 13px; }
.primary span { margin-left: 6px; }
.primary:hover { background: #ffd285; }
.station-status { border-bottom: 1px solid var(--line); }
.station-status [hidden] { display: none; }
.death-taunt {
  position: fixed;
  inset: 0;
  z-index: 50;
  --replay-inset: clamp(8px, 2.2vmin, 24px);
  overflow: hidden;
  color: #ffebca;
  background: #170e0c;
}
.death-taunt[hidden] { display: none; }
#replay { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.death-taunt::after {
  content: "";
  position: absolute;
  inset: var(--replay-inset);
  border: 2px solid #ee7952;
  outline: 1px solid #ee79525c;
  outline-offset: -7px;
  background: linear-gradient(transparent 52%, #1d100ede), repeating-linear-gradient(transparent 0 5px, #260d0c24 5px 6px);
  pointer-events: none;
}
.replay-label {
  position: absolute;
  z-index: 1;
  top: calc(var(--replay-inset) + 11px);
  left: calc(var(--replay-inset) + 11px);
  padding: 5px 9px;
  background: #2b1614;
  border: 1px solid #ee7952;
  color: #ffcaa8;
  font-size: clamp(11px, 2.2vmin, 16px);
  font-weight: 800;
  letter-spacing: .1em;
}
.death-taunt p {
  position: absolute;
  z-index: 1;
  inset: auto 0 max(9%, 22px);
  margin: 0;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(22px, min(10.5vw, 19vh), 152px);
  font-weight: 950;
  letter-spacing: -.105em;
  line-height: 1;
  text-shadow: .04em .045em #501812, 0 .05em .12em #170e0c;
  animation: taunt-enter 150ms ease-out both;
}
.death-taunt p span { font: 900 .86em var(--mono); white-space: pre; color: #ffbb62; letter-spacing: -.14em; }
@media (orientation: portrait) and (max-width: 540px) {
  .death-taunt p { font-size: 13vw; }
  .death-taunt p span { display: block; font-size: 1.2em; }
}
@keyframes taunt-enter { from { transform: scale(.94); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .death-taunt p { animation: none; } }
.death-log { background: #261d19; border-left: 3px solid #e6957e; padding: 7px 10px; }
.death-log[data-tone="stuck"] { background: #252219; border-left-color: var(--orange); }
.death-heading { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; margin-bottom: 3px; }
.death-heading > span { color: #ffb29e; font-size: 11px; font-weight: 800; white-space: nowrap; }
[data-tone="stuck"] .death-heading > span { color: var(--orange); }
.death-heading > strong { font-size: 14px; }
.death-log > p { margin: 0; color: #f2e4d7; font-size: 12px; line-height: 1.4; }
.death-log > #death-hint { margin-top: 2px; color: #c9bcae; font-size: 11px; }
.reset.retry-ready { color: #251908; background: var(--orange); border-color: #fbd07d; box-shadow: inset 0 -3px #ae7432; font-weight: 800; }
.reset.retry-ready:hover { background: #ffd285; }
.notice { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 42px; background: #131d18; }
.notice-label { color: var(--orange); font-size: 10px; font-weight: 800; white-space: nowrap; }
.notice-label > span { display: inline-block; width: 7px; height: 7px; background: #a6d9b0; margin-right: 4px; border-radius: 50%; }
.notice p { margin: 0; color: #d1daca; font-size: 12px; line-height: 1.36; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 11px; user-select: none; }
.controls [hidden] { display: none; }
.directions, .action-controls { display: flex; align-items: center; gap: 6px; }
.control { min-height: 48px; border: 1px solid #475649; border-radius: 6px; background: #243128; box-shadow: inset 0 -3px #111b15; touch-action: none; }
.control:active, .control.pressed { transform: translateY(1px); background: #3e5444; box-shadow: inset 0 1px 4px #102018; }
.control:disabled { opacity: .46; }
.direction { font-size: 26px; font-weight: 670; width: 58px; }
.jump { padding: 0 15px; color: #30210d; background: #edaa4d; border-color: #f7c777; box-shadow: inset 0 -3px #ae7432; font-size: 14px; font-weight: 850; }
.jump:hover, .jump:active, .jump.pressed { background: #ffc778; }
.jump > span { font-size: 18px; margin-right: 2px; }
.reset { display: grid; place-items: center; min-width: 50px; padding: 4px 6px; font-size: 9px; color: var(--muted); }
.reset svg { width: 17px; height: 17px; }
.key-guide { color: var(--muted); font-size: 11px; margin: 0; white-space: nowrap; }
.key-guide > span { color: var(--dim); margin: 0 3px; }
kbd { display: inline-block; font: 11px var(--mono); background: #18221b; border: 1px solid #435146; border-radius: 3px; padding: 3px 4px; margin-right: 2px; }
.files { padding: 13px; }
.files-title { display: flex; align-items: center; gap: 6px; }
.section-icon { color: var(--orange); font-size: 16px; }
.files h2 { margin: 0; font-size: 15px; }
.files-title .micro { margin-left: auto; font-size: 9px; }
.shift-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; border: 1px solid #3d4c41; padding: 8px 9px; background: #131d17; border-radius: 5px; }
.shift-stats > div { display: grid; gap: 4px; }
.shift-stats > div + div { border-left: 1px solid #3b4a3f; padding-left: 11px; }
.shift-stats > div > span { font-size: 10px; color: var(--muted); }
.shift-stats strong { font: 800 23px/1 var(--mono); }
#deaths { color: #ffbb9f; }
.shift-rule { margin: 10px 0; font-size: 11px; color: var(--muted); }
.report-button { width: 100%; min-height: 44px; padding: 6px 7px; display: flex; gap: 6px; align-items: center; background: #26342b; border: 1px solid #475a4c; border-radius: 5px; font-weight: 780; font-size: 12px; }
.report-button strong { margin-left: auto; font: 12px var(--mono); color: var(--orange); }
footer { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 10px; padding: 13px 1px 18px; }
dialog { color: var(--paper); background: #1b2620; border: 1px solid #748170; border-radius: 9px; width: min(530px, calc(100% - 24px)); padding: 0; max-height: min(680px, 86dvh); }
dialog::backdrop { background: #070d0ad9; }
.dialog-header { position: sticky; top: 0; background: #1b2620; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); z-index: 1; }
.dialog-header h2 { font-size: 19px; margin: 0; }
#close-info { min-width: 44px; height: 44px; font-size: 24px; }
.dialog-body { padding: 0 15px 15px; font-size: 14px; line-height: 1.65; }
.dialog-body dl { display: grid; grid-template-columns: 85px 1fr; gap: 7px 12px; margin: 14px 0; }
.dialog-body dt { color: var(--orange); font-weight: 750; }
.dialog-body dd { margin: 0; }
.report-list { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.report-list li { border: 1px solid #435248; border-radius: 5px; padding: 6px 9px; }
.report-list strong { color: var(--orange); }
.report-list p { margin: 3px 0; color: var(--muted); font-size: 12px; }
@media (max-width: 830px) { .key-guide { display: none; } }
@media (max-width: 690px) {
  .site-bar { padding: 0 12px; min-height: 49px; }
  .quiet { height: 44px; }
  .site-brand { gap: 7px; }
  main { width: calc(100% - 20px); }
  .masthead { padding: 15px 1px 12px; }
  .mast-note { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .files { padding: 10px; }
}
@media (max-width: 510px) {
  .viewport { aspect-ratio: 1.52; }
  .station-top { padding: 7px 9px; gap: 8px; }
  .notice { padding-inline: 8px; }
  .controls { padding: 8px; }
  .direction { width: 52px; }
  .card-text { font-size: 12px; margin-bottom: 9px; }
}
@media (max-width: 355px) {
  .bar-caption, .brand-divider { display: none; }
  .direction { width: 44px; }
  .action-controls { gap: 4px; }
  .reset { min-width: 44px; padding-inline: 3px; }
  .jump { padding: 0 6px; font-size: 12px; }
}
@media (max-width: 300px) {
  .controls { gap: 4px; padding-inline: 4px; }
  .directions { gap: 4px; }
  .jump { padding-inline: 4px; }
  .jump > span { display: none; }
}
@media (pointer: coarse) {
  .control { min-height: 52px; }
}
@media (orientation: landscape) and (max-height: 510px) {
  .masthead { display: none; }
  .site-bar { min-height: 41px; padding: 0 9px; }
  .site-bar .quiet { height: 40px; }
  main { width: min(100% - 12px, 760px); margin-top: 3px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .station-top { padding-block: 3px; }
  .station { display: flex; flex-direction: column; height: calc(100dvh - 44px); }
  .viewport { flex: 1; min-height: 120px; aspect-ratio: auto; }
  .death-log { padding-block: 4px; }
  .death-heading { margin-bottom: 0; }
  .death-log > p { font-size: 11px; }
  .death-log > #death-hint { margin-top: 0; }
  .game-overlay { padding: 5px 12px; }
  .game-card { padding: 8px 11px; }
  .game-card h2 { font-size: 21px; margin-bottom: 4px; }
  .card-tag { font-size: 10px; margin-bottom: 2px; }
  .card-text { font-size: 11px; margin-bottom: 6px; }
  .notice { min-height: 25px; padding-block: 4px; }
  .controls { padding: 4px 7px; }
}
