/* Berau Coal Esports — White & Green design system (public site, panel, presentation).
 * All colours are design tokens below; components reference tokens only. */
:root {
  /* Brand */
  --brand: #75B843;          /* primary green (decorative: bars, progress, highlights) */
  --brand-d: #387B32;        /* dark green (text, primary buttons, active states) */
  --brand-a: #8CC63F;        /* accent green */
  --brand-soft: #EEF6E8;     /* soft green surfaces (table labels, active nav) */
  --brand-line: #CFE3C1;     /* green-tinted border */
  /* Neutrals */
  --bg: #F6F8F5;             /* page background (light neutral) */
  --bg2: #FFFFFF;            /* inputs, table heads */
  --card: #FFFFFF;
  --elev: #F6F8F5;           /* nested rows / slots */
  --line: #E0E7DE;
  --text: #202720;
  --muted: #647064;
  --dim: #7C877C;
  /* Semantic */
  --ok: #16A34A; --ok-soft: #DCFCE7; --ok-ink: #166534;
  --warn: #D97706; --warn-soft: #FEF3C7; --warn-ink: #92400E;
  --bad: #DC2626; --bad-soft: #FEE2E2; --bad-ink: #991B1B;
  --info: #2563EB; --info-soft: #DBEAFE; --info-ink: #1E40AF;
  --live: #DC2626;
  --neutral-soft: #EEF1ED; --neutral-ink: #4B564B;
  /* Aliases kept for templates/JS that reference them */
  --accent: var(--brand-d);
  --main: var(--brand-d);
  /* Shape */
  --r: 10px; --r-sm: 7px;
  --shadow: 0 1px 2px rgba(32, 39, 32, .06), 0 2px 8px rgba(32, 39, 32, .05);
  --shadow-lg: 0 6px 24px rgba(32, 39, 32, .10);
  --font: "Inter", "Poppins", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .accent { color: var(--brand-d); }
.small { font-size: 12.5px; } .tiny { font-size: 11px; } .bold { font-weight: 800; } .upper { text-transform: uppercase; letter-spacing: .08em; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
.row { display: flex; gap: 12px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hide, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Site/Area label: neutral text + coloured dot (site colours are data, not theme) */
[data-site] { color: var(--muted) !important; font-weight: 600; }
[data-site]::before { content: ""; display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: var(--sc, var(--dim)); margin-right: .4em; vertical-align: .05em; }

/* ---------- Demo ribbon ---------- */
.demo-ribbon { background: var(--bad); color: #fff; text-align: center; font-weight: 800; font-size: 12px; letter-spacing: .1em; padding: 4px; }

/* ---------- Branding ---------- */
.brand { display: flex; align-items: center; gap: 12px; font-weight: 900; letter-spacing: .02em; color: var(--text); }
.brand-mark { height: 46px; width: auto; flex: none; display: block; }
.brand-corp { height: 48px; width: auto; display: block; flex: none; }
.brand-sep { width: 1px; height: 28px; background: var(--line); flex: none; }
.brand small { display: block; font-size: 10px; color: var(--brand-d); letter-spacing: .18em; font-weight: 800; }
.brand .ev { line-height: 1.15; font-size: 14px; }

/* ---------- Logos ---------- */
.logo { width: var(--s); height: var(--s); border-radius: 22%; object-fit: contain; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--card); }
.logo-initials { background: color-mix(in srgb, var(--c) 14%, #fff); border: 1.5px solid color-mix(in srgb, var(--c) 70%, #000 10%); color: var(--text); font-weight: 900; font-size: calc(var(--s) * .3); letter-spacing: -.02em; }
.logo-tbd { background: var(--neutral-soft); color: var(--dim); font-weight: 900; font-size: calc(var(--s) * .45); }

/* ---------- Public header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(32, 39, 32, .02); }
.site-header .inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; height: 66px; display: flex; align-items: center; gap: 26px; }
.nav { display: flex; gap: 2px; flex: 1; height: 100%; }
.nav a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 700; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--brand-d); border-bottom-color: var(--brand); }
.nav-toggle { display: none; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 18px; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn.off .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.conn.busy .dot { background: var(--warn); }

.page { max-width: 1240px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title h1 { font-size: 32px; font-weight: 900; text-transform: uppercase; letter-spacing: .01em; }
.page-title .kicker { color: var(--brand-d); font-weight: 800; letter-spacing: .2em; font-size: 12px; margin-bottom: 4px; }
.section-title { font-size: 17px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; margin: 32px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ""; width: 4px; height: 18px; background: var(--brand); border-radius: 2px; transform: skewX(-12deg); }

/* ---------- Hero (subtle geometric esports accents) ---------- */
.hero { position: relative; overflow: hidden; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 36px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; }
.hero::before { content: ""; position: absolute; right: -80px; top: -60px; width: 340px; height: 340px; background: var(--brand-soft); transform: rotate(32deg); border-radius: 28px; z-index: 0; }
.hero::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--brand); }
.hero > * { position: relative; z-index: 1; }
.hero-logo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 18px; filter: drop-shadow(0 10px 18px rgba(20, 40, 20, .18)); }
@media (max-width: 900px) { .hero-logo { max-width: 200px; } }
.hero h1 { font-size: 42px; font-weight: 900; line-height: 1.04; text-transform: uppercase; color: var(--text); }
.hero .tag { color: var(--brand-d); font-weight: 900; letter-spacing: .14em; margin-top: 12px; font-size: 14px; }
.hero-meta { display: flex; gap: 24px; margin-top: 22px; flex-wrap: wrap; }
.hero-meta div b { display: block; font-size: 21px; font-weight: 900; }
.hero-meta div span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.phase-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--brand-d); border: 1px solid var(--brand-line); padding: 5px 12px; border-radius: 999px; font-weight: 800; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.progress { height: 8px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }

/* ---------- Tabs & filters ---------- */
.tabs { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; box-shadow: var(--shadow); }
.tabs a { padding: 8px 16px; border-radius: 7px; font-weight: 800; color: var(--muted); font-size: 14px; }
.tabs a:hover { color: var(--text); background: var(--bg); }
.tabs a.on { background: var(--brand-d); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; align-items: center; }
.filters select, .filters input, .inp { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 14px; min-width: 0; }
.filters select:focus, .filters input:focus, .inp:focus { outline: 2px solid var(--brand-line); border-color: var(--brand); }
input[type="checkbox"] { accent-color: var(--brand-d); width: 16px; height: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--brand-line); }
.chip.on { border-color: var(--brand); color: var(--brand-d); background: var(--brand-soft); }

