:root {
  /* 深夜観測: a night observatory. ink-blue glass, ice text, celadon light, grey-blue scales */
  --ink: #dbf7f3;
  --ink2: #a6c3c8;
  --dim: #6f8f9b;
  --tick: #91aebb;
  --panel: rgba(7, 25, 36, 0.93);
  --panel2: rgba(17, 53, 66, 0.94);
  --btn: rgba(17, 53, 66, 0.86);
  --edge: rgba(105, 242, 202, 0.28);
  --sel: #69f2ca;
  --hot: #69f2ca;
  --hot2: #3fc8b0;
  --good: #b6f07a;
  --bad: #ff6a6a;
  --light: #9fe08a;
  --medium: #e8c27a;
  --heavy: #c9a0ff;
  --special: #ff7a5a;
  --water: #7ac8ff;
  --font: "DotGothic16", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #071924; overflow: hidden; color: var(--ink); font-family: var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#gl, #over { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#gl { height: 100dvh; }
#over { pointer-events: none; height: 100dvh; }
.hidden { display: none !important; }
.small { font-size: 13px; color: var(--ink2); }
kbd { font-family: var(--font); font-size: 0.72em; padding: 1px 6px; margin-left: 8px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); color: var(--ink2); white-space: nowrap; }
canvas[width="13"] { image-rendering: pixelated; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; --pad: max(10px, env(safe-area-inset-top)); }
.panel { background: var(--panel); border: 2px solid var(--edge); border-radius: 6px; padding: 7px 11px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.bar { height: 9px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); position: relative; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--hot2), var(--hot)); }
.bar.thin { height: 5px; }
.bar.wide { width: min(360px, 70vw); height: 12px; margin-top: 6px; }

#hudTL { position: absolute; top: 10px; left: max(10px, env(safe-area-inset-left)); width: min(270px, 38vw); }
.lvrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#clsName { font-size: 21px; letter-spacing: 0.04em; white-space: nowrap; }
#hudTL.grow #stormSize { display: none; }
#stormSize { font-size: 15px; color: var(--hot); white-space: nowrap; }
.bar.exp { margin: 5px 0 2px; }
#evoRow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#evoRow:empty { display: none; }
#evoRow .evo { font-size: 12px; padding: 1px 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }

