/* VolleyLab Styles - Multi-Court Side-by-Side (ROT | SR | DEFENSE) + Notebook & Color Modes */

:root {
  --bg-app: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #263349;
  --bg-card-hover: #334155;
  --border-subtle: rgba(148, 163, 184, 0.24);
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  /* Court Palette (VNL / International Warm Off-White & Sand Wood) */
  --court-front: #f8f4ec;
  --court-back: #efe8db;
  --court-line: #1e293b;

  /* Role Colors - High-Contrast Distinct Palette */
  --role-setter: #eab308;     /* Canary Gold Yellow */
  --role-setter2: #0891b2;    /* Bright Turquoise Cyan */
  --role-outside: #1d4ed8;    /* Cobalt Royal Blue */
  --role-outside2: #ea580c;   /* Tangerine Orange */
  --role-middle: #15803d;     /* Kelly Emerald Green */
  --role-middle2: #7e22ce;    /* Deep Royal Purple */
  --role-opposite: #db2777;   /* Electric Fuchsia Pink */
  --role-libero: #dc2626;     /* Fire Crimson Red */

  --accent-primary: #38bdf8;
  --accent-gold: #facc15;
  --accent-green: #22c55e;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header / Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.65rem 1.25rem;
  background: rgba(30, 41, 59, 0.96);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-icon {
  font-size: 1.85rem;
  line-height: 1;
}

.brand h1 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-tagline {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* System Tabs */
.system-tabs {
  display: flex;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.78);
  padding: 0.28rem;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
}

.sys-tab {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.sys-tab:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sys-tab:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  filter: grayscale(1);
}

.sys-tab:disabled .sys-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.sys-tab.is-active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(14, 165, 233, 0.12));
  border-color: var(--accent-primary);
  color: #fff;
}

.sys-badge {
  font-weight: 900;
  font-size: 0.9rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent-gold);
}

.sys-tab.is-active .sys-badge {
  background: var(--accent-gold);
  color: #0f172a;
}

.sys-label {
  display: flex;
  flex-direction: column;
}

.sys-label strong {
  font-size: 0.84rem;
}

.sys-label small {
  font-size: 0.69rem;
  opacity: 0.85;
}

/* View Mode Segmented Control */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.view-mode-Segment {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 0.2rem;
  gap: 0.2rem;
}

.seg-btn {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.seg-btn:hover {
  color: #fff;
}

.seg-btn.is-active {
  background: var(--accent-primary);
  color: #0f172a;
}

/* Secondary Toolbar */
.sub-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.55rem 1.25rem;
  background: rgba(15, 23, 42, 0.65);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rotation-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.rot-btn {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.34rem 0.62rem;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.rot-btn:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.rot-btn.is-active {
  background: rgba(250, 204, 21, 0.18);
  border-color: var(--accent-gold);
  color: #fff;
}

.rot-zone-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.7rem;
  font-weight: 900;
}

.rot-btn.is-active .rot-zone-circle {
  background: var(--accent-gold);
  color: #0f172a;
}



.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #fff;
}

.dot-setter { background: var(--role-setter); }
.dot-setter2 { background: var(--role-setter2); }
.dot-outside { background: var(--role-outside); }
.dot-outside2 { background: var(--role-outside2); }
.dot-middle { background: var(--role-middle); }
.dot-middle2 { background: var(--role-middle2); }
.dot-opposite { background: var(--role-opposite); }
.dot-libero { background: var(--role-libero); }

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
}

.toggle-pill input {
  accent-color: var(--accent-primary);
  margin: 0;
  cursor: pointer;
}

