/* Olympic Clash Live. Mobile first, no framework. Colours are tokens so dark mode is one block. */
:root {
  --navy: #131A31;
  --navy-2: #1D2647;
  --navy-3: #2B3663;
  --bg: #F2F3F7;
  --card: #FFFFFF;
  --ink: #131A31;
  --ink-2: #3B4260;
  --muted: #666E89;
  --line: #E3E5EC;
  --soft: #F5F6FA;
  --red: #D62027;
  --live: #E11D48;
  --ok: #16A34A;
  --amber: #B45309;
  --gold: #C99A06;
  --silver: #8A94A6;
  --bronze: #B06A3B;
  --r-blue: #4F86D9;
  --r-orange: #F27A21;
  --r-yellow: #F5C518;
  --r-purple: #8E44AD;
  --r-red: #E23B3B;
  --r-green: #39A84F;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(19, 26, 49, .05), 0 6px 18px rgba(19, 26, 49, .06);
  --tabbar: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1020;
    --card: #151C35;
    --ink: #EEF0F8;
    --ink-2: #C9CDE0;
    --muted: #97A0BE;
    --line: #26304F;
    --soft: #1C2442;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
img { max-width: 100%; }
h1 { font-size: 22px; line-height: 1.2; margin: 4px 0 12px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--ink-2); }
p { margin: 0 0 10px; }
:focus-visible { outline: 3px solid var(--r-blue); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 54px;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  background: var(--navy); color: #fff;
}
.top-brand img { display: block; height: 30px; width: auto; }
.status {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 999px; padding: 6px 11px;
  background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .88);
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.status.off .dot { background: #F59E0B; }
.status.live .dot { background: #FF4D6D; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); } 70% { box-shadow: 0 0 0 8px rgba(255, 77, 109, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); } }

main { display: block; max-width: 720px; margin: 0 auto; padding: 12px 16px 28px; outline: none; }
.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--r-blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hero */
.hero {
  margin: -12px -16px 14px;
  padding: 22px 16px 20px;
  text-align: center; color: #fff;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(79, 134, 217, .22), transparent 60%),
    radial-gradient(90% 60% at 100% 100%, rgba(142, 68, 173, .18), transparent 60%),
    var(--navy);
  border-radius: 0 0 26px 26px;
}
.hero .lockup { display: block; width: min(74%, 300px); height: auto; margin: 0 auto 12px; }
.hero-meta { margin: 0 0 14px; color: rgba(255, 255, 255, .86); font-size: 14px; }
.hero-meta strong { color: #fff; }
.countdown { display: flex; justify-content: center; gap: 8px; }
.cd { min-width: 64px; padding: 8px 6px 7px; border-radius: 12px; background: rgba(255, 255, 255, .08); }
.cd b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .7); }
.nownext { display: grid; gap: 6px; max-width: 360px; margin: 0 auto; text-align: left; }
.nownext div { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .08); }
.nownext small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .65); }

/* Cards and lists */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 0 0 12px; }
@media (prefers-color-scheme: dark) { .card { border: 1px solid var(--line); } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; font-weight: 600; color: var(--r-blue); text-decoration: none; }
.back { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 8px; color: var(--muted); font-size: 14px; text-decoration: none; }
.back::before { content: "‹"; font-size: 20px; line-height: 1; }
.notice { padding: 12px 14px; border-radius: 12px; background: rgba(245, 197, 24, .13); border: 1px solid rgba(245, 197, 24, .45); font-size: 14px; }
.notice + .notice { margin-top: 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.bullets { margin: 0; padding-left: 20px; }
ul.bullets li { margin: 0 0 6px; }
.rowlink { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); text-decoration: none; }
.rowlink:first-child { border-top: 0; }
.rowlink .grow { flex: 1; min-width: 0; }
.rowlink::after { content: "›"; color: var(--muted); font-size: 22px; line-height: 1; }
.rowlink small { display: block; color: var(--muted); font-size: 13px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  min-height: 94px; padding: 12px 6px;
  border-radius: 14px; background: var(--card); box-shadow: var(--shadow);
  text-decoration: none; text-align: center; font-size: 12.5px; font-weight: 700; line-height: 1.2;
}
@media (prefers-color-scheme: dark) { .tile { border: 1px solid var(--line); } }
.tile .ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; background: var(--soft); background: color-mix(in srgb, var(--c, var(--r-blue)) 16%, transparent); }

