:root{
  --app-height:100vh;
  --bg:#08131c;
  --bg-soft:#102130;
  --panel:#112636;
  --panel-2:#153145;
  --line:rgba(255,255,255,.09);
  --text:#eff7fb;
  --muted:#9ec0d1;
  --blue:#176bff;
  --sand:#f4d479;
  --green:#3ecf8e;
  --red:#d45b5b;
  --shadow:0 18px 48px rgba(0,0,0,.28);
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:
  radial-gradient(circle at top left, rgba(42,108,168,.35), transparent 32%),
  linear-gradient(180deg, #0b1823 0%, #08131c 48%, #071018 100%);
  color:var(--text);
  font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

button,input,select{
  font:inherit;
}

button,input,select{
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  padding:12px 14px;
}

button{
  cursor:pointer;
  background:linear-gradient(135deg, #1d74ff, #1356c8);
  border:none;
  font-weight:700;
  box-shadow:0 10px 22px rgba(23,107,255,.25);
}

button.ghost{
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  box-shadow:none;
}

.shell{
  width:min(1440px, calc(100% - 32px));
  margin:24px auto 36px;
}

.brand-bar{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  margin-bottom:18px;
}

.language-switcher{
  display:flex;
  gap:10px;
  align-items:center;
}

.lang-btn{
  width:48px;
  height:48px;
  padding:0;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  box-shadow:none;
  font-size:1.4rem;
}

.lang-btn.active{
  background:linear-gradient(135deg, #1d74ff, #1356c8);
  box-shadow:0 10px 22px rgba(23,107,255,.25);
}

.eyebrow{
  margin:0 0 10px;
  text-transform:uppercase;
  letter-spacing:.24em;
  color:var(--sand);
  font-size:12px;
  font-weight:800;
}

.brand-copy h1{
  margin:0;
  font-size:clamp(1.8rem, 3vw, 2.8rem);
  line-height:1;
}

.brand-logo{
  margin:0;
  font-family:"Bodoni 72","Didot","Iowan Old Style","Times New Roman",serif;
  font-size:clamp(2.4rem, 4.6vw, 4.4rem);
  font-weight:700;
  line-height:.92;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#fbfdff;
  text-shadow:0 10px 30px rgba(9,18,28,.22);
  display:inline-flex;
  align-items:center;
  gap:14px;
}

.brand-logo::before{
  content:"";
  width:16px;
  height:42px;
  border-radius:999px;
  background:linear-gradient(180deg, #f4d479 0%, #caa24c 38%, #176bff 100%);
  box-shadow:0 0 0 1px rgba(255,255,255,.08), 0 12px 24px rgba(7,16,24,.24);
}

.brand-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:flex-end;
}

.badge{
  padding:10px 14px;
  border-radius:999px;
  background:rgba(62,207,142,.15);
  border:1px solid rgba(62,207,142,.28);
  color:#bff3d8;
  font-weight:700;
}

.badge.soft{
  background:rgba(255,255,255,.04);
  border-color:var(--line);
  color:var(--muted);
}

.hidden{
  display:none !important;
}

.role-nav{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:0 0 18px;
  align-items:center;
}

.role-card{
  border:1px solid var(--line);
  border-radius:24px;
  padding:24px;
  background:rgba(17,38,54,.78);
  box-shadow:var(--shadow);
  display:grid;
  gap:14px;
}

.role-card h2{
  margin:0;
  font-size:2rem;
}

.role-card p{
  margin:0;
  color:var(--muted);
}

.view{
  margin-top:10px;
}

.manager-topbar{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:center;
  margin:0 0 18px;
}

.manager-title h2{
  margin:0;
  font-size:1.8rem;
}

.manager-topbar.compact .eyebrow{
  margin-bottom:6px;
}

.mode-topbar{
  margin-bottom:14px;
}

.mode-topbar .manager-title h2{
  font-size:1.45rem;
}

.manager-tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:8px;
  border-radius:20px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
}

.manager-tabs button{
  min-width:124px;
}

.manager-main-nav{
  justify-content:flex-end;
  align-items:center;
}

.manager-main-nav button{
  min-width:auto;
}

.manager-current{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:flex-start;
  margin:0 0 18px;
  padding:18px 22px;
  border-radius:24px;
  border:1px solid rgba(244,212,121,.18);
  background:linear-gradient(135deg, rgba(244,212,121,.08), rgba(255,255,255,.03));
}

.manager-current h3{
  margin:0;
  font-size:1.65rem;
}

.manager-current p{
  margin:8px 0 0;
  color:var(--muted);
}

.manager-current-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

@media (max-width: 980px){
  .manager-topbar{
    flex-direction:column;
    align-items:stretch;
  }

  .manager-main-nav{
    justify-content:flex-start;
  }
}

.auth-shell{
  display:grid;
  place-items:center;
  margin-top:10px;
}

.auth-card{
  width:min(560px, 100%);
}

.mode-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.mode-card{
  display:grid;
  gap:8px;
  text-align:left;
  padding:18px;
  border-radius:20px;
}

.mode-card span{
  color:var(--muted);
  font-size:14px;
}

.auth-form{
  display:grid;
  gap:12px;
}

.small-note{
  min-height:20px;
  color:var(--sand);
  font-size:14px;
}

.small-note.success{
  color:#bff3d8;
}

.small-note.error{
  color:#ffb8b8;
}

.hint-box{
  border-radius:18px;
  padding:14px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  color:var(--muted);
}

.hint-box strong{
  color:var(--text);
}

.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:18px 0;
}

.stat{
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  background:rgba(17,38,54,.72);
}

.stat .label{
  color:var(--muted);
  font-size:13px;
}

.stat strong{
  display:block;
  margin-top:10px;
  font-size:2rem;
}

.layout{
  display:grid;
  grid-template-columns:1.15fr .85fr;
  gap:18px;
}

.panel{
  border:1px solid var(--line);
  border-radius:24px;
  padding:22px;
  background:rgba(17,38,54,.78);
  box-shadow:var(--shadow);
}

.manager-pane{
  position:relative;
}

.manager-pane::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:3px;
  border-radius:24px 24px 0 0;
  background:linear-gradient(90deg, rgba(244,212,121,.75), rgba(23,107,255,.75));
  opacity:.75;
}

.panel.wide{
  grid-column:1 / -1;
}

.panel-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-end;
  margin-bottom:18px;
}