.btn-secondary,
.btn-accent,
.btn-play,
.btn-rotate,
.btn-settings-trigger {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.42rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-settings-trigger {
  anchor-name: --settings-trigger;
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.btn-settings-trigger:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

/* Viewport-Aware Popover Settings Menu */
.settings-popover {
  position-anchor: --settings-trigger;
  position-area: block-end span-inline-start;
  position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  inset: auto;
  margin: 0.45rem 0 0 0;
  width: min(340px, 92vw);
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

@supports not (position-area: block-end) {
  .settings-popover {
    position: fixed;
    inset: 3.6rem 1.25rem auto auto;
    margin: 0;
  }
}

.settings-popover:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.settings-close-btn {
  width: 26px;
  height: 26px;
  font-size: 0.78rem;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.settings-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.settings-toggles-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.settings-Option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  cursor: pointer;
  user-select: none;
}

.settings-Option:hover {
  background: rgba(51, 65, 85, 0.55);
}

.settings-Option input {
  accent-color: var(--accent-primary);
  margin: 0;
  cursor: pointer;
}

.settings-slider-row {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.settings-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.settings-slider-val {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(56, 189, 248, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
}

.settings-slider-row input[type="range"] {
  width: 100%;
  height: 5px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  margin: 0;
}

.settings-key-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-actions-row {
  flex-direction: row;
  gap: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-subtle);
}

.settings-actions-row > button {
  flex: 1;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: #0f172a;
}

.btn-rotate {
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent-primary);
  border-color: rgba(56, 189, 248, 0.35);
  padding: 0.32rem 0.62rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* Main Layout */
.main-layout {
  max-width: 1580px;
  width: 100%;
  margin: 0 auto;
  padding: 0.9rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

/* Top-Level Learning Module Tabs */
.module-tabs-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

@media (max-width: 820px) {
  .module-tabs-bar {
    grid-template-columns: 1fr;
  }
}

.module-tab {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.module-tab:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.module-tab.is-active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.24), rgba(14, 165, 233, 0.12));
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.18);
}

.module-tab-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent-gold);
  font-weight: 900;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.module-tab.is-active .module-tab-num {
  background: var(--accent-gold);
  color: #0f172a;
}

.module-tab-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.module-tab-text strong {
  font-size: 0.88rem;
  line-height: 1.2;
}

.module-tab-text small {
  font-size: 0.71rem;
  opacity: 0.82;
}

/* Scenario Pills inside Stage Banner */
.scenario-bar-group {
  padding-left: 0.65rem;
  border-left: 1px solid var(--border-subtle);
}

.scenario-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.scenario-btn {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.34rem 0.68rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.scenario-btn:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.scenario-btn.is-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Stage Banner */
.stage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
  background: var(--bg-panel);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.stage-banner-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-width: 0;
}

.stage-banner-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.stage-fixed-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Scenario Toolbar (Only visible for Module 2: Coverage & Module 3: Defense) */
.scenario-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 1160px;
  margin: 0 auto 0.75rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.scenario-toolbar-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Dedicated Left Setter Rotation + Center Courts + Right Admin Edit Panel */
.court-stage-workspace {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

.rotation-side-nav {
  width: 154px;
  min-width: 154px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 0.8rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  align-self: flex-start;
  position: sticky;
  top: 1rem;
}

.rotation-nav-title {
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.rotation-side-nav .rotation-pills {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.rotation-side-nav .rot-btn {
  width: 100%;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

.rotation-side-nav .btn-rotate {
  width: 100%;
  margin-top: 0.2rem;
  text-align: center;
}

.court-stage-main {
  flex: 1 1 0;
  min-width: 0;
  max-width: 1020px;
  padding: 1.15rem 1.35rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.court-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.4rem;
}

.court-bottom-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

/* Dedicated Right-Side Admin Edit Panel */
.admin-edit-panel,
.admin-edit-drawer {
  width: 310px;
  min-width: 280px;
  max-width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 0.9rem;
  background: var(--bg-panel);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  align-self: flex-start;
  position: sticky;
  top: 1rem;
}

.admin-edit-panel[hidden],
.admin-edit-drawer[hidden] {
  display: none !important;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-panel-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-panel-title {
  font-size: 0.74rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-drawer-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-drawer-row .edit-hint-badge {
  width: 100%;
  font-size: 0.68rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  line-height: 1.35;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(250, 204, 21, 0.25);
}

.admin-drawer-arrows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.admin-drawer-weights {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.admin-edit-panel .weight-sliders-grid,
.admin-edit-drawer .weight-sliders-grid {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.admin-edit-panel .weight-slider-item,
.admin-edit-drawer .weight-slider-item {
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
}

@media (max-width: 1200px) {
  .court-stage-workspace {
    flex-wrap: wrap;
  }
  .court-stage-main {
    max-width: none;
  }
  .admin-edit-panel,
  .admin-edit-drawer {
    width: 100%;
    min-width: auto;
    max-width: none;
    position: static;
  }
  .admin-edit-panel .weight-sliders-grid,
  .admin-edit-drawer .weight-sliders-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }
}

@media (max-width: 900px) {
  .court-stage-workspace {
    flex-direction: column;
    gap: 0.75rem;
  }

  .rotation-side-nav {
    width: 100%;
    min-width: auto;
    position: static;
  }

  .rotation-side-nav .rotation-pills {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .rotation-side-nav .rot-btn {
    width: auto;
    flex: 1 1 110px;
  }

  .admin-edit-panel .weight-sliders-grid,
  .admin-edit-drawer .weight-sliders-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }
}

.status-system-pill {
  background: var(--accent-gold);
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
}

.status-rotation-pill {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
}

.row-key-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.65);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.key-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--role-setter);
  color: #0f172a;
  font-weight: 900;
  font-size: 0.68rem;
}

.key-plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1.5px dashed rgba(255, 255, 255, 0.7);
  color: #fff;
  font-weight: 900;
  font-size: 0.68rem;
}

.attacker-count-badge {
  font-size: 0.76rem;
  font-weight: 700;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
}

.viewer-banner-badges,
.admin-banner-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-voronoi-toggle,
.btn-edit-mode {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.btn-voronoi-toggle {
  width: 136px;
}

.btn-edit-mode {
  width: 170px;
}

.btn-voronoi-toggle:hover,
.btn-edit-mode:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.btn-voronoi-toggle.is-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-primary);
  color: #e0f2fe;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-voronoi-toggle:disabled,
.btn-voronoi-toggle.is-disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  background: rgba(15, 23, 42, 0.45) !important;
  color: #64748b !important;
  box-shadow: none !important;
  filter: grayscale(1);
}

.btn-edit-mode.is-active {
  background: rgba(250, 204, 21, 0.2);
  border-color: var(--accent-gold);
  color: #fef08a;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.3);
}

.btn-edit-mode.is-locked {
  opacity: 0.78;
  border-style: dashed;
}

.btn-edit-mode.is-locked:hover {
  opacity: 1;
  border-color: var(--accent-gold);
  color: #fef08a;
}

.btn-admin-logout {
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.25);
  color: #fca5a5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-admin-logout[hidden] {
  display: none !important;
}

.btn-admin-logout:hover {
  background: rgba(185, 28, 28, 0.45);
  border-color: #f87171;
  color: #fff;
}

.edit-hint-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fef08a;
  background: rgba(250, 204, 21, 0.14);
  border: 1px dashed rgba(250, 204, 21, 0.5);
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
}

.edit-hint-badge.is-saved {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.55);
}

