/* Handball Tracker Cloud v1.28 revision 4
   Neutral half-court live input, corrected desktop coordinates, and rebuilt game review. */

body.v128r3-ui .v128-orientation-row,
body.v128r3-ui .v128-review-rail,
body.v128r3-ui #reviewSectionTabs,
body.v128r3-ui #reviewGameStatsTab,
body.v128r3-ui #reviewPlayerCardTab,
body.v128r3-ui #reviewSectionTabs + .card.compact {
  display:none!important;
}

/* Keep the live court's DOM box at the same aspect ratio as its internal bitmap.
   This removes desktop letterboxing/stretching and keeps pointer coordinates exact. */
body.v128r3-ui #courtWrap,
body.v128r3-ui #goalWrap {
  width:100%!important;
  max-width:760px!important;
  margin-inline:auto!important;
}
body.v128r3-ui #courtCanvas,
body.v128r3-ui #goalCanvas {
  display:block!important;
  width:100%!important;
  height:auto!important;
  max-height:none!important;
  object-fit:fill!important;
}
body.v128r3-ui #courtCanvas { aspect-ratio:720 / 810; }
body.v128r3-ui #goalCanvas { aspect-ratio:720 / 520; }

body.v128r3-ui #reviewPage #gameReview {
  display:block!important;
}
body.v128r3-ui #reviewPage #gameReview > .card.compact.topbar {
  margin-bottom:8px;
}

