/* Enkelrad Trav – look and feel after atg.se: deep blue header, white cards on light grey,
   condensed italic game labels, the game-type colours (V75/V85 blue, V86 purple, GS75 green, V64 orange, V65 red). */
:root {
  --blue-950: #061a3a;
  --blue-900: #0b2a5b;
  --blue-800: #123c80;
  --blue-700: #1a4f9e;
  --blue-600: #1f63c6;
  --blue-100: #e6eefb;
  --bg: #eef1f5;
  --paper: #ffffff;
  --ink: #1f262c;
  --muted: #66707a;
  --line: #dde2e8;
  --green: #18884a;
  --green-bg: #e1f4e8;
  --red: #d6312a;
  --gold: #b8892b;
  --gold-bg: #fbf1d8;

  --g-v75: #1f6fd1; --g-v85: #2f7fd6; --g-v86: #a5469a; --g-gs75: #3a8a3e; --g-v64: #f08c2c; --g-v65: #d9372c;
  --g-special: #b8892b; --g-dd: #6b3fa0;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(6, 26, 58, .08), 0 2px 10px rgba(6, 26, 58, .05);
  --sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cond: 'Roboto Condensed', 'Arial Narrow', var(--sans);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--blue-600); }
h1, h2, h3 { font-family: var(--cond); font-weight: 700; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { display: block; font: 700 12px var(--cond); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.right { text-align: right !important; }
.center { text-align: center !important; }
code { font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font: 500 14px var(--sans); padding: 9px 16px; border-radius: 6px;
  cursor: pointer; text-decoration: none; transition: background .15s; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn--primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 700; }
.btn--primary:hover { background: var(--blue-700); }
.btn--green { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn--green:hover { background: #127a3f; }
.btn--primary:disabled, .btn--green:disabled { background: #9fb0c4; border-color: #9fb0c4; cursor: default; }
.btn--block { width: 100%; padding: 12px 18px; font-size: 15px; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn--danger { color: var(--red); border-color: #f1c4c1; }
.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; opacity: .8; padding: 0; }
.link:hover { opacity: 1; text-decoration: underline; }
input[type=email], input[type=search], input[type=text], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=password], input:not([type]), select, textarea, .code-input {
  width: 100%; font: 15px var(--sans); padding: 10px 12px; border: 1px solid #c9d1db; border-radius: 6px;
  background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(31, 99, 198, .15); }
label { font-size: 13px; font-weight: 500; color: #3d4752; }
.check { width: 18px; height: 18px; accent-color: var(--blue-600); vertical-align: -4px; }
.check-label { display: inline-flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.alert { padding: 11px 14px; border-radius: 6px; background: var(--blue-100); margin: 0 0 14px; font-size: 14px; }
.alert--ok { background: var(--green-bg); color: #0f5e33; }
.alert--error { background: #fde4e2; color: #9a221c; }
.alert--warn { background: var(--gold-bg); color: #6e5110; }

/* ---------- game-type labels (ATG style) ---------- */
.gt { display: inline-flex; align-items: center; gap: 6px; font: italic 800 15px var(--cond); color: inherit;
  text-transform: uppercase; letter-spacing: .01em; white-space: nowrap; }
.gt::before { content: ''; width: 16px; height: 10px; background: var(--gt, var(--g-v85));
  clip-path: polygon(18% 0, 100% 0, 82% 100%, 0 100%); }
.gt--V75 { --gt: var(--g-v75); } .gt--V85 { --gt: var(--g-v85); } .gt--V86 { --gt: var(--g-v86); }
.gt--GS75 { --gt: var(--g-gs75); } .gt--V64 { --gt: var(--g-v64); } .gt--V65 { --gt: var(--g-v65); }
.gt--special { --gt: var(--g-special); } .gt--dd { --gt: var(--g-dd); }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 700 11px var(--cond); text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.pill--open { background: var(--green-bg); color: var(--green); }
.pill--live { background: #fde4e2; color: var(--red); }
.pill--results { background: var(--blue-100); color: var(--blue-700); }
.pill--upcoming { background: var(--gold-bg); color: #7a5a14; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- top bar ---------- */
.topbar { background: linear-gradient(180deg, var(--blue-800), var(--blue-900)); color: #fff; position: sticky; top: 0;
  z-index: 30; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.topbar__inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
  font: italic 800 22px var(--cond); letter-spacing: .01em; text-transform: uppercase; }
.brand img { height: 40px; width: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.brand small { font: 700 11px var(--cond); letter-spacing: .12em; opacity: .7; display: block; margin-top: -4px; font-style: normal; }
.topnav { display: flex; gap: 2px; flex: 1; }
.topnav a { color: rgba(255,255,255,.8); text-decoration: none; font: 700 15px var(--cond); text-transform: uppercase;
  letter-spacing: .03em; padding: 8px 12px; border-radius: 4px; }
.topnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.topnav a.is-active { color: #fff; box-shadow: inset 0 -3px 0 #ffd23f; border-radius: 0; }
.topnav__dev { color: #ffd23f !important; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin: 0; }
.who__profile { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.who__name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- avatars ---------- */
.av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: #fff;
  border: 2px solid rgba(255,255,255,.85); }
.av--initials { display: inline-flex; align-items: center; justify-content: center; background: #ffd23f; color: var(--blue-900);
  font: 700 13px var(--sans); }
.av--xs { width: 22px; height: 22px; font-size: 10px; border-width: 1px; }
.av--sm { width: 26px; height: 26px; font-size: 11px; border-color: var(--line); }
.av--md { width: 38px; height: 38px; font-size: 15px; border-color: var(--line); }
.av--xl { width: 110px; height: 110px; font-size: 40px; border-color: var(--line); }

/* ---------- live stats ---------- */
.livestats { display: flex; gap: 14px; font-size: 13px; color: rgba(255,255,255,.85); }
.livestats__item { display: inline-flex; align-items: center; gap: 5px; position: relative; }
.livestats__dot { width: 8px; height: 8px; border-radius: 50%; background: #47d17c; box-shadow: 0 0 0 3px rgba(71,209,124,.25); }
.onlinewho { cursor: default; }
.onlinepop { display: none; position: absolute; top: 28px; right: -10px; min-width: 240px; background: #fff; color: var(--ink);
  border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.2); padding: 12px; z-index: 40; }
.onlinewho:hover .onlinepop, .onlinewho:focus .onlinepop { display: block; }
.onlinepop ul { list-style: none; margin: 8px 0 0; padding: 0; }
.onlinepop li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.onlinepop__name { flex: 1; }
.onlinepop__since, .onlinepop__more { color: var(--muted); font-size: 12px; }
.onlinepop__title { font-size: 12px; }
.livestats--login { color: var(--muted); justify-content: center; }

main.wrap { padding-top: 22px; padding-bottom: 40px; min-height: 70vh; }
.footer { color: var(--muted); font-size: 12.5px; padding: 18px 16px 30px; text-align: center; }

/* ---------- install banner ---------- */
.installbanner { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 16px; border-left: 4px solid var(--green); }
.installbanner img { border-radius: 9px; flex: none; }
.installbanner__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.installbanner__close { font-size: 16px; padding: 4px 6px; }
/* installed app: room for the iPhone status bar */
@media (display-mode: standalone) { .topbar { padding-top: env(safe-area-inset-top); } }

/* ---------- login ---------- */
.login-page { background: radial-gradient(1200px 600px at 50% -10%, var(--blue-700), var(--blue-950)); min-height: 100vh; }
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; }
.login__card { width: 100%; max-width: 440px; background: #fff; border-radius: 12px; padding: 26px 28px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login__logos { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.login__logo--main { width: 230px; height: auto; }
.login__logo--side { width: 78px; height: auto; }
.login__event { text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 14px 0; margin: 4px 0 18px; }
.login__event h2 { font-size: 22px; margin: 2px 0 6px; }
.login__comps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.login__clock { margin-top: 10px; }
.login__form { display: flex; flex-direction: column; gap: 10px; }
.login__form p { margin: 2px 0 0; }
.login__foot { color: rgba(255,255,255,.7); font-size: 13px; margin-top: 18px; }
.remember { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.code-input { font: 700 26px var(--sans); letter-spacing: 10px; text-align: center; }
.code-input--sm { font-size: 20px; letter-spacing: 6px; }

/* ---------- countdown ---------- */
.countdown { display: inline-flex; gap: 6px; justify-content: center; }
.countdown span { display: flex; flex-direction: column; align-items: center; min-width: 46px; padding: 6px 4px;
  background: var(--blue-900); color: #fff; border-radius: 6px; }
.countdown b { font: 700 20px var(--cond); line-height: 1; }
.countdown small { font-size: 10px; text-transform: uppercase; opacity: .75; letter-spacing: .05em; }
.countdown__done { font-size: 13px; color: var(--red); font-style: normal; font-weight: 700; }
.countdown--inline span { background: var(--blue-100); color: var(--blue-900); min-width: 40px; }

/* ---------- page header / competition ---------- */
.event { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.event__title { display: flex; align-items: center; gap: 14px; }
.event__title img { height: 58px; width: auto; }
.event__meta { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.event__side { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font: 700 15px var(--cond); text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--blue-900); border-bottom-color: var(--blue-600); }
.tabs img { height: 18px; vertical-align: -4px; margin-right: 4px; }

/* round chooser */
.rounds { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: thin; }
.roundchip { flex: none; display: flex; flex-direction: column; gap: 2px; min-width: 132px; padding: 9px 12px; border-radius: 8px;
  background: #fff; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border: 2px solid transparent; }
.roundchip:hover { border-color: var(--blue-100); }
.roundchip.is-active { border-color: var(--blue-600); }
.roundchip__day { font-size: 12.5px; color: var(--muted); text-transform: capitalize; }
.roundchip .pill { align-self: flex-start; margin-top: 3px; }

.roundhead { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; background: linear-gradient(90deg, var(--blue-900), var(--blue-700)); color: #fff;
  border-radius: var(--radius) var(--radius) 0 0; }
.roundhead .gt { font-size: 26px; }
.roundhead__meta { opacity: .85; font-size: 14px; }
.roundhead__right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.roundhead .countdown span { background: rgba(255,255,255,.15); }
.roundbody { background: #fff; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 18px; }

/* ---------- pick view ---------- */
.picktools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--bg); border-radius: 6px; padding: 3px; }
.seg button { border: 0; background: none; font: 700 13px var(--cond); text-transform: uppercase; letter-spacing: .03em;
  padding: 7px 12px; border-radius: 4px; cursor: pointer; color: var(--muted); }
.seg button.is-active { background: #fff; color: var(--blue-900); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.savestate { font-size: 13px; color: var(--muted); }
.savestate--ok { color: var(--green); }
.savestate--err { color: var(--red); }
.progress { display: flex; gap: 3px; }
.progress i { width: 26px; height: 22px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center;
  font: 700 12px var(--cond); font-style: normal; opacity: .35; cursor: pointer; }
.progress i.is-done { opacity: 1; }

.legs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.leg { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.leg__head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f6f8fb; border-bottom: 1px solid var(--line); }
.avd { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 4px; font: italic 800 17px var(--cond); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.leg__title { flex: 1; min-width: 0; }
.leg__title strong { font: 700 15px var(--cond); text-transform: uppercase; display: block; }
.leg__title span { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg__dd { font: italic 800 11px var(--cond); background: var(--g-dd); color: #fff; padding: 2px 6px; border-radius: 3px; text-transform: uppercase; }
.starts { width: 100%; border-collapse: collapse; font-size: 14px; }
.starts td { padding: 6px 8px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
.starts tr:last-child td { border-bottom: 0; }
.starts tr.is-pick { background: #e8f1ff; }
.starts tr.is-pick td:first-child { box-shadow: inset 4px 0 0 var(--blue-600); }
.starts tr.is-scratched { opacity: .45; text-decoration: line-through; }
.starts tr.pickable { cursor: pointer; }
.starts tr.pickable:hover { background: #f3f7fd; }
.starts tr.is-pick:hover { background: #dce9fd; }
.num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px; border-radius: 3px;
  font: 700 14px var(--cond); border: 1px solid #c9d1db; background: #fff; color: var(--ink); }
.starts .horse strong { font-weight: 700; text-transform: uppercase; font-family: var(--cond); font-size: 15px; letter-spacing: .01em; }
.starts .horse small { display: block; color: var(--muted); font-size: 12px; }
.starts .odds { text-align: right; font-weight: 700; font-family: var(--cond); color: #3d4752; white-space: nowrap; }
.starts .radio { width: 44px; text-align: center; }
.radio-dot { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #b7c2cf; background: #fff; color: var(--ink); font: 700 14px var(--cond); transition: background .1s, border-color .1s; }
.pickable:hover .radio-dot { border-color: var(--blue-600); }
.is-pick .radio-dot { border-color: var(--blue-600); background: var(--blue-600); color: #fff; }
.ddbox { width: 46px; text-align: center; }
.ddtoggle { position: relative; display: inline-flex; cursor: pointer; margin: 0; }
.ddtoggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ddtoggle span { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 26px;
  border: 2px solid var(--g-dd); border-radius: 5px; background: #fff; color: var(--g-dd);
  font: italic 800 13px var(--cond); letter-spacing: .02em; transition: background .1s, color .1s; }
.ddtoggle:hover span { background: #f3eefa; }
.ddtoggle input:checked + span { background: var(--g-dd); color: #fff; }
.ddtoggle input:focus-visible + span { box-shadow: 0 0 0 3px rgba(107, 63, 160, .3); }
.hot .hot__dd { position: absolute; right: 6px; bottom: 4px; }
.leg__foot { padding: 6px 12px; font-size: 12px; color: var(--muted); background: #fafbfc; border-top: 1px solid var(--line); }

.ddsum { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 8px;
  background: #f3eefa; border: 1px solid #e0d4f0; margin-bottom: 14px; font-size: 14px; }
.ddsum img { height: 34px; }
.ddsum strong { font-family: var(--cond); font-size: 16px; }
.ddsum--bad { background: #fde4e2; border-color: #f4c1bd; }

/* race card view */
.cardview { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: start; }
.cardnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cardnav button { border: 0; cursor: pointer; }
.cardpage { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.cardpage img { display: block; width: 100%; height: auto; }
.hot { position: absolute; border-radius: 4px; cursor: pointer; transition: background .1s, box-shadow .1s; }
.hot:hover { background: rgba(31, 99, 198, .10); box-shadow: inset 0 0 0 2px rgba(31, 99, 198, .45); }
.hot.is-pick { background: rgba(31, 99, 198, .16); box-shadow: inset 0 0 0 3px var(--blue-600); }
.hot.is-pick::after { content: '✓ Ditt val'; position: absolute; right: 6px; top: 4px; background: var(--blue-600); color: #fff;
  font: 700 11px var(--cond); text-transform: uppercase; padding: 2px 6px; border-radius: 3px; }
.hot.is-scratched { background: rgba(214, 49, 42, .08); cursor: not-allowed; }
.cardnav .btn[data-full], .fulltools { margin-left: auto; }
.fulltools { display: flex; align-items: center; gap: 6px; }
.cardscroll { overflow-x: auto; }
.cardpages { min-width: 100%; }
#pick.pick--full { position: fixed; inset: 0; z-index: 100; background: #fff; overflow: auto; padding: 10px 12px 30px; }
#pick.pick--full .seg, #pick.pick--full .cardside, #pick.pick--full .savestate { display: none; }
#pick.pick--full .cardview { grid-template-columns: 1fr; }
#pick.pick--full .cardnav { position: sticky; top: -10px; z-index: 3; background: #fff; padding: 8px 0; margin: 0; }
body.noscroll { overflow: hidden; }
.cardside { position: sticky; top: 76px; }
.cardside .card { padding: 12px; }
.minirow { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.minirow li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #eef1f4; cursor: pointer; }
.minirow li.is-current { font-weight: 700; }
.minirow .avd { min-width: 24px; height: 22px; font-size: 13px; }

/* ---------- result matrix ---------- */
.matrix-wrap { overflow-x: auto; border-radius: 6px; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13.5px; width: 100%; }
.matrix th, .matrix td { padding: 6px 8px; border-bottom: 1px solid #edf0f3; white-space: nowrap; }
.matrix thead th { position: sticky; top: 0; background: #fff; font: 700 13px var(--cond); text-transform: uppercase;
  cursor: pointer; user-select: none; z-index: 1; }
.matrix thead th.leghead { padding: 4px; text-align: center; }
.matrix thead th.leghead .avd { min-width: 34px; height: 26px; font-size: 14px; white-space: nowrap; }
.replay { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 4px;
  border-radius: 50%; background: var(--blue-600); color: #fff; font-size: 10px; text-decoration: none; vertical-align: middle; }
.replay:hover { background: var(--blue-800); }
.avd__leg { display: block; font: 700 10px var(--cond); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 2px; }
.matrix thead th.sorted::after { content: ' ▾'; color: var(--blue-600); }
.matrix thead th.sorted.asc::after { content: ' ▴'; }
.matrix .sticky { position: sticky; left: 0; background: #fff; z-index: 2; }
.matrix thead .sticky { z-index: 3; }
.matrix .pos { width: 34px; text-align: center; color: var(--muted); font-weight: 700; }
.matrix .who { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.matrix .pts { text-align: right; font: 700 15px var(--cond); }
.matrix .tot { text-align: right; font: 700 15px var(--cond); background: #f6f8fb; }
.matrix .cell { text-align: center; font-size: 12.5px; min-width: 64px; }
.cell[data-tip] { position: relative; cursor: default; outline: none; }
.cell[data-tip]:hover::after, .cell[data-tip]:focus::after {
  content: attr(data-tip); position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  white-space: pre; text-align: left; background: var(--blue-950); color: #fff; font: 500 12.5px/1.45 var(--sans);
  padding: 7px 10px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: none; }
.matrix tbody tr:nth-child(-n+2) .cell[data-tip]:hover::after, .matrix tbody tr:nth-child(-n+2) .cell[data-tip]:focus::after {
  bottom: auto; top: calc(100% + 4px); }
.cell__horse { display: block; max-width: 92px; overflow: hidden; text-overflow: ellipsis; color: #3d4752; }
.cell__n { font: 700 12px var(--cond); color: var(--muted); }
.cell--res { font: 700 14px var(--cond); }
.cell--zero { color: #b5bdc6; }
.cell--won { background: #ffe9a6; color: #5a4000; }
.cell--placed { background: var(--green-bg); color: #0f5e33; }
.cell--reserve .cell__horse::before, .cell--reserve.cell--res::before { content: 'R '; color: var(--red); font-size: 10px; }
.matrix tr.is-me td { background: #eef5ff; }
.matrix tr.is-me .sticky { background: #eef5ff; }
.matrix .ddcol { background: #f7f3fc; }
.matrix tr:hover td { background: #f9fbfd; }
.rank1 .pos { color: #b8892b; } .rank2 .pos { color: #8a96a3; } .rank3 .pos { color: #a5683c; }
.medal { font-size: 15px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 4px; }

/* leaderboards */
.board { width: 100%; border-collapse: collapse; }
.board th { text-align: left; font: 700 12px var(--cond); text-transform: uppercase; color: var(--muted); padding: 8px 10px;
  border-bottom: 2px solid var(--line); }
.board td { padding: 9px 10px; border-bottom: 1px solid #edf0f3; }
.board .pts { text-align: right; font: 700 17px var(--cond); }
.board .rnd { text-align: right; color: var(--muted); font-size: 13px; }
.board tr.is-me td { background: #eef5ff; }
.board tr.podium td { background: #fffbef; }

/* home */
.comps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.comp { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.comp__head { padding: 16px 18px; background: linear-gradient(90deg, var(--blue-900), var(--blue-700)); color: #fff; }
.comp__head h2 { font-size: 23px; }
.comp__body { padding: 14px 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.comp__rounds { display: flex; gap: 6px; flex-wrap: wrap; }
.comp__foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; align-items: center; }


/* profile */
.profile { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.profile__current { padding: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile__choices { display: flex; flex-direction: column; gap: 16px; }
.profile__box { padding: 18px 20px; }
.profile__box h2 { margin-bottom: 4px; }
.contactform { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; flex-wrap: wrap; }
.contactform label { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.contactform--verify { flex-direction: column; align-items: stretch; }
.contactform__row { display: flex; gap: 8px; }
.mailprefs { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.avgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.avgrid form { margin: 0; }
.avpick { width: 100%; border: 2px solid var(--line); background: #fff; border-radius: 8px; padding: 10px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font: 12px var(--sans); color: var(--ink); }
.avpick:hover { border-color: var(--blue-100); }
.avpick.is-selected { border-color: var(--blue-600); background: #f3f8ff; }
.cropper { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.cropper__frame { width: 220px; height: 220px; overflow: hidden; border-radius: 50%; position: relative; background: var(--bg);
  touch-action: none; cursor: grab; }
.cropper__frame img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; -webkit-user-drag: none; }

.joindlg { border: 0; border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.joindlg::backdrop { background: rgba(6, 26, 58, .55); }
.joindlg__card { padding: 24px; width: min(440px, 92vw); display: flex; flex-direction: column; gap: 12px; }
.joindlg__card p { margin: 0; }
.joindlg__swish { display: flex; gap: 14px; align-items: center; background: var(--bg); border-radius: 8px; padding: 12px; }
.joindlg__swish img { width: 120px; height: 120px; border-radius: 6px; flex: none; }
.joindlg__actions { display: flex; gap: 8px; }
.phonedlg { border: 0; border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.phonedlg::backdrop { background: rgba(6, 26, 58, .55); }
.phonedlg__card { padding: 24px; width: min(400px, 90vw); display: flex; flex-direction: column; gap: 10px; }
.phonedlg__icon { font-size: 30px; }
.phonedlg label { display: flex; flex-direction: column; gap: 4px; }
.phonedlg__actions { display: flex; gap: 8px; }

/* ---------- admin ---------- */
.admin-tabs { margin-top: 2px; }
.admin h1 { font-size: 26px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 700 12px var(--cond); text-transform: uppercase; color: var(--muted); padding: 8px 10px;
  border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid #edf0f3; vertical-align: middle; }
.table-card { padding: 6px 10px 10px; overflow-x: auto; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.formgrid label { display: flex; flex-direction: column; gap: 4px; }
.box { padding: 16px 18px; margin-bottom: 14px; }
.calendar { display: flex; flex-direction: column; gap: 10px; }
.week { display: grid; grid-template-columns: 70px repeat(7, 1fr); gap: 6px; align-items: stretch; }
.week__no { font: 700 13px var(--cond); color: var(--muted); padding-top: 8px; text-transform: uppercase; }
.day { background: #f6f8fb; border-radius: 6px; padding: 6px; min-height: 64px; display: flex; flex-direction: column; gap: 4px; }
.day__date { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.gamebox { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 6px; cursor: pointer; font-size: 12px; }
.gamebox:has(input:checked) { border-color: var(--blue-600); background: #eef5ff; }
.gamebox .gt { font-size: 13px; }
.gamebox small { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.2; }
.quick { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.quick label { display: flex; flex-direction: column; gap: 4px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.picksgrid td.cnum { text-align: center; font: 700 14px var(--cond); }
.picksgrid td.cnum.empty { background: #fdf0ef; }
.userlist__tools { display: flex; gap: 10px; align-items: center; padding: 8px 4px 12px; flex-wrap: wrap; }
.userlist__tools input { max-width: 280px; }
.userrow summary { display: flex; align-items: center; gap: 12px; padding: 10px 6px; cursor: pointer; list-style: none;
  border-bottom: 1px solid #edf0f3; }
.userrow summary::-webkit-details-marker { display: none; }
.userrow__who { flex: 1; min-width: 0; }
.userrow__who strong { display: block; }
.userrow__edit { padding: 12px 10px 16px 56px; background: #fafbfc; border-bottom: 1px solid #edf0f3; display: flex; flex-direction: column; gap: 10px; }
.badge { display: inline-block; font: 700 11px var(--cond); text-transform: uppercase; padding: 2px 7px; border-radius: 99px;
  background: var(--bg); color: var(--muted); }
.badge--ok { background: var(--green-bg); color: var(--green); }
.badge--admin { background: var(--blue-100); color: var(--blue-700); }
.badge--paid { background: var(--gold-bg); color: #7a5a14; }
.userstatus { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 210px; text-align: right; }
.badge--err { background: #fde4e2; color: #9a221c; }
.mailtable { margin-top: 4px; }
.mailtable td, .mailtable th { padding: 5px 8px; }
@media (max-width: 640px) { .userstatus { min-width: 0; } .userrow summary { flex-wrap: wrap; } }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2fbf6b; margin-right: 4px; }

@media (max-width: 900px) {
  .cardview { grid-template-columns: 1fr; }
  .cardside { position: static; }
  .profile { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(2, 1fr); }
  .week__no { grid-column: 1 / -1; padding: 0; }
}
.topnav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar__inner > * { flex-shrink: 0; }
.topbar__inner > .topnav { flex-shrink: 1; }
body { overflow-x: hidden; }
@media (max-width: 640px) {
  .topbar__inner { gap: 10px; }
  .brand img { height: 32px; }
  .who .link { font-size: 12px; }
  .brand span { display: none; }
  .topnav a { padding: 8px 7px; font-size: 13px; }
  .who__name, .livestats { display: none; }
  h1 { font-size: 24px; }
  .legs { grid-template-columns: 1fr; }
  .roundhead .gt { font-size: 21px; }
}