.btn-reset-pos {
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.22rem 0.58rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-reset-pos:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.overlap-status-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
}

.overlap-status-pill.is-legal {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.overlap-status-pill.is-fault {
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
  border: 1px solid #f43f5e;
}

/* ============================================================================
   MULTI-COURT SIDE-BY-SIDE SHEET (Matches the User's Notebook Drawing!)
   Layout per row: [SETTER IN ④]  [ROT Court]  [SR Court]  [DEFENSE Court]
   ============================================================================ */

.notebook-sheet {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.trio-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(360px, 1.25fr);
  gap: 3.5rem;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.trio-row.is-sheet-row {
  grid-template-columns: 88px minmax(150px, 0.35fr) minmax(360px, 1.25fr);
  gap: 3rem;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

@media (max-width: 900px) {
  .trio-row {
    grid-template-columns: 1fr;
  }
}

/* Left Label: "SETTER IN ④" */
.setter-in-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  padding: 0.5rem;
  z-index: 2;
}

.setter-in-label {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

.setter-in-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--accent-gold);
  background: rgba(250, 204, 21, 0.14);
  color: var(--accent-gold);
  font-size: 1.45rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.setter-who-sub {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* Individual Mini-Court Column (ROT, SR, DEFENSE) */
.court-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  z-index: 2;
}

.court-col-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.mini-action-btn {
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--accent-gold);
  background: rgba(250, 204, 21, 0.16);
  color: var(--accent-gold);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.mini-action-btn:hover,
.mini-action-btn.is-active {
  background: var(--accent-gold);
  color: #0f172a;
}

.court-col-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

.court-col-sub {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* 3-Step Sequence Bar on the SR (Center) Court */
.sr-step-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem;
  border-radius: 999px;
}

.sr-step-btn {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.sr-step-btn:hover {
  color: #fff;
}

.sr-step-btn.is-active {
  background: var(--accent-primary);
  color: #082f49;
}

/* Compact reference styling for the smaller left Reference Court */
.court-column[data-court-type="lineup"],
.court-column[data-is-ref="true"] {
  max-width: 220px;
  justify-self: center;
  width: 100%;
}

.court-column[data-court-type="lineup"] .court-col-title,
.court-column[data-is-ref="true"] .court-col-title {
  font-size: 0.88rem;
}

.court-column[data-court-type="lineup"] .court-col-sub,
.court-column[data-is-ref="true"] .court-col-sub {
  font-size: 0.66rem;
}

.court-column[data-court-type="lineup"] .court-token,
.court-column[data-is-ref="true"] .court-token {
  width: 31px;
  height: 31px;
  border-width: 2px;
}

.court-column[data-court-type="lineup"] .ct-label,
.court-column[data-is-ref="true"] .ct-label {
  font-size: 0.74rem;
}

/* Opponent Attacker Marker & Attack Ray Handles (Module 3: Defense vs. Opponent) */
.opponent-attacker-spot {
  position: absolute;
  left: 0;
  top: 0;
  translate: calc(var(--ox, 50) * 1cqw - 50%) calc(var(--oy, -3) * 1cqh - 50%);
  padding: 2px 8px;
  border-radius: 999px;
  border: 2px solid #fb7185;
  background: rgba(159, 18, 57, 0.92);
  color: #ffe4e6;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
  z-index: 9;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.opponent-attacker-spot.is-editable {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.opponent-attacker-spot.is-dragging {
  cursor: grabbing;
  transform: scale(0.85);
  z-index: 30;
}

.ray-endpoint-handle {
  position: absolute;
  left: 0;
  top: 0;
  translate: calc(var(--rx, 50) * 1cqw - 50%) calc(var(--ry, 80) * 1cqh - 50%);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1.5px dashed #fda4af;
  background: rgba(136, 19, 55, 0.85);
  color: #ffe4e6;
  font-size: 0.58rem;
  font-weight: 800;
  font-family: inherit;
  cursor: grab;
  touch-action: none;
  z-index: 8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.ray-endpoint-handle.is-dragging {
  cursor: grabbing;
  transform: scale(0.5);
  background: #fb7185;
  color: transparent;
  z-index: 30;
}

/* Half-Court Box inside each column */
.mini-court {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.92;
  background: linear-gradient(
    180deg,
    var(--court-front) 0%,
    var(--court-front) 33.33%,
    var(--court-back) 33.33%,
    var(--court-back) 100%
  );
  border: 3.5px solid var(--court-line);
  border-top-width: 5px;
  border-radius: 4px;
  overflow: visible;
  user-select: none;
  container-type: size;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.78),
    0 8px 20px rgba(0, 0, 0, 0.36);
}

.mini-net-label {
  position: absolute;
  top: 2px;
  left: 50%;
  translate: -50% 0;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.82);
  padding: 0 6px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
}

.mini-attack-line {
  position: absolute;
  top: 33.33%;
  left: 0;
  right: 0;
  border-top: 2.5px dashed rgba(15, 23, 42, 0.55);
  z-index: 2;
  pointer-events: none;
}

/* Subtle dot-grid inside each court like the notebook */
.mini-court-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(15, 23, 42, 0.18) 1.2px, transparent 1.2px);
  background-size: 16.66% 16.66%;
  background-position: 8.33% 8.33%;
  pointer-events: none;
  z-index: 1;
}

/* Weighted Voronoi Passing & Defensive Responsibility Overlay */
.voronoi-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
}

/* Voronoi Percentage Labels Layer - Positioned ON TOP of SVG Arrows (z-index: 8 vs court-svg z-index: 5) */
.voronoi-labels-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}

