@font-face { font-family: "Sleek"; src: url("../assets/ripps2-sleek-bold.ttf"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Planet N"; src: url("../assets/ripps2-one.ttf"); unicode-range: U+0031; font-display: swap; }
@font-face { font-family: "Planet N"; src: url("../assets/planet-n-compact.ttf"); font-display: swap; }

:root {
  color-scheme: dark;
  --ground: #04081a; --ink: #ecf2ff; --soft: #aabcec; --dim: #7387b8; --line: rgba(143, 180, 255, .16);
  --accent: #5a8cff; --accent2: #8fe3ff; --sel: #1e3c96; --glass: rgba(7, 12, 32, .78);
  --gut: max(14px, env(safe-area-inset-left)); --gur: max(14px, env(safe-area-inset-right));
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ground); color: var(--ink); font: 15px/1.45 var(--font); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
a { color: var(--accent2); }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: 0; }
#stage.aim { cursor: crosshair; }
button, .ghost, .primary { font: inherit; }

#veil { position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; background: var(--ground); color: var(--dim); font: 13px "Planet N", var(--font); letter-spacing: .1em; text-transform: uppercase; transition: opacity .5s; pointer-events: none; }
#veil.gone { opacity: 0; }

/* ---- the top bar ---- */
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none;
  padding: max(10px, env(safe-area-inset-top)) var(--gur) 0 var(--gut); }
.brand h1 { margin: 0; font: 700 clamp(26px, 5.2vmin, 40px)/1 "Sleek", var(--font); letter-spacing: .02em; text-shadow: 0 0 16px rgba(90, 140, 255, .85); }
.brand p { white-space: nowrap; margin: 3px 0 0; font: 12px/1.2 "Planet N", var(--font); letter-spacing: .1em; color: var(--soft); text-transform: uppercase; }
.top-r { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
#score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
#score span { white-space: nowrap; font: 10px "Planet N", var(--font); letter-spacing: .1em; color: var(--dim); text-transform: uppercase; }
#score b { font: 700 24px/1.1 "Sleek", var(--font); color: #ffb25c; text-shadow: 0 0 12px rgba(255, 130, 40, .8); font-variant-numeric: tabular-nums; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--soft); background: rgba(10, 18, 44, .55); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.icon:hover { color: var(--ink); }

/* ---- the arcade's words ---- */
#ready { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); font: 700 clamp(30px, 9vmin, 76px)/1 "Sleek", var(--font); letter-spacing: .06em; color: #fff; white-space: nowrap;
  text-shadow: 0 0 22px var(--accent), 0 4px 0 #122a78; pointer-events: none; opacity: 0; }
#ready.on { opacity: 1; animation: arcade .32s steps(2, jump-none) 4 forwards; }
@keyframes arcade { 0% { opacity: 1; } 100% { opacity: 0; } }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#hint { position: fixed; left: 50%; top: max(64px, 9vh); transform: translateX(-50%); margin: 0; padding: 7px 14px; background: rgba(8, 14, 36, .72); border: 1px solid var(--line); border-radius: 999px;
  color: var(--soft); font-size: 13px; white-space: nowrap; pointer-events: none; transition: opacity .4s; }
#hint.gone { opacity: 0; }

/* ---- the bottom bar ---- */
#hud { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 var(--gur) max(12px, env(safe-area-inset-bottom)) var(--gut);
  background: linear-gradient(transparent, rgba(4, 8, 26, .85) 42%); pointer-events: none; }