/* ---------- Day header ---------- */
.day-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; padding-bottom: 10px; border-bottom: 2px solid var(--line); position: relative; }
.day-head::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 72px; height: 2px; background: var(--brand); }
.day-head h2 { font-size: 19px; font-weight: 900; text-transform: uppercase; }
.day-head span { color: var(--muted); font-size: 13px; }
.slot-head { color: var(--brand-d); font-weight: 900; font-size: 14px; letter-spacing: .06em; margin: 18px 0 8px; display: flex; gap: 10px; align-items: center; }
.slot-head .dim { font-weight: 700; letter-spacing: 0; }

/* ---------- Match card (MPL-inspired, original) ---------- */
.mc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 12px; }
.mc { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: grid; grid-template-columns: 108px 1fr; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.mc:hover { border-color: var(--brand-line); box-shadow: var(--shadow-lg); }
.mc.live { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad) inset, var(--shadow); }
.mc-table { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--brand-soft); color: var(--brand-d); padding: 10px 6px; text-align: center; border-right: 1px solid var(--brand-line); }
.mc-table .lbl { font-size: 10px; font-weight: 900; letter-spacing: .16em; opacity: .85; }
.mc-table .num { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.mc-table .num.word { font-size: 15px; line-height: 1.1; letter-spacing: .02em; }
.mc-table.tbl-main { background: var(--brand-d); color: #fff; border-right-color: var(--brand-d); }
.mc-table.tbl-none { background: var(--neutral-soft); color: var(--muted); border-right-color: var(--line); }
.mc-body { padding: 10px 14px; min-width: 0; }
.mc-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); font-weight: 700; flex-wrap: wrap; }
.mc-meta .sep { opacity: .4; }
.mc-meta .code { color: var(--text); }
.mc-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; margin: 8px 0 6px; }
.mc-team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mc-team.b { flex-direction: row-reverse; text-align: right; }
.mc-team .nm { display: block; font-weight: 900; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .01em; color: var(--text); }
.mc-team .st { font-size: 11.5px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-team .txt { min-width: 0; }
.mc-team.lose .nm { color: var(--dim); font-weight: 700; }
.mc-team.win .nm::after { content: " ●"; color: var(--brand); font-size: 10px; vertical-align: middle; }
.mc-team.b.win .nm::after { content: ""; }
.mc-team.b.win .nm::before { content: "● "; color: var(--brand); font-size: 10px; vertical-align: middle; }
.mc-score { text-align: center; min-width: 92px; }
.mc-score .sc { font-size: 28px; font-weight: 900; letter-spacing: .02em; color: var(--text); }
.mc-score .sc span { color: var(--dim); }
.mc-score .sc .w { color: var(--text); }
.mc-score .vs { font-size: 14px; font-weight: 900; color: var(--dim); letter-spacing: .12em; }
.mc-score .time { font-size: 18px; font-weight: 900; }
.mc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mc-foot a.det { font-size: 12px; font-weight: 800; color: var(--brand-d); }
.mc-foot a.det:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; background: var(--neutral-soft); color: var(--neutral-ink); }
.badge.bo { background: var(--card); border: 1px solid var(--line); color: var(--text); }
.st-live { background: var(--bad-soft); color: var(--bad-ink); }
.st-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
.st-done { background: var(--ok-soft); color: var(--ok-ink); }
.st-delay { background: var(--warn-soft); color: var(--warn-ink); }
.st-cancel { background: var(--neutral-soft); color: var(--muted); text-decoration: line-through; }
.st-ready { background: var(--info-soft); color: var(--info-ink); }
.st-sched { background: var(--neutral-soft); color: var(--neutral-ink); }
.tbl-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-weight: 900; font-size: 14px; letter-spacing: .04em; background: var(--brand-soft); color: var(--brand-d); border: 1px solid var(--brand-line); }
.tbl-badge.is-main { background: var(--brand-d); color: #fff; border-color: var(--brand-d); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Generic cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
a.card:hover { border-color: var(--brand-line); }
.card h3 { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--line); }
.stat b { display: block; font-size: 27px; font-weight: 900; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat.warn { border-top-color: var(--warn); } .stat.warn b { color: var(--warn-ink); }
.stat.bad { border-top-color: var(--bad); } .stat.bad b { color: var(--bad-ink); }
.stat.ok { border-top-color: var(--brand); } .stat.ok b { color: var(--brand-d); }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); background: var(--card); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Group cards ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.gcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.gcard-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); border-top: 4px solid var(--brand); }
.gcard-head h3 { font-size: 19px; font-weight: 900; color: var(--brand-d); margin: 0; }
.gteam { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.gteam:last-child { border-bottom: 0; }
a.gteam:hover { background: var(--bg); }
.gteam .pos { width: 20px; color: var(--dim); font-weight: 900; }
.gteam .nm { font-weight: 800; }
.gteam .rec { margin-left: auto; font-weight: 900; font-size: 13px; color: var(--muted); }
.gteam.q { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.gteam.q .pos { color: var(--brand-d); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td, table.t tr:hover td { background: #FAFCF9; }
table.t tr.q td { background: var(--brand-soft); }
table.t tr.q td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.t tr.tie td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.t td.num, table.t th.num { text-align: center; }
.teamcell { display: flex; align-items: center; gap: 10px; font-weight: 800; }

/* ---------- Timetable (table allocation grid) ---------- */
.tt { width: 100%; border-collapse: separate; border-spacing: 6px; }
.tt th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 4px; }
.tt th.tbl { color: var(--brand-d); }
.tt th.tbl.is-main { color: var(--text); }
.tt td { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; vertical-align: top; min-width: 150px; font-size: 12.5px; box-shadow: var(--shadow); }
.tt td:hover { border-color: var(--brand-line); }
.tt td.time { background: transparent; border: 0; box-shadow: none; font-weight: 900; color: var(--brand-d); font-size: 15px; min-width: 70px; }
.tt td.free { color: var(--dim); text-align: center; border-style: dashed; background: transparent; box-shadow: none; }
.tt .m-code { font-size: 11px; color: var(--muted); font-weight: 800; }
.tt .m-team { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* ---------- Table board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); border-top: 4px solid var(--line); }
.tcard.available { border-top-color: var(--ok); }
.tcard.reserved { border-top-color: var(--info); }
.tcard.occupied { border-top-color: var(--bad); }
.tcard.maintenance { border-top-color: var(--warn); }
.tcard.unavailable, .tcard.inactive { border-top-color: var(--dim); }
.tcard-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tcard-head .tn { font-size: 21px; font-weight: 900; letter-spacing: .02em; color: var(--brand-d); }
.tcard-head .tn.is-main { color: var(--text); }
.tcard-body { padding: 12px 14px; flex: 1; }
.tcard-foot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; background: var(--bg); }
.ts { font-size: 11px; font-weight: 900; padding: 4px 9px; border-radius: 5px; letter-spacing: .06em; text-transform: uppercase; }
.ts-available { background: var(--ok-soft); color: var(--ok-ink); }
.ts-reserved { background: var(--info-soft); color: var(--info-ink); }
.ts-occupied { background: var(--bad-soft); color: var(--bad-ink); }
.ts-unavailable, .ts-inactive { background: var(--neutral-soft); color: var(--neutral-ink); }
.ts-maintenance { background: var(--warn-soft); color: var(--warn-ink); }
.tcard .vsline { font-weight: 900; font-size: 15px; text-transform: uppercase; margin: 6px 0; }
.tcard .kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; color: var(--muted); }
.tcard .kv b { color: var(--text); font-weight: 700; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; margin: 8px 0; border: 1px solid; border-left-width: 4px; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.alert.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); }
.alert.info { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); }
.alert a { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 800; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 1px rgba(32, 39, 32, .04); }
.btn:hover { border-color: var(--brand-line); background: var(--bg); }
.btn.pri { background: var(--brand-d); color: #fff; border-color: var(--brand-d); }
.btn.pri:hover { background: #2F6A2A; }
.btn.danger { background: var(--card); border-color: var(--bad); color: var(--bad-ink); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.lg { padding: 13px 22px; font-size: 15.5px; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ---------- Bracket ---------- */
.bracket-shell { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); overflow: hidden; height: 72vh; min-height: 480px; touch-action: none; cursor: grab; box-shadow: var(--shadow); }
.bracket-shell.drag { cursor: grabbing; }
.bracket-shell svg { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.bracket-tools { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; z-index: 3; }
.br-node:hover rect:first-child { stroke: var(--brand); }
.ko-list { display: none; }
.ko-round { margin-bottom: 18px; }
.champ { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: 12px; border: 1px solid var(--brand-line); border-left: 6px solid var(--brand); background: var(--brand-soft); }
.champ .crown { font-size: 12px; letter-spacing: .3em; color: var(--brand-d); font-weight: 900; }
.champ .nm { font-size: 26px; font-weight: 900; text-transform: uppercase; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 24px 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.site-footer b { color: var(--brand-d); letter-spacing: .14em; }
.site-footer .foot-brand { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; }

/* ---------- Panel ---------- */
.panel { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 4px 8px 14px; flex-wrap: wrap; gap: 10px; }
.side .brand-corp { height: 52px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--muted); font-weight: 700; font-size: 13.5px; border-left: 3px solid transparent; }
.side nav a:hover { background: var(--bg); color: var(--text); }
.side nav a.on { background: var(--brand-soft); color: var(--brand-d); border-left-color: var(--brand); }
.side nav .n { width: 20px; font-size: 11px; color: var(--dim); text-align: right; }
.side .sec { font-size: 10px; letter-spacing: .16em; color: var(--dim); font-weight: 900; padding: 14px 10px 6px; }
.main { padding: 22px 28px 60px; min-width: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; font-weight: 900; }
.msgs { margin-bottom: 14px; }
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.field label { display: block; font-size: 11.5px; font-weight: 800; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
.field .inp, .field select, .field textarea { width: 100%; }
.field .err { color: var(--bad); font-size: 12px; margin-top: 3px; }
.field .help { color: var(--dim); font-size: 11.5px; margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
textarea.inp { resize: vertical; }
.kvs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kvs dt { color: var(--muted); font-weight: 700; }
.kvs dd { margin: 0; font-weight: 700; }
details.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
details.box summary { cursor: pointer; font-weight: 800; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 800; background: var(--neutral-soft); color: var(--neutral-ink); }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
code { background: var(--neutral-soft); padding: 1px 4px; border-radius: 4px; font-size: .92em; }

/* ---------- Referee ---------- */
.ref-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; box-shadow: var(--shadow); border-left: 6px solid var(--brand); }
.ref-head .tn { font-size: 30px; font-weight: 900; color: var(--brand-d); }
.game-row { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin-bottom: 8px; }
.wbtn { display: block; width: 100%; padding: 14px 8px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--text); font-weight: 900; font-size: 15px; cursor: pointer; text-transform: uppercase; }
.wbtn:hover { border-color: var(--brand-line); }
.wbtn.on { border-color: var(--brand-d); background: var(--brand-soft); color: var(--brand-d); }
.kd { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; grid-column: 1 / -1; }
.kd input { width: 100%; }
.kd-win { grid-template-columns: auto repeat(3, minmax(0, 1fr)); align-items: center; }
.kd-label { font-weight: 800; font-size: 13px; color: var(--brand-d); white-space: nowrap; }
.kd-note { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.series { font-size: 40px; font-weight: 900; text-align: center; letter-spacing: .05em; }

/* ---------- Presentation (white-green event stage) ---------- */
.present { position: fixed; inset: 0; background: #E9EFE6; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.stage { flex: none; width: 1920px; height: 1080px; transform-origin: center center; position: relative; overflow: hidden; background: #FFFFFF; padding: 40px 64px; display: flex; flex-direction: column; color: var(--text); }
.stage::before { content: ""; position: absolute; right: -220px; top: -260px; width: 720px; height: 720px; background: var(--brand-soft); transform: rotate(35deg); border-radius: 60px; z-index: 0; }
.stage::after { content: ""; position: absolute; left: -160px; bottom: -300px; width: 560px; height: 560px; border: 36px solid var(--brand-soft); transform: rotate(35deg); border-radius: 50px; z-index: 0; }
.stage > * { position: relative; z-index: 1; }
.stage-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--brand); padding-bottom: 14px; margin-bottom: 22px; gap: 30px; }
.stage-head .lock { display: flex; align-items: center; gap: 26px; }
.stage-head .lock .brand-corp { height: 92px; }
.stage-head .lock .brand-mark { height: 78px; width: auto; }
.stage-head .lock .brand-sep { height: 60px; }
.stage-head .k { color: var(--brand-d); font-weight: 900; letter-spacing: .3em; font-size: 18px; }
.stage-head h1 { font-size: 52px; font-weight: 900; text-transform: uppercase; line-height: 1; }
.stage-head .r { text-align: right; color: var(--muted); font-size: 21px; font-weight: 700; }
.stage .clock { font-size: 38px; font-weight: 900; color: var(--text); }
.p-groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; flex: 1; }
.p-group { background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--brand); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.p-group h2 { font-size: 32px; color: var(--brand-d); font-weight: 900; margin-bottom: 10px; }
.p-slot { display: flex; align-items: center; gap: 14px; height: 60px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); padding: 0 14px; margin-bottom: 8px; }
.p-slot.empty { background: transparent; border: 2px dashed var(--line); }
.p-slot .pot-tag { font-size: 13px; font-weight: 800; letter-spacing: .08em; color: var(--muted, #8A9585); }
.p-slot .nm { font-size: 22px; font-weight: 900; text-transform: uppercase; line-height: 1.1; }
.p-slot .st { font-size: 15px; font-weight: 700; }
.p-slot.new { animation: slotIn .9s cubic-bezier(.2, .9, .2, 1); background: var(--brand-soft); border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-line); }
@keyframes slotIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.reveal-card { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(246, 248, 245, .9); backdrop-filter: blur(4px); z-index: 10; opacity: 0; pointer-events: none; transition: opacity .3s; }
.reveal-card.show { opacity: 1; }
.reveal-inner { text-align: center; transform: scale(.8); transition: transform .5s cubic-bezier(.2, .9, .2, 1); background: var(--card); border: 1px solid var(--line); border-top: 10px solid var(--brand); border-radius: 24px; padding: 50px 90px; box-shadow: 0 30px 80px rgba(32, 39, 32, .18); min-width: 900px; }
.reveal-card.show .reveal-inner { transform: scale(1); }
.reveal-inner .to { font-size: 30px; color: var(--muted); font-weight: 800; letter-spacing: .2em; margin-top: 24px; }
.reveal-inner .grp { font-size: 140px; font-weight: 900; color: var(--brand-d); line-height: 1; }
.reveal-inner .nm { font-size: 72px; font-weight: 900; text-transform: uppercase; margin-top: 18px; }
.reveal-inner .st { font-size: 28px; font-weight: 800; }
.p-foot { margin-top: auto; display: flex; justify-content: space-between; color: var(--muted); font-size: 18px; font-weight: 700; padding-top: 16px; }
.p-foot .tagline { color: var(--brand-d); font-weight: 900; letter-spacing: .14em; }
.p-list .mc { grid-template-columns: 170px 1fr; }
.p-list .mc-table .num { font-size: 44px; }
.p-list .mc-team .nm { font-size: 26px; }
.p-list .mc-score .sc { font-size: 44px; }
.p-list .mc-meta { font-size: 17px; }
.p-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.p-status { position: absolute; right: 18px; bottom: 12px; font-size: 13px; color: var(--dim); z-index: 2; }

/* ---------- Visual export ---------- */
.visual-frame { border: 1px solid var(--line); border-radius: var(--r); overflow: auto; background: var(--card); max-height: 78vh; box-shadow: var(--shadow); }
.visual-frame svg { display: block; max-width: 100%; height: auto; }
@media print {
  .site-header, .site-footer, .no-print, .demo-ribbon { display: none !important; }
  body, html { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .visual-frame { max-height: none; overflow: visible; border: 0; box-shadow: none; }
  .page { padding: 0; max-width: none; }
  @page { size: landscape; margin: 6mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .mc-list { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .nav { display: none; position: absolute; top: 66px; left: 0; right: 0; height: auto; flex-direction: column; background: var(--card); padding: 8px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; border-bottom: 0; border-left: 3px solid transparent; }
  .nav a.on { border-left-color: var(--brand); background: var(--brand-soft); }
  .nav-toggle { display: block; margin-left: auto; }
  .site-header .conn span { display: none; }
  .panel { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: grid; grid-template-columns: 1fr 1fr; }
  .main { padding: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  html, body { font-size: 14px; }
  .page { padding: 18px 12px 40px; }
  .page-title h1 { font-size: 25px; }
  .hero { padding: 22px 22px 22px 26px; }
  .hero h1 { font-size: 28px; }
  .brand .ev { display: none; }
  .brand-corp { height: 42px; }
  .mc { grid-template-columns: 74px 1fr; }
  .mc-table .num { font-size: 24px; }
  .mc-table .num.word { font-size: 12px; }
  .mc-body { padding: 9px 10px; }
  .mc-team { gap: 6px; }
  .mc-team .logo { --s: 30px !important; }
  .mc-team .nm { font-size: 13px; }
  .mc-team .st { font-size: 10.5px; }
  .mc-score { min-width: 46px; }
  .mc-vs { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "a s" "b s"; gap: 6px 10px; }
  .mc-vs .mc-team.a { grid-area: a; }
  .mc-vs .mc-team.b { grid-area: b; flex-direction: row; text-align: left; }
  .mc-vs .mc-score { grid-area: s; }
  .mc-team.b.win .nm::before { content: ""; }
  .mc-team.b.win .nm::after { content: " ●"; color: var(--brand); font-size: 10px; vertical-align: middle; }
  .mc-meta { gap: 5px; font-size: 11px; }
  .mc-score .sc { font-size: 22px; }
  .mc-score .time { font-size: 14px; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .bracket-shell { display: none; }
  .ko-list { display: block; }
  .game-row { grid-template-columns: 44px 1fr 1fr; }
  .kd { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kd-win { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kd-win .kd-label { grid-column: 1 / -1; }
}

/* QR codes (install page): scale the generated SVG to its box */
.qr { width: 168px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
@media print { .qr { width: 220px; } }

/* ---------- Result screenshots ---------- */
.shot { display: block; }
.shot img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.shot-card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); }
.shot-card .shot img { max-height: 200px; object-fit: cover; }
.shot-card figcaption { margin-top: 8px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