.voronoi-pct-pill {
  position: absolute;
  left: calc(var(--lx, 50) * 1%);
  top: calc(var(--ly, 50) * 1%);
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.54rem;
  font-weight: 800;
  line-height: 1.1;
  color: #f8fafc;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  backdrop-filter: blur(2px);
  z-index: 8;
}

.voronoi-pct-pill.is-passer {
  border-color: rgba(250, 204, 21, 0.65);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(250, 204, 21, 0.3);
}

.v-pill-role {
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.52rem;
}

.voronoi-pct-pill.is-passer .v-pill-role {
  color: #fde047;
}

.v-pill-pct {
  font-weight: 900;
  color: #ffffff;
}

.mini-target-spot {
  position: absolute;
  left: 0;
  top: 0;
  translate: calc(var(--tx, 66) * 1cqw - 50%) calc(var(--ty, 12) * 1cqh - 50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px dashed #d97706;
  background: rgba(250, 204, 21, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #78350f;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.mini-target-spot.is-editable {
  z-index: 25 !important;
  pointer-events: auto !important;
  cursor: grab !important;
  touch-action: none !important;
}

.mini-target-spot.is-editable:hover {
  transform: scale(1.18);
  background: rgba(250, 204, 21, 0.6);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.95);
}

.mini-target-spot.is-dragging {
  cursor: grabbing !important;
  transition: none !important;
  transform: scale(1.28);
  background: rgba(250, 204, 21, 0.7);
  z-index: 35 !important;
}

/* Draggable Arrow Tip Handles on the SR Court (for editing where players run after the serve) */
.arrow-tip-handle {
  position: absolute;
  top: 0;
  left: 0;
  translate: calc(var(--ax, 50) * 1cqw - 50%) calc(var(--ay, 50) * 1cqh - 50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.9);
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  font-size: 0.58rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  z-index: 8;
  padding: 0;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.arrow-tip-handle[data-setter="true"] {
  border-color: #facc15;
  color: #facc15;
}

.arrow-tip-handle[data-attack="true"] {
  border-color: #f43f5e;
  color: #f43f5e;
}

.arrow-tip-handle:hover,
.arrow-tip-handle.is-selected {
  transform: scale(1.25);
  border-style: solid;
  border-color: #38bdf8;
  background: #0f172a;
  z-index: 18;
}

.arrow-tip-handle.is-dragging {
  cursor: grabbing;
  transition: transform 0.12s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transform: scale(0.45) !important;
  border-style: solid;
  border-width: 4px;
  border-color: #facc15;
  background: #ffffff !important;
  color: transparent !important;
  z-index: 30;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.7), 0 4px 12px rgba(0, 0, 0, 0.6);

  @media (prefers-reduced-motion: reduce) {
    transition: none !important;
  }
}

.arrow-tip-handle[data-attack="true"].is-dragging {
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.7), 0 4px 12px rgba(0, 0, 0, 0.6);
}

