/* Sabong Arena - web betting portal */
:root {
  --bg: #0b0f17;
  --bg-2: #0f1520;
  --surface: #141b28;
  --surface-2: #1a2333;
  --line: #243045;
  --text: #e7ecf5;
  --muted: #8b97ad;
  --gold: #f2b84b;
  --gold-2: #d4952a;
  --meron: #e5484d;
  --meron-soft: rgba(229, 72, 77, .14);
  --wala: #3b82f6;
  --wala-soft: rgba(59, 130, 246, .14);
  --ok: #2fbf71;
  --warn: #f5a524;
  --err: #f0545c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(229, 72, 77, .10), transparent 60%),
    radial-gradient(1200px 500px at 85% -10%, rgba(59, 130, 246, .10), transparent 60%),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;            /* mobile: no jump when the address bar hides */
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }

/* ---------- cursor ---------- */
/* Live text (numbers, names, timer) changes every second; keep a normal arrow
   over it instead of the text beam, and give each control one clear cursor. */
body { cursor: default; }
a, button, select, label.side, .side span, .chip, summary { cursor: pointer; }
input, textarea, .input:not(select) { cursor: text; caret-color: var(--gold); }
input[type="radio"], input[type="checkbox"] { cursor: pointer; }
button:disabled, .btn:disabled, input:disabled, select:disabled { cursor: not-allowed; }
/* Touch: no grey flash box and no double-tap zoom delay on controls. */
a, button, label, select, input, .chip { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
/* No number spinners: they jumped the value on click/scroll. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* Live readouts: double-click selected them while they re-rendered. */
.timer, .badge, .balance, .pool, .stats, .split__legend, .vs, .corner, .tier { user-select: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  /* Solid instead of backdrop-filter: blur. The blurred sticky bar had to be
     re-composited on every scroll and every live update, which made the
     pointer and page stutter/flicker on Windows Chrome/Edge. */
  background: rgba(11, 15, 23, .97);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar__right { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand__name { font-weight: 800; letter-spacing: .3px; font-size: 17px; }
.brand__sub { font-size: 12px; color: var(--muted); }
.brand--lg .brand__name { font-size: 20px; }

.balance {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 6px 14px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(242, 184, 75, .16), rgba(242, 184, 75, .06));
  border: 1px solid rgba(242, 184, 75, .35);
}
.balance__label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.balance__value { font-weight: 800; font-size: 17px; color: var(--gold); font-variant-numeric: tabular-nums; }
.user { display: flex; align-items: center; gap: 8px; }
.user__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line);
}
.user__name { font-weight: 600; }

/* ---------- layout ---------- */
.layout {
  max-width: 1280px; margin: 0 auto; padding: 24px 20px 8px;
  display: grid; gap: 20px;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
@media (max-width: 1020px) {
  .layout { grid-template-columns: 1fr; }
  .user__name { display: none; }
}

.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card__title { font-size: 18px; font-weight: 700; }
.card__sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 18px 0 8px; }

/* ---------- status / timer ---------- */
.status { display: flex; align-items: center; gap: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--open { color: var(--ok); border-color: rgba(47, 191, 113, .4); background: rgba(47, 191, 113, .1); }
.badge--open::before { animation: pulse 1.2s infinite; }
.badge--fight { color: var(--meron); border-color: rgba(229, 72, 77, .45); background: var(--meron-soft); }
.badge--fight::before { animation: pulse .7s infinite; }
.badge--wait { color: var(--warn); border-color: rgba(245, 165, 36, .4); background: rgba(245, 165, 36, .1); }
.badge--off { color: var(--err); }
@keyframes pulse { 50% { opacity: .25; } }

.timer { position: relative; width: 52px; height: 52px; }
.timer__ring { width: 52px; height: 52px; transform: rotate(-90deg); }
.timer__track { fill: none; stroke: var(--line); stroke-width: 3; }
.timer__bar { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 100.53; stroke-dashoffset: 0; transition: stroke-dashoffset .9s linear; }
.timer__num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- fight ---------- */
.fight { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
@media (max-width: 640px) { .fight { grid-template-columns: 1fr; } .vs { padding: 4px 0; } }
.fighter {
  border-radius: 12px; padding: 16px; border: 1px solid var(--line);
  background: var(--surface-2); position: relative; overflow: hidden;
}
.fighter::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; }
.fighter--meron { background: linear-gradient(180deg, var(--meron-soft), var(--surface-2) 55%); }
.fighter--meron::before { background: var(--meron); }
.fighter--wala { background: linear-gradient(180deg, var(--wala-soft), var(--surface-2) 55%); }
.fighter--wala::before { background: var(--wala); }
.fighter.is-winner { outline: 2px solid var(--gold); }
.fighter__head { display: flex; justify-content: space-between; align-items: center; }
.corner { font-size: 12px; font-weight: 800; letter-spacing: 2px; }
.fighter--meron .corner { color: var(--meron); }
.fighter--wala .corner { color: var(--wala); }
.tier { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: rgba(242, 184, 75, .12); color: var(--gold); }
.tier:empty { display: none; }
.fighter__name { font-size: 22px; font-weight: 800; margin: 10px 0 2px; overflow-wrap: anywhere; }
.fighter__trainer { font-size: 13px; color: var(--muted); }

.hp { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .08); margin: 12px 0 2px; overflow: hidden; }
.hp__bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--ok), #8be29b); transition: width .6s ease; }
.hp__bar.low { background: linear-gradient(90deg, var(--err), var(--warn)); }