#hud > * { pointer-events: auto; }
.bar { display: flex; gap: 3px; height: 26px; }
#bar { display: flex; gap: 3px; height: 26px; }
.seg { position: relative; min-width: 3px; background: rgba(120, 150, 230, .16); border-radius: 3px; overflow: hidden; display: flex; align-items: center; padding: 0 7px; }
.seg i { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: var(--c, var(--accent)); opacity: .55; }
.seg span { position: relative; font: 10.5px/1 "Planet N", var(--font); letter-spacing: .08em; white-space: nowrap; color: var(--ink); text-transform: uppercase; overflow: hidden; }
.seg em { position: relative; margin-left: auto; padding-left: 6px; font-style: normal; font-size: 11px; color: var(--soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.seg.power { --c: #566; flex: none !important; width: 62px; } .seg.splash { --c: var(--sky, var(--accent)); } .seg.black { --c: #30343f; } .seg.towers { --c: var(--accent2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
#readout { margin: 0; color: var(--soft); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
#readout b { color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 8px; flex: none; }
.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px; cursor: pointer; text-decoration: none; white-space: nowrap; font-weight: 600; }
.primary { color: #fff; background: linear-gradient(180deg, #3f74f5, #2450c8); border: 1px solid #6c97ff; box-shadow: 0 2px 16px rgba(60, 110, 255, .4); }
.primary:hover { background: linear-gradient(180deg, #4d82ff, #2c5ad8); }
.ghost { color: var(--ink); background: rgba(14, 24, 58, .7); border: 1px solid var(--line); }
.ghost:hover { border-color: rgba(143, 180, 255, .5); }
#boom { color: #ffc98f; border-color: rgba(255, 150, 70, .4); }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ---- the glass panel ---- */
#scrim { position: fixed; inset: 0; background: rgba(2, 4, 14, .35); opacity: 0; pointer-events: none; transition: opacity .32s; }
#panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); display: flex; flex-direction: column; color: var(--ink); background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); border-left: 1px solid var(--line); box-shadow: -24px 0 80px rgba(0, 0, 0, .5);
  transform: translateX(102%); display: none; transition: transform .36s cubic-bezier(.2, .8, .2, 1); outline: 0; }
body.show #panel { display: flex; }
body.open #panel { transform: none; }
body.open #scrim { opacity: 1; pointer-events: auto; }
.phead { flex: none; display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) var(--gur) 10px 20px; border-bottom: 1px solid var(--line); }
.phead h2 { margin: 0; font: 700 26px/1 "Sleek", var(--font); text-shadow: 0 0 12px rgba(90, 140, 255, .7); }
.pbody { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px var(--gur) calc(24px + env(safe-area-inset-bottom)) 20px; }
.preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 8px; }
#pv { display: block; width: 100%; height: auto; border-radius: 6px; background: #000; box-shadow: 0 0 0 1px var(--line), 0 8px 30px rgba(0, 0, 0, .5); }
.pvnum { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.pvnum b { font: 700 32px/1 "Sleek", var(--font); color: var(--accent2); font-variant-numeric: tabular-nums; }
.pvnum span { font-size: 13px; color: var(--soft); }
#pvbar { display: flex; gap: 2px; height: 8px; margin: 8px 0 7px; }
#pvbar .seg { padding: 0; border-radius: 2px; width: auto; } #pvbar .seg.power { flex: 1 1 0 !important; } #pvbar .seg i { transform: none; opacity: .9; }
.pvnote { margin: 0; font-size: 12.5px; line-height: 1.35; color: var(--soft); }
.sect, .group { padding-top: 18px; }
.sect h3, .group h3 { margin: 0 0 3px; font: 14px/1.2 "Planet N", var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--accent2); }
.note { margin: 0 0 8px; color: var(--soft); font-size: 13px; }
.note.fine { color: var(--dim); font-size: 12px; }
.set { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 4px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.set .name { font-weight: 600; padding-top: 7px; }
.set .hint { grid-column: 2; margin: 2px 0 0; font-size: 12px; line-height: 1.35; color: var(--dim); }
.set.dim { display: none; }
.opts { display: flex; flex-wrap: wrap; gap: 4px; }
.opt { min-height: 36px; padding: 4px 11px; background: rgba(30, 50, 110, .22); border: 1px solid transparent; border-radius: 6px; color: var(--soft); font: inherit; font-size: 14px; cursor: pointer; }
.opt:hover { color: var(--ink); border-color: var(--line); }
.opt[aria-checked="true"] { color: #fff; background: var(--sel); border-color: #4e78e6; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 5px; }
.swatch { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 4px 8px; background: rgba(30, 50, 110, .22); border: 1px solid transparent; border-radius: 6px; color: var(--soft); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.swatch i { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--s); box-shadow: 0 0 8px var(--s); }
.swatch[aria-checked="true"] { color: #fff; background: var(--sel); border-color: #4e78e6; }
.custom { grid-column: 2; display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--soft); }
.custom input { width: 52px; height: 36px; padding: 0; background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
#ini { margin: 8px 0; padding: 11px 12px; overflow-x: auto; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 8px; font: 12.5px/1.5 ui-monospace, Consolas, Menlo, monospace; color: #cdd9f7; white-space: pre; }
.links { margin: 6px 0 0; padding: 0; list-style: none; }
.links a { display: flex; align-items: center; min-height: 40px; border-top: 1px solid var(--line); text-decoration: none; }
.links a:hover { text-decoration: underline; }
#nogl { position: fixed; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 4px; padding: 20px; text-align: center; background: var(--ground); }
#nogl[hidden] { display: none; }
#nogl img { max-width: 100%; height: auto; }

/* ---- narrower ---- */
@media (max-width: 720px) {
  #panel { width: 100%; border-left: 0; transform: translateY(102%); }
  body.open #panel { transform: none; }
  .phead { padding-left: var(--gut); }
  .pbody { padding-left: var(--gut); }
  .set { grid-template-columns: minmax(0, 1fr); }
  .set .name { padding-top: 0; }
  .set .hint, .custom { grid-column: 1; }
  .opt { min-height: 42px; padding: 6px 12px; } .swatch { min-height: 44px; }
  #readout { display: none; }
  .row { justify-content: flex-end; }
  .actions { flex: 1; }
  .actions > * { flex: 1; padding: 0 8px; }
  .primary#open { flex: 1.3; }
}
@media (max-width: 520px) {
  #bar .seg { padding: 0 5px; }
  .seg.power { width: 12px; }
  .seg.power span, .seg.power em { display: none; }
  .seg em { display: none; }
}
@media (max-width: 420px) {
  .preview { grid-template-columns: minmax(0, 1fr); }
}
/* a phone on its side: one tight row, so the set keeps the height */
@media (max-height: 480px) and (orientation: landscape) {
  #hud { display: flex; align-items: center; gap: 10px; }
  #bar { flex: 1; min-width: 0; height: 22px; }
  .row { margin: 0; flex: none; }
  #readout { display: none; }
  .actions { flex: none; } .actions > * { flex: none; padding: 0 12px; }
  .primary, .ghost { min-height: 40px; }
  .preview { grid-template-columns: 200px minmax(0, 1fr); }
  #hint { top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #panel, #scrim { transition-duration: .01s; }
  #ready.on { animation: none; }
}

/* a typed value beside a row's choices (Power-on Wait) */
.custom.typed input { width: 92px; padding: 0 8px; font: inherit; color: var(--ink, inherit); background: rgba(0, 0, 0, 0.25); cursor: text; }