.arrow-tip-handle.is-dimmed {
  opacity: 0.3;
}

body.is-notebook-theme .arrow-tip-handle {
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  border-color: #334155;
}

.arrow-toggle-btn {
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.15);
  color: #bae6fd;
  cursor: pointer;
}

.arrow-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #fff;
}

.arrow-toggle-btn.has-arrow {
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(244, 63, 94, 0.16);
  color: #fecdd3;
}

.overlap-status-pill.is-edit-pill {
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.court-arrow-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.38rem;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px dashed rgba(148, 163, 184, 0.28);
}

.court-arrow-bar-label {
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.court-arrow-pills {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

/* Interactive Player Responsibility Weight Sliders beneath the court */
.court-weight-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(56, 189, 248, 0.26);
}

.court-weight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.court-bleed-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

.court-bleed-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.court-bleed-slider {
  width: 76px;
  height: 4px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  margin: 0;
}

.court-bleed-val {
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--accent-primary);
  min-width: 28px;
  text-align: right;
}

.court-weight-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.court-weight-title small {
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 0.2rem;
}

.weight-reset-all-btn,
.weight-reset-single-btn {
  font-family: inherit;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0.16rem 0.45rem;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.weight-reset-all-btn:hover,
.weight-reset-single-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--accent-primary);
}

.weight-reset-single-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.weight-sliders-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

@media (max-width: 640px) {
  .weight-sliders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.weight-slider-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.weight-slider-item.is-selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.weight-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.weight-role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.64rem;
  font-weight: 900;
  color: #0f172a;
  cursor: pointer;
}

.weight-role-chip[data-color="setter"] {
  background: var(--role-setter);
  color: #0f172a;
}
.weight-role-chip[data-color="setter2"] {
  background: var(--role-setter2);
  color: #fff;
}
.weight-role-chip[data-color="outside"] {
  background: var(--role-outside);
  color: #fff;
}
.weight-role-chip[data-color="outside2"] {
  background: var(--role-outside2);
  color: #fff;
}
.weight-role-chip[data-color="middle"] {
  background: var(--role-middle);
  color: #fff;
}
.weight-role-chip[data-color="middle2"] {
  background: var(--role-middle2);
  color: #fff;
}
.weight-role-chip[data-color="opposite"] {
  background: var(--role-opposite);
  color: #fff;
}
.weight-role-chip[data-color="libero"] {
  background: var(--role-libero);
  color: #fff;
}

