#full-scoreboard {
  position: fixed;
  z-index: 900;
  inset: 0;
  min-height: 100dvh;
  overflow: auto;
  padding: clamp(12px, 2vw, 28px);
  background: #111820;
  color: #fff;
  touch-action: manipulation;
  user-select: none;
}

#full-scoreboard[hidden] { display: none; }
body.scoreboard-open { overflow: hidden; }

.fs-board {
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr) auto;
  gap: clamp(10px, 1.6vw, 22px);
  width: 100%;
  min-height: calc(100dvh - clamp(24px, 4vw, 56px));
}

.fs-topbar,
.fs-actions,
.fs-timeout-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fs-topbar strong { color: #ffc515; letter-spacing: .08em; }
.fs-topbar span { color: #aebdcd; font-size: .8rem; }
.fs-topbar button { background: #263442; color: #fff; }

.fs-status {
  padding: 9px 14px;
  border-radius: 10px;
  background: #203044;
  text-align: center;
  font-weight: 900;
}
.fs-status.suspended { background: #74321f; color: #ffe1d8; }

.fs-score-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 18vw) minmax(0, 1fr);
  gap: clamp(12px, 2.4vw, 36px);
  align-items: stretch;
}

.fs-team {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto;
  gap: 12px;
  min-width: 0;
}
.fs-team h2 {
  overflow: hidden;
  margin: 0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.25rem, 3.8vw, 3.8rem);
}
.fs-team.home h2 { color: #55b5ff; }
.fs-team.away h2 { color: #ff6258; }

.fs-point-surface {
  display: grid;
  place-items: center;
  min-height: 230px;
  border: 0;
  border-radius: clamp(16px, 2vw, 30px);
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: clamp(7rem, 23vw, 22rem);
  font-weight: 1000;
  line-height: .8;
  box-shadow: inset 0 -10px 30px #0002, 0 18px 40px #0005;
  touch-action: none;
}
.home .fs-point-surface { background: linear-gradient(145deg, #0877ca, #2aa8ff); }
.away .fs-point-surface { background: linear-gradient(145deg, #db3028, #ff4b42); }
.fs-point-surface:active { transform: scale(.992); }

.fs-point-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.fs-point-buttons button { min-height: 52px; background: #263442; color: #fff; font-size: 1.3rem; }
.fs-point-buttons button:last-child { background: #ffc515; color: #071831; }

.fs-center {
  display: grid;
  align-content: center;
  gap: 16px;
  text-align: center;
}
.fs-current-set { color: #aebdcd; font-size: .8rem; font-weight: 900; letter-spacing: .12em; }
.fs-set-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fs-set-box {
  min-height: 76px;
  padding: 8px;
  background: #263442;
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}
.fs-set-box.home { border-bottom: 5px solid #2aa8ff; }
.fs-set-box.away { border-bottom: 5px solid #ff4b42; }
.fs-clock {
  color: #ffc515;
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 7vw, 7rem);
  font-weight: 1000;
}
.fs-clock-label { min-height: 2.5em; color: #c6d3df; font-size: .8rem; }
.fs-last-set { min-height: 1.2em; color: #ffc515; font-size: .7rem; font-weight: 900; }
.fs-resume { background: #ffc515; color: #071831; }
.fs-swap-sides { min-height: 36px; padding: 6px 9px; background: #263442; color: #fff; font-size: .72rem; }

.fs-timeout-button {
  min-height: 50px;
  background: #263442;
  color: #fff;
}
.fs-timeout-button:disabled { opacity: .42; }
.fs-team-hint { color: #93a5b6; text-align: center; font-size: .72rem; }
.fs-actions { justify-content: center; flex-wrap: wrap; }
.fs-actions button { min-height: 46px; }
.fs-stop { background: #d83a22; color: #fff; }
.fs-finish { background: #ffc515; color: #071831; }

.rotation-panel {
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid #344454;
  border-radius: 18px;
  background: #17212b;
}
.rotation-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 14px; }
.rotation-heading span { color: #ffc515; font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.rotation-heading h3 { margin: 4px 0 0; font-size: clamp(1rem, 2vw, 1.5rem); }
.rotation-heading p { max-width: 430px; margin: 0; color: #aebdcd; font-size: .75rem; }
.rotation-courts { display: grid; grid-template-columns: 1fr 8px 1fr; gap: 10px; }
.rotation-net { display: grid; place-items: center; border-radius: 8px; background: repeating-linear-gradient(0deg,#fff 0 3px,#718296 3px 8px); }
.rotation-net span { padding: 5px 2px; background: #111820; font-size: .55rem; font-weight: 900; writing-mode: vertical-rl; }
.rotation-court { min-width: 0; padding: 12px; border-radius: 14px; }
.rotation-court.home { background: linear-gradient(145deg,#075fa7,#159eef); }
.rotation-court.away { background: linear-gradient(145deg,#be2b26,#f5473e); }
.rotation-team-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rotation-team-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-toggle { padding: 7px 10px; background: #17212bcc; color: #fff; font-size: .7rem; }
.service-toggle.serving { background: #ffc515; color: #071831; box-shadow: 0 0 0 3px #fff5; }
.court-net-label { display: block; margin: 10px 0 5px; border-bottom: 2px solid #fff9; color: #fff; text-align: center; font-size: .58rem; font-weight: 900; letter-spacing: .12em; }
.rotation-positions { display: grid; grid-template-columns: repeat(3,1fr); grid-template-areas: "p4 p3 p2" "p5 p6 p1"; gap: 8px; }
.rotation-position { display: grid; place-items: center; gap: 3px; min-width: 0; padding: 6px; border-radius: 12px; background: #ffffff24; }
.rotation-position.pos-1 { grid-area: p1; }.rotation-position.pos-2 { grid-area: p2; }.rotation-position.pos-3 { grid-area: p3; }.rotation-position.pos-4 { grid-area: p4; }.rotation-position.pos-5 { grid-area: p5; }.rotation-position.pos-6 { grid-area: p6; }
.rotation-position span { overflow: hidden; width: 100%; color: #fff; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(.45rem,1vw,.62rem); }
.rotation-player { width: min(100%,78px); height: clamp(46px,6vw,70px); padding: 3px; border: 2px solid #fff; border-radius: 50%; background: #eef2f5; color: #132230; text-align: center; font-size: clamp(1.25rem,3vw,2.1rem); font-weight: 900; }
.rotation-position.server { outline: 3px solid #ffc515; background: #ffc51545; }
.rotation-actions { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.rotation-actions button { min-height: 38px; background: #17212b; color: #fff; }
.rotation-actions .primary { background: #ffc515; color: #071831; }

@media (max-width: 760px) and (orientation: portrait) {
  #full-scoreboard { overflow: hidden; padding: 6px; }
  .fs-board { grid-template-rows: auto auto minmax(0, 34dvh) minmax(0, 1fr) auto; height: calc(100dvh - 12px); min-height: 0; gap: 4px; }
  .fs-topbar { min-height: 30px; }
  .fs-topbar span { display: none; }
  .fs-topbar button { min-height: 30px; padding: 4px 8px; }
  .fs-status { padding: 4px 8px; font-size: .68rem; }
  .fs-score-grid {
    grid-template-columns: minmax(0,1fr) minmax(70px,22vw) minmax(0,1fr);
    gap: 5px;
  }
  .fs-team { grid-template-rows: auto minmax(0,1fr) auto auto; gap: 3px; }
  .fs-team h2 { font-size: clamp(.8rem,4vw,1.15rem); }
  .fs-point-surface { min-height: 0; font-size: clamp(4rem,24vw,7rem); border-radius: 14px; }
  .fs-point-buttons { gap: 3px; }
  .fs-point-buttons button,.fs-timeout-button { min-height: 28px; padding: 3px; font-size: .62rem; }
  .fs-team-hint,.fs-last-set,.fs-clock-label { display: none; }
  .fs-center { gap: 4px; }
  .fs-current-set { font-size: .62rem; }
  .fs-set-boxes { gap: 3px; }
  .fs-set-box { min-height: 42px; padding: 2px; font-size: clamp(1.6rem,9vw,2.4rem); }
  .fs-clock { font-size: clamp(1.55rem,8vw,2.3rem); }
  .fs-swap-sides { min-height: 27px; padding: 3px; font-size: .58rem; }
  .rotation-panel { min-height: 0; overflow: hidden; padding: 5px; border-radius: 12px; }
  .rotation-heading { display: flex; margin-bottom: 3px; }
  .rotation-heading h3,.rotation-heading p { display: none; }
  .rotation-heading span { font-size: .56rem; }
  .rotation-courts { height: calc(100% - 15px); grid-template-columns: minmax(0,1fr) 4px minmax(0,1fr); gap: 3px; }
  .rotation-net span { display: none; }
  .rotation-court { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; min-height: 0; padding: 4px; border-radius: 9px; }
  .rotation-team-title { gap: 3px; font-size: .68rem; }
  .service-toggle { padding: 3px 4px; font-size: .52rem; }
  .court-net-label { margin: 2px 0; font-size: .45rem; }
  .rotation-positions { min-height: 0; gap: 3px; }
  .rotation-position { gap: 0; padding: 2px; border-radius: 7px; }
  .rotation-position span { font-size: .4rem; }
  .rotation-player { width: min(100%,42px); height: min(7.2vh,42px); font-size: 1rem; }
  .rotation-actions { gap: 3px; margin-top: 2px; }
  .rotation-actions button { min-height: 24px; padding: 2px 4px; font-size: .55rem; }
  .fs-actions { gap: 4px; }
  .fs-actions button { min-height: 29px; padding: 3px 7px; font-size: .62rem; }
}

@media (max-height: 520px) and (orientation: landscape) {
  #full-scoreboard { padding: 8px 14px; }
  .fs-board { grid-template-rows: auto auto minmax(0, 1fr) auto; min-height: calc(100dvh - 16px); height: calc(100dvh - 16px); gap: 4px; }
  .fs-topbar { min-height: 28px; }
  .fs-topbar span { display: none; }
  .fs-status { padding: 4px 10px; font-size: .74rem; }
  .fs-score-grid { gap: 12px; }
  .fs-point-surface { min-height: 118px; font-size: clamp(5rem, 31vh, 8rem); }
  .fs-team { grid-template-rows: auto minmax(100px, 1fr) auto auto; gap: 3px; }
  .fs-team h2 { font-size: clamp(1rem, 4vh, 1.35rem); }
  .fs-center { gap: 5px; }
  .fs-set-box { min-height: 50px; font-size: clamp(2rem, 10vh, 3rem); }
  .fs-clock { font-size: clamp(2.2rem, 12vh, 3.5rem); }
  .fs-clock-label { min-height: 1.2em; font-size: .68rem; }
  .fs-team-hint { display: none; }
  .fs-point-buttons button, .fs-timeout-button { min-height: 31px; padding: 3px 6px; font-size: .78rem; }
  .fs-actions button { min-height: 29px; padding: 4px 9px; font-size: .72rem; }
  .rotation-panel { padding: 7px; }
  .rotation-heading { margin-bottom: 5px; }
  .rotation-heading p { display: none; }
  .rotation-court { padding: 6px; }
  .rotation-player { width: 42px; height: 42px; font-size: 1.15rem; }
  .court-net-label { margin: 4px 0 3px; }
  .rotation-actions { margin-top: 4px; }
  .rotation-actions button { min-height: 27px; padding: 3px 7px; font-size: .66rem; }
}
