/* Ring Escape: night arcade */
@font-face { font-family: "Young Serif"; font-display: swap; src: url(../fonts/young-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #0F0B1C;
  --panel: #1A1430;
  --panel-2: #241C40;
  --line: #342A57;
  --text: #F1ECFF;
  --muted: #A79CC8;
  --accent: #3EE6C8;
  --accent-ink: #062A24;
  --lose: #FF6B8A;
  --win: #7CF29A;
  --display: "Young Serif", Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--ui); line-height: 1.45; min-height: 100vh; }
a { color: inherit; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.layout { max-width: 1000px; margin: 0 auto; padding: 0 14px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; }
.back { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.back:hover { color: var(--text); }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
}
.icon-btn:hover { background: var(--panel); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.muted .wave { display: none; }

.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 0 10px; }
h1 { font-family: var(--display); font-weight: 400; font-size: 2rem; margin: 0; line-height: 1.1; }
.sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.stage { display: grid; gap: 14px; }
@media (min-width: 820px) { .stage { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 24px; } }

.arena-wrap { position: relative; width: 100%; max-width: 520px; margin: 0 auto; aspect-ratio: 1; }
@media (max-width: 819px) { .arena-wrap { max-width: min(100%, calc(100svh - 250px)); min-width: 260px; } }
canvas { width: 100%; height: 100%; display: block; border-radius: 18px; background: radial-gradient(circle at 50% 45%, #1C1535 0%, #0F0B1C 70%); }
.hud {
  position: absolute; left: 12px; right: 12px; top: 10px; display: flex; justify-content: space-between;
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; pointer-events: none;
}
#hud-rings { color: var(--muted); font-weight: 600; font-size: 0.9rem; }

/* bet slip */
.slip, .result { background: var(--panel); border-radius: 18px; padding: 14px 14px 12px; }
.bank-row { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); }
.bank-row strong { font-size: 1.5rem; color: var(--text); font-variant-numeric: tabular-nums; }
.market { margin-top: 12px; }
.market h2 { font-size: 0.98rem; margin: 0 0 6px; font-weight: 650; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rings-opts { grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); }
.opt {
  border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 8px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 52px; justify-content: center;
}
.opt .label { font-weight: 650; }
.opt .mult { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.opt .staked { font-size: 0.78rem; color: var(--accent); font-weight: 700; }
.opt.on { border-color: var(--accent); background: #12332E; }
.opt.on .mult { color: var(--text); }
.opt:disabled { opacity: .45; cursor: default; }
.stake-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 0.92rem; }
.stakes { display: flex; gap: 4px; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.stakes button { border: 0; background: transparent; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 700; color: var(--muted); }
.stakes button.on { background: var(--text); color: var(--bg); }

.drop {
  width: 100%; margin-top: 12px; border: 0; border-radius: 14px; padding: 14px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 1.1rem;
}
.slip.locked .market, .slip.locked .stake-row, .slip.locked .fine { display: none; }
.drop:disabled { background: var(--panel-2); color: var(--muted); cursor: default; }
.ghost { width: 100%; margin-top: 8px; border: 1.5px solid var(--line); background: transparent; border-radius: 14px; padding: 12px; cursor: pointer; font-weight: 700; }
.fine { color: var(--muted); font-size: 0.8rem; margin: 8px 0 0; text-align: center; }

.result h2 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; margin: 2px 0 8px; }
.result ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.result li { display: flex; justify-content: space-between; gap: 10px; background: var(--panel-2); border-radius: 10px; padding: 8px 10px; font-size: 0.95rem; }
.result li .w { color: var(--win); font-weight: 700; }
.result li .l { color: var(--lose); font-weight: 700; }
.res-total { font-size: 1.15rem; font-weight: 700; margin: 12px 0 0; }
.res-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.res-actions .ghost { margin-top: 12px; }
.next { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 10px 0 0; }

/* ads */
.ad-inline { margin-top: 26px; }
.ad-slot { display: block; margin: 0 auto; overflow: hidden; }
.ad-banner { width: 100%; max-width: 728px; min-height: 100px; }
.ad-slot.placeholder { border: 1.5px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.ad-slot.placeholder::before { content: "Ad space " attr(data-size); }
.ad-slot.collapsed { min-height: 0; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }
.ad-label { font-size: 11px; color: var(--muted); text-align: center; margin: 0 0 4px; }

.foot { display: flex; justify-content: center; gap: 22px; padding: 26px 0 40px; color: var(--muted); font-size: 0.9rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--text); }
.dlg::backdrop { background: rgba(5, 3, 12, .7); }
.dlg h2 { font-family: var(--display); font-weight: 400; margin: 0 0 10px; font-size: 1.6rem; }
.dlg p { color: var(--muted); }
.dlg .x { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--panel-2); border-radius: 10px; padding: 10px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