.weight-duty-pct {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weight-val-badge {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-dim);
  background: rgba(15, 23, 42, 0.65);
  padding: 1px 4px;
  border-radius: 4px;
}

.weight-val-badge.is-custom {
  color: #fde047;
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid rgba(250, 204, 21, 0.45);
}

.weight-range-input {
  width: 100%;
  height: 5px;
  margin: 2px 0 0;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.spotlight-weight-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.spotlight-weight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.spotlight-weight-readout {
  font-weight: 800;
  color: var(--accent-gold);
}

.spotlight-weight-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Player Tokens inside Multi-Court (Compositor-thread translate using cqw/cqh) */
.court-token {
  position: absolute;
  top: 0;
  left: 0;
  translate: calc(var(--px, 50) * 1cqw - 50%) calc(var(--py, 50) * 1cqh - 50%);
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  z-index: 10;
  transition:
    translate 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.18s ease,
    opacity 0.2s ease,
    box-shadow 0.18s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: opacity 0.15s ease;
  }
}

/* FRONT ROW = Circled Token (Matches the circled S₂, M₂, P₁ in the user's notebook!) */
.court-token.is-front-row {
  border-radius: 50%;
  border: 3px solid #0f172a;
  box-shadow:
    0 0 0 1.5px #ffffff,
    0 4px 10px rgba(0, 0, 0, 0.35);
}

/* BACK ROW = Uncircled / Rounded-Square Dashed Badge (Matches uncircled P₂, M₁, S₁ in notebook!) */
.court-token.is-back-row {
  border-radius: 10px;
  border: 2px dashed #0f172a;
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.9),
    0 3px 8px rgba(0, 0, 0, 0.28);
}

.court-token.is-draggable,
.player-token.is-draggable {
  cursor: grab;
  touch-action: none;
}

.court-token.is-dragging,
.player-token.is-dragging {
  cursor: grabbing;
  /* Zero lag on translate while dragging; smooth scale down into a precision dot */
  transition: transform 0.12s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transform: scale(0.32) !important;
  border-radius: 50% !important;
  border: 6px solid #ffffff !important;
  z-index: 30;
  box-shadow:
    0 0 0 5px #facc15,
    0 6px 18px rgba(0, 0, 0, 0.65) !important;

  @media (prefers-reduced-motion: reduce) {
    transition: none !important;
  }
}

.court-token.is-dragging .ct-label,
.court-token.is-dragging .ct-sub,
.player-token.is-dragging .ct-label,
.player-token.is-dragging .ct-sub {
  opacity: 0;
  pointer-events: none;
}

.court-token.is-selected {
  transform: scale(1.16);
  z-index: 12;
  box-shadow: 0 0 0 3.5px #ffffff, 0 0 18px rgba(250, 204, 21, 0.95);
}

.court-token.is-dimmed {
  opacity: 0.3;
}

