/* Papan keputusan sukan SK Minyak Beku. Telefon dahulu; ?tv=1 untuk skrin besar (tema gelap, tulisan besar). */
:root {
  --bg: #f2f4f7; --surface: #ffffff; --text: #0e1726; --muted: #5a6577; --line: #e3e7ee; --navy: #0b1f3a; --accent: #1e5bb8;
  --gold: #f2c94c; --silver: #c9ced6; --bronze: #d49a6a;
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-label: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --radius: 14px;
}
.tv { --bg: #07111f; --surface: #0f1d33; --text: #f3f6fb; --muted: #a8b4c7; --line: #22314b; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.tv a { color: #8fb8ff; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff; }
.bar__inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { color: #b9c6da; font-size: 12px; }
.bar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px; background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.tv .btn { color: #fff; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #d6e0ee; font-variant-numeric: tabular-nums; }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6); } 70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }
@media (prefers-reduced-motion: reduce) { .live__dot { animation: none; } }

.loading, .empty { color: var(--muted); padding: 24px 0; }
.hero { padding: 28px 0 8px; }
.hero__eyebrow { margin: 0; font-family: var(--font-label); font-size: 15px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.tv .hero__eyebrow { color: #8fb8ff; }
.hero h1 { margin: 4px 0; font-size: clamp(26px, 5vw, 44px); line-height: 1.1; text-wrap: balance; }
.hero__meta { margin: 0; color: var(--muted); }
.hero--empty { padding: 60px 0; text-align: center; }

.panel { margin: 16px 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel__title { margin: 0 0 12px; font-family: var(--font-label); font-size: 18px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.panel__note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.houses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.house { display: grid; grid-template-columns: 34px minmax(90px, 1.1fr) minmax(60px, 2fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border-left: 8px solid var(--hc, #999); background: color-mix(in srgb, var(--hc, #999) 8%, var(--surface)); }
.house__rank { font-size: 24px; font-weight: 800; text-align: center; }
.house__name { font-weight: 700; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.house__track { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.house__fill { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--hc, #999); transition: width 0.6s ease; }
.house__points { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; line-height: 1; }
.house__points small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.house__medals { display: flex; gap: 4px; }
.m { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; font-size: 13px; font-weight: 700; color: #1b1b1b; font-variant-numeric: tabular-nums; }
.m--1 { background: var(--gold); } .m--2 { background: var(--silver); } .m--3 { background: var(--bronze); }
.house--merah { --hc: #d93a3a; } .house--biru { --hc: #2a6fd6; } .house--kuning { --hc: #e0ac12; } .house--hijau { --hc: #2e9e5b; } .house--ungu { --hc: #7a4cc2; }
.house--oren { --hc: #ee8a2b; } .house--jambu { --hc: #ec7fb0; } .house--putih { --hc: #b8bec8; } .house--hitam { --hc: #333; } .house--coklat { --hc: #8a5a35; }
.dot { display: inline-block; width: 11px; height: 11px; margin-right: 6px; border-radius: 50%; background: #999; vertical-align: 0; }
.dot--merah { background: #d93a3a; } .dot--biru { background: #2a6fd6; } .dot--kuning { background: #e0ac12; } .dot--hijau { background: #2e9e5b; } .dot--ungu { background: #7a4cc2; }
.dot--oren { background: #ee8a2b; } .dot--jambu { background: #ec7fb0; } .dot--putih { background: #e6e9ee; border: 1px solid #999; } .dot--hitam { background: #222; } .dot--coklat { background: #8a5a35; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0 16px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.result { padding: 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.result h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.3; }
.result h3 small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.result__code { color: var(--muted); font-size: 12px; font-weight: 600; }
.podium { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.podium li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 14px; }
.podium__who { min-width: 0; overflow-wrap: anywhere; }
.podium__result { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.medal { display: inline-flex; justify-content: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1b1b1b; }
.medal--1 { background: var(--gold); } .medal--2 { background: var(--silver); } .medal--3 { background: var(--bronze); }
.record { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: #d93a3a; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.schedule { list-style: none; margin: 0; padding: 0; }
.schedule li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.schedule li:last-child { border-bottom: 0; }
.schedule__time { font-weight: 700; font-variant-numeric: tabular-nums; }
.schedule__status { color: var(--muted); font-size: 13px; text-align: right; }

.champions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.champ { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.champ--main { background: var(--navy); color: #fff; border-color: var(--navy); }
.champ__label { font-family: var(--font-label); font-size: 14px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.champ--main .champ__label { color: var(--gold); }
.champ strong { font-size: 20px; }
.champ__house { font-size: 28px !important; }
.champ span:last-child { color: var(--muted); font-size: 14px; }
.champ--main span:last-child { color: #d6e0ee; }

.foot { padding: 24px 0 40px; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .house { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: 'rank name points' 'rank track track' 'rank medals medals'; row-gap: 6px; }
  .house__rank { grid-area: rank; font-size: 20px; }
  .house__name { grid-area: name; }
  .house__track { grid-area: track; }
  .house__points { grid-area: points; font-size: 22px; }
  .house__medals { grid-area: medals; }
  .brand small { display: none; }
  .podium li { grid-template-columns: 58px minmax(0, 1fr); }
  .podium__result { grid-column: 2; text-align: left; }
}

/* Mod TV: tulisan besar, kedudukan rumah sentiasa kelihatan, panel kanan bergilir. */
.tv body { font-size: 20px; }
.tv .wrap { max-width: none; padding-left: 3vw; padding-right: 3vw; }
.tv .bar__inner { max-width: none; padding-left: 3vw; padding-right: 3vw; }
.tv .hero { padding-top: 2vh; }
.tv .hero h1 { font-size: clamp(32px, 3.6vw, 64px); }
.tv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2vw; align-items: start; }
.tv .house { padding: 1.4vh 1vw; }
.tv .house__name { font-size: clamp(20px, 2vw, 34px); }
.tv .house__points { font-size: clamp(30px, 3vw, 56px); }
.tv .house__rank { font-size: clamp(26px, 2.4vw, 44px); }
.tv .m { min-width: 36px; height: 36px; font-size: 18px; border-radius: 18px; }
.tv .panel__title { font-size: 24px; }
.tv .result h3 { font-size: 22px; }
.tv .podium li { font-size: 19px; grid-template-columns: 84px minmax(0, 1fr) auto; }
.tv .schedule li { font-size: 20px; grid-template-columns: 90px minmax(0, 1fr) auto; }
.tv .foot { display: none; }
@media (max-width: 900px) { .tv-grid { grid-template-columns: 1fr; } }
.tv .results { grid-template-columns: 1fr; }
.tv .house { grid-template-columns: 3vw minmax(12vw, 1.3fr) minmax(6vw, 1.5fr) auto auto; }
.tv .house__name { overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