/* Teams */
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .35); flex: none; }
.team-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.members { display: flex; flex-wrap: wrap; gap: 6px; }
.member { padding: 5px 9px; border-radius: 8px; background: var(--soft); font-size: 13.5px; }
.member.me { background: var(--soft); background: color-mix(in srgb, var(--r-blue) 18%, transparent); font-weight: 700; }
.teamgrid { display: grid; gap: 10px; }
.teamcard { padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.teamcard h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--ink); font-size: 14.5px; }
.teamcard .members .member { background: var(--card); }
.bgband { height: 6px; border-radius: 999px; background: var(--c); margin: -4px 0 12px; }
.bgcards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.bgcard { display: block; padding: 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; }
@media (prefers-color-scheme: dark) { .bgcard { border: 1px solid var(--line); } }
.bgcard .dotbig { display: block; width: 34px; height: 34px; border-radius: 10px; background: var(--c); margin-bottom: 10px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .35); }
.bgcard b { display: block; font-size: 16px; }
.bgcard small { color: var(--muted); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-decoration: none; }
a.chip:active { transform: scale(.97); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.tag.rr { background: var(--soft); background: color-mix(in srgb, var(--r-blue) 16%, transparent); color: var(--r-blue); }
.tag.tt { background: var(--soft); background: color-mix(in srgb, var(--r-orange) 18%, transparent); color: #C25E12; }
@media (prefers-color-scheme: dark) { .tag.tt { color: var(--r-orange); } }

/* Standings */
table.std { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.std th { padding: 4px 4px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: right; }
table.std td { padding: 11px 4px; border-top: 1px solid var(--line); text-align: right; }
table.std .l { text-align: left; }
table.std .rk { width: 30px; text-align: center; font-weight: 800; }
table.std .pts { font-weight: 800; font-size: 16px; }
.medal { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 800; }
.medal.g { background: var(--gold); } .medal.s { background: var(--silver); } .medal.b { background: var(--bronze); }
table.pts td, table.pts th { padding: 8px 4px; border-top: 1px solid var(--line); text-align: left; }
table.pts { width: 100%; border-collapse: collapse; }
table.pts th { border-top: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.pts td:last-child, table.pts th:last-child { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Announcements */
.ann { padding: 12px 0; border-top: 1px solid var(--line); }
.ann:first-of-type { border-top: 0; padding-top: 2px; }
.ann p { margin: 0 0 4px; white-space: pre-line; }
.ann small { color: var(--muted); font-size: 12px; }
.ann .pin { display: inline-block; margin-right: 4px; }
.ann.new p { font-weight: 700; }
.flash { animation: flash 1.8s ease-out 1; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--r-yellow) 45%, transparent); } 100% { background: transparent; } }

/* Timeline */
ol.tl { list-style: none; margin: 0; padding: 0; }
ol.tl li { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 11px 6px; border-top: 1px solid var(--line); border-radius: 10px; }
ol.tl li:first-child { border-top: 0; }
ol.tl time { font-weight: 800; font-variant-numeric: tabular-nums; }
ol.tl li.now { background: var(--soft); background: color-mix(in srgb, var(--live) 10%, transparent); border-top-color: transparent; }
ol.tl li.now time { color: var(--live); }
ol.tl li.done { color: var(--muted); }

/* Find */
.search { width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px; }
.search:focus { border-color: var(--r-blue); outline: none; }
.result { padding: 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); margin: 10px 0 0; }
@media (prefers-color-scheme: dark) { .result { border: 1px solid var(--line); } }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.result-head b { font-size: 17px; }
.entry { padding: 10px 0 2px; border-top: 1px solid var(--line); }
.entry a { font-weight: 700; text-decoration: none; }
.entry .with { margin-top: 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--navy); color: #fff; font: 700 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-decoration: none; cursor: pointer; }
@media (prefers-color-scheme: dark) { .btn { background: var(--r-blue); } }
.btn.block { display: flex; width: 100%; }

/* Cheer */
.cheer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 16px; }
.cheer-btn {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 92px; border: 0; border-radius: 16px;
  background: var(--c); color: #fff;
  font: 800 19px/1.1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 4px 12px rgba(0, 0, 0, .12);
  transition: transform .07s ease;
}
.cheer-btn:active { transform: scale(.95); }
.cheer-btn small { font-size: 12.5px; font-weight: 700; opacity: .92; font-variant-numeric: tabular-nums; }
.cheer-btn .plus { position: absolute; top: 8px; right: 12px; font-size: 14px; opacity: 0; }
.cheer-btn.pop .plus { animation: plus .6s ease-out 1; }
@keyframes plus { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-18px); } }
.race { display: grid; gap: 10px; }
.race-row { display: grid; grid-template-columns: 92px 1fr 64px; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.race-row .track { height: 12px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.race-row .bar { height: 100%; width: 0; border-radius: 999px; background: var(--c); transition: width .7s ease; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.race-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* Tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--navy); }
@media (prefers-color-scheme: dark) { .tabs a.on { color: #fff; } }

.noscript { padding: 24px 16px; text-align: center; }
.foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.foot img { display: block; width: 110px; height: auto; margin: 0 auto 6px; opacity: .9; }
@media (prefers-color-scheme: dark) { .foot .lightonly { display: none; } }
@media (prefers-color-scheme: light) { .foot .darkonly { display: none; } }

@media (min-width: 560px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .bgcards { grid-template-columns: repeat(3, 1fr); }
  .cheer-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Live match rows (public app) */
.mrow { display: block; padding: 10px 12px; margin: 0 0 8px; border-radius: 12px; background: var(--soft); text-decoration: none; }
.card .mrow:last-child { margin-bottom: 0; }
.mrow-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.mrow-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.mrow-body .vs { flex: none; color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.mrow-body .side { flex: 1; min-width: 0; }
.mrow-body .side:last-child { text-align: right; display: flex; justify-content: flex-end; }
.mrow-body .side.won .team-chip { font-weight: 900; }
.mrow-body .side:not(.won) .team-chip { font-weight: 600; }
.mrow-body .side.mine { text-decoration: underline; text-decoration-color: var(--r-blue); text-underline-offset: 4px; }
.st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .03em; }
.st.upcoming { background: var(--card); color: var(--muted); }
.st.live { background: #FFE4E8; color: #BE123C; }
.st.final { background: #DCFCE7; color: #15803D; }
@media (prefers-color-scheme: dark) { .st.live { background: rgba(225,29,72,.2); color: #FDA4AF; } .st.final { background: rgba(22,163,74,.2); color: #86EFAC; } }
.sec-title { margin: 16px 2px 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.chip.on { background: var(--navy); color: #fff; }
button.chip { border: 0; cursor: pointer; font-family: inherit; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #FF4D6D; margin-right: 8px; vertical-align: 1px; animation: pulse 1.6s infinite; }
