/* Off-Meta: base styles. Fonts, colours, page layout, header and tabs, buttons, dialogs, settings, loading, accessibility, effects. */
@font-face { font-family: "Oxanium"; src: url("../fonts/oxanium.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0a1020; --bg2: #121b33; --card: #17223f; --line: #2a3a63; --text: #e9ecf5; --muted: #94a0bf; --gold: #e4b54f;
  --gold2: #f6d98b; --bad: #ef5d6a; --good: #5fd39a; --font-display: "Oxanium", "Segoe UI", sans-serif;
  --font-ui: "Inter", system-ui, "Segoe UI", Roboto, sans-serif; --common: #a7b0c2; --rare: #4ea4ff; --epic: #b678ff;
  --legendary: #ff9a3c; --mythic: #ff4f7b; --gem: #6ff0ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* hidden always wins over layout rules like .row { display: flex } */
html, body { margin: 0; }
body {
  font-family: var(--font-ui); color: var(--text); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 600px at 50% -200px, #1e2d58 0%, var(--bg) 60%) fixed, var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
button { font: inherit; cursor: pointer; }
.top {
  display: flex; gap: 20px; align-items: center; position: relative; z-index: 100; padding: 12px 20px;
  background: rgba(10, 16, 32, .7); backdrop-filter: blur(6px);
}
.brand-mark {
  width: 40px; height: 40px; margin: -3px -2px -3px 0; filter: drop-shadow(0 0 8px rgba(111, 240, 255, .35));
  transition: transform .4s cubic-bezier(.2, 1.6, .4, 1);
}
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.08); }
.w-off, .w-meta { -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.w-off { color: var(--gold2); background-image: linear-gradient(180deg, #fff3cc 0%, #f6d98b 45%, #d9a441 100%); }
.w-meta { color: var(--gem); background-image: linear-gradient(180deg, #e6fdff 0%, #6ff0ff 45%, #2fb8d8 100%); }
.brand-word {
  font-family: var(--font-display); font-weight: 900; font-size: 23px; letter-spacing: .04em; line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .5));
}
.tabs button, .icon-btn {
  background: transparent; color: var(--muted); border: 1px solid transparent; padding: 7px 12px; border-radius: 8px;
}
.tabs button:hover, .icon-btn:hover { color: var(--text); }
.tabs button.active, .icon-btn.active { color: var(--gold2); border-color: var(--line); background: var(--bg2); }
/* Right-side tools: help + settings */
.tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 17px; font-weight: 800;
  border-color: var(--line); border-radius: 50%; transition: color .15s, transform .2s, border-color .15s;
}
.icon-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
#settings-btn { font-size: 19px; font-weight: 400; }
#settings-btn[aria-expanded="true"] { color: var(--gold2); border-color: var(--gold); transform: rotate(60deg); }
.settings { position: relative; }
.settings-title { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; cursor: pointer; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting input[type="range"] { width: 110px; accent-color: var(--gold); }
.setting input[type="range"]:disabled { opacity: .4; }
.switch {
  appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--line); position: relative;
  cursor: pointer; transition: background .2s; margin: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform .2s cubic-bezier(.3, 1.5, .5, 1);
}
.switch:checked { background: var(--gold); }
.switch:checked::after { transform: translateX(18px); background: #1a1406; }
.small { font-size: 13px; margin: 10px 0 0; }
.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; padding: 24px 24px 20px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-top: 2px solid var(--gold);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.modal[open] { animation: modalIn .3s cubic-bezier(.2, 1.4, .4, 1); }
.modal.closing { animation: modalOut .18s ease-in forwards; }
.modal::backdrop { background: rgba(5, 8, 18, .7); backdrop-filter: blur(3px); }
.modal h2 { margin: 0 0 12px; color: var(--gold2); }
.modal h3 { margin: 18px 0 6px; font-size: 16px; color: var(--gold2); }
.modal p { line-height: 1.5; margin: 8px 0; }
.modal .big { margin-top: 16px; }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; background: transparent;
  border: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.modal-close:hover { color: var(--text); border-color: var(--gold); }
.view { animation: fade .25s ease; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.panel h2 { margin-top: 0; color: var(--gold2); }
.muted { color: var(--muted); }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.sub { color: var(--muted); margin-top: 8px; font-size: 14px; }
.big {
  background: var(--gold); color: #1a1406; border: 0; font-weight: 700; border-radius: 10px; padding: 13px 22px;
  font-size: 17px; margin-top: 14px; width: 100%;
}
.ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; }
.common { --tc: var(--common); }
.rare { --tc: var(--rare); }
.epic { --tc: var(--epic); }
.mythic { --tc: var(--mythic); }
.gem { --tc: var(--gem); }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.all { text-align: left; margin-top: 14px; }
.all h4 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.row select { font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.link-btn {
  background: none; border: 0; padding: 4px 8px; color: #5d6886; font-size: 12px; text-decoration: underline;
  text-underline-offset: 3px; transition: color .15s;
}
.link-btn:hover { color: var(--muted); }
.tabs button:hover { transform: translateY(-1px); }
.tabs button:active, .icon-btn:active, .big:active, .ghost:active { transform: scale(.94); }
.big, .ghost { transition: transform .1s, background .15s, box-shadow .2s; }
.big:hover { background: var(--gold2); box-shadow: 0 0 18px rgba(228, 181, 79, .45); }
.ghost:hover { border-color: var(--gold); }
.brand {
  display: flex; align-items: center; gap: 9px; white-space: nowrap; background: none; border: 0; padding: 0;
  color: inherit; cursor: pointer; animation: brandGlow 4s ease-in-out infinite;
}
/* Reduce motion: follows the OS setting by default, can be changed in Settings */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
}
h2, h3 { font-family: var(--font-display); letter-spacing: .02em; }
.panel h2, .modal h2 { font-weight: 800; }
.loader {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: radial-gradient(900px 500px at 50% 30%, #1e2d58, var(--bg) 70%);
  transition: opacity .5s ease, visibility .5s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-mark {
  width: 72px; height: 72px; filter: drop-shadow(0 0 18px rgba(111, 240, 255, .45));
  animation: loaderGem 1.4s ease-in-out infinite;
}
.loader-word { font-family: var(--font-display); font-weight: 900; font-size: 30px; letter-spacing: .05em; }
.loader-bar { width: 140px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.loader-bar i {
  display: block; height: 100%; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gem)); animation: loaderBar 1s ease-in-out infinite;
}
.banner {
  position: relative; z-index: 90; text-align: center; font-size: 14px; padding: 8px 16px; background: #3a2a10;
  color: var(--gold2); border-bottom: 1px solid #6b4e1c;
}
.error-state { text-align: center; margin-top: 30px; }
.img-fallback {
  width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted); font-weight: 800; font-size: 14px;
}
.empty { text-align: center; padding: 10px 0; }
#stats-btn svg { fill: currentColor; }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-tile { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat-tile b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--gold2); line-height: 1.1; }
.stat-tile span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.dist { display: grid; gap: 6px; }
.dist-row { display: flex; align-items: center; gap: 10px; }
.dist-label { width: 54px; font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.dist-track { flex: 1; }
.dist-bar {
  display: block; width: var(--w); min-width: 26px; padding: 3px 8px; border-radius: 6px; background: var(--line);
  font-size: 13px; font-weight: 700; text-align: right; animation: barGrow .6s cubic-bezier(.2, 1, .4, 1) backwards;
  transform-origin: left;
}
.dist-bar.today { background: linear-gradient(90deg, var(--gold), var(--gold2)); color: #1a1406; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gem); outline-offset: 3px; border-radius: 6px; }
/* already has a gold focus border */
.switch:focus-visible { outline-offset: 2px; border-radius: 999px; }
.dev-panel { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.dev-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dev-buttons .ghost { padding: 7px 8px; font-size: 13px; }
.dev .brand::after {
  content: "DEV"; font: 800 10px var(--font-ui); letter-spacing: .1em; color: #1a1406; background: var(--gold);
  border-radius: 4px; padding: 2px 5px; margin-left: 2px;
}
.dev-btn { border-style: dashed; }
.ghost.copied { border-color: var(--good); color: var(--good); }
.text-input {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); outline: none;
}
.text-input:focus { border-color: var(--gold); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--font-display); font-weight: 800; }
.you {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #1a1406;
  background: var(--gem); border-radius: 4px; padding: 1px 4px; vertical-align: middle;
}
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.view-title { margin: 3px 0 0; font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1.15; color: var(--text); }
.view-side { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pill {
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--bg2);
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.lead { margin-top: 0; line-height: 1.55; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; position: relative; }
.tabs button { transition: color .15s, transform .15s, background .15s; position: relative; z-index: 1; }
.tabs button.active { background: transparent; border-color: transparent; }
.tab-ink {
  position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; border-radius: 8px; background: var(--bg2);
  border: 1px solid var(--line); box-shadow: 0 0 14px rgba(228, 181, 79, .12);
  transition: transform .38s cubic-bezier(.3, 1.25, .5, 1), width .38s cubic-bezier(.3, 1.25, .5, 1), opacity .2s;
}
main > .view { width: 100%; }
/* The view (heading + card) sits in the middle of the space between header and footer.
   Areas that grow during play keep a fixed minimum height so nothing jumps while you type. */
main {
  width: 100%; max-width: 680px; margin: 0 auto; flex: 1; display: flex; flex-direction: column;
  justify-content: center; padding: 14px 16px 18px;
}
.standings { margin: 6px 0 14px; display: grid; gap: 6px; text-align: left; }
.standings-head {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 2px;
}
.standing {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--bg2);
  border: 1px solid var(--line);
}
.standing.me { border-color: rgba(111, 240, 255, .45); }
.st-rank { font-family: var(--font-display); font-weight: 800; color: var(--gold2); width: 18px; }
.st-name { flex: 1; font-weight: 600; }
.st-wins { color: var(--muted); font-size: 13px; font-weight: 600; }
.stats-section { margin-top: 18px; }
/* Legal link lives in the settings menu (no footer, so pages fit the screen) */
.settings-legal {
  display: block; margin: 6px auto 0; padding: 6px 0 2px; width: 100%; text-align: center;
  border-top: 1px solid var(--line);
}
.settings-menu {
  position: absolute; right: 0; top: calc(100% + 10px); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); animation: menuIn .18s ease-out;
  width: 250px; z-index: 10;
}

@media (max-width: 560px) {
  .tabs { order: 3; width: 100%; }
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .tabs button { flex: 1; padding: 9px 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .brand-word { font-size: 21px; }
  .stat-tile b { font-size: 24px; }
  .modal { padding: 20px 16px 16px; }
  .actions .ghost { flex: 1 1 40%; }
  .settings-menu { right: 0; max-width: calc(100vw - 24px); }
  .view-side { justify-content: flex-start; }
  .pill { padding: 3px 9px; font-size: 11.5px; }
  .panel { padding: 14px 14px; }
  .view-title { font-size: 20px; margin-top: 0; }
  main { padding-top: 10px; padding-bottom: 0; }
}

/* Animations */
@keyframes menuIn { from { transform: translateY(-6px) scale(.97); } }
@keyframes timerPulse { to { box-shadow: 0 0 16px rgba(239, 93, 106, .5); } }
@keyframes modalIn { from { transform: translateY(16px) scale(.94); } }
@keyframes modalOut { to { transform: translateY(10px) scale(.95); opacity: 0; } }
@keyframes fade { from { transform: translateY(4px); } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.06); } }
@keyframes boom { 0% { transform: scale(1); } 30% { transform: scale(2.4); filter: brightness(3) saturate(2); opacity: .9; } 60% { transform: scale(.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes brandGlow { 50% { text-shadow: 0 0 14px rgba(246, 217, 139, .55); } }
@keyframes drop { from { transform: translateY(-24px) scale(.96); opacity: 0; } }
@keyframes shine { to { transform: translateX(100%); } }
@keyframes slam { from { transform: translateY(-14px) scale(1.06); opacity: 0; } }
@keyframes missShake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes glowPulse { 0% { box-shadow: 0 0 0 0 var(--tc); } 30% { box-shadow: 0 0 28px 2px var(--tc); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes gemIn { 0% { transform: scale(.4) rotate(-4deg); opacity: 0; } 60% { transform: scale(1.08) rotate(1deg); opacity: 1; } }
@keyframes gemGlow { 0%, 100% { box-shadow: 0 0 0 1px var(--gem), 0 0 18px rgba(111, 240, 255, .25); } 50% { box-shadow: 0 0 0 1px var(--gem), 0 0 34px rgba(111, 240, 255, .55); } }
@keyframes iconPop { from { transform: scale(0) rotate(-30deg); } }
@keyframes pipPulse { 50% { background: #3d5189; box-shadow: 0 0 8px rgba(228, 181, 79, .35); } }
@keyframes pipPop { from { transform: scaleY(2.2) scaleX(1.3); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes chipIn { from { transform: scale(.3); opacity: 0; } }
@keyframes toss { 0% { transform: scale(1); } 40% { transform: translateY(-30px) scale(1.25) rotate(20deg); } }
@keyframes hurt { 0%, 100% { background: var(--card); } 20% { background: #5a1b25; transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } }
@keyframes shieldGlow { 50% { box-shadow: 0 0 18px rgba(78, 164, 255, .6); } }
@keyframes holderIn { from { transform: scale(.6); opacity: 0; } }
@keyframes dangerTint { 50% { filter: drop-shadow(0 0 22px rgba(239, 93, 106, .25)); } }
@keyframes loaderGem { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(6deg) translateY(-8px); } }
@keyframes loaderBar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes barGrow { from { transform: scaleX(0); } }
@keyframes swapIn { from { opacity: 0; transform: translateY(10px) scale(.99); } }