.r3-review-shell { display:grid; gap:8px; }
.r3-review-tabs,
.r3-review-subtabs {
  display:flex;
  gap:5px;
  padding:5px!important;
  background:#061522!important;
  border-color:#203b51!important;
  overflow-x:auto;
}
.r3-review-tabs button,
.r3-review-subtabs button {
  flex:1 0 auto;
  min-height:38px;
  border:0!important;
  background:transparent!important;
  color:#8fa6b8!important;
  box-shadow:none!important;
  white-space:nowrap;
}
.r3-review-tabs button.active,
.r3-review-subtabs button.active {
  background:linear-gradient(135deg,#2d8140,#4ebd5c)!important;
  color:#fff!important;
}
.r3-review-subtabs { margin-top:0; }
.r3-team-heading {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 14px!important;
}
.r3-team-heading h2 { margin:0; }
.r3-team-heading span { color:#8fa6b8; font-size:12px; }

.r3-overview-score {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
  align-items:center;
  gap:14px;
  padding:16px;
  background:linear-gradient(90deg,#071a2a,#04101b,#071a2a);
  border:1px solid #24435b;
  border-radius:12px;
}
.r3-overview-team { display:grid; gap:3px; }
.r3-overview-team.away { text-align:right; }
.r3-overview-team strong { font-size:16px; color:#f0f6fa; }
.r3-overview-team small { color:#89a0b1; }
.r3-overview-scoreline { font-size:36px; font-weight:950; color:#5ed86e; letter-spacing:.04em; }
.r3-overview-scoreline span:last-child { color:#4a9dea; }
.r3-overview-scoreline em { font-style:normal; color:#526b7e; padding:0 7px; }

.r3-comparison-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:7px;
  margin-top:10px;
}
.r3-comparison-card {
  min-height:82px;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:7px;
  padding:10px;
  border:1px solid #203e55;
  border-radius:10px;
  background:#071827;
}
.r3-comparison-card strong:first-child { color:#62d774; text-align:left; font-size:19px; }
.r3-comparison-card strong:last-child { color:#49a0ed; text-align:right; font-size:19px; }
.r3-comparison-card span { color:#91a6b6; font-size:10px; text-align:center; text-transform:uppercase; letter-spacing:.04em; }

.r3-review-card {
  background:#061522!important;
  border-color:#203e55!important;
}
.r3-section-title {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:9px;
}
.r3-section-title h2,.r3-section-title h3 { margin:0; }
.r3-section-title p { margin:3px 0 0; color:#8da4b6; font-size:11px; }

.r3-full-field-wrap,
.r3-half-court-wrap,
.r3-goal-wrap,
.r3-timeline-wrap {
  width:100%;
  overflow:hidden;
  border:1px solid #284960;
  border-radius:10px;
  background:#03101c;
}
.r3-full-field-wrap canvas,
.r3-half-court-wrap canvas,
.r3-goal-wrap canvas,
.r3-timeline-wrap canvas {
  display:block;
  width:100%;
  height:auto;
}
.r3-full-field-wrap canvas { aspect-ratio:2 / 1; }
.r3-half-court-wrap canvas { aspect-ratio:720 / 810; max-width:760px; margin:auto; }
.r3-goal-wrap canvas { aspect-ratio:720 / 430; max-width:760px; margin:auto; }
.r3-timeline-wrap canvas { aspect-ratio:4 / 1; }

.r3-field-legend { display:flex; gap:12px; flex-wrap:wrap; margin-top:8px; color:#8fa6b8; font-size:10px; }
.r3-field-legend span { display:inline-flex; align-items:center; gap:5px; }
.r3-field-legend i { width:9px; height:9px; border-radius:50%; display:inline-block; }
.r3-field-legend .home { background:#52cc65; }
.r3-field-legend .away { background:#448fd8; transform:rotate(45deg); border-radius:2px; }
.r3-field-legend .goal { border:2px solid #58d26a; background:transparent; }
.r3-field-legend .save { border:2px solid #3e92df; background:transparent; }
.r3-field-legend .miss { border:2px solid #ef8a27; background:transparent; }
.r3-field-legend .blocked { border:2px solid #9aa9b4; background:transparent; }

.r3-filter-card { padding:10px!important; }
.r3-filter-grid {
  display:grid;
  grid-template-columns:repeat(6,minmax(115px,1fr));
  gap:7px;
  align-items:end;
}
.r3-filter-grid label,.r3-filter-label { color:#9db1c0; font-size:10px; font-weight:750; }
.r3-filter-grid select,.r3-filter-grid input,.r3-filter-grid summary {
  width:100%; min-height:36px; margin-top:4px; border-radius:7px; background:#04121f; border:1px solid #25445c; color:#eef5f8;
}
.r3-filter-grid summary { display:flex; align-items:center; padding:0 9px; cursor:pointer; list-style:none; }
.r3-filter-grid summary::-webkit-details-marker { display:none; }
.r3-multi-filter { position:relative; }
.r3-multi-menu {
  position:absolute; z-index:80; top:calc(100% + 4px); left:0; min-width:220px; max-height:260px; overflow:auto;
  padding:7px; border:1px solid #2d536d; border-radius:8px; background:#071827; box-shadow:0 16px 35px rgba(0,0,0,.42);
}
.r3-multi-menu label { display:flex; align-items:center; gap:7px; min-height:31px; padding:4px 6px; border-radius:5px; color:#d7e3ea; font-size:11px; }
.r3-multi-menu label:hover { background:#0d2639; }
.r3-multi-menu input { width:auto!important; min-height:auto!important; margin:0!important; }
.r3-filter-actions { display:flex; align-items:center; justify-content:flex-end; gap:6px; margin-top:8px; }
.r3-filter-actions button { min-height:36px; }
.r3-filter-actions .r3-apply { background:linear-gradient(135deg,#2f9146,#56c966)!important; color:#fff!important; }

.r3-stat-grid { display:grid; grid-template-columns:repeat(6,minmax(105px,1fr)); gap:7px; }
.r3-stat-card { min-height:78px; padding:10px; border:1px solid #23445b; border-radius:9px; background:#071827; }
.r3-stat-card span { display:block; min-height:25px; color:#8fa6b8; font-size:9px; text-transform:uppercase; letter-spacing:.04em; }
.r3-stat-card strong { display:block; color:#eef5f8; font-size:22px; }
.r3-stat-card.accent strong { color:#5fd872; }

.r3-analysis-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(300px,.8fr); gap:8px; }
.r3-table-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.r3-table-card { min-width:0; padding:10px; border:1px solid #203e55; border-radius:9px; background:#071827; }
.r3-table-card h3 { margin:0 0 7px; font-size:12px; }
.r3-table-card table { width:100%; font-size:10px; }
.r3-table-card th { color:#8fa6b8; text-transform:uppercase; font-size:8px; }
.r3-table-card th,.r3-table-card td { padding:6px 7px; border-bottom:1px solid #173248; text-align:left; }
.r3-table-card td.num,.r3-table-card th.num { text-align:right; }
.r3-empty { padding:24px; color:#8198aa; text-align:center; }
.r3-defender-note { margin:0; padding:8px 10px; border-left:3px solid #57c968; background:#071b29; color:#a6bac8; font-size:10px; }
.r3-player-badge-list { display:flex; gap:5px; flex-wrap:wrap; }
.r3-player-badge { padding:5px 8px; border-radius:999px; border:1px solid #2b4d64; background:#081b2b; color:#d7e5ec; font-size:10px; }

@media(max-width:1050px){
  .r3-comparison-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .r3-filter-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .r3-stat-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .r3-analysis-grid{grid-template-columns:1fr}
}
@media(max-width:700px){
  .r3-review-tabs,.r3-review-subtabs{position:sticky;top:55px;z-index:45}
  .r3-review-tabs button,.r3-review-subtabs button{min-height:34px;padding:6px 9px!important;font-size:9px!important}
  .r3-overview-score{grid-template-columns:1fr auto 1fr;padding:10px;gap:5px}
  .r3-overview-team strong{font-size:11px}.r3-overview-team small{font-size:8px}
  .r3-overview-scoreline{font-size:24px}
  .r3-comparison-grid{grid-template-columns:1fr 1fr;gap:4px}
  .r3-comparison-card{min-height:64px;padding:7px}.r3-comparison-card strong:first-child,.r3-comparison-card strong:last-child{font-size:15px}
  .r3-filter-grid{grid-template-columns:1fr 1fr;gap:5px}
  .r3-filter-grid label,.r3-filter-label{font-size:8px}
  .r3-filter-grid select,.r3-filter-grid input,.r3-filter-grid summary{min-height:33px;font-size:10px}
  .r3-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}
  .r3-stat-card{min-height:64px;padding:7px}.r3-stat-card strong{font-size:18px}
  .r3-table-grid{grid-template-columns:1fr}
  .r3-full-field-wrap{overflow-x:auto}.r3-full-field-wrap canvas{min-width:680px}
  .r3-timeline-wrap{overflow-x:auto}.r3-timeline-wrap canvas{min-width:680px}
  .r3-team-heading{padding:9px 10px!important}.r3-team-heading h2{font-size:14px}
}
