/* Paper-and-ink look like the original: white graph paper, black italic serif, light gray Unity-style buttons. */
:root { --ink: #141414; --blue: #2d70b3; --red: #d6292b; --btn: #f2f2f2; --btn-line: #9a9a9a; --serif: "Cambria Math", "Times New Roman", "Songti SC", "STSong", serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #fff; color: var(--ink); overflow: hidden; overscroll-behavior: none;
  font: italic 400 18px/1.4 var(--serif); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
canvas { position: fixed; inset: 0; display: block; }

#hud { position: fixed; top: max(10px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); pointer-events: none; opacity: 0; transition: opacity .15s; }
body[data-screen="play"] #hud, body[data-screen="paused"] #hud, body[data-screen="over"] #hud { opacity: 1; }
#shield { margin-top: 6px; display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; border: 3px dashed var(--ink); background: #fff; font: italic 700 22px/1 var(--serif); }
#score { font-size: clamp(22px, 4.4vw, 40px); line-height: 1; font-variant-numeric: tabular-nums; }
.icon { position: fixed; top: max(10px, env(safe-area-inset-top)); width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--btn-line); background: var(--btn); color: #444;
  display: grid; place-items: center; font: 700 20px/1 system-ui, sans-serif; letter-spacing: 1px; cursor: pointer; padding: 0; touch-action: manipulation; z-index: 7; }