.panel-head h2{
  margin:0;
  font-size:1.35rem;
}

.panel-head p{
  margin:6px 0 0;
  color:var(--muted);
  max-width:46ch;
}

.form-grid{
  display:grid;
  gap:12px;
  grid-template-columns:repeat(3,minmax(0,1fr));
  padding:16px;
  border-radius:20px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.05);
}

.form-grid.compact{
  grid-template-columns:2fr 1fr;
}

.permission-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  padding:4px 0;
}

.permission-grid.compact{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.permission-pill{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:48px;
  padding:0 14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-weight:700;
}

.permission-pill input{
  width:18px;
  height:18px;
  margin:0;
  accent-color:var(--blue);
}

.permission-pill.active{
  border-color:rgba(23,107,255,.5);
  background:rgba(23,107,255,.12);
}

.athlete-form{
  margin:16px 0 14px;
}

.schedule-bar{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:18px;
  align-items:flex-end;
}

label{
  display:grid;
  gap:8px;
  color:var(--muted);
  font-size:14px;
}

.stack{
  display:grid;
  gap:12px;
}

.event-workspace{
  margin-top:20px;
  padding-top:4px;
  border-top:1px solid var(--line);
}

.division-card,.queue-item,.result-item{
  border:1px solid var(--line);
  border-radius:20px;
  padding:16px;
  background:rgba(255,255,255,.03);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

.division-head{
  display:flex;
  justify-content:space-between;
  gap:14px;
  cursor:pointer;
}

.division-head h3,.queue-item h3,.mat-card h3{
  margin:0;
}

.division-head p,.queue-item p,.result-item p{
  margin:6px 0 0;
  color:var(--muted);
}

.division-card.division-collapsed .division-config,
.division-card.division-collapsed form,
.division-card.division-collapsed .chips{
  display:none;
}

.division-card.division-collapsed{
  padding-bottom:14px;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-size:14px;
}

.chip small{
  color:var(--muted);
}

.queue-item{
  display:grid;
  gap:12px;
}

.queue-item-compact{
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  padding:12px 16px;
}

.queue-compact-main{
  min-width:0;
}

.queue-compact-main h3{
  font-size:1rem;
  line-height:1.2;
}

.queue-compact-main p{
  margin-top:4px;
  font-size:13px;
  line-height:1.2;
}

.queue-compact-actions{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}

.queue-compact-actions button{
  padding:10px 14px;
  white-space:nowrap;
}

.queue-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}

.queue-row.compact-line{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.025);
}

.queue-row.compact-line span:first-of-type{
  flex:1 1 260px;
}

.status{
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
}

