:root {
  --cyan: #37e6ff;
  --pink: #ff7a2e;
  --gold: #ffd24a;
  --bg: #03040d;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; font-family: var(--font); color: #e8f4ff; -webkit-user-select: none; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
body.menu-open canvas#game { cursor: default; }

#ui { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; pointer-events: auto; background: radial-gradient(ellipse at center, rgba(3,4,13,0.35), rgba(3,4,13,0.82)); text-align: center; }
.screen.hidden, .hidden { display: none !important; }
#title { background: radial-gradient(ellipse at 50% 40%, rgba(3,4,13,0.15), rgba(3,4,13,0.72) 75%); }

.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 0.95; font-weight: 900; font-style: italic; text-transform: uppercase; }
.logo span { display: block; background: linear-gradient(180deg, #fff 10%, var(--cyan) 55%, #1b6bff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 12px rgba(55, 230, 255, 0.55)); }
.logo .l1 { font-size: clamp(34px, 7vw, 64px); letter-spacing: 0.34em; margin-right: -0.34em; }
.logo .l2 { font-size: clamp(56px, 12.5vw, 118px); letter-spacing: 0.06em; background: linear-gradient(180deg, #fff 5%, var(--pink) 60%, #a04a10); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 16px rgba(255, 122, 46, 0.6)); }
.logo .l3 { font-size: clamp(30px, 6.4vw, 60px); letter-spacing: 0.22em; margin-right: -0.22em; }
.tag { margin: 4px 0 10px; color: #9fb7d8; letter-spacing: 0.22em; text-transform: uppercase; font-size: clamp(11px, 1.6vw, 15px); }

h2 { margin: 0 0 4px; font-size: clamp(30px, 6vw, 52px); letter-spacing: 0.2em; font-weight: 900; color: #fff; text-shadow: 0 0 18px rgba(55, 230, 255, 0.8); }
h2.over { color: #ff6a6a; text-shadow: 0 0 22px rgba(255, 60, 60, 0.9); }

.menu { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: min(300px, 80vw); }
button { font: 800 16px/1 var(--font); letter-spacing: 0.18em; padding: 15px 22px; color: #dff6ff; background: rgba(10, 20, 50, 0.7); border: 1.5px solid rgba(55, 230, 255, 0.55); border-radius: 4px; cursor: pointer; transition: transform 0.08s, box-shadow 0.12s, background 0.12s; box-shadow: 0 0 0 rgba(55, 230, 255, 0); }
button:hover, button:focus-visible { background: rgba(20, 60, 110, 0.85); box-shadow: 0 0 18px rgba(55, 230, 255, 0.55); outline: none; transform: translateY(-1px); }
button.primary { border-color: var(--pink); color: #fff; background: linear-gradient(180deg, rgba(255, 122, 46, 0.28), rgba(150, 70, 10, 0.28)); box-shadow: 0 0 14px rgba(255, 122, 46, 0.35); }
button.primary:hover, button.primary:focus-visible { box-shadow: 0 0 26px rgba(255, 122, 46, 0.8); }
button:active { transform: translateY(1px) scale(0.99); }

.hint { margin: 8px 0 0; font-size: clamp(11px, 1.5vw, 13px); color: #8fa6c8; max-width: 640px; line-height: 1.7; }
.hint b { color: var(--cyan); }
.credit { position: absolute; bottom: 12px; left: 0; right: 0; font-size: 12px; color: #6f86a8; }
.credit a { color: #8fd8ff; text-decoration: none; border-bottom: 1px dotted rgba(143, 216, 255, 0.5); }
.credit a:hover { color: #fff; }

.panel { display: flex; flex-direction: column; gap: 14px; padding: 20px 26px; min-width: min(420px, 90vw); background: rgba(8, 14, 36, 0.78); border: 1px solid rgba(55, 230, 255, 0.35); border-radius: 6px; text-align: left; }
.panel label { display: flex; justify-content: space-between; align-items: center; gap: 18px; font-size: 15px; letter-spacing: 0.04em; }
.panel label.check { justify-content: flex-start; gap: 12px; }
input[type="range"] { width: 180px; accent-color: var(--cyan); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pink); }

.scorelist { list-style: none; margin: 0; padding: 14px 22px; min-width: min(380px, 90vw); background: rgba(8, 14, 36, 0.78); border: 1px solid rgba(55, 230, 255, 0.35); border-radius: 6px; counter-reset: r; }
.scorelist li { counter-increment: r; display: grid; grid-template-columns: 2.2em 3.6em 1fr auto; gap: 8px; padding: 6px 0; font-size: 17px; font-variant-numeric: tabular-nums; text-align: left; color: #bcd8f5; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.scorelist li::before { content: counter(r) "."; color: #ff5d8f; font-weight: 800; }
.scorelist li .nm { font-weight: 800; letter-spacing: 0.12em; color: #fff; }
.scorelist li .sc { text-align: right; font-weight: 700; color: var(--cyan); }
.scorelist li .st { color: #7f95b8; font-size: 12px; align-self: center; text-align: right; padding-left: 8px; }
.scorelist li.me { background: rgba(255, 210, 74, 0.12); }
.scorelist li.me .nm, .scorelist li.me .sc { color: var(--gold); }

.final { margin: 0; font-size: 20px; color: #bcd8f5; }
.final b { color: var(--gold); }
.entry { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.newhs { margin: 0; color: var(--gold); letter-spacing: 0.12em; font-weight: 800; text-shadow: 0 0 12px rgba(255, 210, 74, 0.7); }
#goName { width: 7em; text-align: center; font: 900 44px/1.1 var(--font); letter-spacing: 0.3em; text-transform: uppercase; padding: 6px 0 6px 0.3em; color: #fff; background: rgba(10, 20, 50, 0.8); border: 2px solid var(--cyan); border-radius: 4px; outline: none; box-shadow: 0 0 18px rgba(55, 230, 255, 0.5); -webkit-user-select: text; user-select: text; }

@media (max-height: 560px) {
  .screen { gap: 8px; padding: 10px; }
  .hint, .tag { display: none; }
  button { padding: 11px 18px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

.keysec { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid rgba(55, 230, 255, 0.2); }
.keyhead { margin: 0; font-size: 12px; letter-spacing: 0.16em; font-weight: 800; color: var(--cyan); }
.keyhead span { display: block; margin-top: 3px; letter-spacing: 0.02em; font-weight: 500; color: #7f95b8; }
.keygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.keygrid label { font-size: 13px; }
.keybtn { min-width: 64px; padding: 7px 10px; font-size: 14px; letter-spacing: 0.06em; }
.keybtn.listening { border-color: #ffd24a; color: #ffd24a; box-shadow: 0 0 14px rgba(255, 210, 74, 0.6); }
button.small { padding: 8px 12px; font-size: 12px; align-self: flex-start; }
body.touch .keysec { display: none; }
@media (max-height: 700px) { #settings .panel { max-height: 70vh; overflow-y: auto; } }
select { font: 700 14px var(--font); padding: 6px 8px; color: #dff6ff; background: rgba(10, 20, 50, 0.85); border: 1.5px solid rgba(55, 230, 255, 0.55); border-radius: 4px; }

/* ---- campaign screens ---- */
.menu.wide { min-width: min(560px, 92vw); }
.diffbtn { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; letter-spacing: 0.12em; }
.diffbtn b { font-size: 18px; color: #fff; }
.diffbtn span { font: 500 12px/1.3 var(--font); letter-spacing: 0.02em; color: #9fb7d8; }
.diffbtn.last { border-color: var(--pink); box-shadow: 0 0 12px rgba(255, 122, 46, 0.4); }
.menu.row { flex-direction: row; justify-content: center; min-width: 0; }
.mapinfo { margin: 0; font-size: 13px; letter-spacing: 0.1em; color: #9fb7d8; }
.mapinfo b { color: var(--gold); }
.board { position: relative; padding: 8px 4px; }
.board svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.board svg path { fill: none; stroke: rgba(120, 160, 210, 0.3); stroke-width: 2; }
.board svg path.hot { stroke: var(--gold); stroke-width: 3; filter: drop-shadow(0 0 4px rgba(255, 210, 74, 0.8)); }
#mapCols { position: relative; display: flex; gap: 22px; align-items: center; justify-content: center; }
.mapcol { display: flex; flex-direction: column; gap: 10px; }
.mapcard { width: 112px; padding: 8px 6px; display: flex; flex-direction: column; gap: 3px; align-items: center; letter-spacing: 0.04em; text-align: center; font-size: 11px; background: rgba(8, 16, 40, 0.86); }
.mapcard .mn { font-size: 10px; color: #7f95b8; letter-spacing: 0.14em; }
.mapcard .mt { font-size: 12px; color: #fff; line-height: 1.15; }
.mapcard .mr { font-size: 9px; color: #9fe8ff; letter-spacing: 0.1em; }
.mapcard.hard .mr { color: #ff9a6a; }
.mapcard.sel { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 210, 74, 0.7); }
.mapcard.dim { opacity: 0.55; }
.mapcard.soon { opacity: 0.35; }
.mapcard.done::after { content: "\2713"; color: #7dff9a; font-size: 12px; }
.medal { display: inline-block; padding: 2px 7px; border-radius: 10px; font: 800 10px/1.2 var(--font); letter-spacing: 0.12em; }
.medal.gold { background: linear-gradient(180deg, #ffe28a, #d89a14); color: #3a2400; }
.medal.silver { background: linear-gradient(180deg, #f2f6ff, #9aa8c4); color: #1d2840; }
.medal.bronze { background: linear-gradient(180deg, #f0b98a, #a86428); color: #2e1704; }
.medal.none { background: rgba(255, 255, 255, 0.08); color: #6f86a8; }
.detail { max-width: min(640px, 92vw); min-height: 3.2em; font-size: 13px; line-height: 1.5; color: #bcd8f5; }
.detail b { color: #fff; letter-spacing: 0.08em; }
.detail .rt { color: #9fe8ff; font-size: 11px; letter-spacing: 0.1em; }
.detail i { color: #ff9a6a; }
button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }
.resname { margin: 0; font-size: 18px; letter-spacing: 0.2em; color: #ffd24a; }
.resmedal { transform: scale(1.7); margin: 8px 0; }
.bar { width: min(360px, 80vw); height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #2fd6ff, #7dffb0); }
.rows { list-style: none; margin: 0; padding: 12px 18px; min-width: min(420px, 90vw); background: rgba(8, 14, 36, 0.78); border: 1px solid rgba(55, 230, 255, 0.35); border-radius: 6px; }
.rows li { display: flex; justify-content: space-between; gap: 18px; padding: 5px 0; font-size: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: #bcd8f5; }
.rows li b { color: #fff; }
.rows li.cr b { color: var(--gold); }
.credits { margin: 0; font-size: 16px; letter-spacing: 0.14em; color: #9fb7d8; }
.credits b { color: var(--gold); font-size: 22px; }
.shopwrap { display: flex; gap: 18px; align-items: flex-start; max-width: 96vw; }
.shopmoss { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 150px; }
.shopmoss canvas { background: rgba(30, 50, 90, 0.6); border: 2px solid #7dff9a; border-radius: 6px; width: 150px; height: 150px; }
.shopmoss p { margin: 0; font-size: 12px; line-height: 1.4; color: #bcd8f5; text-align: left; }
.shoplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: min(520px, 62vw); max-height: 56vh; overflow-y: auto; }
.shoplist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; background: rgba(8, 14, 36, 0.78); border: 1px solid rgba(55, 230, 255, 0.3); border-radius: 5px; text-align: left; }
.shoplist .si { display: flex; flex-direction: column; gap: 3px; }
.shoplist .si b { font-size: 13px; letter-spacing: 0.1em; color: #fff; }
.shoplist .sd { font-size: 11px; color: #8fa6c8; }
.pip { display: inline-block; width: 9px; height: 9px; margin-left: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.pip.on { background: #7dff9a; box-shadow: 0 0 6px rgba(125, 255, 154, 0.8); }
.buy { min-width: 74px; padding: 9px 10px; font-size: 13px; }
@media (max-height: 560px) {
  .mapcard { width: 92px; padding: 5px 4px; }
  #mapCols { gap: 16px; }
  .detail { font-size: 11px; min-height: 2.6em; }
  .resmedal { transform: none; }
  .shopmoss { display: none; }
  .shoplist { max-height: 44vh; width: min(620px, 92vw); }
  .rows li { font-size: 13px; padding: 3px 0; }
}
#title .hint { max-width: min(560px, 56vw); }
#diff, #map, #results, #shop, #cont { background: radial-gradient(ellipse at center, rgba(3, 4, 13, 0.82), rgba(3, 4, 13, 0.94)); }
.screen { justify-content: safe center; overflow-y: auto; }
@media (max-height: 420px) {
  h2 { font-size: 24px; margin: 0; }
  .mapinfo { font-size: 11px; }
  .board { padding: 2px; }
  .mapcol { gap: 6px; }
  .mapcard { width: 88px; padding: 4px 3px; gap: 2px; }
  .menu.row button { padding: 9px 16px; }
  .credits { font-size: 13px; } .credits b { font-size: 17px; }
  .shoplist li { padding: 5px 10px; } .shoplist .sd { display: none; } .shoplist .si { flex-direction: row; align-items: center; gap: 12px; } .shoplist { max-height: 54vh; }
}

.story { max-width: min(560px, 90vw); font-size: 15px; line-height: 1.6; color: #cfe4ff; }
.story i { color: #ffd24a; }
.credit2 { margin: 0; letter-spacing: 0.3em; font-size: 11px; color: #7de8ff; }
#ending { background: radial-gradient(ellipse at center, rgba(3, 4, 13, 0.7), rgba(3, 4, 13, 0.94)); }

.heroart { position: absolute; right: 3%; bottom: 0; height: min(84%, 560px); pointer-events: none; filter: drop-shadow(0 0 26px rgba(255, 130, 40, 0.45)); opacity: 0.96; }
@media (max-width: 820px) { .heroart { display: none; } }
.howgrid { display: flex; gap: 16px; align-items: stretch; justify-content: center; flex-wrap: wrap; max-width: 96vw; }
.panel.how { min-width: 0; width: min(420px, 92vw); gap: 7px; }
.panel.how h3 { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.2em; color: var(--cyan); }
.panel.how p { margin: 0; font-size: 13px; line-height: 1.45; color: #cfe4ff; }
.panel.how p.sm { font-size: 11px; color: #8fa6c8; }
.panel.how b { color: #fff; }
@media (max-height: 560px) { .panel.how p { font-size: 11px; line-height: 1.35; } .howgrid { gap: 8px; } }

#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; font: 800 18px var(--font); letter-spacing: 0.4em; color: #7de8ff; background: #03040d; }
