/* MASAIO design system — shared by the web app and (later) the MAUI Blazor UI.
   Layout: dark navy sidebar, light content area, white cards. */

:root {
  --navy: #0E1B33;
  --navy-2: #16274A;
  --navy-3: #1E3259;
  --nav-text: #C7D0E0;
  --nav-muted: #7D8CA8;
  --brand: #EF4444;           /* school badge */
  --accent: #2563EB;          /* links */
  --ink: #0B1220;             /* primary buttons */
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --border: #E6EAF0;
  --text: #0F172A;
  --text-2: #5B677A;
  --text-3: #95A1B3;
  --ok: #16A34A;
  --ok-soft: #E7F7EE;
  --warn: #D97706;
  --warn-soft: #FEF4E6;
  --danger: #DC2626;
  --danger-soft: #FDECEC;
  --info: #2563EB;
  --info-soft: #EAF1FE;
  --violet: #7C3AED;
  --violet-soft: #F1EBFE;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --sidebar-w: 264px;
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220;
    --surface: #111A2B;
    --surface-2: #162235;
    --border: #22314A;
    --text: #E2E8F0;
    --text-2: #A3B1C6;
    --text-3: #6B7A90;
    --ink: #E2E8F0;
    --accent: #60A5FA;
    --ok-soft: #0F2E1C;
    --warn-soft: #33250D;
    --danger-soft: #3B1515;
    --info-soft: #13233F;
    --violet-soft: #241A3D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; }
button { font: inherit; }

/* ── Shell ──────────────────────────────────────────────────── */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: var(--nav-text); padding: 22px 16px 16px; display: flex; flex-direction: column; }
.school { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.school-badge { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #F87171, #DC2626); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.school-name { color: #fff; font-weight: 700; line-height: 1.15; }
.school-sub { color: var(--nav-muted); font-size: .8rem; }
.nav-group { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-muted); padding: 16px 12px 8px; }
.nav-link { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; color: var(--nav-text); font-weight: 600; margin-bottom: 2px; }
.nav-link:hover { background: var(--navy-2); color: #fff; }
.nav-link.active { background: #fff; color: var(--navy); }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.nav-count { margin-left: auto; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(239, 68, 68, .22); color: #FCA5A5; }
.nav-link.active .nav-count { background: var(--danger-soft); color: var(--danger); }
.profile { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 16px 8px 4px; border-top: 1px solid var(--navy-3); }
.profile .avatar { background: #fff; color: var(--navy); }
.profile-name { color: #fff; font-weight: 700; font-size: .9rem; line-height: 1.2; }
.profile-role { color: var(--nav-muted); font-size: .8rem; }
.icon-btn-dark { margin-left: auto; width: 36px; height: 32px; border-radius: 10px; border: 0; background: var(--navy-2); color: var(--nav-text); cursor: pointer; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 20px 32px 8px; }
.greeting { flex: 1; min-width: 0; }
.greeting-title { font-weight: 700; font-size: 1.05rem; }
.greeting-sub { color: var(--text-2); font-size: .85rem; }
.search { display: flex; align-items: center; gap: 10px; width: min(430px, 40vw); padding: 11px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text-2); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); width: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; position: relative; flex-shrink: 0; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.menu-btn { display: none; }
.content { padding: 16px 32px 40px; max-width: 1240px; width: 100%; }

.tabbar { display: none; }
.drawer-backdrop { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45); }
  .menu-btn { display: grid; }
  .search { display: none; }
  .topbar { padding: 14px 16px 4px; gap: 12px; }
  .content { padding: 12px 16px calc(var(--tabbar-h) + 24px); }
  h1 { font-size: 1.6rem; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); z-index: 20; }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; font-weight: 600; color: var(--text-3); }
  .tab .nav-icon { font-size: 1.15rem; }
  .tab.active { color: var(--danger); }
}

