:root {
  --ink: #17212b;
  --muted: #647282;
  --line: #cbd4dc;
  --surface: #f7f9fb;
  --background: #dfe7eb;
  --blue: #1769aa;
  --blue-dark: #0c4e86;
  --green: #15734b;
  --red: #b83a49;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); line-height: 1.5; }
a { color: inherit; }
button, input, select { font: inherit; }
.site-header {
  min-height: 72px;
  padding: 14px max(20px, calc((100% - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--ink); font-size: 1.1rem; font-weight: 900; letter-spacing: .07em; text-decoration: none; }
.brand span { color: var(--blue); margin-left: 5px; }
.brand small { display: inline-block; margin-left: 7px; color: var(--muted); font-size: .65rem; letter-spacing: .08em; }
.container { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.hero { max-width: 760px; padding: 76px 0 56px; }
.hero h1, .event-hero h1 { margin: 12px 0 20px; font-size: clamp(2.2rem, 6vw, 4.35rem); line-height: 1.05; letter-spacing: -.045em; }
.hero > p:last-child { max-width: 590px; color: var(--muted); font-size: 1.15rem; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: .73rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 14px 0 22px; }
h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.2; }
h3 { margin: 0; line-height: 1.3; }
.muted { color: var(--muted); }
.event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 16px; padding-bottom: 72px; }
.event-card { display: flex; gap: 20px; min-width: 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.event-card { position: relative; }
.event-card-content { position: relative; width: 100%; }
.event-card-badges { position: absolute; top: 0; right: 0; display: grid; justify-items: end; gap: 5px; }
.registration-preview { min-height: 26px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; color: #4a5967; background: #edf2f5; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.event-status { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; max-width: 180px; color: #52665a; font-size: .68rem; font-weight: 750; text-align: right; white-space: normal; }
.event-status span { color: #31835b; font-size: .76rem; }
.event-status-checkin { color: #9f1727; }
.event-status-checkin span { color: #c51f32; }
.event-status-published { color: var(--blue-dark); }
.event-status-published span { color: var(--blue); }
.event-status-closed { color: #805018; }
.event-status-closed span { color: #a56a16; }
.event-status-open { color: #17633c; }
.event-status-open span { color: #31835b; }
.event-card-content > .eyebrow { padding-right: 122px; }
.event-date { flex: 0 0 58px; height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; background: #eaf3fb; color: var(--blue-dark); }
.event-date span { font-size: 1.65rem; font-weight: 850; line-height: 1; }
.event-date small { margin-top: 5px; font-size: .68rem; font-weight: 800; }
.event-card-content { min-width: 0; }
.event-card h3 { margin: 3px 0 4px; font-size: 1.25rem; }
.event-card p { margin: 4px 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 9px 16px;
  color: #fff;
  background: var(--blue);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button:disabled, input:disabled { opacity: .58; cursor: not-allowed; }
.button-outline { color: var(--blue-dark); background: transparent; }
.button-secondary { border-color: var(--green); background: var(--green); }
.button-danger { border-color: var(--red); background: var(--red); }
.text-link { color: var(--blue-dark); font-weight: 700; text-decoration: none; }
.event-hero { padding: 54px 0 32px; }
.event-hero h1 { font-size: clamp(2.1rem, 5vw, 3.35rem); }
.event-hero > p { color: var(--muted); }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; background: #eef2f6; color: #4a5967; font-size: .78rem; font-weight: 750; }
.pill-open { color: #126340; background: #e5f6ed; }
.pill-closed { color: #79500a; background: #fff4d8; }
.content-panel { margin: 22px 0; padding: clamp(20px, 4vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.notice { margin: 16px 0; border-radius: 8px; padding: 12px 15px; }
.notice-success { color: #135d3b; background: #e5f6ed; border: 1px solid #bee6ce; }
.notice-error { color: #8d1d2a; background: #fff0f1; border: 1px solid #f0c5ca; }
.bracket-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.bracket-card { border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.bracket-card h3 { font-size: 1rem; }
.bracket-match { display: grid; margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.bracket-match span { min-height: 36px; padding: 7px 9px; }
.bracket-match span + span { border-top: 1px solid var(--line); }
.bracket-match small { display: block; padding: 7px 9px; border-top: 1px solid var(--line); color: var(--muted); background: #f7f9fa; }
.bracket-match .winner { color: #0f6540; background: #e7f5ed; font-weight: 800; }
.bracket-rounds { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 220px); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.bracket-round h4 { margin: 10px 0 6px; color: var(--muted); font-size: .78rem; }
.bracket-match { position: relative; cursor: help; }
.bracket-graph-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.bracket-graph-card { grid-column: 1 / -1; }
.bracket-graph-toolbar .button { min-height: 36px; padding: 6px 12px; }
.bracket-graph-toolbar [data-expand] { margin-left: auto; }
.bracket-viewport { max-height: 72vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; touch-action: none; user-select: none; cursor: grab; }
.bracket-viewport:active { cursor: grabbing; }
.bracket-scaled-holder { position: relative; }
.bracket-graph { position: relative; display: flex; align-items: stretch; gap: 36px; width: max-content; padding: 18px; transform-origin: top left; }
.bracket-connectors { position: absolute; inset: 0; z-index: 0; overflow: visible; pointer-events: none; }
.bracket-connector { fill: none; stroke: #9cabb9; stroke-width: 2; }
.bracket-graph-round { position: relative; z-index: 1; display: flex; flex: 0 0 280px; flex-direction: column; }
.bracket-graph-round h4 { min-height: 28px; margin: 0 0 8px; color: var(--muted); font-size: .8rem; }
.bracket-graph-matches { display: flex; flex: 1; flex-direction: column; justify-content: space-around; gap: 22px; }
.bracket-graph-match { display: grid; gap: 8px; padding: 12px; border: 1px solid #d5dee7; border-left: 4px solid var(--bracket-accent, #2975a9); border-radius: 12px; background: #fff; box-shadow: 0 7px 14px rgb(23 33 43 / 9%); }
.bracket-match-heading { color: var(--bracket-accent, #2975a9); font-size: .73rem; font-weight: 850; letter-spacing: .03em; }
.bracket-graph-side { display: flex; min-width: 0; align-items: center; gap: 9px; }
.bracket-graph-side-blue { border: 1px solid #b9d6f1; border-radius: 8px; padding: 5px; background: #edf6ff; }
.bracket-graph-side-red { border: 1px solid #efc0c3; border-radius: 8px; padding: 5px; background: #fff0f0; }
.bracket-graph-side-red .bracket-avatar { border-color: #e3a8ac; color: #8e2430; background: radial-gradient(circle at 30% 25%, #fff 0 12%, #f5d1d2 38%, #c47b81 100%); box-shadow: inset 2px 3px 4px #fff, inset -3px -4px 5px #a7525a, 0 3px 5px rgb(23 33 43 / 20%); }
.bracket-corner { flex: 0 0 auto; border-radius: 4px; padding: 3px 5px; color: #fff; background: #1768a1; font-size: .58rem; font-weight: 900; }
.bracket-graph-side-red .bracket-corner { background: #ad2935; }
.bracket-avatar { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border: 1px solid #aac2d5; border-radius: 50%; color: #15547e; background: radial-gradient(circle at 30% 25%, #fff 0 12%, #d7e9f5 38%, #76a3c4 100%); box-shadow: inset 2px 3px 4px #fff, inset -3px -4px 5px #5681a0, 0 3px 5px rgb(23 33 43 / 20%); transform: perspective(55px) rotateY(-12deg); }
.bracket-avatar svg { width: 22px; height: 22px; filter: drop-shadow(1px 2px 1px rgb(23 33 43 / 25%)); }
.bracket-graph-name { flex: 1; min-width: 0; font-size: .82rem; font-weight: 750; overflow-wrap: anywhere; }
.bracket-graph-team { display: block; color: var(--muted); font-size: .7rem; font-weight: 500; }
.bracket-outcome { flex: 0 0 auto; border-radius: 5px; padding: 2px 6px; color: #fff; background: #647282; font-size: .68rem; font-weight: 900; }
.bracket-outcome-win { background: #15734b; }
.bracket-outcome-loss { background: #bd2433; }
.bracket-score { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.bracket-match-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.bracket-match-editor label { display: grid; gap: 4px; color: #344250; font-size: .72rem; font-weight: 700; }
.bracket-match-editor select, .bracket-match-editor input { min-width: 0; width: 100%; min-height: 36px; border: 1px solid #cbd5df; border-radius: 6px; padding: 5px 7px; background: #fff; }
.bracket-result-fields { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bracket-result-fields[hidden] { display: none; }
.bracket-match-editor button { grid-column: 1 / -1; }
.bracket-graph-widget.is-expanded { position: fixed; z-index: 9999; inset: 0; display: flex; flex-direction: column; overflow: hidden; border: 0; border-radius: 0; padding: 12px; background: #fff; }
.bracket-graph-widget.is-expanded .bracket-graph-toolbar { flex: 0 0 auto; }
.bracket-graph-widget.is-expanded .bracket-viewport { flex: 1 1 auto; min-height: 0; max-height: none; }
body.bracket-graph-expanded { overflow: hidden; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; color: #344250; font-size: .9rem; font-weight: 700; }
.field input, .field select { width: 100%; min-height: 42px; border: 1px solid #cbd5df; border-radius: 7px; padding: 9px 11px; color: var(--ink); background: #fff; }
.derived-category { display: flex; min-height: 42px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; color: var(--blue-dark); background: #edf2f5; }
.field-wide { grid-column: 1 / -1; }
.check-group { display: flex; flex-wrap: wrap; gap: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.check-group label { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.absolute-option { display: flex; align-items: center; gap: 12px; margin-top: 2px; padding: 15px; border: 1px solid #e8aab1; border-radius: 9px; color: #8c1623; background: #fff0f1; }
.absolute-option input { flex: 0 0 auto; width: 20px; height: 20px; accent-color: #b83a49; }
.absolute-option strong, .absolute-option small { display: block; }
.absolute-option small { margin-top: 3px; color: #7d4650; font-weight: 500; }
.agreements { display: grid; gap: 12px; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: #edf2f5; }
.agreements legend { padding: 0 6px; font-weight: 750; }
.agreements label { display: flex; align-items: flex-start; gap: 9px; font-weight: 550; }
.agreements input { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 3px; }
.conditional-fields { display: flex; flex: 1 1 100%; gap: 14px; margin-top: 12px; }
.conditional-fields .field { flex: 1; }
.login-card { width: min(420px, 100%); margin: 60px auto; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.login-card h1 { margin: 0 0 22px; }
.stack-form { display: grid; gap: 16px; }
.admin-container { padding-top: 34px; }
.event-selector { max-width: 520px; margin-bottom: 22px; }
.admin-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.event-lifecycle { margin: 14px 0 0; color: var(--muted); font-size: .9rem; font-weight: 750; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.stat-card h3 { margin-bottom: 12px; }
.stat-row { display: flex; justify-content: space-between; gap: 10px; margin: 7px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.table-heading { margin-top: 0; }
.refresh-note { margin: 16px 0 0; color: var(--muted); font-size: .82rem; }
.manager-category { border: 1px solid var(--line); border-radius: 10px; margin-top: 14px; padding: 16px; }
.manager-category h3 { margin-bottom: 12px; }
.manager-round { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 12px; margin-top: 12px; }
.manager-round h4 { grid-column: 1 / -1; margin: 4px 0 0; color: var(--muted); }
.match-manager { display: grid; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafb; }
.match-manager label { display: grid; gap: 5px; color: #344250; font-size: .82rem; font-weight: 700; }
.match-manager select, .match-manager input { min-height: 38px; width: 100%; border: 1px solid #cbd5df; border-radius: 7px; padding: 7px 9px; background: #fff; }
.match-participants { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; font-size: .82rem; }
.empty-state { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
.site-footer { padding: 28px 20px; text-align: center; color: var(--muted); font-size: .85rem; }
.site-footer span { margin: 0 5px; }
.site-footer p { margin: 0 0 10px; }
.site-footer-credit strong { color: var(--ink); }
.site-footer-socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; }
.site-footer-socials a { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; }
.site-footer-socials a:hover, .site-footer-socials a:focus-visible { color: var(--blue-dark); text-decoration: underline; }
.site-footer-socials a:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 2px; }
.site-footer-socials svg { width: 18px; height: 18px; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 54px; }
}
@media (max-width: 560px) {
  .container { width: min(100% - 28px, 1120px); }
  .site-header { min-height: 62px; padding: 12px 14px; }
  .site-header > .button { max-width: 150px; padding: 8px 10px; font-size: .78rem; text-align: center; }
  .event-card { padding: 17px; gap: 12px; }
  .event-date { flex-basis: 48px; height: 58px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: 1; }
  .admin-summary { align-items: flex-start; flex-direction: column; }
  .admin-actions .button { flex: 1 1 150px; }
  .login-card { margin: 30px auto; padding: 24px; }
  .conditional-fields { flex-direction: column; }
  .bracket-graph-toolbar { gap: 6px; }
  .bracket-graph-toolbar .button { flex: 1 1 auto; padding: 6px 8px; font-size: .75rem; }
  .bracket-graph-toolbar [data-expand] { margin-left: 0; }
  .bracket-result-fields { grid-template-columns: 1fr; }
  .bracket-graph-widget.is-expanded { padding: 8px; }
}
