/* Layout: full-bleed portrait canvas, HUD strip on top, home screen and cards overlaid. */
:root {
  --night: #141a2b; --slate: #232b42; --slate2: #2d3754; --ink: #f4f6fb; --muted: #a9b2cb;
  --blue: #2f7df6; --blue-d: #1b4fa8; --red: #ef3e4a; --gold: #ffc83d;
  --display: "Lilita One", "Arial Black", Impact, sans-serif;
  --body: "Nunito", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night); color: var(--ink); font: 600 15px/1.4 var(--body);
  overflow: hidden; user-select: none; -webkit-user-select: none;
}
#wrap { position: relative; height: 100%; max-width: 560px; margin: 0 auto; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
[hidden] { display: none !important; }

button {
  font-family: var(--display); font-size: 1.35rem; letter-spacing: .03em; color: #fff;
  background: var(--blue); border: 0; border-radius: 14px; padding: 13px; cursor: pointer;
  box-shadow: 0 5px 0 var(--blue-d);
}
button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--blue-d); }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button.ghost { background: transparent; box-shadow: none; color: var(--muted); font-size: 1.05rem; padding: 8px; }

/* HUD */
.hud { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px; display: flex; align-items: center; gap: 10px; }
.icon { font-size: .95rem; padding: 6px 11px; border-radius: 999px; background: rgba(20,26,43,.72); box-shadow: none; }
.lvl { font-family: var(--display); font-size: 1.15rem; letter-spacing: .02em; background: rgba(20,26,43,.72); padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.bar { flex: 1; height: 10px; background: rgba(20,26,43,.72); border-radius: 999px; overflow: hidden; border: 2px solid rgba(20,26,43,.72); }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--gold)); border-radius: 999px; }
.banner {
  position: absolute; top: 28%; left: 0; right: 0; text-align: center; pointer-events: none;
  font-family: var(--display); font-size: 2.6rem; color: var(--gold);
  text-shadow: 0 3px 0 rgba(16,20,34,.9), 0 0 18px rgba(0,0,0,.5); opacity: 0; transition: opacity .25s;
}
.banner.show { opacity: 1; }

/* Home */
.home {
  position: absolute; inset: 0; overflow-y: auto; padding: 20px 16px 0;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  background: linear-gradient(rgba(10,14,26,.72), rgba(10,14,26,.9) 40%);
  -webkit-overflow-scrolling: touch; touch-action: pan-y;
}
.brand { text-align: center; margin-bottom: 6px; }
.brand h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 3.4rem; line-height: 1; }
.brand h1 b, .card h1 b { color: var(--gold); font-weight: 400; }
.brand p { margin: 6px 0 0; color: var(--muted); }
.home h2 { font-family: var(--display); font-weight: 400; font-size: 1.2rem; letter-spacing: .03em; margin: 18px 0 8px; color: var(--muted); }

.opt {
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  font-family: var(--body); font-size: .88rem; letter-spacing: 0; color: var(--ink);
  background: var(--slate); border: 2px solid transparent; border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 4px 0 #161c2e;
}
.opt:active { box-shadow: 0 1px 0 #161c2e; }
.opt[aria-pressed="true"] { border-color: var(--gold); background: var(--slate2); }
.opt .name { font-family: var(--display); font-size: 1.2rem; letter-spacing: .02em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.opt .blurb { color: var(--muted); line-height: 1.3; }
.opt canvas { width: 100%; height: 54px; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modes .rec { font-family: var(--display); font-size: .9rem; color: var(--gold); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats { display: grid; gap: 3px; margin-top: 2px; }
.stat { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); }
.stat i { height: 6px; border-radius: 99px; background: #151a2a; position: relative; overflow: hidden; }
.stat i::after { content: ""; position: absolute; inset: 0; width: calc(var(--v) * 100%); background: var(--blue); border-radius: 99px; }
.tag { font-family: var(--body); font-weight: 800; font-size: .68rem; padding: 2px 7px; border-radius: 99px; background: var(--gold); color: #3a2a00; white-space: nowrap; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg .opt { align-items: center; text-align: center; }
.note { margin: 6px 0 0; color: var(--muted); font-size: .85rem; text-align: center; }

.how { margin-top: 18px; background: var(--slate); border-radius: 14px; padding: 10px 12px; }
.how summary { cursor: pointer; font-family: var(--display); font-size: 1.1rem; }
.how ul { margin: 10px 0 2px; padding: 0; list-style: none; display: grid; gap: 8px; }
.how li, .card li { display: flex; gap: 10px; align-items: center; line-height: 1.35; font-size: .9rem; }
.chip { flex: none; font-family: var(--display); font-size: .95rem; min-width: 44px; text-align: center; padding: 3px 6px; border-radius: 8px; color: #fff; }
.chip.g { background: var(--blue); } .chip.r { background: var(--red); } .chip.y { background: var(--gold); color: #3a2a00; } .chip.s { background: #7b8194; }

.playbar {
  position: sticky; bottom: 0; margin: 18px -16px 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 6px; background: linear-gradient(transparent, rgba(10,14,26,.96) 30%);
}
.playbar #play { font-size: 1.7rem; }

/* Overlays */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding-inline: 16px; background: rgba(10,14,26,.6); }
.card {
  width: 100%; max-width: 360px; background: var(--slate); border-radius: 20px; padding: 22px 20px;
  display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.card.wide { max-width: 420px; }
.card h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 2.4rem; line-height: 1; text-wrap: balance; }
.card p { margin: 0; color: var(--muted); line-height: 1.5; }
.big { font-family: var(--display); font-size: 3rem; color: var(--gold); line-height: 1; }
.ups { display: grid; gap: 10px; }
.ups .opt { background: var(--slate2); box-shadow: 0 4px 0 #161c2e; }
.ups .opt .pips { display: flex; gap: 3px; }
.ups .opt .pips i { width: 10px; height: 6px; border-radius: 3px; background: #151a2a; }
.ups .opt .pips i.on { background: var(--gold); }
.ups .opt .tag.w { background: #ff9a3c; }
.ups .opt .tag.s { background: #7fdca4; color: #0f3b22; }