#colC { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(340px, 34vw); }
#hudTC { text-align: center; text-shadow: 2px 2px 0 #0d1220, 0 0 8px rgba(0, 0, 0, 0.6); }
#timer { font-size: 32px; line-height: 1.05; }
#timer.low { color: var(--bad); }
#timer.bonus { color: var(--good); }
.scoreRow { display: flex; gap: 12px; justify-content: center; align-items: baseline; white-space: nowrap; }
#score { font-size: 22px; color: var(--hot); }
#rate { font-size: 14px; color: var(--ink2); }
#boss { width: 100%; padding: 5px 9px; }
.bossTop { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.bossTop canvas { width: 18px; height: 18px; }
.bar.boss { margin-top: 4px; }
.bar.boss > i { background: linear-gradient(90deg, #ff4a4a, #ff9a6a); }
.bar.boss .cap { position: absolute; top: -1px; bottom: -1px; width: 2px; background: #fff; opacity: 0.75; }
#bossShield { margin-top: 2px; color: #8fe8ff; }
/* the upgrade a campaign boss leaves: one of three */
#pick { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 10, 20, 0.45); z-index: 6; pointer-events: auto; }
.pickBox { background: var(--panel2); border: 2px solid var(--edge); border-radius: 10px; padding: 14px 16px; width: min(760px, 94vw); max-height: 92vh; overflow: auto; animation: tin 0.25s ease-out; }
.pickHead { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; text-align: center; }
.pickHead b { font-weight: normal; font-size: 20px; color: var(--hot); }
.pickCards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 80vw), 1fr)); gap: 10px; }
.pickCard { font-family: var(--font); color: var(--ink); text-align: left; background: var(--panel); border: 2px solid transparent; border-radius: 8px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; min-width: 0; transition: transform 0.08s, border-color 0.1s; }
.pickCard:hover, .pickCard.on { border-color: var(--hot); transform: translateY(-2px); }
.pickCard:focus { outline: none; }
.pickCard kbd { align-self: flex-start; font-size: 11px; color: var(--dim); }
.pickCard b { font-weight: normal; font-size: 18px; color: var(--hot); }
.pickCard .lv { color: var(--hot); letter-spacing: 2px; font-size: 13px; }
.pickCard .lv i { font-style: normal; color: var(--good); }
.pickCard .ds { font-size: 13px; color: var(--ink2); line-height: 1.5; }
.pickCard .nt { font-size: 12px; color: #c9b8ff; line-height: 1.5; }
.pickCard.evo { background: rgba(70, 52, 120, 0.85); }
.pickCard.evo .nt { color: #e6dcff; }
body.touch .pickCard kbd { display: none; }
#perf { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-size: 11px; line-height: 1.4; white-space: pre; color: #c8f0ff; background: rgba(8, 12, 24, 0.75); padding: 2px 8px; border-radius: 4px; pointer-events: none; z-index: 5; }
#boss.guarded .bar.boss > i { background: #8a96a8; }
#bossShield:empty { display: none; }

#colR { position: absolute; top: 10px; right: max(10px, env(safe-area-inset-right)); width: min(260px, 30vw); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#pauseBtn { pointer-events: auto; min-width: 0; width: 38px; height: 34px; padding: 0; font-size: 14px; justify-content: center; }
#missions { width: 100%; font-size: 13px; padding: 6px 9px; }
#missions:empty { display: none; }
#missions .m { display: flex; gap: 6px; align-items: baseline; line-height: 1.45; }
#missions .m .box { flex: none; color: var(--dim); }
#missions .m.done { color: var(--good); }
#missions .m.done .box { color: var(--good); }
#missions .m .tx { flex: 1; min-width: 0; }
#missions .m .pr { flex: none; color: var(--ink2); font-size: 12px; }
#missions .m.cur .tx { color: var(--hot); }
#combo { width: 100%; display: flex; flex-direction: column; align-items: flex-end; text-align: right; text-shadow: 2px 2px 0 #0d1220, 0 0 10px rgba(0, 0, 0, 0.5); }
#comboN { font-size: 21px; transform-origin: right center; color: var(--hot); letter-spacing: 0.02em; white-space: nowrap; }
#comboMul { font-size: 14px; color: #ffe8b0; white-space: nowrap; }
#combo .bar { margin-top: 3px; width: 70%; flex: none; }
#combo .bar > i { background: var(--hot); }
#combo.pop #comboN { animation: cpop 0.22s ease-out; }
#combo.hot #comboN { color: #ff9a5a; }
#combo.max #comboN { color: #ff5a5a; }
@keyframes cpop { from { transform: scale(1.35); color: #fff; } to { transform: none; } }

#hudBL { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); width: min(270px, 36vw); padding: 7px 10px; }
.gauge { display: grid; grid-template-columns: 4.6em 1fr 3em; align-items: center; gap: 6px; font-size: 12px; margin: 2px 0; }
.gauge .gl { color: var(--ink2); white-space: nowrap; }
.gauge .gv { text-align: right; white-space: nowrap; }
#magText { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar.en > i { background: linear-gradient(90deg, #4aa8ff, #9fe8ff); }
.bar.en.out > i { background: #6a7180; }
.bar.en.out { animation: blink 0.8s steps(2) infinite; }
.bar.load { height: 11px; display: flex; }
.bar.load > i { position: static; height: 100%; flex: none; }
#ldL { background: var(--light); }
#ldM { background: var(--medium); }
#ldH { background: var(--heavy); }
#ldS { background: var(--special); }
#ldW { background: var(--water); }
.bar.load .cap { display: none; }
/* past full: it only hits harder, so it shows as a glow, not a warning */
.bar.load.over { border-color: var(--hot); box-shadow: 0 0 6px rgba(255, 210, 90, 0.6); }
#loadText.over { color: var(--hot); }
@keyframes blink { 50% { border-color: rgba(255, 255, 255, 0.5); } }
#stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: min(420px, 86vw); font-size: 13px; color: var(--ink2); text-align: left; }
#stats3 .mini { height: 6px; background: rgba(255, 255, 255, 0.1); margin-top: 3px; position: relative; }
#stats3 .mini i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--good); width: 0; }
#stats3 .mini i.low { background: var(--bad); }

#controls { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: flex-end; pointer-events: auto; }
#shapes, #acts { display: flex; gap: 5px; }
.ctl { position: relative; font-family: var(--font); color: var(--ink); background: var(--panel); border: 2px solid transparent; border-radius: 6px; padding: 5px 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 62px; cursor: pointer; transition: transform 0.08s, background 0.1s; touch-action: none; }
.ctl canvas { width: 24px; height: 24px; }
.ctl span { font-size: 12px; white-space: nowrap; }
.ctl kbd { margin: 0; font-size: 10px; }
.ctl:hover { transform: translateY(-2px); }
.ctl:active, .ctl.held { transform: translateY(1px); background: rgba(255, 210, 90, 0.25); }
.ctl.on { background: rgba(255, 210, 90, 0.2); border-color: var(--hot); }
.ctl.off { opacity: 0.45; }
.ctl:focus { outline: none; }
.ctl:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ctl .cd { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--hot); width: 0; }
#hudMaps { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); width: 150px; }
#minimap, #townMap { width: 100%; border: 2px solid var(--edge); border-radius: 6px; background: #0d1220; }
#minimap, #townMap canvas { display: block; aspect-ratio: 1; width: 100%; image-rendering: pixelated; }
#townMap { position: absolute; bottom: calc(100% + 6px); overflow: hidden; }

#toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; width: min(560px, 56vw); }
#toast .t { background: rgba(14, 20, 34, 0.9); border: 2px solid var(--hot); border-radius: 6px; padding: 5px 14px; font-size: 15px; text-align: center; animation: tin 0.25s ease-out; }
#toast .t.good { border-color: var(--good); }
#toast .t.info { border-color: #8fe8ff; }
#toast .t.out { opacity: 0; transition: opacity 0.4s; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
#banner { position: absolute; left: 0; right: 0; top: 30%; padding: 0 24px; text-align: center; pointer-events: none; opacity: 0; }
#banner.show { animation: ban 2.6s ease-out forwards; }
#banner .b1 { font-size: clamp(24px, 4.4vw, 52px); text-wrap: balance; color: var(--hot); text-shadow: 0 4px 0 #6a3a10, 0 0 24px rgba(255, 170, 60, 0.6); letter-spacing: 0.06em; }
#banner .b2 { font-size: clamp(14px, 2.4vw, 22px); margin-top: 8px; text-shadow: 0 2px 0 #000; text-wrap: balance; }
#banner.evo .b1 { color: #e8d8ff; text-shadow: 0 4px 0 #3a2a6a, 0 0 28px rgba(190, 150, 255, 0.8); }
#banner.clear .b1 { color: #fff; text-shadow: 0 4px 0 #2f6fd1, 0 0 28px rgba(120, 190, 255, 0.8); }
#banner.boss .b1 { color: #ff9a6a; text-shadow: 0 4px 0 #6a1a10, 0 0 28px rgba(255, 90, 60, 0.7); }
@keyframes ban { 0% { opacity: 0; transform: scale(1.22); } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
/* a boss drops in: a slanted band sweeps across with its portrait and name */
#cutin { position: absolute; left: 0; right: 0; top: 18%; pointer-events: none; opacity: 0; overflow: hidden; }
#cutin.show { animation: cutin 3.2s ease-out forwards; }
#cutin .ciBand { margin: 0 auto; width: min(980px, 96vw); display: flex; align-items: center; gap: 18px; padding: 10px 28px; background: linear-gradient(90deg, rgba(120, 10, 10, 0), rgba(120, 10, 10, 0.92) 12%, rgba(40, 6, 6, 0.95) 70%, rgba(40, 6, 6, 0)); border-top: 3px solid #ff5a3a; border-bottom: 3px solid #ff5a3a; transform: skewX(-12deg); }
#cutin canvas { width: clamp(90px, 14vw, 180px); height: clamp(90px, 14vw, 180px); image-rendering: pixelated; transform: skewX(12deg); flex: none; }
#cutin .ciText { transform: skewX(12deg); min-width: 0; }
#cutin .ci0 { font-size: clamp(13px, 1.8vw, 18px); color: #ffd25a; letter-spacing: 0.4em; animation: ciBlink 0.4s steps(2) 6; }
@keyframes ciBlink { 50% { opacity: 0.25; } }
#cutin .ci1 { font-size: clamp(28px, 5vw, 56px); color: #fff; text-shadow: 0 4px 0 #6a1a10, 0 0 24px rgba(255, 90, 60, 0.8); letter-spacing: 0.06em; text-wrap: balance; }
#cutin .ci2 { font-size: clamp(13px, 1.8vw, 18px); color: #ffd8c8; margin-top: 4px; }
@keyframes cutin { 0% { opacity: 0; transform: translateX(60%); } 12% { opacity: 1; transform: translateX(0); } 80% { opacity: 1; transform: translateX(-2%); } 100% { opacity: 0; transform: translateX(-60%); } }
@keyframes cutinStill { 0%, 100% { opacity: 0; } 10%, 85% { opacity: 1; } }
@keyframes pulse { 50% { transform: translateX(-50%) translateY(-3px); } }
#stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.05); display: none; pointer-events: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); }
#stick.on { display: block; }

/* ------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 12px; padding: 20px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); text-align: center; overflow-y: auto; }
#title { background: linear-gradient(180deg, rgba(8, 12, 24, 0.55), rgba(8, 12, 24, 0.12) 45%, rgba(8, 12, 24, 0.72)); }
#bossattack, #ranking, #dex, #how, #settings { background: rgba(8, 12, 24, 0.84); z-index: 2; }
#loading, #nogl { background: #0d1220; z-index: 6; }
#pause, #result { background: rgba(8, 12, 24, 0.74); z-index: 3; }
.logo h1 { margin: 0; font-size: clamp(44px, 10vw, 104px); letter-spacing: 0.08em; color: var(--ink); text-shadow: 4px 4px 0 #2f6fd1, 8px 8px 0 #0d1220; font-weight: normal; }
.logo .sub { margin: 4px 0 0; font-size: clamp(16px, 3vw, 26px); color: var(--hot); letter-spacing: 0.3em; text-shadow: 2px 2px 0 #0d1220; }
h2 { margin: 0; font-weight: normal; font-size: clamp(24px, 4vw, 36px); color: var(--hot); text-shadow: 3px 3px 0 #0d1220; }
h2 .small { font-size: 14px; margin-left: 10px; }
.menu { display: flex; flex-direction: column; gap: 9px; align-items: stretch; min-width: min(360px, 86vw); }
.menu.row { flex-direction: row; flex-wrap: wrap; justify-content: center; min-width: 0; }
.btn { font-family: var(--font); font-size: 18px; color: var(--ink); background: var(--panel); border: 2px solid transparent; border-radius: 6px; padding: 9px 18px; cursor: pointer; transition: transform 0.08s, background 0.12s; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); }
.btn.big { font-size: 21px; padding: 11px 22px; background: linear-gradient(180deg, #ffb34a, #ff8a3c); color: #2a1406; }
.btn:hover { transform: translateY(-3px); background: var(--panel2); }
.btn.big:hover { background: linear-gradient(180deg, #ffc060, #ff9a4c); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.btn:focus { outline: none; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn.big kbd { background: rgba(0, 0, 0, 0.15); color: #3a1e08; }
.volume { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink2); background: rgba(14, 20, 34, 0.6); padding: 6px 12px; border-radius: 6px; }
.volume input { width: 160px; accent-color: var(--hot); }
.volume output { width: 3em; text-align: right; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 86vw), 1fr)); gap: 10px; width: min(1000px, 100%); }
.tile { font-family: var(--font); color: var(--ink); text-align: left; background: var(--panel); border: 2px solid transparent; border-radius: 8px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); transition: transform 0.08s, background 0.12s; min-width: 0; }
.tile:hover { transform: translateY(-3px); background: var(--panel2); }
.tile:focus { outline: none; }
.tile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.tile .tn { font-size: 18px; color: var(--hot); display: flex; align-items: center; gap: 6px; }
.tile .tn small { font-size: 12px; color: var(--ink2); margin-left: auto; }
.tile .tn canvas { width: 16px; height: 16px; flex: none; image-rendering: pixelated; }
.tile .ts { font-size: 13px; color: var(--ink2); line-height: 1.5; }
.tile .tr { font-size: 12px; color: var(--good); margin-top: auto; line-height: 1.5; }
.tile .tr:empty, .tile .ts:empty { display: none; }
.tile .tr .dim { color: var(--dim); }
.tile.locked { opacity: 0.5; cursor: default; }
.tile.locked:hover { transform: none; background: var(--panel); }
.tile.locked .tn { color: var(--dim); }
.tile .stars { color: var(--hot); letter-spacing: 2px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--panel); border: 2px solid transparent; border-radius: 5px; padding: 5px 10px; cursor: pointer; transition: transform 0.08s; }
.chip:hover { transform: translateY(-2px); }
.chip.on { border-color: var(--hot); background: rgba(255, 210, 90, 0.18); }
.chip:disabled { opacity: 0.4; cursor: default; transform: none; }
.chip:focus { outline: none; }
.chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.chip .sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
/* boss attack: a portrait beside each boss */
.baGrid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 90vw), 1fr)); }
.tile.ba { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 2px 10px; }
.tile.ba .pt { grid-row: 1 / 4; width: 72px; height: 72px; image-rendering: pixelated; align-self: center; }
.tile.ba .tn, .tile.ba .ts, .tile.ba .tr { grid-column: 2; }

/* the online ranking */
#ranking { gap: 10px; }
.rkCard { background: var(--panel); border-radius: 8px; padding: 10px 12px; width: min(640px, 94vw); min-width: 0; }
.rkBody { max-height: min(46vh, 440px); overflow: auto; }
.rkMsg { padding: 26px 8px; text-align: center; color: var(--ink2); line-height: 1.6; }
.rkTable { width: 100%; border-collapse: collapse; font-size: 15px; }
.rkTable th { font-weight: normal; font-size: 12px; color: var(--dim); text-align: left; padding: 2px 6px; border-bottom: 1px solid var(--edge); }
.rkTable td { padding: 5px 6px; border-bottom: 1px solid rgba(43, 58, 88, 0.6); white-space: nowrap; }
.rkTable td.nm { max-width: 13em; overflow: hidden; text-overflow: ellipsis; }
.rkTable td.nm b { font-weight: normal; font-size: 11px; color: #10203a; background: var(--good); border-radius: 3px; padding: 0 4px; margin-left: 6px; }
.rkTable td.v { color: var(--hot); text-align: right; }
.rkTable tr.m1 td:first-child { color: #ffd25a; }
.rkTable tr.m2 td:first-child { color: #d8e0ec; }
.rkTable tr.m3 td:first-child { color: #e0a070; }
.rkTable tr.own td { background: rgba(127, 224, 138, 0.12); }
#rkNote { margin: 8px 0 0; line-height: 1.5; }
#rkNote:empty { display: none; }
.rkName { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 94vw; }
.rkName > span:first-child { color: var(--ink2); font-size: 14px; }
#rkNick { font-family: var(--font); font-size: 15px; color: var(--ink); background: var(--panel2); border: 2px solid var(--edge); border-radius: 5px; padding: 4px 8px; width: 13em; max-width: 60vw; -webkit-user-select: text; user-select: text; }
#rkNick:focus { outline: none; border-color: var(--hot); }
#rkStatus { min-height: 1.2em; }
#resRanking { margin-top: 6px; text-align: center; min-height: 1.2em; }
#resRanking:empty { display: none; }

/* boss attack: the storm's health instead of its growth */
#hudTL.hp .bar.exp > i { background: linear-gradient(90deg, #3fbf6a, var(--good)); }
#hudTL.hp.danger .bar.exp > i { background: linear-gradient(90deg, #c8301a, var(--bad)); animation: hpPulse 0.6s ease-in-out infinite alternate; }
#hudTL.hp.danger #clsName { color: var(--bad); }
#hudTL.hp.grown .bar.exp > i { background: linear-gradient(90deg, var(--good), var(--hot)); }
#hudTL.hp.grown #clsName { color: var(--hot); }
@keyframes hpPulse { from { opacity: 0.6; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #hudTL.hp.danger .bar.exp > i { animation: none; } }

.dexGrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.dexGrid .tile { align-items: center; text-align: center; padding: 8px 6px; cursor: default; }
.dexGrid .tile:hover { transform: none; }
.dexGrid canvas { width: 72px; height: 72px; image-rendering: pixelated; }
.dexGrid .tn { font-size: 13px; justify-content: center; }
.dexGrid .ts { font-size: 11px; }
.dexGrid .unknown .tn { color: var(--dim); }
.dexGrid .cat { grid-column: 1 / -1; text-align: left; color: var(--ink2); font-size: 14px; border-bottom: 1px solid var(--edge); padding: 4px 2px; margin-top: 6px; }
.dexGrid .rw { text-align: left; align-items: stretch; }
.dexGrid .boss { grid-column: auto; }
.dexGrid .boss .ts { line-height: 1.5; }
.dexGrid .hint { color: var(--dim); }

.howgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 320px)); gap: 10px; }
.howcard { background: var(--panel); border-radius: 6px; padding: 10px; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; gap: 2px 10px; text-align: left; align-items: center; }
.howcard canvas { width: 39px; height: 39px; grid-row: span 2; }
.howcard b { font-weight: normal; color: var(--hot); }
.howcard span { font-size: 13px; color: var(--ink2); line-height: 1.5; }
#how > p.small { max-width: 660px; line-height: 1.6; }
/* wide screens: three columns, so the practice button is in view without scrolling */
@media (min-width: 1000px) and (min-height: 561px) { .howgrid { grid-template-columns: repeat(3, minmax(0, 300px)); } }

#pauseInfo { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 520px; line-height: 1.6; }
#pauseInfo:empty { display: none; }
#pauseInfo .pi { display: flex; flex-direction: column; align-items: center; }
#pauseInfo .pi b { font-weight: normal; font-size: 18px; }
#pauseInfo .pi span { font-size: 14px; color: var(--ink2); }
.vols { display: flex; flex-direction: column; gap: 12px; }

#resStage { margin-top: -6px; }
.resTop { display: flex; align-items: center; gap: 28px; }
.resScore { display: flex; flex-direction: column; }
#resScore { font-weight: normal; font-size: clamp(30px, 5vw, 50px); color: var(--hot); }
#resRank { font-size: clamp(60px, 10vw, 110px); line-height: 1; width: 1.2em; color: var(--ink); text-shadow: 4px 4px 0 #2f6fd1; opacity: 0; transform: scale(2.2); transition: opacity 0.15s, transform 0.2s cubic-bezier(.2,1.6,.4,1); }
#resRank.show { opacity: 1; transform: scale(1); }
#resRank.none { font-size: 32px; width: auto; }
#resLine { font-size: 17px; min-height: 1.4em; }
#resDetail { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; align-items: flex-start; max-width: 980px; }
#resGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 230px)); gap: 4px 10px; font-size: 14px; }
#resGrid div { background: rgba(14, 20, 34, 0.75); padding: 4px 9px; border-radius: 4px; display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
#resGrid div b { font-weight: normal; color: var(--hot); }
#resGrid div.nb b::after { content: ' NEW'; color: var(--good); font-size: 11px; }
#resMissions, #resUnlocks { display: flex; flex-direction: column; gap: 3px; font-size: 14px; text-align: left; min-width: min(260px, 90vw); }
#resMissions:empty, #resUnlocks:empty { display: none; }
#resMissions .m { background: rgba(14, 20, 34, 0.75); padding: 4px 9px; border-radius: 4px; }
#resMissions .m.done { color: var(--good); }
#resMissions .m:not(.done) { color: var(--dim); }
#resUnlocks div { color: var(--hot); background: rgba(60, 40, 10, 0.75); padding: 4px 9px; border-radius: 4px; }
#resUnlocks div.rec { color: var(--good); background: rgba(14, 40, 20, 0.75); }

/* ------------------------------------------------------------ touch */
body.touch kbd { display: none; }
body.touch #controls { left: auto; right: max(12px, env(safe-area-inset-right)); transform: none; flex-direction: column; align-items: flex-end; gap: 8px; }
body.touch #acts { gap: 8px; }
body.touch #acts .ctl { width: 66px; height: 66px; border-radius: 50%; justify-content: center; }
body.touch #acts .ctl canvas { width: 26px; height: 26px; }
body.touch #shapes .ctl { min-width: 50px; padding: 4px 6px; }
body.touch #hudMaps { right: auto; left: calc(min(270px, 36vw) + 22px); width: 100px; }
body.touch #toast { bottom: auto; top: 110px; }

/* ------------------------------------------------------------ small and low screens */
/* mid widths: the bottom-left panel and the buttons would run into each other, so the buttons get the space
   between that panel and the maps, and wrap onto two rows if they must */
@media (min-width: 761px) and (max-width: 1180px) {
  #hudBL { width: 236px; }
  body:not(.touch) #controls { left: calc(max(10px, env(safe-area-inset-left)) + 246px); right: calc(max(10px, env(safe-area-inset-right)) + 160px); transform: none; justify-content: center; flex-wrap: wrap-reverse; row-gap: 6px; }
  body:not(.touch) .ctl { min-width: 54px; padding: 4px 6px 3px; }
}
/* the buttons are on two rows here: messages go above them */
@media (min-width: 761px) and (max-width: 840px) and (min-height: 561px) {
  body:not(.touch) #toast { bottom: 170px; }
}
@media (max-width: 900px) {
  #colC { width: min(300px, 40vw); }
  #missions .m .tx { font-size: 12px; }
  #clsName { font-size: 18px; }
}
@media (max-width: 760px) {
  #hudTL { width: min(220px, 46vw); padding: 5px 8px; }
  #clsName { font-size: 16px; }
  #stormSize { font-size: 13px; }
  #colC { top: auto; bottom: 150px; width: min(280px, 70vw); }
  body.touch #colC { bottom: auto; top: 64px; }
  #timer { font-size: 24px; }
  #score { font-size: 17px; }
  #colR { width: min(200px, 46vw); }
  #missions { font-size: 11px; }
  #missions .m .tx { font-size: 11px; }
  #comboN { font-size: 17px; }
  #comboMul { font-size: 12px; }
  #hudBL { width: min(210px, 52vw); }
  #hudMaps { width: 92px; }
  .ctl { min-width: 48px; padding: 3px 5px; }
  .ctl canvas { width: 18px; height: 18px; }
  .ctl span { font-size: 11px; }
  .ctl kbd { display: none; }
  #controls { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 96px); }
  body.touch #controls { bottom: max(12px, env(safe-area-inset-bottom)); }
  #toast { width: 90vw; bottom: 210px; }
  #resGrid { grid-template-columns: repeat(2, minmax(0, 170px)); font-size: 12px; }
  .howgrid { grid-template-columns: minmax(0, 340px); }
  .opt > span { width: auto; text-align: center; flex-basis: 100%; }
}
@media (max-height: 560px) {
  #hudTL { padding: 4px 8px; }
  #clsName { font-size: 16px; }
  #colC { top: 4px; bottom: auto; gap: 3px; }
  #timer { font-size: 22px; }
  #score { font-size: 16px; }
  #missions { font-size: 11px; padding: 4px 7px; }
  #comboN { font-size: 16px; }
  #hudBL { padding: 4px 8px; }
  #hudMaps { width: 86px; }
  #controls { bottom: max(8px, env(safe-area-inset-bottom)); }
  #toast { bottom: 70px; }
  body.touch #toast { top: 70px; }
  .screen { justify-content: flex-start; gap: 7px; padding-top: 10px; }
  .logo h1 { font-size: 40px; }
  .btn { padding: 6px 14px; font-size: 15px; }
  .btn.big { font-size: 17px; padding: 7px 16px; }
  .menu { gap: 6px; }
  #resGrid { grid-template-columns: repeat(3, minmax(0, 170px)); font-size: 12px; }
  #resRank { font-size: 56px; }
  #resScore { font-size: 28px; }
  .howgrid { grid-template-columns: repeat(2, minmax(0, 300px)); gap: 6px; }
  .howcard { padding: 6px; }
  /* the pause screen on a low screen: where the run stands beside the storm's qualities, the two volumes side by side */
  #pauseInfo { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 20px; max-width: 94vw; }
  #pauseInfo .pi b { font-size: 15px; }
  #pauseInfo .pi span { font-size: 12px; }
  #stats3 { width: 300px; gap: 10px; font-size: 12px; }
  .vols { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .vols .volume input { width: 110px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #hudTL { width: min(230px, 28vw); }
  #colC { width: min(250px, 30vw); }
  #colR { width: min(250px, 30vw); }
  #toast { top: 112px; bottom: auto; width: min(420px, 40vw); flex-direction: column; }
  body.touch #toast { top: 112px; }
  #toast .t { font-size: 13px; padding: 4px 10px; }
}
/* not tall enough for the title's menu in one column: the campaign across the top, the rest in two columns */
@media (max-height: 700px) and (orientation: landscape), (max-height: 560px) {
  #title .menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(480px, 92vw); min-width: 0; }
  #title .menu .btn.big { grid-column: 1 / -1; }
}
/* a phone on its side: the pause screen's four buttons two by two, so the volumes under them stay on the screen
   (go on beside start over, the two ways out side by side) */
@media (max-height: 420px) {
  #pause .menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(520px, 94vw); min-width: 0; }
}
/* narrow portrait: two columns at the top (level + time on the left, missions on the right) */
@media (max-width: 560px) and (orientation: portrait) {
  #hudTL { width: calc(50vw - 24px); }
  #colC { top: 74px; bottom: auto; left: 10px; transform: none; width: calc(50vw - 24px); align-items: flex-start; }
  body.touch #colC { top: 74px; }
  #hudTC { text-align: left; }
  .scoreRow { justify-content: flex-start; }
  #colR { top: 10px; width: calc(50vw - 8px); }
  #toast { top: 40%; bottom: auto; width: 88vw; }
  body.touch #toast { top: 40%; }
  #toast .t { font-size: 13px; }
  body.touch #hudMaps { left: auto; right: max(10px, env(safe-area-inset-right)); bottom: auto; top: 56%; }
  body.touch #acts .ctl { width: 58px; height: 58px; }
  #hudBL { width: max(118px, calc(100vw - 232px)); }
}
@media (prefers-reduced-motion: reduce) {
  #banner.show { animation-duration: 3s; }
  #cutin.show { animation-name: cutinStill; }
  .btn:hover, .ctl:hover, .tile:hover, .chip:hover { transform: none; }
}

/* ------------------------------------------------------------ れんしゅう (the tutorial) */
/* the practice shows only what it is about: no clock, score, boss, missions or combo */
#hud.tut #colC, #hud.tut #missions, #hud.tut #combo { display: none !important; }
/* one card at the top: which step, what to do, what to press, how far along, and a line of help */
#tut { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 2 * (min(270px, 38vw) + 24px))); display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px; pointer-events: none; animation: tutIn 0.3s ease-out; }
/* (opacity only: the card is centred with a transform) */
@keyframes tutIn { from { opacity: 0; } }
.tutTop { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--dim); }
#tutSkip { pointer-events: auto; font-family: var(--font); font-size: 12px; color: var(--ink2); background: none; border: 0; padding: 2px 4px; margin: -2px -4px; cursor: pointer; }
#tutSkip:hover, #tutSkip:focus-visible { color: var(--ink); text-decoration: underline; }
#tutText { font-size: 16px; line-height: 1.55; text-wrap: pretty; }
#tutKeys { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#tutKeys:empty { display: none; }
#tutKeys kbd { margin: 0; font-size: 14px; padding: 2px 8px; color: var(--ink); background: rgba(255, 255, 255, 0.16); }
#tutKeys canvas { width: 26px; height: 26px; image-rendering: pixelated; }
/* idle: the keys to press blink */
#tut.go #tutKeys kbd { animation: tutPress 0.9s steps(2) infinite; }
#tut.go #tutKeys canvas { animation: tutNudge 0.9s steps(2) infinite; }
@keyframes tutPress { 50% { transform: translateY(2px); background: var(--hot); color: #2a1406; } }
@keyframes tutNudge { 50% { transform: translateY(2px); } }
#tut .bar > i { background: var(--good); transition: width 0.15s; }
#tutHint { font-size: 13px; line-height: 1.5; }
#tutHint:empty { display: none; }
#tutHint.hint { color: var(--ink2); }
#tutHint.say { color: var(--hot2); }
#tut.ok { border-color: var(--good); }
#tut.ok #tutText { color: var(--good); }
/* what the step is about */
.tutHi { outline: 2px solid var(--hot); outline-offset: 2px; animation: tutHi 1s ease-in-out infinite; }
@keyframes tutHi { 50% { outline-color: rgba(255, 210, 90, 0.25); } }
/* the finger that shows what to do on a touch screen: the tip of it is the point (column 6 of 13, the top row) */
#tutHand { position: absolute; width: 39px; height: 39px; margin: 0 0 0 -18px; image-rendering: pixelated; pointer-events: none; z-index: 7; }
#tutHand.tap { animation: tutTap 0.9s ease-in-out infinite; }
#tutHand.drag { animation: tutDrag 1.6s ease-in-out infinite; }
@keyframes tutTap { 0%, 100% { transform: translateY(12px); } 50% { transform: translateY(0) scale(0.9); } }
@keyframes tutDrag { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(60px, -40px); opacity: 1; } 100% { transform: translate(60px, -40px); opacity: 0; } }
/* the end of the practice: on to the campaign, how to play, or the title */
#tutDone { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 10, 20, 0.45); z-index: 6; pointer-events: auto; }
.tutBox { width: min(580px, 94vw); text-align: center; }
.tutBox p { margin: 0 0 14px; font-size: 15px; line-height: 1.6; color: var(--ink2); text-wrap: pretty; }
/* in the practice a message on a touch screen goes under the storm, not over the card */
body.touch #hud.tut #toast { top: auto; bottom: 22%; }
/* mid widths: centred, the card would run into the top-left panel, so it sits beside it, up to the pause button */
@media (max-width: 967px) {
  #tut { left: calc(max(10px, env(safe-area-inset-left)) + min(270px, 38vw) + 12px); right: 64px; width: auto; max-width: 480px; margin: 0 auto; transform: none; }
}
/* narrow: under the top-left panel, across the screen */
@media (max-width: 760px) {
  #tut { top: 70px; left: 50%; right: auto; width: min(460px, 94vw); margin: 0; transform: translateX(-50%); }
  #tutText { font-size: 15px; }
}
/* low screens: beside the top-left panel, up to the pause button */
@media (max-height: 560px) and (orientation: landscape) {
  #tut { top: 6px; left: calc(max(10px, env(safe-area-inset-left)) + min(230px, 28vw) + 10px); right: 64px; width: auto; max-width: 520px; margin: 0 auto; transform: none; padding: 5px 10px 7px; gap: 4px; }
  #tutText { font-size: 14px; line-height: 1.45; }
  #tutKeys kbd { font-size: 12px; }
  #tutKeys canvas { width: 20px; height: 20px; }
  .tutBox p { margin-bottom: 8px; font-size: 14px; }
  /* a message goes just under the card (the bottom has the map and the buttons) */
  #hud.tut #toast, body.touch #hud.tut #toast { top: 124px; bottom: auto; }
}
@media (max-width: 560px) and (orientation: portrait) {
  #tut { top: 80px; width: 92vw; }
}
@media (prefers-reduced-motion: reduce) {
  #tut, #tut.go #tutKeys canvas, #tutHand.tap, #tutHand.drag { animation: none; }
  #tut.go #tutKeys kbd { animation: none; background: var(--hot); color: #2a1406; }
  .tutHi { animation: none; }
}

/* ============================================================ 深夜観測 (the look: a night observatory)
   Glass panels with one corner cut off and a scale engraved along the bottom; buttons are thin bands; what is
   selected gets celadon corner brackets (the glow only outside them). Sizes and layout are left to the rules above. */
.panel, .pickBox, .rkCard, .howcard, .volume, #toast .t, #resGrid div, #resMissions .m, #resUnlocks div, #hudTC, #stats3, .rkName {
  background:
    repeating-linear-gradient(90deg, rgba(145, 174, 187, 0.45) 0 1px, transparent 1px 8px) left bottom / 100% 3px no-repeat,
    linear-gradient(180deg, rgba(105, 242, 202, 0.06), rgba(105, 242, 202, 0) 40%),
    var(--panel);
  border: 1px solid var(--edge);
  border-radius: 0;
  box-shadow: none;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.pickBox { background-color: rgba(7, 25, 36, 0.94); clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); padding-top: 18px; }
#hudTC { padding: 1px 14px 4px; text-shadow: none; }
#stats3 { padding: 8px 12px 10px; }
.rkName { padding: 6px 12px; }
#toast .t { border-left: 3px solid var(--hot); }
#toast .t.good { border-left-color: var(--good); }
#toast .t.info { border-left-color: #8fe8ff; }
#resUnlocks div { color: var(--hot); }
#resUnlocks div.rec { color: var(--good); }

/* headings: wide-spaced, ice, a scale under them */
h2 { color: var(--ink); letter-spacing: 0.22em; text-shadow: 0 0 14px rgba(105, 242, 202, 0.35), 2px 2px 0 #071924; padding: 0 0.2em 6px; background: repeating-linear-gradient(90deg, rgba(145, 174, 187, 0.6) 0 1px, transparent 1px 7px) left bottom / 100% 3px no-repeat; }
h2 .small { letter-spacing: 0.04em; color: var(--ink2); }
.pickHead b { color: var(--ink); letter-spacing: 0.2em; }
.pickHead b::before { content: '[ '; color: var(--sel); }
.pickHead b::after { content: ' ]'; color: var(--sel); }

kbd { background: rgba(145, 174, 187, 0.12); color: var(--tick); border: 1px solid rgba(145, 174, 187, 0.35); border-radius: 2px; }

/* bands */
.btn { background: var(--btn); border: 0; border-radius: 0; box-shadow: none; letter-spacing: 0.08em; }
.btn:hover { background: var(--panel2); }
.btn.big { background: linear-gradient(90deg, rgba(105, 242, 202, 0.24), rgba(17, 53, 66, 0.92) 70%); color: var(--ink); }
.btn.big:hover { background: linear-gradient(90deg, rgba(105, 242, 202, 0.32), rgba(17, 53, 66, 0.96) 70%); }
.btn.big kbd { background: rgba(145, 174, 187, 0.12); color: var(--tick); }
.btn:active { box-shadow: none; }
/* a menu in one column: the name on the left, its key on the right */
.menu:not(.row) > .btn { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.tile, .chip, .ctl, .pickCard { background: var(--btn); border: 1px solid transparent; border-radius: 0; box-shadow: none; }
.tile { background: repeating-linear-gradient(90deg, rgba(145, 174, 187, 0.35) 0 1px, transparent 1px 8px) left bottom / 100% 3px no-repeat, var(--panel); border-color: rgba(105, 242, 202, 0.16); }
.tile:hover { background: repeating-linear-gradient(90deg, rgba(145, 174, 187, 0.35) 0 1px, transparent 1px 8px) left bottom / 100% 3px no-repeat, var(--panel2); }
.tile.locked:hover { background: var(--panel); }
.pickCard { background: var(--panel); border-color: rgba(105, 242, 202, 0.16); }
.pickCard:hover, .pickCard.on { border-color: rgba(105, 242, 202, 0.16); }
.pickCard.evo { background: rgba(48, 40, 96, 0.88); }
.chip.on { background: rgba(105, 242, 202, 0.18); border-color: transparent; color: var(--ink); box-shadow: inset 0 -2px 0 var(--sel); }
.ctl.on { background: rgba(105, 242, 202, 0.16); border-color: transparent; }
.ctl:active, .ctl.held { background: rgba(105, 242, 202, 0.22); }
.ctl .cd { background: var(--sel); }

/* the selection: celadon corner brackets either side, the glow outside them only */
.btn, .tile, .chip, .ctl, .pickCard { position: relative; }
:is(.btn, .tile, .chip, .ctl, .pickCard)::before, :is(.btn, .tile, .chip, .ctl, .pickCard)::after {
  content: ''; position: absolute; top: -4px; bottom: -4px; width: 9px; border: 2px solid var(--sel); opacity: 0; pointer-events: none;
  transition: opacity 0.08s;
}
:is(.btn, .tile, .chip, .ctl, .pickCard)::before { left: -5px; border-right: 0; box-shadow: -3px 0 8px -2px rgba(105, 242, 202, 0.75); }
:is(.btn, .tile, .chip, .ctl, .pickCard)::after { right: -5px; border-left: 0; box-shadow: 3px 0 8px -2px rgba(105, 242, 202, 0.75); }
:is(.btn, .tile, .chip).sel::before, :is(.btn, .tile, .chip).sel::after,
.pickCard.on::before, .pickCard.on::after, .ctl.on::before, .ctl.on::after { opacity: 1; }
/* a tab or a look that is chosen is lit and underlined; the brackets are only for where the keys are */
.tile.locked::before, .tile.locked::after { display: none; }
.btn:focus-visible, .tile:focus-visible, .chip:focus-visible, .ctl:focus-visible { outline: none; }
.ctl:focus-visible { box-shadow: inset 0 0 0 1px var(--sel); }

.bar { background: rgba(145, 174, 187, 0.12); border: 1px solid rgba(145, 174, 187, 0.3); }
.bar > i { background: repeating-linear-gradient(90deg, var(--sel) 0 12px, rgba(105, 242, 202, 0.55) 12px 14px); }
.bar.en > i { background: repeating-linear-gradient(90deg, #9fe8ff 0 12px, rgba(159, 232, 255, 0.55) 12px 14px); }
#combo .bar > i, #tut .bar > i { background: var(--sel); }
.volume input, #bgmVol, #seVol { accent-color: var(--sel); }
#minimap, #townMap { border: 1px solid var(--edge); border-radius: 0; background: #071924; }
#evoRow .evo { background: rgba(105, 242, 202, 0.12); border-radius: 0; }
#pauseBtn { color: var(--ink); }
.tile .tn small { color: var(--tick); }
.dexGrid .cat { border-bottom: 1px solid var(--edge); color: var(--tick); letter-spacing: 0.08em; }
.rkTable th { color: var(--tick); border-bottom-color: var(--edge); }
.rkTable td { border-bottom-color: rgba(105, 242, 202, 0.1); }
.rkTable tr.own td { background: rgba(105, 242, 202, 0.14); }
.rkTable td.nm b { color: #071924; background: var(--sel); }
#rkNick { background: #071924; border: 1px solid var(--edge); border-radius: 0; }
#rkNick:focus { border-color: var(--sel); }
#stats3 .mini { background: rgba(145, 174, 187, 0.14); }
#stats3 .mini i { background: repeating-linear-gradient(90deg, var(--sel) 0 6px, rgba(105, 242, 202, 0.5) 6px 8px); }

/* the big moments keep their own colours (a boss is red, an evolution violet); the rest glow celadon */
#banner .b1 { color: var(--ink); text-shadow: 0 4px 0 #0b3a3a, 0 0 24px rgba(105, 242, 202, 0.6); }
#comboN { color: var(--ink); }
#comboMul { color: var(--hot); }
#score { color: var(--ink); }
#stormSize { color: var(--hot); }
#resScore { color: var(--ink); text-shadow: 0 0 16px rgba(105, 242, 202, 0.35); }
#resRank { color: var(--sel); text-shadow: 0 0 20px rgba(105, 242, 202, 0.6), 4px 4px 0 #0b3a3a; }

/* behind the menus: the night town, isobars round the storm */
#title { background:
  radial-gradient(ellipse 75% 85% at 50% 50%, rgba(3, 12, 18, 0) 55%, rgba(3, 12, 18, 0.78) 100%),
  url(../ui/isobars.webp) center / cover no-repeat,
  linear-gradient(180deg, rgba(4, 18, 34, 0.7), rgba(4, 18, 34, 0.42) 45%, rgba(4, 18, 34, 0.78)); }
#bossattack, #ranking, #dex, #how, #settings { background: url(../ui/isobars.webp) center / cover no-repeat, rgba(4, 16, 24, 0.86); }
#pause, #result { background: url(../ui/isobars.webp) center / cover no-repeat, rgba(4, 16, 24, 0.78); }
#loading, #nogl { background: #071924; }
/* the title: a scope over the town, cross hairs through the middle */
#title::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(105, 242, 202, 0.22) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(180deg, transparent calc(50% - 1px), rgba(105, 242, 202, 0.22) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    radial-gradient(circle at 50% 50%, transparent 0 calc(46vmax - 2px), rgba(105, 242, 202, 0.3) calc(46vmax - 2px) 46vmax, transparent 46vmax); }
#title { isolation: isolate; }
.titleVersion {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  line-height: 1.2;
  pointer-events: none;
}

.logo h1 { line-height: 0; text-shadow: none; }
.logo h1 img { display: block; width: clamp(300px, 48vw, 660px); height: auto; filter: drop-shadow(0 0 18px rgba(105, 242, 202, 0.25)); }
.logo .sub { color: var(--ink); letter-spacing: 0.5em; text-shadow: 0 0 10px rgba(105, 242, 202, 0.45), 2px 2px 0 #071924; }
#loading .logo h1 img { width: clamp(240px, 36vw, 480px); }
@media (max-height: 560px) { .logo h1 img { width: 280px; } }
/* wide enough: the logo top left, the menu down the right, the middle (the whirl) left clear */
@media (min-width: 900px) and (min-height: 561px) {
  #title { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); align-items: center; justify-content: stretch; padding: 5vh 6vw; text-align: left; }
  #title .logo { align-self: start; justify-self: start; }
  #title .menu { justify-self: end; width: 100%; min-width: 0; }
}

/* the observation picture of each map: the town as dots, then the coast, the plain, the islands, the globe */
.obsRow { display: flex; align-items: center; gap: 6px; justify-content: center; }
.obsRow .sp { width: 52px; height: 52px; opacity: 0.22; }
.obsRow .sp.past { opacity: 0.5; }
.obsRow .sp.now { opacity: 1; width: 72px; height: 72px; filter: drop-shadow(0 0 6px rgba(105, 242, 202, 0.6)); }
.obsRow i:not(.sp) { width: 10px; height: 1px; background: var(--tick); opacity: 0.6; }
/* the result: the map reached, in the top-left corner out of the way (only where there is room beside the table) */
#resObs { position: absolute; left: max(24px, 4vw); top: max(20px, 4vh); width: clamp(96px, 11vw, 150px); height: auto; aspect-ratio: 1; filter: drop-shadow(0 0 8px rgba(105, 242, 202, 0.55)); pointer-events: none; }
@media (max-width: 1099px), (max-height: 560px) { #resObs { display: none; } }
@media (max-height: 560px) { .obsRow .sp { width: 34px; height: 34px; } .obsRow .sp.now { width: 46px; height: 46px; } }
@media (prefers-reduced-motion: reduce) { :is(.btn, .tile, .chip, .ctl, .pickCard)::before, :is(.btn, .tile, .chip, .ctl, .pickCard)::after { transition: none; } }
.volume:has(input.sel) { border-color: var(--sel); box-shadow: inset 3px 0 0 var(--sel); }

/* icons drawn for the 深夜観測 look (on ui/sheet.webp: .sp-up-<id>, .sp-how-<card>, .sp-obs-<map>) */
.sp[hidden] { display: none; }
.pickCard .ph { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.pickCard .ph .sp { width: 72px; height: 72px; }
.pickCard .ph div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pickCard .ph kbd { align-self: flex-start; }
.pickCard .nt .sp { width: 22px; height: 22px; vertical-align: -6px; margin-right: 4px; }
#evoRow .evo .sp { width: 16px; height: 16px; vertical-align: -3px; margin-right: 3px; }
.howcard { grid-template-columns: 84px 1fr; padding: 8px 12px 10px 8px; }
.howcard .sp { width: 84px; height: 84px; grid-row: span 2; }
/* (its mask, the storm's shape, is set with the sprites below) */
i.sw { position: relative; display: inline-block; flex: none; background: var(--c); }
i.sw .sp { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: multiply; }
.chip .sw { width: 26px; height: 26px; margin: -6px 6px -6px -2px; vertical-align: middle; }
.chip:disabled .sw { background: #3a4a52; }
/* the unlocks: an icon at the head of each, an outline for what is still to come */
.dexGrid .rw .tn { align-items: center; gap: 8px; }
.dexGrid .rw .tn .ic, .dexGrid .rw .tn .sw { width: 36px; height: 36px; flex: none; }
.dexGrid .rw .tn canvas.ic { image-rendering: pixelated; }
.dexGrid .rw .tn .sp.sil { filter: brightness(0) invert(1); opacity: 0.18; }
.dexGrid .rw .tn .sw.sil { background: #c9d6db; opacity: 0.18; }
@media (max-height: 560px) {
  .pickCard .ph { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .pickCard .ph .sp { width: 40px; height: 40px; }
  .howcard { grid-template-columns: 56px 1fr; }
  .howcard .sp { width: 56px; height: 56px; }
}
@media (max-width: 760px) { .howcard { grid-template-columns: 64px 1fr; } .howcard .sp { width: 64px; height: 64px; } }
/* the looks: five to a row, each a storm in its colour */
#skinRow { display: grid; grid-template-columns: repeat(5, minmax(0, 120px)); gap: 8px; }
#skinRow .chip { text-align: left; padding: 8px 10px; }
@media (max-width: 760px) { #skinRow { grid-template-columns: repeat(2, minmax(0, 150px)); } }
@media (max-height: 560px) and (min-width: 761px) { #skinRow .chip { padding: 5px 8px; } }
.obsRow b { width: 52px; height: 52px; display: grid; place-items: center; font-weight: normal; font-size: 22px; color: var(--dim); border: 1px dashed rgba(145, 174, 187, 0.35); }
@media (max-height: 560px) { .obsRow b { width: 34px; height: 34px; font-size: 16px; } }

/* Japanese line breaks: at phrase boundaries where the browser knows them (word-break: auto-phrase), strict about
   small kana and closing brackets, and no lone last word; a phrase longer than the line still breaks */
body { line-break: strict; word-break: auto-phrase; overflow-wrap: break-word; text-wrap: pretty; }
/* what to press: one line of its own, never split */
.howcard .k { color: var(--ink); white-space: nowrap; }
/* an unlock: the icon and the boss (its map on the right), then what it gives, a line each */
.dexGrid .rw { grid-column: auto; }
.dexGrid .rw .ts b { display: block; font-weight: normal; color: var(--ink); }
.dexGrid .rw .tn small { white-space: nowrap; }
/* short descriptions: lines of even length (no word or two left alone on the last line) */
.ds, .nt, .ts, .howcard > span, #tutText, #tutHint, #toast .t, .tutBox p, #how > p.small, #resLine, #pauseInfo .pi span { text-wrap: balance; }
/* the boss and unlock tabs: wide cards on a grid of their own, so every row is filled edge to edge (two narrow
   columns per card left the last column empty and the cards off centre) */
.dexGrid:has(> .boss), .dexGrid:has(> .rw) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
/* a menu keeps the same centre whether or not it is long enough to scroll (else switching tabs nudges it sideways) */
.screen { scrollbar-gutter: stable both-edges; }
/* sprites: written by design/ui-art/build.py, do not edit */
.sp { display: inline-block; flex: none; background: url(../ui/sheet.webp) no-repeat; }
.sp-up-range { background-size: 825% 809.375%; background-position: 0.2155% 0.2203%; }
.sp-up-spin { background-size: 825% 809.375%; background-position: 14.4397% 0.2203%; }
.sp-up-updraft { background-size: 825% 809.375%; background-position: 28.6638% 0.2203%; }
.sp-up-light { background-size: 825% 809.375%; background-position: 42.8879% 0.2203%; }
.sp-up-dense { background-size: 825% 809.375%; background-position: 57.1121% 0.2203%; }
.sp-up-press { background-size: 825% 809.375%; background-position: 71.3362% 0.2203%; }
.sp-up-centri { background-size: 825% 809.375%; background-position: 85.5603% 0.2203%; }
.sp-up-turb { background-size: 825% 809.375%; background-position: 99.7845% 0.2203%; }
.sp-up-grind { background-size: 825% 809.375%; background-position: 0.2155% 14.7577%; }
.sp-up-float { background-size: 825% 809.375%; background-position: 14.4397% 14.7577%; }
.sp-up-tail { background-size: 825% 809.375%; background-position: 28.6638% 14.7577%; }
.sp-up-gust { background-size: 825% 809.375%; background-position: 42.8879% 14.7577%; }
.sp-up-battery { background-size: 825% 809.375%; background-position: 57.1121% 14.7577%; }
.sp-up-guard { background-size: 825% 809.375%; background-position: 71.3362% 14.7577%; }
.sp-up-rapid { background-size: 825% 809.375%; background-position: 85.5603% 14.7577%; }
.sp-up-shatter { background-size: 825% 809.375%; background-position: 99.7845% 14.7577%; }
.sp-up-crush { background-size: 825% 809.375%; background-position: 0.2155% 29.2952%; }
.sp-up-eye { background-size: 825% 809.375%; background-position: 14.4397% 29.2952%; }
.sp-up-wing { background-size: 825% 809.375%; background-position: 28.6638% 29.2952%; }
.sp-up-spread { background-size: 825% 809.375%; background-position: 42.8879% 29.2952%; }
.sp-up-blast { background-size: 825% 809.375%; background-position: 57.1121% 29.2952%; }
.sp-up-recall { background-size: 825% 809.375%; background-position: 71.3362% 29.2952%; }
.sp-up-heavyshot { background-size: 825% 809.375%; background-position: 85.5603% 29.2952%; }
.sp-up-magnet { background-size: 825% 809.375%; background-position: 99.7845% 29.2952%; }
.sp-up-intercept { background-size: 825% 809.375%; background-position: 0.2155% 43.8326%; }
.sp-up-twin { background-size: 825% 809.375%; background-position: 14.4397% 43.8326%; }
.sp-up-thunder { background-size: 825% 809.375%; background-position: 28.6638% 43.8326%; }
.sp-up-fire { background-size: 825% 809.375%; background-position: 42.8879% 43.8326%; }
.sp-up-gravity { background-size: 825% 809.375%; background-position: 57.1121% 43.8326%; }
.sp-up-water { background-size: 825% 809.375%; background-position: 71.3362% 43.8326%; }
.sp-up-sand { background-size: 825% 809.375%; background-position: 85.5603% 43.8326%; }
.sp-up-storm { background-size: 825% 809.375%; background-position: 99.7845% 43.8326%; }
i.sw { -webkit-mask: url(../ui/sheet.webp) 99.7845% 43.8326% / 825% 809.375% no-repeat; mask: url(../ui/sheet.webp) 99.7845% 43.8326% / 825% 809.375% no-repeat; }
.sp-how-move { background-size: 628.5714% 616.6667%; background-position: 0.2252% 61.0599%; }
.sp-how-fire { background-size: 628.5714% 616.6667%; background-position: 19.5946% 61.0599%; }
.sp-how-focus { background-size: 628.5714% 616.6667%; background-position: 38.964% 61.0599%; }
.sp-how-dash { background-size: 628.5714% 616.6667%; background-position: 58.3333% 61.0599%; }
.sp-how-shape { background-size: 628.5714% 616.6667%; background-position: 77.7027% 61.0599%; }
.sp-how-grow { background-size: 628.5714% 616.6667%; background-position: 97.0721% 61.0599%; }
.sp-how-load { background-size: 628.5714% 616.6667%; background-position: 0.2252% 80.8756%; }
.sp-how-campaign { background-size: 628.5714% 616.6667%; background-position: 19.5946% 80.8756%; }
.sp-how-bossattack { background-size: 628.5714% 616.6667%; background-position: 38.964% 80.8756%; }
.sp-obs-0 { background-size: 660% 647.5%; background-position: 0.2232% 99.7717%; }
.sp-obs-1 { background-size: 660% 647.5%; background-position: 18.5268% 99.7717%; }
.sp-obs-2 { background-size: 660% 647.5%; background-position: 36.8304% 99.7717%; }
.sp-obs-3 { background-size: 660% 647.5%; background-position: 55.1339% 99.7717%; }
.sp-obs-4 { background-size: 660% 647.5%; background-position: 73.4375% 99.7717%; }
/* end sprites */
/* 設定: the keys and pad buttons, a row an action */
.ctltable { display: grid; grid-template-columns: auto repeat(3, minmax(92px, auto)); gap: 4px 8px; align-items: center; font-size: 14px; }
.ctltable .ch { font-size: 12px; color: var(--tick); }
.ctltable .cn { text-align: left; color: var(--ink2); padding-right: 8px; }
.ctltable .cpad { font-size: 12px; color: var(--dim); }
.btn.keybtn { font-size: 14px; padding: 4px 10px; min-width: 92px; }
.btn.keybtn.wait { color: var(--sel); animation: keywait 0.9s steps(2) infinite; }
@keyframes keywait { 50% { color: var(--ink); } }
@media (prefers-reduced-motion: reduce) { .btn.keybtn.wait { animation: none; } }
.ctlnote { min-height: 1.4em; color: var(--sel); }
@media (max-width: 480px) { .ctltable { grid-template-columns: auto repeat(3, minmax(64px, auto)); gap: 3px 4px; } .btn.keybtn { min-width: 64px; padding: 3px 6px; } }