#pause { right: max(10px, env(safe-area-inset-right)); display: none; }
#mute { right: calc(max(10px, env(safe-area-inset-right)) + 56px); }
body[data-screen="play"] #pause { display: grid; }
.icon:hover, .btn:hover { background: #e6e6e6; }
.icon:focus-visible, .btn:focus-visible, .linkbtn:focus-visible, .music input:focus-visible, .volume input:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#mute .off { display: none; } #mute[aria-pressed="true"] .on { display: none; } #mute[aria-pressed="true"] .off { display: inline; }

.panel { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 24px; pointer-events: none; z-index: 5; }
body[data-screen="title"] #title, body[data-screen="howto"] #howto, body[data-screen="paused"] #paused, body[data-screen="over"] #over { display: flex; }
body[data-screen="paused"] #paused, body[data-screen="over"] #over, body[data-screen="howto"] #howto { background: rgba(255, 255, 255, .88); }
body[data-credits="1"] #credits { display: flex; background: rgba(255, 255, 255, .96); pointer-events: auto; z-index: 8; }
.panel button, .panel input, .panel a, .panel label { pointer-events: auto; }
h1 { margin: 0; font-size: clamp(44px, 11vw, 104px); font-weight: 400; letter-spacing: .02em; text-shadow: 0 0 10px #fff, 0 0 20px #fff; }
h2 { margin: 0 0 6px; font-size: clamp(30px, 6vw, 48px); font-weight: 400; }
.daily { margin: 2px 0 14px; font-size: 16px; color: #444; background: rgba(255, 255, 255, .8); padding: 0 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.stack.row { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.btn { min-width: 168px; min-height: 44px; padding: 8px 22px; border-radius: 6px; border: 1px solid var(--btn-line); background: var(--btn); color: #323232;
  font: italic 400 clamp(18px, 3vw, 26px)/1.1 var(--serif); cursor: pointer; touch-action: manipulation; }
.btn.back { margin-top: 18px; }
.linkbtn { margin-top: 12px; background: rgba(255, 255, 255, .85); border: 0; color: #555; font: italic 400 15px var(--serif); text-decoration: underline; cursor: pointer; min-height: 36px; padding: 4px 10px; }
.corner { position: fixed; top: max(12px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); margin: 0; font-size: clamp(18px, 3.2vw, 28px); background: rgba(255, 255, 255, .8); padding: 0 6px; }
.music { position: fixed; top: max(14px, env(safe-area-inset-top)); right: calc(max(10px, env(safe-area-inset-right)) + 118px); display: flex; align-items: center; gap: 8px; font-size: clamp(15px, 2.4vw, 20px); background: rgba(255, 255, 255, .85); padding: 4px 8px; border-radius: 6px; }
.music input { width: 20px; height: 20px; accent-color: #2d70b3; }
.volume { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 20px; }
.volume input { width: min(60vw, 260px); accent-color: #2d70b3; }
.small { margin: 8px 0 0; font-size: 14px; color: #555; background: rgba(255, 255, 255, .8); padding: 0 6px; }
.lbl { font-size: clamp(20px, 3.4vw, 28px); }
#over-score { font-size: clamp(56px, 14vw, 120px); line-height: 1; font-variant-numeric: tabular-nums; }
#over-best { font-size: clamp(18px, 3vw, 26px); color: #444; }
#over-msg { min-height: 1.4em; font-size: clamp(18px, 3.2vw, 26px); color: var(--red); }
#over-msg[data-best="1"] { color: var(--blue); }
.howto { max-width: 34em; margin: 0; font-size: clamp(16px, 2.8vw, 24px); line-height: 1.55; text-align: left; }
.credit-text { max-width: 34em; margin: 10px 0 14px; font-size: clamp(15px, 2.6vw, 20px); line-height: 1.8; font-style: normal; }
.credit-text a { color: var(--blue); word-break: break-all; }
#rotate { position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); left: 0; right: 0; margin: 0; text-align: center; font-size: 14px; color: #555; display: none; pointer-events: none; z-index: 4; }
@media (orientation: portrait) and (max-width: 700px) { #rotate { display: block; } }
@media (max-height: 460px) {
  h1 { font-size: 44px; } .panel { gap: 4px; padding: 8px; } .daily { margin-bottom: 4px; } .btn { min-height: 38px; padding: 4px 18px; font-size: 18px; }
  .stack:not(.row) { flex-direction: row; } .howto { font-size: 15px; line-height: 1.4; } #over-score { font-size: 54px; } .small { display: none; }
}
.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; }
@media (prefers-reduced-motion: reduce) { #hud { transition: none; } }

#shield[hidden], #mult[hidden] { display: none; }
#chap { font-size: 16px; color: #1d4f84; margin-top: 2px; }
#mult { display: inline-block; margin: 6px 8px 0 0; padding: 2px 10px; border-radius: 8px; background: #1d4f84; color: #fff; font: italic 700 20px/1.3 var(--serif); }

/* leaderboard, settings */
.links { display: flex; gap: 6px; justify-content: center; }
body[data-settings="1"] #settings { display: flex; background: rgba(255, 255, 255, .96); pointer-events: auto; z-index: 9; }
#settings .field { display: flex; align-items: center; gap: 10px; font-size: clamp(18px, 3vw, 24px); }
#settings input[type="text"] { width: min(60vw, 14em); min-height: 44px; padding: 4px 10px; border: 1px solid var(--btn-line); border-radius: 6px; background: #fff; color: var(--ink); font: italic 400 20px var(--serif); user-select: text; -webkit-user-select: text; touch-action: manipulation; }
#settings .music.in { position: static; margin: 8px 0 14px; font-size: clamp(16px, 2.6vw, 20px); }
.err { min-height: 1.3em; margin: 0; font-size: 15px; color: var(--red); }
#over { pointer-events: auto; overflow-y: auto; justify-content: safe center; }
#over-board { width: min(92vw, 340px); margin-top: 6px; }
#over-board[hidden] { display: none; }
#over-board h3 { margin: 0 0 2px; font-size: 18px; font-weight: 400; color: #444; }
#board-list { list-style: none; margin: 0; padding: 0; font-size: 16px; line-height: 1.5; text-align: left; font-variant-numeric: tabular-nums; }
#board-list li { display: grid; grid-template-columns: 2.6em 1fr auto; gap: 6px; padding: 0 8px; border-radius: 4px; }
#board-list li > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; }
#board-list li > span:last-child { text-align: right; }
#board-list li.me { background: rgba(45, 112, 179, .16); color: #1d4f84; }
#board-rank { margin: 4px 0 0; font-size: 18px; color: var(--blue); min-height: 1.3em; }
@media (max-height: 460px) { #board-list { columns: 2; column-gap: 14px; font-size: 14px; line-height: 1.35; } #over-board { width: min(94vw, 560px); } #over-board h3 { font-size: 15px; } #board-rank { font-size: 15px; } }

/* arcade "More games": link on the title screen, strip on the game-over screen (mounted by /games/more.js) */
.more-start { margin-top: 2px; font-size: 15px; }
.more-start .mg-link { margin-top: 4px; background: rgba(255, 255, 255, .85); padding: 0 6px; color: #555; }
.more-end { width: min(92vw, 560px); }
.more-end .mg { margin: 14px 0 0; }
.more-end .mg-row { grid-template-columns: 1fr 1fr; gap: 8px; }
.more-end .mg-card { background: rgba(255, 255, 255, .92); min-height: 64px; padding: 8px 10px; gap: 10px; }
.more-end .mg-icon { width: 40px; height: 40px; }
.more-end .mg-hook { display: none; }
.more-end .mg-play { padding: 6px 10px; }
.more-end a { pointer-events: auto; }
@media (max-width: 640px) { .more-end .mg-row { grid-template-columns: 1fr; } }
@media (max-height: 460px) { .more-end { display: none; } .more-start { display: none; } }