/* ── Page building blocks ───────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; flex-wrap: wrap; }
.page-sub { color: var(--text-2); margin-top: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent; background: var(--ink); color: var(--surface); font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; min-width: 0; }
@media (max-width: 1100px) { .layout-2col { grid-template-columns: minmax(0, 1fr); } }

.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 26px; color: #fff; background: radial-gradient(circle at 88% 20%, rgba(255,255,255,.08) 0 120px, transparent 121px), linear-gradient(135deg, var(--navy) 0%, #1B3160 100%); }
.hero-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); font-size: .85rem; font-weight: 600; }
.chip .live { width: 8px; height: 8px; border-radius: 50%; background: #34D399; }
.hero h2 { font-size: 1.6rem; letter-spacing: -0.01em; }
.hero p { color: #C8D3E8; margin: 8px 0 18px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-btn { padding: 9px 14px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-weight: 700; cursor: pointer; }
.hero-btn.primary { background: #fff; color: var(--navy); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1300px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .stats { gap: 10px; } .stat { padding: 14px; } .stat-value { font-size: 1.5rem; } }
.stat { padding: 18px; }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; color: var(--text-2); font-weight: 600; font-size: .9rem; }
.stat-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.stat-value { font-size: 1.9rem; font-weight: 800; margin: 12px 0 4px; letter-spacing: -0.02em; }
.stat-note { font-size: .8rem; font-weight: 700; color: var(--text-2); }
.stat-note.up { color: var(--ok); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }

.row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); color: var(--text); font-weight: 500; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--text-2); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); }
.chevron { color: var(--text-3); }

.attention { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); margin-top: 10px; color: var(--text); font-weight: 500; }
.attention:first-of-type { margin-top: 0; }

.event-card { border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.event-when { color: var(--danger); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.event-name { font-size: 1.15rem; font-weight: 700; margin: 4px 0; }
.event-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.event-stat { border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; text-align: center; }
.event-stat b { display: block; font-size: 1.15rem; }
.event-stat span { font-size: .65rem; letter-spacing: .08em; color: var(--text-2); text-transform: uppercase; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--info-soft); color: var(--info); display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex-shrink: 0; object-fit: cover; }
.avatar.lg { width: 88px; height: 88px; font-size: 1.8rem; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }

.input { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; max-width: 220px; }

.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
@media (max-width: 600px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dt { margin-top: 8px; } }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.workspace { text-align: center; padding: 48px 20px; }
.workspace .tile { margin: 0 auto 14px; width: 56px; height: 56px; font-size: 1.4rem; }

.state { text-align: center; padding: 48px 16px; color: var(--text-2); }
.state.error { color: var(--danger); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hide-sm { }
@media (max-width: 700px) { .hide-sm { display: none; } }

a.row:hover .row-title { color: var(--accent); }

/* Help assistant */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { align-self: flex-start; max-width: min(640px, 92%); padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface-2); color: var(--text); white-space: pre-wrap; line-height: 1.45; }
.bubble.mine { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--info-soft); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; white-space: normal; text-align: left; }
.chip-btn:hover { background: var(--info-soft); }
.ask { display: flex; gap: 8px; margin-top: 8px; }
.ask .input { flex: 1; }

