:root{
  --cell: 84px;
  --gap: 2px;

  --bg-dark-1: #0b1220;
  --bg-dark-2: #111827;
  --bg-dark-3: #1f2937;

  --panel: rgba(255,255,255,0.06);
  --panel-border: rgba(255,255,255,0.10);
  --panel-soft: rgba(255,255,255,0.04);

  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #f59e0b;
  --accent-blue: #3b82f6;
  --danger: #ef4444;

  --board-blue: #5DAEF5;
  --board-border: #1f2937;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, Segoe UI, Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--bg-dark-1) 0%, var(--bg-dark-2) 42%, var(--bg-dark-3) 100%);
}

.topbar{
  background: linear-gradient(90deg, #0f172a 0%, #1d4ed8 55%, #0f172a 100%);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.topbarInner{
  max-width: 1700px;
  margin: 0 auto;
  padding: 16px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}

.brandWrap{
  display:flex;
  align-items:center;
  gap:16px;
}

.brandText{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.eyebrow{
  font-size:12px;
  font-weight:800;
  letter-spacing:1.8px;
  text-transform:uppercase;
  color:#dbeafe;
}

.title{
  font-weight:900;
  letter-spacing:.5px;
  color:#ffffff;
  font-size:38px;
  line-height:1;
  text-transform:uppercase;
}

.topbarActions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.actionBtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:10px 16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  text-decoration:none;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.actionBtn:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 18px rgba(0,0,0,.22);
}

.actionBtn.secondary{
  background:rgba(255,255,255,.10);
  color:#fff;
}

.linkBtn{
  background:#ffffff;
  color:#111827;
}

.dev-controls{
  display:none;
  align-items:center;
  gap:10px;
  color:#fff;
}

.dev-controls input{
  width:72px;
  padding:6px 8px;
  border-radius:8px;
  border:none;
}

.pageWrap{
  max-width: 1700px;
  margin: 0 auto;
  padding: 22px;
}

.heroCard{
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:center;
  margin-bottom:20px;
  padding:22px 24px;
  border-radius:20px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  border:1px solid var(--panel-border);
  box-shadow:0 12px 28px rgba(0,0,0,.28);
}

.heroLeft{
  max-width:760px;
}

.heroLabel{
  display:inline-block;
  margin-bottom:10px;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(245,158,11,.14);
  border:1px solid rgba(245,158,11,.35);
  color:#fde68a;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:1px;
}

.heroCard h1{
  margin:0 0 10px 0;
  font-size:34px;
  line-height:1.05;
}

.heroCard p{
  margin:0;
  color:var(--muted);
  font-size:15px;
  line-height:1.55;
}

.heroRight{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.heroStat{
  min-width:110px;
  padding:16px 18px;
  border-radius:18px;
  background:rgba(15,23,42,.55);
  border:1px solid var(--panel-border);
  text-align:center;
}

.statValue{
  display:block;
  font-size:26px;
  font-weight:900;
  color:#fff;
}

.statLabel{
  display:block;
  margin-top:4px;
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:1px;
  color:var(--muted);
}

.layout{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 500px;
  gap:20px;
  align-items:start;
}

.boardWrap,
.moneyWrap{
  background: var(--panel);
  border:1px solid var(--panel-border);
  border-radius:20px;
  box-shadow:0 12px 30px rgba(0,0,0,.26);
  backdrop-filter: blur(3px);
}

.boardWrap{
  padding:18px;
  overflow:auto;
}

.boardPanelHeader,
.moneyHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}

.panelEyebrow{
  font-size:12px;
  font-weight:800;
  letter-spacing:1.4px;
  text-transform:uppercase;
  color:#93c5fd;
}

.panelTitle,
.moneyTitle{
  font-size:28px;
  font-weight:900;
  line-height:1.05;
  text-transform:uppercase;
}

.panelHint,
.moneySub{
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
  text-align:right;
}

.homeLabel{
  text-align:center;
  font-size:28px;
  font-weight:900;
  margin-bottom:10px;
  letter-spacing:4px;
  color:#f8fafc;
  text-shadow:0 2px 10px rgba(0,0,0,.28);
}

.boardArea{
  display:flex;
  align-items:center;
}

.awayLabel{
  writing-mode:vertical-rl;
  transform:rotate(180deg);
  font-size:28px;
  font-weight:900;
  margin-right:12px;
  letter-spacing:4px;
  color:#f8fafc;
  text-shadow:0 2px 10px rgba(0,0,0,.28);
}

.board{
  display:grid;
  grid-template-columns: 40px repeat(10, var(--cell));
  grid-template-rows: 40px repeat(10, var(--cell));
  gap: var(--gap);
  user-select:none;
}

.axisCell{
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg, #7cc2ff, #4b9fe8);
  border:1px solid var(--board-border);
  font-weight:900;
  font-size:32px;
  color:#0f172a;
  border-radius:8px;
}

.square{
  position:relative;
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg, #79c2ff, #5aaef5);
  border:1px solid var(--board-border);
  border-radius:10px;
  overflow:hidden;
  cursor:default;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, outline 0.2s ease, background 0.2s ease;
}

.square .top{
  flex: 1 1 33%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:4px;
  font-weight:800;
  font-size:16px;
  border-bottom:1px solid var(--board-border);
  text-align:center;
  line-height:1.1;
  color:#0f172a;
  background:rgba(255,255,255,.18);
}

.square .bottom{
  flex: 2 1 67%;
  padding:5px 6px;
  font-size:11px;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  gap:3px;
  color:#082f49;
}

.scoreLine{
  display:flex;
  justify-content:space-between;
  gap:8px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-weight:800;
}

.scoreLine .teams{
  overflow:hidden;
  text-overflow:ellipsis;
}

.square:hover{
  outline:3px solid var(--accent);
  background:linear-gradient(180deg, #ffe89a, #ffd966);
  outline-offset:-3px;
  z-index:2;
  box-shadow:0 8px 18px rgba(0,0,0,.22);
}

.square.player-highlight{
  background:linear-gradient(180deg, #fff3b0, #ffe28a);
  outline:3px solid var(--danger);
  outline-offset:-3px;
  z-index:3;
  box-shadow:0 0 0 2px rgba(239, 68, 68, 0.12), 0 10px 20px rgba(0,0,0,.20);
}

.square.player-highlight .top{
  background:rgba(239, 68, 68, 0.12);
}

.square.player-dim{
  opacity:0.26;
}

.tooltip{
  position:absolute;
  z-index:50;
  min-width:260px;
  max-width:320px;
  background:#476DED;
  border:1px solid #2b3350;
  border-radius:10px;
  padding:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.45);
  display:none;
  pointer-events:none;
}

.tooltip .ttTitle{
  font-weight:900;
  font-size:16px;
  margin-bottom:6px;
  color:#f8fafc;
}

.tooltip .ttSub{
  font-weight:800;
  font-size:12px;
  margin-bottom:10px;
  color:#cbd5e1;
  text-transform:uppercase;
  letter-spacing:.5px;
}

.tooltip .ttRow{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:12px;
  padding:4px 0;
  font-weight:700;
  border-bottom:1px solid rgba(255,255,255,.06);
}

.tooltip .ttRow:last-child{
  border-bottom:none;
}

.moneyWrap{
  position:relative;
  z-index:1;
  background: var(--panel);
  border:1px solid #23263a;
  border-radius:10px;
  padding:10px;
  overflow:hidden;
  width:480px;
  justify-self:start;
}

.moneyTableWrap{
  overflow:auto;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(15,23,42,.45);
}

.moneyTable{
  width:100%;
  table-layout:fixed;
  border-collapse:collapse;
  font-size:12px;
  color:#f8fafc;
}

.moneyTable tbody tr:nth-child(even){
  background: rgba(255,255,255,.04);
}

.moneyTable th,
.moneyTable td{
  padding:8px 8px;
  border-right:1px solid rgba(255,255,255,.08);
  text-align:center;
}

.moneyTable th:last-child,
.moneyTable td:last-child{
  border-right:none;
}

.moneyTable th:first-child,
.moneyTable td:first-child{
  width:130px;
}

.moneyTable thead th{
  position:sticky;
  top:0;
  background:#0f172a;
  color:#ffffff;
  z-index:2;
  border-bottom:1px solid rgba(255,255,255,.12);
}

.moneyTable th:first-child,
.moneyTable td:first-child{
  text-align:left;
  font-weight:800;
}

.moneyTable tbody tr{
  cursor:pointer;
  transition:background .16s ease;
}

.moneyTable tbody tr:hover{
  background: rgba(59,130,246,.12);
}

.moneyTable tbody tr.selected-player{
  background: rgba(239,68,68,.18) !important;
  outline:2px solid var(--danger);
  outline-offset:-2px;
}

.moneyTable small{
  font-size:10px;
  color:#cbd5e1;
}

@media (max-width: 1450px){
  .layout{
    grid-template-columns: 1fr;
  }

  .moneyWrap{
    width:100%;
  }
}

@media (max-width: 900px){
  .topbarInner{
    flex-direction:column;
    align-items:flex-start;
  }

  .heroCard{
    flex-direction:column;
    align-items:flex-start;
  }

  .heroRight{
    justify-content:flex-start;
  }

  .title{
    font-size:30px;
  }

  .panelTitle,
  .moneyTitle{
    font-size:24px;
  }
}

@media (max-width: 640px){
  .pageWrap{
    padding:14px;
  }

  .heroCard{
    padding:18px;
  }

  .heroCard h1{
    font-size:26px;
  }
}

/* PRINT */
@media print {
  @page {
    size: Letter landscape;
    margin: 0.25in;
  }

  :root{
    --cell: 0.72in;
    --gap: 0.02in;
  }

  html, body {
    width: 11in;
    height: 8.5in;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: hidden !important;
    color:#000 !important;
  }

  body {
    -webkit-print-color-adjust: economy;
    print-color-adjust: economy;
  }

  .no-print,
  .tooltip,
  .moneyWrap,
  .topbar,
  .heroCard {
    display: none !important;
  }

  .pageWrap{
    max-width:none !important;
    padding:0 !important;
    margin:0 !important;
  }

  .layout {
    display: block !important;
    width: 10.5in !important;
    margin: 0 auto !important;
    padding: 0 !important;
  }

  .print-area,
  .boardWrap {
    display: block !important;
    width: 10.5in !important;
    max-width: 10.5in !important;
    overflow: hidden !important;
    border: none !important;
    background: #ffffff !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }

  .boardPanelHeader{
    display:none !important;
  }

  .homeLabel {
    font-size: 24px !important;
    margin: 0 0 0.08in 0 !important;
    line-height: 1 !important;
    color:#000 !important;
    text-shadow:none !important;
  }

  .awayLabel {
    font-size: 24px !important;
    margin-right: 0.08in !important;
    line-height: 1 !important;
    color:#000 !important;
    text-shadow:none !important;
  }

  .boardArea {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0 !important;
  }

  .board {
    grid-template-columns: 0.34in repeat(10, var(--cell)) !important;
    grid-template-rows: 0.34in repeat(10, var(--cell)) !important;
    gap: var(--gap) !important;
    margin: 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .axisCell {
    font-size: 24px !important;
    border-radius: 0 !important;
    color:#000 !important;
    background:#fff !important;
    background-image:none !important;
    border:1px solid #000 !important;
  }

  .square {
    border-radius: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    overflow: hidden !important;
    background:#fff !important;
    background-image:none !important;
    border:1px solid #000 !important;
    box-shadow:none !important;
  }

  .square .top {
    font-size: 13px !important;
    padding: 2px !important;
    color:#000 !important;
    background:#fff !important;
    background-image:none !important;
    border-bottom:1px solid #000 !important;
  }

  .square .bottom {
    font-size: 8px !important;
    padding: 2px 3px !important;
    gap: 1px !important;
    color:#000 !important;
  }

  .scoreLine {
    gap: 3px !important;
    font-size: 8px !important;
  }

  .square:hover {
    outline: none !important;
  }

  .square.player-dim {
    opacity: 1 !important;
  }

  .square.player-highlight {
    outline: 2px solid #000 !important;
    outline-offset: -2px !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .square.player-highlight .top {
    background: #fff !important;
  }
}