.status.pending{background:rgba(255,255,255,.06);color:var(--muted)}
.status.active{background:rgba(23,107,255,.18);color:#cde0ff}
.status.done{background:rgba(62,207,142,.16);color:#ccf5e1}

@media (max-width: 760px){
  .queue-item-compact{
    grid-template-columns:1fr;
    align-items:flex-start;
  }

  .queue-compact-actions{
    width:100%;
    justify-content:space-between;
  }
}

.mats-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(290px,1fr));
  gap:16px;
}

.mat-card{
  overflow:hidden;
  min-height:360px;
}

.mobile-controller{
  display:grid;
  gap:16px;
  margin-top:18px;
}

.mobile-controller label{
  max-width:220px;
}

.mobile-summary{
  border-radius:18px;
  padding:16px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
}

.mobile-actions{
  display:grid;
  gap:12px;
}

.tv-stage.compact{
  min-height:360px;
}

.tv-stage.compact .tv-fighter{
  grid-template-columns:minmax(0,1fr) minmax(150px, 38%);
  min-height:120px;
}

.tv-stage.compact .tv-fighter-name{
  padding:18px 20px;
  font-size:clamp(1.8rem, 3vw, 3rem);
}

.tv-stage.compact .tv-score-cluster{
  gap:4px;
}

.tv-stage.compact .tv-score-card{
  border-left-width:2px;
  border-right-width:2px;
}

.tv-stage.compact .tv-score-card strong{
  font-size:clamp(3.4rem, 6vw, 5.4rem);
}

.tv-footer.compact{
  gap:10px;
  padding:10px 14px;
}

.tv-footer.compact .tv-timer{
  font-size:clamp(2.6rem, 6vw, 4.6rem);
}

.tv-footer.compact .tv-division{
  font-size:clamp(1rem, 1.8vw, 1.4rem);
}

.referee-layout{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

.manager-score-layout{
  grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:start;
}

.referee-toolbar{
  margin-bottom:14px;
}

.referee-current-topbar{
  margin:0 0 12px;
}

.referee-filter-row{
  margin:12px 0 14px;
}

.referee-filter-row label{
  display:block;
  max-width:220px;
}

#refereeView,
#refereeView button,
#refereeView select{
  touch-action:manipulation;
}

html.referee-current-mode,
body.referee-current-mode{
  overflow:hidden;
  overscroll-behavior:none;
  height:100%;
}

html.referee-current-mode{
  position:fixed;
  width:100%;
  inset:0;
}

body.referee-current-mode .brand-bar,
body.referee-current-mode #sessionBar,
body.referee-current-mode #refereeView > .panel > .panel-head,
body.referee-current-mode #refereeMessage,
body.referee-current-mode #refereeWorkspace > .referee-toolbar,
body.referee-current-mode #refereeWorkspace > #refereeTabs,
body.referee-current-mode #refereeQueuePane{
  display:none;
}

body.referee-current-mode .shell{
  position:fixed;
  inset:0;
  width:100%;
  max-width:none;
  margin:0;
  padding:0;
  min-height:var(--app-height);
  height:var(--app-height);
  overflow:hidden;
}

body.referee-current-mode #refereeView{
  min-height:var(--app-height);
  height:var(--app-height);
  overflow:hidden;
}

body.referee-current-mode #refereeView > .panel{
  min-height:var(--app-height);
  height:var(--app-height);
  margin:0;
  padding:10px 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-radius:0;
  border:none;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  overscroll-behavior:none;
}

body.referee-current-mode #refereeWorkspace{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
}

body.referee-current-mode #refereeCurrentPane{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  height:100%;
  overflow:hidden;
  overscroll-behavior:none;
  padding-bottom:4px;
}

body.referee-current-mode #refTimerRow{
  margin-top:0;
  gap:8px;
}

.ref-mini-pill{
  display:flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border-radius:10px;
  font-size:.95rem;
  font-weight:900;
  color:#fff;
}

.ref-mini-pill.green{
  background:#268630;
}

.ref-mini-pill.gold{
  background:#d3e42a;
  color:#111;
}

.ref-mini-pill.red{
  background:#bf1f1f;
}

.ref-current-timer{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:82px;
  height:42px;
  padding:0 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-size:1.05rem;
  font-weight:900;
}

.ref-inline-stats{
  grid-column:2 / -1;
  display:flex;
  justify-content:flex-start;
  gap:8px;
  align-items:center;
  flex-wrap:nowrap;
}