/* Tournament drill-down: sessions, brackets, bout grading */
.btn:disabled { opacity: .45; cursor: not-allowed; }
a.btn { text-decoration: none; }
.crumbs { font-size: .85rem; color: var(--text-2); margin-bottom: 12px; overflow-wrap: anywhere; }
.crumbs span { color: var(--text); font-weight: 600; }
.session-link { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-2); font-size: .82rem; font-weight: 500; }
.session-link:hover { background: var(--surface-2); }
.session-go { color: var(--accent); font-weight: 700; white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--text-2); }
.group-title { margin: 18px 0 4px; font-size: 1rem; }
.section-title { margin: 16px 0 6px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 800; }
.corner { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.corner.red { background: #DC2626; }
.corner.blue { background: #2563EB; }
.notice { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: .9rem; }

.scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 20px; }
.corner-panel { border-radius: 16px; padding: 16px; color: #fff; text-align: center; min-width: 0; border: 3px solid transparent; }
.corner-panel.red { background: linear-gradient(160deg, #EF4444, #B91C1C); }
.corner-panel.blue { background: linear-gradient(160deg, #3B82F6, #1D4ED8); }
.corner-panel.leading { border-color: #FACC15; }
.corner-label { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; opacity: .85; font-weight: 800; }
.corner-name { font-weight: 800; font-size: 1.05rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corner-score { font-size: 3.4rem; font-weight: 900; line-height: 1.1; margin: 8px 0; font-variant-numeric: tabular-nums; }
.corner-meta { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 24px; }
.corner-panel .pill { background: rgba(255,255,255,.2); color: #fff; }
.clock { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 150px; text-align: center; }
.clock-time { font-size: 2.6rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.clock-time.urgent { color: var(--danger); }
.clock-status { color: var(--text-2); font-weight: 700; font-size: .85rem; }
.clock-buttons, .clock-adjust { display: flex; gap: 8px; }
@media (max-width: 700px) {
  .scoreboard { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .scoreboard .clock { grid-column: 1 / -1; grid-row: 1; }
  .corner-score { font-size: 2.6rem; }
}

table.judges td { vertical-align: top; }
.judge-name { font-weight: 700; white-space: nowrap; }
.calls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.call-btn { min-width: 44px; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 800; cursor: pointer; }
.call-btn:hover:not(:disabled) { background: var(--info-soft); }
.call-btn:active:not(:disabled) { transform: scale(.96); }
.call-btn.foul { color: var(--danger); }
.call-btn:disabled { opacity: .45; cursor: not-allowed; }
.kata-input { max-width: 110px; }
.finish { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.finish h2 { margin: 0 0 4px; }

/* Photo over initials: the initials show until (or unless) the picture loads. */
span.avatar { position: relative; overflow: hidden; }
span.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Belt test results */
details.result { border-top: 1px solid var(--border); padding: 10px 0; }
details.result:first-of-type { border-top: 0; }
details.result > summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
details.result > summary::-webkit-details-marker { display: none; }
details.result > summary .grow { flex: 1; min-width: 0; }
details.result[open] > summary { margin-bottom: 8px; }

/* Bracket search and generation */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.filters label, .form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--text-2); }
.filters .select { max-width: none; width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.one { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 420px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.check-row:first-of-type { border-top: 0; }
.check-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bout-line { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 6px 0; font-size: .88rem; border-top: 1px dashed var(--border); }
.bout-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Program editor and fee settings */
textarea.input { resize: vertical; font: inherit; }
.rank-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 6px 0; }
.discount-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) 120px minmax(80px, .8fr) minmax(120px, 1fr) 150px 150px auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--border); }
@media (max-width: 900px) { .discount-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.discount-row .select { max-width: none; }
.scroll-list { max-height: 420px; overflow-y: auto; }
.notice.finish { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Grading pictures: competitors, judges, point and foul images */
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar.xl { width: 72px; height: 72px; font-size: 1.4rem; }
.corner-photo { margin: 8px auto 4px; background: rgba(255,255,255,.2); color: #fff; border: 2px solid rgba(255,255,255,.6); }
.call-btn.pic { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; min-width: 56px; }
.call-btn.pic img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.call-btn.pic span { font-size: .78rem; }

/* ── Public landing page (signed out) ───────────────────────────────────── */
.landing { overflow-x: hidden; --lp-navy: #0B1630; --lp-navy-2: #12224A; --lp-gold: #F5B83D; --lp-ink: #0F172A; --lp-muted: #5B677A;
  min-height: 100vh; background: #F6F8FC; color: var(--lp-ink); font-family: inherit; }
.landing h1, .landing h2, .landing h3 { letter-spacing: -0.02em; }
.lp-nav { position: absolute; z-index: 3; inset: 0 0 auto 0; display: flex; align-items: center; gap: 24px; padding: 18px clamp(16px, 4vw, 48px); color: #fff; }
.lp-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.05rem; text-decoration: none; }
.lp-brand small { display: block; font-size: .7rem; font-weight: 600; opacity: .7; letter-spacing: .04em; }
.lp-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--lp-gold); color: var(--lp-navy); font-weight: 900; }
.lp-links { display: flex; gap: 22px; margin-left: auto; }
.lp-links a { color: rgba(255,255,255,.85); font-weight: 600; font-size: .92rem; text-decoration: none; }
.lp-links a:hover { color: #fff; }
.lp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font: inherit; font-weight: 800; cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.lp-btn.primary { background: var(--lp-gold); color: var(--lp-navy); }
.lp-btn.primary:hover { filter: brightness(1.05); }
.lp-btn.ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.45); }
.lp-btn.ghost:hover { background: rgba(255,255,255,.16); }

.lp-hero { position: relative; overflow: hidden; min-height: min(760px, 92vh); display: flex; align-items: center;
  background: radial-gradient(1200px 600px at 80% 20%, #22407F 0%, transparent 60%), linear-gradient(135deg, var(--lp-navy) 0%, var(--lp-navy-2) 60%, #1B2F63 100%); color: #fff; }
.lp-hero::before { content: ""; position: absolute; inset: 0; opacity: .07;
  background-image: repeating-linear-gradient(45deg, #fff 0 1px, transparent 1px 22px); }
.lp-hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lp-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,15,35,.92) 0%, rgba(8,15,35,.72) 45%, rgba(8,15,35,.35) 100%); }
.lp-hero-content { position: relative; z-index: 2; max-width: 720px; padding: 120px clamp(16px, 4vw, 48px) 64px; }
.lp-kicker { display: inline-block; padding: 6px 12px; border-radius: 999px; background: rgba(245,184,61,.16); color: var(--lp-gold); font-weight: 700; font-size: .82rem; letter-spacing: .02em; }
.lp-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; margin: 18px 0 16px; color: #fff; }
.lp-hero p { font-size: clamp(1rem, 1.6vw, 1.18rem); color: rgba(255,255,255,.82); max-width: 560px; line-height: 1.55; margin: 0; }
.lp-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 36px; }
.lp-stats { display: flex; gap: clamp(16px, 4vw, 40px); flex-wrap: wrap; }
.lp-stats div { border-left: 3px solid var(--lp-gold); padding-left: 12px; }
.lp-stats b { display: block; font-size: 1.15rem; }
.lp-stats span { font-size: .85rem; color: rgba(255,255,255,.7); }

.lp-banner { position: relative; max-width: 1180px; margin: -36px auto 0; padding: 0 clamp(16px, 4vw, 48px); z-index: 4; }
.lp-banner a { display: block; border-radius: 18px; overflow: hidden; box-shadow: 0 18px 40px rgba(15,23,42,.18); }
.lp-banner img { display: block; width: 100%; height: auto; }
.lp-banner .lp-sponsored { position: static; display: inline-block; margin: 0 0 6px 4px; }
.lp-sponsored { position: absolute; top: 12px; right: 12px; z-index: 2; padding: 3px 9px; border-radius: 999px; background: rgba(15,23,42,.72); color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.lp-section { max-width: 1180px; margin: 0 auto; padding: 72px clamp(16px, 4vw, 48px) 0; }
.lp-section-head { max-width: 640px; margin-bottom: 28px; }
.lp-section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 8px; }
.lp-section-head p { color: var(--lp-muted); margin: 0; line-height: 1.55; }
.lp-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.lp-feature { background: #fff; border: 1px solid #E6EAF0; border-radius: 18px; padding: 22px; }
.lp-feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #EAF1FE; font-size: 1.25rem; }
.lp-feature h3 { margin: 14px 0 6px; font-size: 1.05rem; }
.lp-feature p { margin: 0; color: var(--lp-muted); font-size: .92rem; line-height: 1.5; }

.lp-ads { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 20px; }
.lp-ad { background: #fff; border: 1px solid #E6EAF0; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.lp-ad:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(15,23,42,.10); }
.lp-ad-media { position: relative; aspect-ratio: 16 / 9; background: var(--lp-navy); }
.lp-ad-media img, .lp-ad-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.lp-ad-placeholder { height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.6); font-size: 2.4rem; }
.lp-ad-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.lp-ad-sponsor { font-size: .75rem; font-weight: 700; color: var(--lp-muted); text-transform: uppercase; letter-spacing: .06em; }
.lp-ad-body h3 { margin: 0; font-size: 1.12rem; }
.lp-ad-body p { margin: 0; color: var(--lp-muted); font-size: .92rem; line-height: 1.5; }
.lp-ad-cta { margin-top: auto; padding-top: 8px; font-weight: 800; color: #1D4ED8; text-decoration: none; }

.lp-advertise { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 36px; border-radius: 24px; color: #fff;
  background: linear-gradient(135deg, var(--lp-navy) 0%, #1E3A8A 100%); }
.lp-advertise h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.lp-advertise p { margin: 0; max-width: 620px; color: rgba(255,255,255,.8); line-height: 1.55; }
.lp-footer { max-width: 1180px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 48px) 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--lp-muted); font-size: .85rem; }

@media (max-width: 760px) {
  .lp-links { display: none; }
  .lp-nav .lp-btn { margin-left: auto; padding: 9px 16px; }
  .lp-hero-content { padding-top: 104px; }
  .lp-hero-shade { background: linear-gradient(180deg, rgba(8,15,35,.82) 0%, rgba(8,15,35,.9) 100%); }
  .lp-banner { margin-top: 20px; }
  .lp-advertise { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { .lp-hero-video { display: none; } .lp-ad { transition: none; } }

/* Landing hero: content beside an auto-sliding picture carousel */
.lp-hero-inner { position: relative; z-index: 2; width: 100%; max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(24px, 4vw, 56px); align-items: center; padding: 0 clamp(16px, 4vw, 48px); }
.lp-hero-inner .lp-hero-content { padding-left: 0; padding-right: 0; }
.lp-slider { position: relative; margin-top: 40px; }
.lp-slides { position: relative; aspect-ratio: 800 / 560; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08); background: #F8FAFC;
  transform: perspective(1400px) rotateY(-6deg); transition: transform .4s ease; }
.lp-slider:hover .lp-slides { transform: perspective(1400px) rotateY(0deg); }
.lp-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transform: scale(1.03); transition: opacity .8s ease, transform 1.2s ease; }
.lp-slide.active { opacity: 1; transform: scale(1); }
.lp-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lp-slider-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.lp-slide-caption { color: rgba(255,255,255,.85); font-weight: 600; font-size: .95rem; }
.lp-dots { display: flex; gap: 8px; }
.lp-dot { width: 10px; height: 10px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: rgba(255,255,255,.35); transition: width .3s ease, background .3s ease; }
.lp-dot.active { width: 28px; background: var(--lp-gold); }
@media (max-width: 960px) {
  .lp-hero-inner { grid-template-columns: minmax(0, 1fr); }
  .lp-slider { margin: 0 0 48px; }
  .lp-slides { transform: none; }
  .lp-hero-inner .lp-hero-content { padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .lp-slide, .lp-slides, .lp-dot { transition: none; } }

/* MASAIO emblem: header logo, faded large emblem in the hero, and a soft page watermark */
.lp-logo-img { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; box-shadow: 0 4px 14px rgba(0,0,0,.35); background: #0B3FA8; }
.lp-brand > span { font-size: 1.15rem; letter-spacing: .02em; }
.lp-hero-emblem { position: absolute; z-index: 1; pointer-events: none;
  width: min(1100px, 120vw); aspect-ratio: 1; left: -18%; top: 50%; transform: translateY(-50%);
  background: url("../../../brand/masaio-logo-1000.jpg") center / cover no-repeat; border-radius: 50%;
  opacity: .12; filter: saturate(.9); mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 70%); mask-image: radial-gradient(circle, #000 52%, transparent 70%); }
.lp-watermark { position: fixed; z-index: 0; pointer-events: none; width: min(900px, 110vw); aspect-ratio: 1; right: -12%; bottom: -14%;
  background: url("../../../brand/masaio-logo-1000.jpg") center / cover no-repeat; border-radius: 50%; opacity: .05;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 71%); mask-image: radial-gradient(circle, #000 55%, transparent 71%); }
.landing > :not(.lp-watermark) { position: relative; z-index: 1; }
.landing > .lp-nav { position: absolute; z-index: 3; }
@media (max-width: 760px) {
  .lp-logo-img { width: 38px; height: 38px; border-radius: 10px; }
  .lp-hero-emblem { left: -40%; opacity: .1; }
}

/* Landing: registered schools' logos scrolling above the hero pictures */
.lp-hero-side { min-width: 0; margin-top: 40px; }
.lp-hero-side .lp-slider { margin-top: 0; }
.lp-logos { margin-bottom: 18px; }
.lp-logos-title { display: block; color: rgba(255,255,255,.7); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 8px 2px; }
.lp-logos-window { overflow: hidden; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.lp-logos-track { display: flex; gap: 10px; padding: 10px; width: max-content; }
.lp-logos-track.moving { animation: lp-logos-scroll 40s linear infinite; }
.lp-logos:hover .lp-logos-track { animation-play-state: paused; }
@keyframes lp-logos-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.lp-logo-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255,255,255,.95); color: #0F172A; font-weight: 700; font-size: .82rem; white-space: nowrap; max-width: 220px; }
.lp-logo-chip img { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; flex: none; background: #E2E8F0; }
.lp-logo-chip span { overflow: hidden; text-overflow: ellipsis; }
.lp-sell { background: linear-gradient(135deg, #0B3FA8, #1E293B); color: #fff; }
.lp-sell p { color: rgba(255,255,255,.82); }
@media (max-width: 960px) { .lp-hero-side { margin: 0 0 48px; } .lp-hero-side .lp-slider { margin: 0; } }
@media (prefers-reduced-motion: reduce) { .lp-logos-track.moving { animation: none; } .lp-logos-window { overflow-x: auto; } }

/* Marketplace: product cards, media strip */
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.market-card { display: flex; flex-direction: column; background: var(--surface, #fff); border: 1px solid var(--border, #E6EAF0); border-radius: 16px; overflow: hidden; min-width: 0; }
.market-card.inactive { opacity: .6; }
.market-card.clickable { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.market-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.10); }
.market-cover { position: relative; aspect-ratio: 4 / 3; background: #F1F5F9; display: grid; place-items: center; font-size: 2.4rem; }
.market-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.market-badge { position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 999px; background: rgba(15,23,42,.75); color: #fff; font-size: .72rem; font-weight: 700; }
.market-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.market-price { font-weight: 800; font-size: 1.1rem; margin-top: 4px; }
.market-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.market-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; margin-bottom: 8px; }
@media (max-width: 760px) { .market-detail { grid-template-columns: minmax(0, 1fr); } }
.media-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.media-tile { position: relative; width: 120px; height: 120px; margin: 0; border-radius: 12px; overflow: hidden; background: #F1F5F9; border: 1px solid var(--border, #E6EAF0); flex: none; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 999px; border: 0; background: rgba(15,23,42,.75); color: #fff; cursor: pointer; font-size: .75rem; }
.media-add { display: grid; place-items: center; text-align: center; padding: 8px; cursor: pointer; border-style: dashed; color: var(--muted, #64748B); font-size: .82rem; font-weight: 600; }
.media-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.media-add.busy { cursor: progress; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs .chip-btn.active { background: var(--primary, #0B3FA8); color: #fff; border-color: transparent; }

/* Welcome page for a signed-in owner/administrator: live organization figures */
.lp-org-kicker { display: inline-flex; align-items: center; gap: 8px; }
.lp-org-kicker img { width: 24px; height: 24px; border-radius: 999px; object-fit: cover; background: #fff; }
.lp-stats a { border-left: 3px solid var(--lp-gold); padding-left: 12px; color: inherit; text-decoration: none; }
.lp-stats a:hover b { color: var(--lp-gold); }
.lp-stats a b { display: block; font-size: 1.4rem; }
.lp-stats a span { font-size: .85rem; color: rgba(255,255,255,.7); }
.lp-mine-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.lp-mine-card { background: #fff; border: 1px solid #E6EAF0; border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lp-mine-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.lp-mine-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-radius: 10px; color: inherit; text-decoration: none; min-width: 0; }
.lp-mine-row:hover { background: #F1F5F9; }
.lp-mine-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-mine-row span { color: var(--lp-muted); font-size: .85rem; }
.lp-mine-product { flex-direction: row; align-items: center; gap: 12px; }
.lp-mine-product img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.lp-mine-product > span { display: flex; flex-direction: column; min-width: 0; }
.lp-mine-more { margin-top: auto; padding: 10px 8px 0; font-weight: 700; color: #0B3FA8; text-decoration: none; }

/* Bracket rounds (tree) — on screen and printed / saved as PDF */
.bracket-scroll { overflow-x: auto; }
.bracket-svg { display: block; width: 100%; min-width: 760px; height: auto; background: #fff; border-radius: 10px; font-family: Helvetica, Arial, sans-serif; }
.bracket-svg .bt-title { fill: #fff; font-size: 15px; font-weight: 700; }
.bracket-svg .bt-sub { fill: #98B2DE; font-size: 8px; }
.bracket-svg .bt-round { fill: #fff; font-size: 8.5px; font-weight: 700; }
.bracket-svg .bt-bout { fill: #46648F; font-size: 7px; }
.bracket-svg .bt-name { fill: #16162D; font-size: 8.5px; }
.bracket-svg .bt-name.win { fill: #006E30; font-weight: 700; }
.bracket-svg .bt-score { fill: #464646; font-size: 7.5px; }
.bracket-svg .bt-score.win { fill: #007634; font-weight: 700; }
.bracket-svg .bt-seed { fill: #6E7A98; font-size: 6.5px; }
.bracket-svg .bt-tbd { fill: #9EAAC3; font-size: 8px; }
.bracket-svg .bt-champ-l { fill: #785800; font-size: 9px; font-weight: 700; }
.bracket-svg .bt-champ-n { fill: #3C2C00; font-size: 8.5px; }
.bracket-svg .bt-foot { fill: #7D8AA2; font-size: 7px; }
.bracket-svg .bt-line { fill: none; stroke: #558ACD; stroke-width: 1.4; }
.bracket-svg .bt-arrow { fill: #558ACD; }
.bracket-svg .bt-div { stroke: #C8D4E6; stroke-width: 0.5; }
.bracket-svg .bt-link:hover rect:first-child { stroke: #0B3FA8; stroke-width: 1.4; }

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body, .app, .main, .content { background: #fff !important; }
  .sidebar, .topbar, .tabbar, .drawer-backdrop, .no-print { display: none !important; }
  .app { display: block !important; }
  .content { padding: 0 !important; }
  .bracket-print { gap: 0 !important; }
  .bracket-sheet { border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; break-after: page; page-break-after: always; }
  .bracket-sheet:last-child { break-after: auto; page-break-after: auto; }
  .bracket-scroll { overflow: visible !important; }
  .bracket-svg { min-width: 0; width: 100%; max-height: 190mm; border-radius: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.assign-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.assign-bar .chip-btn.active { background: var(--primary, #0B3FA8); color: #fff; border-color: transparent; }
.assign-panel { border: 1px solid var(--border, #E6EAF0); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: #F8FAFC; }
.assign-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--border, #E6EAF0); }
.assign-row:first-of-type { border-top: 0; }

/* Where a competitor / judge is from: flags and organization */
.person-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0 2px; }
.person-badges.compact { justify-content: flex-start; gap: 4px; margin: 3px 0 0; }
.pb-place, .pb-org { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px 3px 4px; border-radius: 999px; background: rgba(255,255,255,.9); border: 1px solid var(--border, #E6EAF0); font-size: .8rem; font-weight: 600; color: #1E293B; }
.pb-place { padding-left: 6px; }
.pb-place > span, .pb-org > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-flag { width: 24px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(15,23,42,.15); flex: none; }
.pb-org img { width: 24px; height: 24px; border-radius: 999px; object-fit: cover; background: #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.12); flex: none; }
.pb-org-mark { width: 24px; text-align: center; flex: none; }
.person-badges.compact .pb-place, .person-badges.compact .pb-org { font-size: .72rem; padding: 2px 8px 2px 3px; }
.person-badges.compact .pb-flag { width: 18px; height: 12px; }
.person-badges.compact .pb-org img { width: 18px; height: 18px; }

/* Senshu (first point) toggle on each corner */
.senshu-btn { border: 1.5px dashed rgba(255,255,255,.7); background: rgba(255,255,255,.12); color: inherit; border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: .8rem; cursor: pointer; letter-spacing: .02em; }
.senshu-btn.on { border: 1.5px solid #B48A00; background: #FFC300; color: #3C2C00; box-shadow: 0 0 0 3px rgba(255,195,0,.35); }
.senshu-btn:disabled { cursor: default; opacity: .9; }

/* Program services tiles (like the app's Services grid) */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.svc-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 16px; background: var(--surface, #fff); border: 1px solid var(--border, #E6EAF0); color: inherit; text-decoration: none; text-align: left; font: inherit; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.svc-tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.svc-tile.active { border-color: var(--primary, #0B3FA8); box-shadow: 0 0 0 2px rgba(11,63,168,.18); }
.svc-tile:disabled { opacity: .55; cursor: default; }
.svc-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; }
.program-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.program-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.program-card h2 { margin: 0; }