.stats { margin: 14px 0 0; display: grid; gap: 8px; }
.stats div { display: grid; grid-template-columns: 64px 1fr; align-items: center; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; display: flex; align-items: center; gap: 10px; }
.stats b { font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; font-size: 13px; }
.meter { flex: 1; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .5s ease; }
.fighter--meron .meter i { background: var(--meron); }
.fighter--wala .meter i { background: var(--wala); }
.record { margin-top: 12px; font-size: 13px; color: var(--muted); }

.pool { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pool > div { background: rgba(0, 0, 0, .22); border-radius: 8px; padding: 8px 10px; }
.pool__label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.pool__value { font-weight: 800; font-variant-numeric: tabular-nums; }

.vs { display: grid; place-items: center; }
.vs span {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; letter-spacing: 1px; color: #111;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 0 0 6px rgba(242, 184, 75, .12);
}

.split { margin-top: 18px; }
.split__bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line); }
.split__bar i { display: block; height: 100%; width: 50%; transition: width .6s ease; }
.split__a { background: var(--meron); }
.split__b { background: var(--wala); }
.split__legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 13px; }

.idle { text-align: center; padding: 36px 12px 12px; }
.idle__icon { font-size: 44px; }
.idle__title { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.arena.is-idle .fight, .arena.is-idle .split { opacity: .35; filter: grayscale(.6); }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field__label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.input {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 184, 75, .18); }
.input--lg { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side { position: relative; display: block; }
.side input { position: absolute; inset: 0; opacity: 0; pointer-events: none; margin: 0; }
.side span {
  display: grid; gap: 2px; padding: 12px; border-radius: 10px; cursor: pointer; text-align: center;
  border: 2px solid var(--line); background: var(--surface-2); transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.side small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side--meron b { color: var(--meron); }
.side--wala b { color: var(--wala); }
.side--meron input:checked + span { border-color: var(--meron); background: var(--meron-soft); }
.side--wala input:checked + span { border-color: var(--wala); background: var(--wala-soft); }
.side input:focus-visible + span { box-shadow: 0 0 0 3px rgba(242, 184, 75, .3); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 6px 10px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }

.estimate {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: 10px; background: rgba(242, 184, 75, .08);
  border: 1px dashed rgba(242, 184, 75, .35);
}
.estimate strong { color: var(--gold); font-size: 18px; font-variant-numeric: tabular-nums; }
.hint { margin: -6px 0 0; font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; transition: transform .05s, filter .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #16120a; }
.btn--primary:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--muted); }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--lg { padding: 14px 18px; font-size: 16px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }

.notice { min-height: 20px; font-size: 14px; }
.notice.ok { color: var(--ok); }
.notice.err { color: var(--err); }
.notice.wait { color: var(--warn); }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; border: 1px solid; }
.alert--error { color: #ffd6d8; background: rgba(240, 84, 92, .12); border-color: rgba(240, 84, 92, .4); }
.alert--info { color: var(--text); background: var(--surface-2); border-color: var(--line); }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.list li { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }

/* ---------- tables / lists ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid rgba(36, 48, 69, .6); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.pill--win { background: rgba(47, 191, 113, .15); color: var(--ok); }
.pill--loss { background: rgba(240, 84, 92, .15); color: var(--err); }
.pill--refunded, .pill--draw, .pill--void { background: rgba(139, 151, 173, .15); color: var(--muted); }
.pill--pending { background: rgba(245, 165, 36, .15); color: var(--warn); }
.tag-a { color: var(--meron); font-weight: 700; }
.tag-b { color: var(--wala); font-weight: 700; }

.results, .ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.results li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.results .r-top { display: flex; justify-content: space-between; gap: 8px; }
.results .r-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ladder { counter-reset: rank; }
.ladder li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.ladder li::before { counter-increment: rank; content: counter(rank); font-weight: 800; color: var(--muted); text-align: center; }
.ladder li:nth-child(1)::before { color: var(--gold); }
.ladder li:nth-child(2)::before { color: #cfd6e3; }
.ladder li:nth-child(3)::before { color: #d08a52; }
.ladder li.muted::before { content: ""; }
.ladder .l-pts { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.ladder .l-sub { font-size: 12px; color: var(--muted); }

.footer {
  max-width: 1280px; margin: 0 auto; padding: 20px; display: flex; flex-wrap: wrap;
  justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted);
}

/* ---------- login ---------- */
.auth-body { display: grid; place-items: center; padding: 24px 16px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-title { font-size: 20px; margin-top: 8px; }
.auth-card p { margin: 0; }
.auth-foot { font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 360px;
  padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-weight: 600; animation: slidein .25s ease;
}
.toast.ok { border-color: rgba(47, 191, 113, .5); }
.toast.err { border-color: rgba(240, 84, 92, .5); }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* Home button (back to /ragnarok/) */
.home-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
@media (max-width: 560px) {
  .home-link__t { display: none; }
  .home-link { padding: 7px 9px; }
}