/* Role Colors for Tokens */
.court-token[data-color="setter"],
.player-token[data-color="setter"] {
  background: linear-gradient(145deg, #fef08a, #eab308);
  color: #0f172a;
}

.court-token[data-color="setter2"],
.player-token[data-color="setter2"] {
  background: linear-gradient(145deg, #a5f3fc, #0891b2);
  color: #fff;
}

.court-token[data-color="outside"],
.player-token[data-color="outside"] {
  background: linear-gradient(145deg, #93c5fd, #1d4ed8);
  color: #fff;
}

.court-token[data-color="outside2"],
.player-token[data-color="outside2"] {
  background: linear-gradient(145deg, #fed7aa, #ea580c);
  color: #fff;
}

.court-token[data-color="middle"],
.player-token[data-color="middle"] {
  background: linear-gradient(145deg, #bbf7d0, #15803d);
  color: #fff;
}

.court-token[data-color="middle2"],
.player-token[data-color="middle2"] {
  background: linear-gradient(145deg, #e9d5ff, #7e22ce);
  color: #fff;
}

.court-token[data-color="opposite"],
.player-token[data-color="opposite"] {
  background: linear-gradient(145deg, #fbcfe8, #db2777);
  color: #fff;
}

.court-token[data-color="libero"],
.player-token[data-color="libero"] {
  background: linear-gradient(145deg, #fecaca, #dc2626);
  color: #fff;
}

.ct-label {
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1;
}

.ct-sub {
  font-size: 0.54rem;
  font-weight: 800;
  opacity: 0.85;
  margin-top: 1px;
}

/* ============================================================================
   NOTEBOOK SKETCH THEME (Toggled via "📓 Notebook Look")
   Reproduces the exact hand-drawn dot-grid paper look from the reference photo!
   ============================================================================ */

body.is-notebook-theme .trio-row {
  background-color: #f5f2eb;
  background-image: radial-gradient(#94a3b8 1.25px, transparent 1.25px);
  background-size: 22px 22px;
  color: #1e293b;
  border: 2px solid #cbd5e1;
}

body.is-notebook-theme .btn-voronoi-toggle:disabled,
body.is-notebook-theme .btn-voronoi-toggle.is-disabled {
  opacity: 0.42 !important;
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
  color: #94a3b8 !important;
}

body.is-notebook-theme .mini-attack-line::before,
body.is-notebook-theme .mini-attack-line::after {
  border-top-color: rgba(71, 85, 105, 0.55);
}

body.is-notebook-theme .setter-in-label,
body.is-notebook-theme .setter-who-sub,
body.is-notebook-theme .court-col-title,
body.is-notebook-theme .court-col-sub {
  color: #1e293b;
  font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", system-ui, sans-serif;
}

body.is-notebook-theme .setter-in-circle {
  border: 2.5px solid #1e293b;
  background: transparent;
  color: #1e293b;
  box-shadow: none;
}

body.is-notebook-theme .mini-court {
  background: rgba(255, 255, 255, 0.45);
  border: 2.5px solid #1e293b;
  box-shadow: none;
}

body.is-notebook-theme .mini-attack-line {
  border-top: 2px dashed #334155;
}

body.is-notebook-theme .mini-net-label {
  background: transparent;
  color: #475569;
}

/* In Notebook Look: Front row is circled, Back row is uncircled plain ink! */
body.is-notebook-theme .court-token {
  background: transparent !important;
  color: #0f172a !important;
  box-shadow: none;
  font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", system-ui, sans-serif;
}

body.is-notebook-theme .court-token.is-front-row {
  border: 2.5px solid #1e293b;
  background: rgba(255, 255, 255, 0.82) !important;
}

body.is-notebook-theme .court-token.is-back-row {
  border: none;
  background: rgba(245, 242, 235, 0.75) !important;
}

body.is-notebook-theme .court-token.is-selected {
  box-shadow: 0 0 0 3px #0284c7;
  background: #e0f2fe !important;
}

body.is-notebook-theme .court-token.is-dragging {
  background: #0284c7 !important;
  border-color: #ffffff !important;
}

/* ============================================================================
   SINGLE ANIMATED COURT VIEW (When user selects "1 Court (Animate)")
   ============================================================================ */

.single-court-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.single-phase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 680px;
  background: var(--bg-panel);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.phase-stepper-horizontal {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.phase-btn {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  background: var(--bg-card);
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.phase-btn.is-active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
}

.btn-play {
  background: var(--accent-green);
  color: #052e16;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-play.is-playing {
  background: #f43f5e;
  color: #fff;
}

.court-wrapper.single-wrapper {
  width: 100%;
  max-width: 640px;
  background: #c2410c;
  padding: 0.85rem 1.2rem 1rem;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.opponent-bar {
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.court-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.92;
  background: linear-gradient(
    180deg,
    var(--court-front) 0%,
    var(--court-front) 33.33%,
    var(--court-back) 33.33%,
    var(--court-back) 100%
  );
  border: 4px solid var(--court-line);
  border-top-width: 6px;
  border-radius: 4px;
  overflow: visible;
  container-type: size;
}

.net-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: rgba(15, 23, 42, 0.75);
  border-bottom: 2px solid #facc15;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}

.net-label {
  color: #facc15;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.attack-line {
  position: absolute;
  top: 33.33%;
  left: 0;
  right: 0;
  border-top: 3px dashed rgba(255, 255, 255, 0.9);
  z-index: 2;
  display: flex;
  justify-content: center;
}

.attack-line-label {
  margin-top: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(7, 89, 133, 0.85);
  padding: 1px 8px;
  border-radius: 4px;
}

.target-marker {
  position: absolute;
  left: 0;
  top: 0;
  translate: calc(var(--tx, 66) * 1cqw - 50%) calc(var(--ty, 12) * 1cqh - 50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.target-marker.is-editable {
  z-index: 25 !important;
  pointer-events: auto !important;
  cursor: grab !important;
  touch-action: none !important;
}

.target-marker.is-editable:hover .target-ring {
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.9);
}

.target-marker.is-dragging {
  cursor: grabbing !important;
  z-index: 35 !important;
}

.target-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px dashed #fde047;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.28) 0%, rgba(250, 204, 21, 0) 75%);
}

.target-text {
  font-size: 0.62rem;
  font-weight: 900;
  color: #fef08a;
  background: rgba(15, 23, 42, 0.8);
  padding: 1px 5px;
  border-radius: 4px;
}

.mini-court-svg,
.court-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.players-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.players-layer > * {
  pointer-events: auto;
}

.player-token {
  position: absolute;
  top: 0;
  left: 0;
  translate: calc(var(--px, 50) * 1cqw - 50%) calc(var(--py, 50) * 1cqh - 50%);
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  color: #0f172a;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42);
  transition:
    translate 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.2s ease,
    opacity 0.25s ease;

  @media (prefers-reduced-motion: reduce) {
    transition: opacity 0.15s ease;
  }
}

/* ============================================================================
   COACHING DOCK (3 Cards Below the Side-by-Side Courts)
   ============================================================================ */

.coaching-details {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.coaching-details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.coaching-details-summary::-webkit-details-marker {
  display: none;
}

.coaching-summary-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
}

.coaching-details[open] .coaching-details-summary {
  border-bottom: 1px solid var(--border-subtle);
}

.coaching-dock {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: stretch;
  padding: 0.85rem;
}

@media (max-width: 1100px) {
  .coaching-dock {
    grid-template-columns: 1fr;
  }
}

.coach-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.coach-card-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.coach-icon {
  font-size: 1.3rem;
}

.coach-card-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.coach-sub {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.coach-headline {
  margin: 0 0 0.55rem 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(250, 204, 21, 0.1);
  border-left: 3px solid var(--accent-gold);
  padding: 0.42rem 0.65rem;
  border-radius: 0 6px 6px 0;
}

.coach-steps {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.player-spotlight-card {
  border-color: rgba(56, 189, 248, 0.45);
}

.spotlight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.spotlight-badge-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.spotlight-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  color: #0f172a;
}

.spotlight-title h3 {
  margin: 0;
  font-size: 0.94rem;
}

.spotlight-title p {
  margin: 0;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.spotlight-zone-tag {
  font-size: 0.73rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

.spotlight-jobs {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  font-size: 0.79rem;
}

.job-box {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}

.job-box strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 2px;
}

.job-box.overlap-box strong {
  color: #4ade80;
}

.spotlight-edit-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-spot-action {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.58rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
}

.btn-spot-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.btn-spot-action.is-danger {
  border-color: rgba(244, 63, 94, 0.5);
  color: #fda4af;
}

.btn-spot-action.is-gold {
  border-color: rgba(250, 204, 21, 0.55);
  color: #fef08a;
}

.editable-note-input {
  width: 100%;
  margin-top: 4px;
  padding: 0.32rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.76rem;
}

.editable-note-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.system-summary-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.65rem 0;
}

.system-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.meta-box {
  background: rgba(15, 23, 42, 0.5);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.meta-label {
  display: block;
  font-size: 0.69rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.meta-box strong {
  font-size: 0.8rem;
  color: #fff;
}

/* Dialogs & Top-Layer Animations (following animate-to-from-top-layer guidance) */
.modal-dialog {
  max-width: 760px;
  width: calc(100% - 2rem);
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);

  opacity: 0;
  transform: scale(0.92);
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

.modal-dialog::backdrop {
  background-color: rgb(0 0 0 / 0);
  transition-property: background-color, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

:is(dialog[open], [popover]:popover-open):where(:not([data-closing])) {
  opacity: 1;
  transform: scale(1);

  @starting-style {
    opacity: 0;
    transform: scale(0.92);
  }

  &::backdrop {
    background-color: rgb(0 0 0 / 0.65);

    @starting-style {
      background-color: transparent;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-dialog {
    transform: none;
    transition-duration: 0.1s;
  }

  @starting-style {
    :is(dialog[open], [popover]:popover-open):where(:not([data-closing])) {
      transform: none;
    }
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.modal-header p {
  margin: 2px 0 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-close-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.modal-body {
  padding: 1.2rem;
}

.compare-table-wrap {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}