body.referee-current-mode .referee-layout{
  flex:1;
  min-height:0;
  overflow:hidden;
  gap:8px;
}

body.referee-current-mode .referee-score-card{
  flex:1;
  padding:10px;
}

body.referee-current-mode .result-row{
  margin-top:10px !important;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

body.referee-current-mode .result-row button{
  grid-column:1 / -1;
  min-height:50px;
  margin-top:0;
}

body.referee-current-mode #refereeCurrentPane,
body.referee-current-mode #refereeCurrentPane *{
  overscroll-behavior:none;
}

body.referee-current-mode .referee-current-topbar{
  margin:0 0 8px;
  align-items:center;
  justify-content:space-between;
}

body.referee-current-mode .referee-current-topbar button{
  min-height:42px;
  padding:10px 14px;
}

body.referee-current-mode .referee-timer-row button{
  min-height:44px;
  border-radius:14px;
  font-size:.94rem;
}

body.referee-current-mode .referee-score-card span{
  font-size:.98rem;
  margin-bottom:0;
}

body.referee-current-mode .referee-score-card button{
  min-height:46px;
  border-radius:14px;
  font-size:.96rem;
}

@media (display-mode: standalone){
  body.referee-current-mode #refereeView > .panel{
    padding:14px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  }

  body.referee-current-mode #refereeCurrentPane{
    padding-bottom:8px;
  }

  body.referee-current-mode #refTimerRow{
    gap:10px;
  }

  body.referee-current-mode .referee-layout{
    gap:12px;
  }

  body.referee-current-mode .referee-score-card{
    padding:14px;
  }

  body.referee-current-mode .result-row{
    margin-top:18px !important;
    gap:10px;
  }

  body.referee-current-mode .result-row button{
    min-height:56px;
    margin-top:4px;
  }

  body.referee-current-mode .referee-current-topbar{
    margin:0 0 12px;
  }

  body.referee-current-mode .referee-current-topbar button{
    min-height:46px;
    padding:12px 16px;
  }

  body.referee-current-mode .referee-timer-row button{
    min-height:50px;
    border-radius:16px;
    font-size:1rem;
  }

  body.referee-current-mode .referee-score-card span{
    font-size:1.05rem;
    margin-bottom:2px;
  }

  body.referee-current-mode .referee-score-card button{
    min-height:52px;
    border-radius:16px;
    font-size:1rem;
  }

  .ref-current-timer{
    min-width:92px;
    height:46px;
    font-size:1.14rem;
  }
}

.touch-group{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.touch-group span{
  grid-column:1 / -1;
  color:var(--muted);
  font-weight:700;
}

.touch-group button{
  min-height:54px;
}

.referee-score-card{
  padding:14px;
  border-radius:20px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
}

#currentEventClosedMatches .queue-item{
  gap:10px;
}

.referee-score-card span{
  margin-bottom:2px;
  font-size:1.05rem;
  color:var(--text);
}

.referee-score-card button{
  min-height:52px;
  padding:0;
  border-radius:16px;
  font-size:1rem;
}

.referee-timer-row{
  margin-top:10px;
  grid-template-columns:repeat(4,minmax(0,1fr));
}

.referee-timer-row button{
  min-height:50px;
  padding:0;
  border-radius:16px;
}

.timer-row,.result-row{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}

.manager-timer-row{
  grid-template-columns:repeat(8,minmax(0,1fr));
}

.manager-timer-row button{
  min-height:40px;
  font-size:.92rem;
  border-radius:14px;
}

.manager-touch-group{
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  padding:12px;
}

.manager-touch-group button{
  min-height:42px;
  font-size:.95rem;
  border-radius:14px;
}

.manager-touch-group span{
  margin-bottom:4px;
}

@media (max-width: 1024px){
  .manager-score-layout{
    grid-template-columns:1fr;
  }

  .manager-timer-row{
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
}

table{
  width:100%;
  border-collapse:collapse;
  background:rgba(255,255,255,.02);
  border-radius:18px;
  overflow:hidden;
}

th,td{
  padding:12px 10px;
  border-bottom:1px solid var(--line);
  text-align:left;
}

th{
  color:var(--muted);
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.xp-bar{
  position:relative;
  height:10px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  overflow:hidden;
}

.xp-bar > div{
  position:absolute;
  inset:0 auto 0 0;
  background:linear-gradient(90deg, var(--sand), #ffb74d);
  border-radius:999px;
}

.tv-shell{
  position:relative;
  padding:28px;
}

.tv-presentation{
  display:block;
  margin-top:16px;
}

.tv-division-filters{
  display:grid;
  gap:10px;
  min-width:min(100%, 560px);
}

.tv-filter-pills{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.tv-filter-pills button{
  min-width:auto;
  padding:10px 14px;
  box-shadow:none;
}

.tv-filter-pills button.active{
  background:linear-gradient(135deg, #1d74ff, #1356c8);
  border:none;
  box-shadow:0 10px 22px rgba(23,107,255,.25);
}

.tv-exit-btn{
  display:none;
  position:absolute;
  top:16px;
  left:16px;
  z-index:20;
  padding:12px 18px;
  border-radius:16px;
  background:rgba(7,16,24,.72);
  border:1px solid rgba(255,255,255,.18);
  color:#fff;
}

.tv-stage{
  display:grid;
  grid-template-rows:1fr 1fr auto;
  border-radius:32px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#dfe7f2;
  color:#08131c;
  min-height:calc(100vh - 210px);
}

.tv-results-stage{
  min-height:calc(100vh - 210px);
  height:calc(var(--app-height) - 210px);
  border-radius:32px;
  overflow:hidden;
  border:1px solid var(--line);
  background:linear-gradient(180deg, #10263a 0%, #0a1520 100%);
  color:#eef7fb;
  display:grid;
  grid-template-rows:auto 1fr;
}

.tv-results-header{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:end;
  padding:20px 28px 16px;
  background:linear-gradient(180deg, #1f51e0 0%, #173ea9 100%);
}

.tv-results-title{
  font-size:clamp(1.6rem, 3.2vw, 3.1rem);
  font-weight:900;
  text-transform:uppercase;
}

.tv-results-event{
  font-size:clamp(.92rem, 1.45vw, 1.28rem);
  font-weight:700;
  color:rgba(255,255,255,.88);
  text-align:right;
}

.tv-results-grid{
  display:grid;
  gap:14px;
  padding:18px;
  align-content:start;
  align-items:stretch;
  height:100%;
  min-height:0;
  grid-auto-rows:1fr;
}

.tv-results-division{
  height:100%;
  border-radius:24px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.1);
  background:rgba(255,255,255,.04);
}

.tv-results-division-all{
  display:grid;
  grid-template-rows:auto 1fr;
}

.tv-results-division-name{
  padding:13px 16px;
  font-size:clamp(1rem, 1.55vw, 1.26rem);
  font-weight:900;
  text-transform:uppercase;
  background:rgba(255,255,255,.06);
}

.tv-results-list{
  display:grid;
  align-content:start;
}

.tv-results-all-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:8px;
  padding:10px;
  height:100%;
  grid-auto-rows:minmax(0,1fr);
}

.tv-results-mini-block{
  height:100%;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  overflow:hidden;
}

.tv-results-mini-title{
  padding:8px 10px;
  font-size:clamp(.72rem, .92vw, .9rem);
  font-weight:900;
  text-transform:uppercase;
  background:rgba(255,255,255,.05);
}

.tv-results-mini-list{
  display:grid;
  height:100%;
  align-content:start;
  grid-auto-rows:auto;
}

.tv-results-mini-row{
  display:grid;
  grid-template-columns:46px minmax(0,1fr) auto;
  gap:5px;
  align-items:center;
  padding:5px 8px;
  border-top:1px solid rgba(255,255,255,.06);
}

.tv-results-mini-place{
  font-size:clamp(.72rem, .9vw, .9rem);
  font-weight:900;
  line-height:1;
}

.tv-results-mini-name{
  font-size:clamp(.76rem, .92vw, .96rem);
  font-weight:800;
  min-width:0;
  line-height:1.05;
}

.tv-results-mini-meta{
  font-size:clamp(.66rem, .78vw, .84rem);
  font-weight:700;
  color:rgba(255,255,255,.74);
  line-height:1;
}

.tv-results-mini-empty{
  padding:12px;
  font-size:.84rem;
  color:rgba(255,255,255,.68);
}

.tv-results-row{
  display:grid;
  grid-template-columns:50px minmax(0,1fr) auto;
  gap:6px;
  align-items:center;
  padding:7px 12px;
  border-top:1px solid rgba(255,255,255,.08);
}

.tv-results-place{
  font-size:clamp(.95rem, 1.8vw, 1.45rem);
  font-weight:900;
  line-height:1;
}

.tv-results-name{
  font-size:clamp(.92rem, 1.45vw, 1.4rem);
  font-weight:800;
  min-width:0;
  line-height:1.05;
}

.tv-results-meta{
  font-size:clamp(.76rem, 1vw, .96rem);
  font-weight:700;
  color:rgba(255,255,255,.78);
  line-height:1;
}

.tv-results-mode-compact .tv-results-row{
  grid-template-columns:44px minmax(0,1fr) auto;
  gap:5px;
  padding:6px 10px;
}

.tv-results-mode-compact .tv-results-place{
  font-size:clamp(.86rem, 1.25vw, 1.14rem);
}

.tv-results-mode-compact .tv-results-name{
  font-size:clamp(.82rem, 1.05vw, 1rem);
}

.tv-results-mode-compact .tv-results-meta{
  font-size:clamp(.68rem, .82vw, .82rem);
}

.tv-results-all-mode .tv-results-grid{
  grid-template-columns:1fr !important;
  grid-auto-rows:minmax(0,1fr);
}

.tv-results-all-stacked .tv-results-grid{
  grid-template-columns:1fr !important;
  grid-template-rows:repeat(2,minmax(0,1fr));
}

.tv-results-all-stacked .tv-results-all-grid{
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:10px;
  padding:12px;
}

.tv-results-all-stacked .tv-results-mini-title{
  font-size:clamp(.8rem, .9vw, .95rem);
  padding:9px 10px;
}

.tv-results-all-stacked .tv-results-mini-row{
  grid-template-columns:42px minmax(0,1fr) auto;
  gap:5px;
  padding:5px 8px;
}

.tv-results-all-stacked .tv-results-mini-place{
  font-size:clamp(.86rem, .95vw, 1rem);
}

.tv-results-all-stacked .tv-results-mini-name{
  font-size:clamp(.74rem, .84vw, .9rem);
}

.tv-results-all-stacked .tv-results-mini-meta{
  font-size:clamp(.62rem, .68vw, .76rem);
}

.tv-results-all-solo .tv-results-grid{
  grid-template-columns:1fr !important;
}

.tv-results-all-solo .tv-results-all-grid{
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:12px;
  padding:14px;
}

.tv-results-all-solo .tv-results-mini-title{
  font-size:clamp(.84rem, 1vw, 1rem);
  padding:9px 11px;
}

.tv-results-all-solo .tv-results-mini-row{
  grid-template-columns:52px minmax(0,1fr) auto;
  padding:6px 9px;
}

.tv-results-all-solo .tv-results-mini-place{
  font-size:clamp(.92rem, 1.1vw, 1.15rem);
}

.tv-results-all-solo .tv-results-mini-name{
  font-size:clamp(.78rem, .9vw, .94rem);
}

.tv-results-all-solo .tv-results-mini-meta{
  font-size:clamp(.64rem, .72vw, .78rem);
}

.tv-results-mode-dense .tv-results-grid{gap:12px;padding:16px;}

.tv-results-mode-dense .tv-results-division-name{
  padding:12px 14px;
  font-size:clamp(.95rem, 1.35vw, 1.12rem);
}

.tv-results-mode-dense .tv-results-row{
  grid-template-columns:48px minmax(0,1fr) auto;
  gap:5px;
  padding:6px 10px;
}

.tv-results-mode-dense .tv-results-place{
  font-size:clamp(.9rem, 1.3vw, 1.1rem);
}

.tv-results-mode-dense .tv-results-name{
  font-size:clamp(.84rem, 1.05vw, 1rem);
}

.tv-results-mode-dense .tv-results-meta{
  font-size:clamp(.72rem, .9vw, .84rem);
}

.tv-results-row.podium-1{
  background:rgba(244,212,121,.12);
}

.tv-results-row.podium-2{
  background:rgba(210,220,235,.08);
}

.tv-results-row.podium-3{
  background:rgba(190,125,79,.12);
}

.tv-fighter{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(440px, 40%);
  align-items:stretch;
  min-height:0;
}

.tv-fighter.top{
  background:linear-gradient(180deg, #2e67ff 0%, #1f51e0 100%);
  color:#fff;
}

.tv-fighter.bottom{
  background:#edf3fb;
  color:#111;
}

.tv-fighter.top .tv-score-cluster,
.tv-fighter.bottom .tv-score-cluster{
  padding-bottom:10px;
}

.tv-fighter-name{
  display:flex;
  align-items:center;
  padding:24px 42px;
  font-size:clamp(3.2rem, 7vw, 7.8rem);
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.02em;
}

.tv-score-cluster{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  padding:0;
  align-self:stretch;
  height:100%;
  min-height:100%;
  grid-auto-rows:1fr;
}

.tv-score-card{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 6px;
  border-radius:0;
  border-left:3px solid rgba(0,0,0,.16);
  border-right:3px solid rgba(0,0,0,.16);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18);
  height:100%;
}

.tv-score-card strong{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  font-size:clamp(5.4rem, 10vw, 10rem);
  line-height:1;
}

.tv-score-card.green{
  background:#268630;
  color:#eef7ff;
}

.tv-score-card.gold{
  background:#d3e42a;
  color:#111;
}

.tv-score-card.red{
  background:#bf1f1f;
  color:#fff;
}

.tv-footer{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:end;
  gap:20px;
  background:#c61b1b;
  color:#111;
  padding:20px 28px 18px;
}

.tv-timer{
  font-size:clamp(4rem, 10vw, 8rem);
  font-weight:900;
  line-height:1;
}

.tv-division{
  align-self:center;
  font-size:clamp(1.2rem, 2vw, 2rem);
  font-weight:800;
  text-transform:uppercase;
  color:rgba(255,255,255,.86);
}

.tv-shell:fullscreen{
  width:100vw;
  height:100vh;
  margin:0;
  padding:0;
  border:none;
  border-radius:0;
  background:#000;
  box-shadow:none;
}

.tv-shell:fullscreen .panel-head{
  display:none;
}

.tv-shell:fullscreen .tv-presentation{
  margin:0;
  width:100%;
  height:100%;
}

.tv-shell:fullscreen .tv-stage{
  min-height:100vh;
  height:100vh;
  border:none;
  border-radius:0;
}

.tv-shell:fullscreen .tv-results-stage{
  min-height:100vh;
  height:100vh;
  border:none;
  border-radius:0;
}

.tv-shell:fullscreen .tv-exit-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.athlete-profile{
  display:grid;
  gap:18px;
}

.athlete-hero{
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:18px;
}

.athlete-profile-hero{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  gap:18px;
  align-items:center;
}

.athlete-profile-copy{
  min-width:0;
}

.athlete-profile-avatar-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
}

.athlete-avatar{
  display:flex;
  align-items:center;
  justify-content:center;
}

.athlete-avatar svg{
  display:block;
  width:100%;
  height:auto;
}

.avatar-lg{
  width:180px;
}

.avatar-xl{
  width:220px;
}

.avatar-editor{
  display:grid;
  grid-template-columns:220px minmax(0,1fr);
  gap:22px;
  align-items:center;
}

.avatar-editor-preview{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  border:1px solid var(--line);
  border-radius:20px;
  background:radial-gradient(circle at center, rgba(255,255,255,.07), rgba(255,255,255,.02));
}

.avatar-editor-controls{
  display:grid;
  gap:14px;
}

.avatar-editor-controls p{
  margin:0;
  color:var(--muted);
}

.avatar-form-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}

.profile-card{
  border:1px solid var(--line);
  border-radius:22px;
  padding:20px;
  background:rgba(255,255,255,.03);
}

.profile-card h3{
  margin:0;
  font-size:2rem;
}

.profile-title-row{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.profile-card p{
  color:var(--muted);
}

.athlete-nameplate{
  display:grid;
  gap:4px;
}

.athlete-name-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.title-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  border-radius:999px;
  font-weight:800;
  letter-spacing:.02em;
}

.title-badge img{
  display:block;
  object-fit:contain;
}

.title-badge-sm{
  padding:5px 10px 5px 6px;
  font-size:.8rem;
}

.title-badge-sm img{
  width:20px;
  height:20px;
}

.title-badge-lg{
  padding:8px 14px 8px 8px;
  font-size:1rem;
}

.title-badge-lg img{
  width:28px;
  height:28px;
}

.history-list{
  display:grid;
  gap:10px;
}

.history-item{
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  background:rgba(255,255,255,.03);
}

.ranking-list{
  display:grid;
  gap:12px;
}

.division-ranking-block{
  display:grid;
  gap:12px;
  margin-bottom:18px;
}

.division-ranking-block.compact{
  gap:8px;
}

.ranking-card{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  gap:14px;
  align-items:center;
  padding:16px 18px;
  border-radius:20px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
}

.ranking-card.podium-1{
  border-color:rgba(255,210,84,.35);
  box-shadow:0 14px 30px rgba(255,210,84,.08);
}

.ranking-card.podium-2{
  border-color:rgba(211,225,241,.24);
}

.ranking-card.podium-3{
  border-color:rgba(189,128,72,.28);
}

.compact-ranking-wrap{
  overflow-x:auto;
}

.compact-ranking-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:.9rem;
}

.compact-ranking-table th,
.compact-ranking-table td{
  padding:10px 8px;
  text-align:left;
  border-bottom:1px solid var(--line);
  white-space:nowrap;
}

.compact-ranking-table th{
  color:var(--muted);
  font-size:.76rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.compact-ranking-table td{
  color:var(--text);
}

.compact-ranking-table tbody tr:last-child td{
  border-bottom:none;
}

.compact-ranking-table .podium-1 td:first-child,
.compact-ranking-table .podium-2 td:first-child,
.compact-ranking-table .podium-3 td:first-child{
  font-weight:900;
}

body.referee-current-mode .compact-ranking-table{
  font-size:.82rem;
}

body.referee-current-mode .compact-ranking-table th,
body.referee-current-mode .compact-ranking-table td{
  padding:7px 6px;
}

.ranking-place{
  display:grid;
  justify-items:center;
  min-width:74px;
  gap:4px;
}

.ranking-medal{
  font-size:1.7rem;
  line-height:1;
}

.ranking-main{
  display:grid;
  gap:4px;
}

.ranking-main p{
  margin:0;
  color:var(--muted);
}

.ranking-name-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.ranking-metrics{
  display:grid;
  gap:6px;
  justify-items:end;
  color:var(--muted);
  text-align:right;
}

@media (max-width: 860px){
  .ranking-card{
    grid-template-columns:1fr;
    justify-items:start;
  }

  .ranking-place,
  .ranking-metrics{
    justify-items:start;
    text-align:left;
  }

  .athlete-profile-hero,
  .avatar-editor,
  .avatar-form-grid{
    grid-template-columns:1fr;
  }

  .athlete-profile-avatar-wrap,
  .avatar-editor-preview{
    justify-content:flex-start;
  }
}

.inline-edit-grid{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:10px;
  align-items:end;
  margin-top:10px;
}

.inline-edit-grid.tight{
  grid-template-columns:1.2fr .9fr .9fr .8fr 1.2fr auto;
}

.division-config{
  margin-top:12px;
  grid-template-columns:1.6fr .9fr auto;
}

#divisionForm{
  grid-template-columns:1.8fr .9fr auto;
}

.inline-edit-grid button{
  padding:10px 12px;
}

.result-edit-labels{
  display:grid;
  gap:10px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.result-edit-labels.four-cols{
  grid-template-columns:1.2fr .9fr .9fr 1.2fr;
}

.result-edit-labels.three-cols{
  grid-template-columns:.8fr 1.2fr auto;
}

.small-label{
  color:var(--muted);
  font-size:12px;
}

.hidden-pane{
  display:none !important;
}

code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
}

.empty{
  color:var(--muted);
  padding:16px;
  border-radius:18px;
  border:1px dashed var(--line);
}

@media (max-width: 1024px){
  .layout,.athlete-hero{
    grid-template-columns:1fr;
  }

  .brand-bar,
  .manager-topbar{
    flex-direction:column;
  }

  .tv-fighter{
    grid-template-columns:1fr;
  }

  .tv-stage{
    min-height:calc(100vh - 240px);
  }
}

@media (max-width: 720px){
  .shell{
    width:min(100% - 18px, 100%);
    margin:10px auto 24px;
  }

  .panel{
    padding:18px;
    border-radius:20px;
  }

  .brand-bar{
    align-items:flex-start;
  }

  .form-grid,.form-grid.compact,.timer-row,.result-row{
    grid-template-columns:1fr;
  }

  body.referee-current-mode .result-row{
    grid-template-columns:1fr 1fr;
  }

  body.referee-current-mode .result-row button{
    grid-column:1 / -1;
  }

  .permission-grid,
  .permission-grid.compact,
  .mode-grid{
    grid-template-columns:1fr;
  }

  .touch-group{
    grid-template-columns:repeat(4,minmax(0,1fr));
  }

  .referee-timer-row{
    grid-template-columns:repeat(4,minmax(0,1fr));
  }

  .inline-edit-grid,
  .inline-edit-grid.tight,
  .result-edit-labels,
  .result-edit-labels.four-cols,
  .result-edit-labels.three-cols{
    grid-template-columns:1fr;
  }

  .mat-controls{
    grid-template-columns:1fr 1fr;
  }

  .tv-score-cluster{
    grid-template-columns:repeat(3,1fr);
  }

  .tv-footer{
    grid-template-columns:1fr;
    align-items:start;
  }
}
