﻿@font-face {
  font-family: "Pretendard";
  src: url("./fonts/Pretendard-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Pretendard";
  src: url("./fonts/Pretendard-SemiBold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Pretendard";
  src: url("./fonts/Pretendard-Bold.otf") format("opentype");
  font-weight: 700 950;
  font-style: normal;
  font-display: block;
}
:root {
  --court-charcoal: #202123;
  --court-charcoal-soft: #282a2d;
  --court-orange: #f25b2c;
  --line: rgba(255, 255, 255, 0.96);
  --home-token: #f7fbf8;
  --away-token: #ffe4cf;
  --accent: #40d2c1;
  --danger: #ef4444;
  --blue-pad: #174bb8;
  --ui-bg: #f3f1ea;
  --ui-card: #ffffff;
  --ui-soft: #ebe8df;
  --ui-text: #202124;
  --ui-muted: #6b665d;
  --ui-border: #d8d2c6;
  --team-orange: #f25b2c;
  --button-rest-shadow: 0 1px 0 rgba(255, 255, 255, 0.92) inset, 0 4px 12px rgba(64, 52, 38, 0.06);
  --button-press-shadow: 0 1px 0 rgba(255, 255, 255, 0.68) inset, 0 2px 7px rgba(64, 52, 38, 0.08);
  --button-active-bg: #fff0e7;
  --button-active-bg-strong: #ffe1cf;
  --button-active-border: rgba(242, 91, 44, 0.62);
  --button-active-text: #963812;
  --button-press-scale: 0.975;
  --panel-width: clamp(286px, 31vw, 336px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f6f1 100%);
  color: var(--ui-text);
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  box-shadow: var(--button-rest-shadow);
  transform: translateZ(0);
  transition:
    transform 0.1s cubic-bezier(.2, .8, .2, 1),
    background 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    color 0.14s ease,
    opacity 0.14s ease;
}

button:not(.object-token):active {
  background: linear-gradient(180deg, #f3eee5 0%, #ebe3d6 100%);
  box-shadow: var(--button-press-shadow);
  transform: scale(var(--button-press-scale));
}

button.active {
  background: linear-gradient(180deg, var(--button-active-bg) 0%, var(--button-active-bg-strong) 100%);
  border-color: var(--button-active-border);
  color: var(--button-active-text);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 0 0 1px rgba(255, 255, 255, 0.52) inset,
    0 6px 16px rgba(242, 91, 44, 0.16);
}

button.active:not(.object-token):active {
  background: linear-gradient(180deg, #ffe8d9 0%, #ffd3bd 100%);
  transform: scale(var(--button-press-scale));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.72) inset,
    0 2px 9px rgba(242, 91, 44, 0.16);
}

button.danger {
  background: linear-gradient(180deg, #ffffff 0%, #fbf7f4 100%);
  border-color: rgba(239, 68, 68, 0.24);
  color: #7f1d1d;
}

button.danger:not(.object-token):active {
  background: linear-gradient(180deg, #fff1f1 0%, #fee2e2 100%);
  border-color: rgba(239, 68, 68, 0.48);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset, 0 2px 9px rgba(239, 68, 68, 0.12);
}

.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.9) 0 1px, transparent 430px),
    linear-gradient(120deg, #ece8de 0%, #f8f6ef 44%, #e7e1d5 100%);
}

.topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(165px, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-height: 50px;
  max-width: 100%;
  padding: calc(env(safe-area-inset-top) + 5px) 8px 5px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(216, 210, 198, 0.9);
  box-shadow: 0 8px 28px rgba(68, 58, 47, 0.08);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  gap: 1px;
  min-width: 150px;
  overflow: hidden;
}

.brand strong {
  font-size: clamp(18px, 2.1vw, 26px);
  font-weight: 950;
  letter-spacing: -0.03em;
  text-shadow: none;
  white-space: nowrap;
}

.brand .byline {
  margin-left: 6px;
  color: var(--ui-muted);
  font-size: 0.48em;
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: baseline;
}

.brand span {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 900;
}

.brand span.saved-flash {
  color: var(--team-orange);
}

.timer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--ui-border);
  backdrop-filter: blur(8px);
}

.timer input {
  width: 38px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  text-align: center;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.timer strong {
  min-width: 48px;
  text-align: center;
  font-size: 18px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.timer button {
  min-width: 34px;
  min-height: 32px;
  padding: 0 7px;
}

.timer .timer-toggle {
  width: 36px;
  padding: 0;
}

.mode-actions {
  display: flex;
  gap: 5px;
  padding: 3px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--ui-border);
  backdrop-filter: blur(8px);
}

.mode-actions button {
  min-width: 38px;
  min-height: 32px;
  padding: 0 9px;
}

#mode-toggle {
  background: rgba(242, 91, 44, 0.96);
  color: #fff;
  border-color: transparent;
  padding-inline: 12px;
}

.workspace {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: rgba(235, 232, 223, 0.9);
}

.mode-switch button {
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.mode-switch button.active,
.quick-mode.active {
  background: rgba(242, 91, 44, 0.96);
  color: #fff;
}

.board-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  overflow: hidden;
  border-radius: 0;
  background: var(--court-charcoal);
  box-shadow: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@supports (height: 100dvh) {
  .board {
    width: 100%;
    height: 100%;
    max-height: none;
  }
}

.court-svg,
.draw-canvas,
.laser-layer,
.object-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.court-svg {
  z-index: 1;
}

.draw-canvas {
  z-index: 3;
  pointer-events: none;
}

.laser-layer {
  z-index: 5;
  pointer-events: none;
}

.object-layer {
  z-index: 4;
  pointer-events: none;
}

.free-zone,
.court-charcoal {
  fill: var(--court-charcoal);
}

.court-orange {
  fill: var(--court-orange);
}

.court-outline {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}

.court-line {
  stroke: var(--line);
  stroke-width: 7;
  stroke-linecap: square;
}

.outside-mark {
  stroke: var(--line);
  stroke-width: 8;
  stroke-linecap: square;
}

.net-band {
  fill: #141516;
  stroke: rgba(255, 255, 255, 0.94);
  stroke-width: 2;
}

.net-mesh {
  fill: url(#net-mesh);
  stroke: rgba(255, 255, 255, 0.64);
  stroke-width: 1;
}

.net-line {
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 2;
}

.net-post {
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 3;
  stroke-linecap: round;
}

.object-token {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: var(--token-size, 46px);
  height: var(--token-size, 46px);
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 3px solid rgba(10, 80, 82, 0.9);
  background: var(--home-token);
  color: #061d1e;
  font-size: var(--token-font, 13px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.12em;
  white-space: nowrap;
  overflow: visible;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: none !important;
}

.object-token::before {
  content: "";
  position: absolute;
  inset: var(--token-hit, -10px);
  border-radius: 50%;
}

.token-size-small {
  --token-size: 54px;
  --token-font: 15px;
  --token-hit: -12px;
  --token-border: 3px;
}

.token-size-base {
  --token-size: 66px;
  --token-font: 18px;
  --token-hit: -10px;
  --token-border: 3px;
}

.token-size-large {
  --token-size: 78px;
  --token-font: 21px;
  --token-hit: -8px;
  --token-border: 3px;
}

.object-token.away {
  background: var(--away-token);
  border-color: rgba(132, 63, 30, 0.9);
}

.object-token.number-view {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.object-token.selected {
  outline: 4px solid rgba(64, 210, 193, 0.58);
  outline-offset: 2px;
}

.object-token.dragging {
  cursor: grabbing;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42);
  transition: none !important;
}

.object-token:active,
.object-token.dragging {
  transform: translate(-50%, -50%) !important;
}

.ball-token {
  font-size: 0;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: center / cover no-repeat url("./mikasa-ball.png");
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.32);
}

.ball-token::before {
  inset: -13px;
}

.ball-token.trajectory-armed {
  border-color: rgba(64, 210, 193, 0.96);
  box-shadow:
    0 0 0 4px rgba(64, 210, 193, 0.28),
    0 0 18px rgba(64, 210, 193, 0.36),
    0 5px 12px rgba(0, 0, 0, 0.32);
}

.ball-token.trajectory-armed::after {
  content: "⤳";
  position: absolute;
  right: -7px;
  top: -9px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(64, 210, 193, 0.96);
  color: #102321;
  font-size: 11px;
  font-weight: 950;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.22);
}

.panel-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 27;
  min-width: 40px;
  min-height: 84px;
  padding: 8px 7px;
  transform: translateY(-50%);
  background: rgba(242, 91, 44, 0.96);
  color: #fff;
  border-color: transparent;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(242, 91, 44, 0.24);
  font-size: 15px;
  touch-action: none;
}

.panel-toggle:active {
  transform: translateY(-50%) scale(0.98);
}

.panel-toggle::before {
  content: "";
  position: absolute;
  inset: -18px -20px;
  border-radius: 999px;
}

.tool-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 24;
  width: var(--panel-width);
  padding: 14px;
  background: rgba(255, 255, 255, 0.97);
  border-left: 1px solid var(--ui-border);
  color: var(--ui-text);
  transform: translateX(100%);
  transition: transform 0.18s cubic-bezier(.2, .8, .2, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.tool-panel.open {
  transform: translateX(0);
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid var(--ui-border);
  border-radius: 22px;
  background: rgba(235, 232, 223, 0.88);
  box-shadow: inset 0 1px 2px rgba(84, 71, 53, 0.08);
}

.panel-tabs::after {
  content: "";
  grid-column: 1 / -1;
  height: 1px;
  margin: 8px 2px 0;
  background: linear-gradient(90deg, transparent, rgba(145, 133, 115, 0.45), transparent);
}

.panel-tabs .tab {
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  box-shadow: none;
  color: #4b4d50;
  font-size: 14px;
}

.panel-tabs .tab.active {
  background: linear-gradient(180deg, #ffffff 0%, #ffe3d2 100%);
  border-color: rgba(242, 91, 44, 0.46);
  color: var(--button-active-text);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 5px 15px rgba(242, 91, 44, 0.14);
}

.panel-page {
  display: none;
}

.panel-page.active {
  display: grid;
  gap: 13px;
}

.panel-actions,
.tool-grid,
.color-row,
.preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.panel-actions button,
.tool-grid button,
.preset-row button,
.roster-player {
  min-height: 44px;
  border-radius: 14px;
}

.player-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
}

.player-actions button {
  width: 100%;
  min-height: 48px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px;
  border: 1px solid rgba(216, 210, 198, 0.85);
  border-radius: 18px;
  background: rgba(250, 248, 243, 0.74);
}

.tool-grid .draw-mode[data-tool="eraser"] {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: min(180px, 72%);
}

.tool-grid .draw-mode[data-tool="ballTrajectory"],
.tool-grid .draw-mode[data-tool="laser"] {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.34);
}

.tool-grid .draw-mode[data-tool="laser"] {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.34);
}

.tool-grid .draw-mode.active,
.quick-toolbar .draw-mode.active {
  background: linear-gradient(180deg, #fff4ed 0%, #ffd9c5 100%);
  border-color: rgba(242, 91, 44, 0.68);
  color: var(--button-active-text);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 0 0 1px rgba(255, 255, 255, 0.45) inset,
    0 6px 16px rgba(242, 91, 44, 0.15);
}

.color-chip {
  min-width: 46px;
}

.color-row {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-inline: auto;
}

.color-row .color-chip {
  position: relative;
  width: 48px;
  min-width: 48px;
  height: 42px;
  padding: 0;
  font-size: 0;
}

.color-row .color-chip::before {
  margin: 0;
}

.color-chip::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--chip);
  border: 1px solid rgba(0, 0, 0, 0.28);
  vertical-align: -4px;
}

.color-chip.active {
  border-color: rgba(242, 91, 44, 0.72);
  box-shadow:
    0 0 0 3px rgba(242, 91, 44, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 6px 14px rgba(64, 52, 38, 0.08);
  transform: scale(1.035);
}

.color-chip.active::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 17px;
  font-weight: 950;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.42);
}

.color-chip.active:not(.object-token):active {
  transform: scale(1);
}

.range-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.setting-block {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(216, 210, 198, 0.85);
  border-radius: 18px;
  background: rgba(250, 248, 243, 0.74);
}

.setting-block h3 {
  margin: 0;
  color: var(--team-orange);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.token-size-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(216, 210, 198, 0.9);
  border-radius: 20px;
  background: rgba(235, 232, 223, 0.72);
}

.token-size-row button {
  min-height: 42px;
  padding: 7px 8px;
  border-color: transparent;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}

.token-size-row button.active {
  background: linear-gradient(180deg, #ffffff 0%, #ffe0cd 100%);
  border-color: rgba(242, 91, 44, 0.46);
  color: var(--button-active-text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset, 0 5px 13px rgba(242, 91, 44, 0.12);
}

.roster-list {
  display: grid;
  gap: 14px;
}

.position-group {
  display: grid;
  gap: 7px;
}

.position-group h3 {
  margin: 0;
  color: var(--team-orange);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.roster-player {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  border-radius: 12px;
  background: var(--ui-soft);
  border: 1px solid var(--ui-border);
  text-align: left;
}

.roster-player.inserted {
  background: rgba(242, 91, 44, 0.12);
  border-color: rgba(242, 91, 44, 0.72);
}

.roster-player .number {
  color: var(--ui-muted);
}

.roster-player .check {
  color: var(--team-orange);
  font-size: 18px;
  text-align: right;
}

.quick-toolbar {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  z-index: 35;
  display: none;
  gap: 7px;
  transform: translateX(-50%);
  width: min(94vw, 980px);
  padding: 8px 10px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--ui-border);
  backdrop-filter: blur(14px);
}

.quick-toolbar button {
  min-width: 72px;
  min-height: 36px;
  padding: 6px 12px;
  white-space: nowrap;
}

.quick-toolbar .icon-button {
  min-width: 50px;
}

.quick-drawing-tools {
  position: fixed;
  right: calc(env(safe-area-inset-right) + 18px);
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 34;
  display: flex;
  gap: 8px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--ui-border);
  box-shadow: 0 10px 24px rgba(30, 27, 22, 0.16);
  backdrop-filter: blur(12px);
}

.quick-drawing-tools button {
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 23px;
  line-height: 1;
}

.quick-drawing-tools svg {
  width: 25px;
  height: 25px;
  display: block;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-drawing-tools button.active {
  background: linear-gradient(180deg, var(--button-active-bg) 0%, var(--button-active-bg-strong) 100%);
  border-color: var(--button-active-border);
  color: var(--button-active-text);
}

.panel-open:not(.ui-hidden) .quick-drawing-tools {
  display: none;
}

.laser-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #ff1f5b;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 13px rgba(255, 31, 91, 0.72);
  animation: laserFade 1.2s ease-out forwards;
}

.show-ui {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  right: calc(env(safe-area-inset-right) + 12px);
  z-index: 36;
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(216, 210, 198, 0.78);
  color: var(--ui-text);
  box-shadow: 0 10px 24px rgba(30, 27, 22, 0.16);
  backdrop-filter: blur(10px);
}

.config-mode .board-wrap,
.whiteboard-mode .board-wrap {
  padding: 0;
}

.config-mode .board,
.whiteboard-mode .board {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

@supports (height: 100dvh) {
  .config-mode .board,
  .whiteboard-mode .board {
    width: 100%;
    height: 100%;
    max-height: none;
  }
}

.config-mode .quick-toolbar,
.whiteboard-mode .quick-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  max-width: calc(100vw - 20px);
}

.whiteboard-mode .board {
  background: #fff;
  box-shadow: 0 22px 70px rgba(60, 48, 35, 0.18);
}

.whiteboard-mode .court-svg {
  display: none;
}

.ui-hidden {
  grid-template-rows: minmax(0, 1fr);
}

.ui-hidden .topbar,
.ui-hidden .quick-toolbar,
.ui-hidden .panel-toggle,
.ui-hidden .tool-panel {
  display: none;
}

.timer.finished strong {
  animation: timerPulse 0.32s ease-in-out 6;
  color: #ffd166;
}

.icon-button {
  min-width: 42px;
  font-size: 24px;
  line-height: 1;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); text-shadow: none; }
  50% { transform: scale(1.18); text-shadow: 0 0 18px rgba(255, 209, 102, 0.9); }
}

@keyframes laserFade {
  0% { opacity: 0.98; transform: translate(-50%, -50%) scale(1); }
  55% { opacity: 0.76; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.42); }
}

.ui-hidden .show-ui {
  display: block;
}

.drawing-hidden .draw-canvas {
  opacity: 0;
}

.object-locked .object-token {
  cursor: default;
}

@media (orientation: portrait) {
  .board-wrap {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .timer,
  .mode-actions {
    justify-content: center;
  }

  .board {
    width: 100%;
    height: 100%;
    max-height: none;
  }
}






/* v22: player portraits and simplified controls */
.object-token.photo-view { background: #eee9df; border: 3px solid #264b4a; letter-spacing: 0; }
.player-portrait { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:center 10%; border-radius:50%; pointer-events:none; }
.player-name-label { position:absolute; top:calc(100% - 2px); left:50%; transform:translateX(-50%); padding:3px 7px; border-radius:6px; background:#fffaf1; color:#172825; border:1px solid rgba(30,49,46,.35); box-shadow:0 2px 5px #0003; font-size:12px; font-weight:800; line-height:1.1; letter-spacing:-.04em; pointer-events:none; }
.tool-panel { background:#f8f7f3; padding:16px; border-left:1px solid #ddd8cd; }
.panel-tabs { border:0; border-radius:13px; background:#eae8e2; box-shadow:none; gap:3px; padding:4px; margin-bottom:16px; }
.panel-tabs::after { display:none; }
.panel-tabs .tab { border-radius:10px; min-height:42px; }
.panel-tabs .tab.active { background:#fff; border-color:transparent; color:#a83b19; box-shadow:0 2px 6px #0002; }
.panel-actions button, .tool-grid button, .preset-row button, .roster-player { border-radius:10px; box-shadow:none; }
.tool-grid { border:0; background:#eeece6; border-radius:12px; }
.tool-grid .draw-mode[data-tool="ballTrajectory"], .tool-grid .draw-mode[data-tool="laser"] { background:#f8f7f3; border-color:#ddd8cd; }
.roster-list { gap:12px; }
.roster-player { background:#fff; }
.quick-drawing-tools { border-radius:16px; background:#f8f7f3ef; gap:4px; padding:5px; }
.quick-drawing-tools button { border-radius:11px; }
.panel-toggle { background:#e96937; color:#20120c; box-shadow:0 5px 14px #0002; }

/* v23: compact player actions */
.player-action-bar { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.player-action-bar button { min-width:0; min-height:46px; padding:8px 5px; border:1px solid #dedbd3; border-radius:10px; background:#fff; box-shadow:none; color:#303631; font-size:14px; font-weight:700; }
.player-action-bar button span { color:#ba4d26; font-size:18px; padding-right:2px; }
.clear-menu { border-bottom:1px solid #e2dfd8; padding-bottom:4px; }
.clear-menu summary { min-height:42px; display:flex; align-items:center; gap:7px; padding:0 4px; cursor:pointer; list-style:none; font-size:14px; font-weight:750; color:#404843; }
.clear-menu summary::-webkit-details-marker { display:none; }
.clear-menu summary::after { content:"⌄"; margin-left:auto; font-size:18px; color:#737a73; }
.clear-menu[open] summary::after { transform:rotate(180deg); }
.clear-menu summary span { color:#777d76; font-size:12px; font-weight:500; }
.clear-options { display:grid; grid-template-columns:1fr 1fr; gap:5px; padding:0 0 9px; }
.clear-options button { min-width:0; min-height:44px; padding:7px 4px; text-align:left; border:0; border-radius:8px; background:transparent; box-shadow:none; color:#68554e; font-size:13px; font-weight:650; }
.clear-options button:active { background:#f1e9e4; }

/* v24 — interface: restrained palette and consistent controls */
:root { --ui-bg:#f2f1ed; --ui-text:#252a28; --ui-muted:#747a76; --ui-border:#e3e5df; --ui-soft:#f5f5f1; --button-active-bg:#faeee7; --button-active-bg-strong:#faeee7; --button-active-border:#e3b39c; --button-active-text:#954b2e; }
.topbar { background:#fbfbf8; border-bottom:1px solid #e4e6df; box-shadow:0 3px 12px #2028200a; padding-left:14px; padding-right:14px; }
.brand strong { font-size:clamp(17px,1.9vw,21px); letter-spacing:-.045em; font-weight:800; }
.brand .byline { color:#898f89; font-weight:500; }
.brand span { font-size:10px; font-weight:600; }
.timer { background:#f1f2ed; border:0; padding:4px; gap:3px; border-radius:12px; }
.timer button, .mode-actions > button { border:0; background:transparent; box-shadow:none; border-radius:8px; font-weight:700; }
.timer input { background:#fff; border-radius:7px; font-weight:700; }
.timer strong { font-weight:800; }
.mode-switch { background:#f0f1ec; border:0; padding:4px; border-radius:11px; box-shadow:none; }
.mode-switch button { border:0; background:transparent; box-shadow:none; border-radius:8px; }
.mode-switch button.active { background:#fff; color:#303936; border:0; box-shadow:0 1px 4px #16201618; }
.tool-panel { background:#fafaf7; border-left:1px solid #e4e6df; padding:18px 16px; }
.panel-tabs { background:#eff0eb; border-radius:12px; padding:4px; margin-bottom:20px; }
.panel-tabs .tab { color:#747b76; font-weight:700; }
.panel-tabs .tab.active { color:#303936; box-shadow:0 2px 6px #1f2a1d14; }
.panel-page.active { gap:14px; }
.player-action-bar button { background:#f1f2ed; border:0; color:#303936; font-weight:700; }
.player-action-bar button span { color:#b65732; }
.clear-menu { border-bottom:1px solid #e6e7e1; }
.clear-menu summary { color:#515953; }
.clear-options button { color:#626961; }
.position-group h3 { color:#8d9890; font-size:12px; font-weight:800; letter-spacing:.07em; }
.roster-list { gap:16px; }
.roster-player { border:1px solid #e9ebe5; background:#fff; border-radius:10px; font-weight:700; }
.roster-player.inserted { background:#f9eee8; border-color:#e8c7b6; }
.roster-player .check { color:#aa5736; }
.section-heading { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin:2px 2px -4px; }
.section-heading h2 { margin:0; font-size:14px; font-weight:800; color:#303936; }
.section-heading span { font-size:11px; color:#89908a; }
.tool-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; padding:0; background:transparent; border:0; }
.tool-grid .draw-mode, .tool-grid .draw-mode[data-tool="laser"], .tool-grid .draw-mode[data-tool="ballTrajectory"] { min-width:0; min-height:48px; text-align:left; padding:8px 12px; background:#f0f1ed; border:1px solid transparent; border-radius:10px; box-shadow:none; color:#454c47; font-size:13px; font-weight:700; }
.tool-grid .draw-mode span { display:inline-block; width:23px; color:#7d877e; font-size:17px; text-align:center; margin-right:4px; }
.tool-grid .draw-mode[data-tool="eraser"] { grid-column:auto; justify-self:stretch; min-width:0; }
.tool-grid .draw-mode.active { background:#faeee7; border-color:#e8c3b1; color:#964d2f; box-shadow:none; }
.tool-grid .draw-mode.active span { color:#b45a35; }
.color-row { display:flex; justify-content:space-between; width:100%; gap:3px; margin:0; }
.color-row .color-chip { width:42px; min-width:42px; height:44px; border:0; background:transparent; box-shadow:none; border-radius:10px; }
.color-chip::before { width:23px; height:23px; border:1px solid #0003; }
.color-chip.active { background:#eceee8; transform:none; }
.color-chip.active::after { content:""; inset:auto 18px 1px; width:5px; height:5px; background:#a85837; border-radius:50%; box-shadow:none; }
.range-row { padding:3px 4px; font-size:13px; font-weight:700; color:#626b63; }
.range-row input { accent-color:#b85f3a; }
.range-row span { color:#343b36; text-align:right; }
.draw-actions { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; }
.draw-actions button { min-width:0; min-height:46px; padding:6px 3px; border:0; border-radius:10px; background:#f0f1ed; color:#48504a; box-shadow:none; font-size:13px; font-weight:700; }
.draw-actions button span { font-size:12px; }
.setting-block { border:0; background:#f1f2ed; border-radius:12px; }
.setting-block h3 { color:#69736a; letter-spacing:0; }
.token-size-row { background:#e9ebe5; border:0; border-radius:10px; }
.token-size-row button { border-radius:8px; }
.token-size-row button.active { background:#fff; border-color:transparent; color:#354039; box-shadow:0 1px 4px #0002; }
.panel-actions button,.preset-row button { background:#f0f1ed; border:0; box-shadow:none; color:#454d47; font-weight:700; }
.quick-drawing-tools { background:#fbfbf8f2; border:1px solid #e1e4dc; box-shadow:0 6px 20px #1e2b201e; border-radius:14px; }
.quick-drawing-tools button { background:transparent; border:0; box-shadow:none; color:#47534a; }
.quick-drawing-tools button.active { background:#f8ede6; border:0; color:#a55431; }
.panel-toggle { background:#f9faf7; color:#a45332; border:1px solid #dedfd8; box-shadow:0 4px 14px #1d271d20; }

/* v25 training-board navigator */
.app { grid-template-rows:auto auto minmax(0,1fr); }
.training-bar { z-index:29; min-width:0; display:flex; align-items:center; justify-content:center; gap:6px; padding:5px 14px; background:#f7f8f4; border-bottom:1px solid #e5e8e1; }
.training-bar button,.training-bar select { height:38px; min-height:38px; border:0; border-radius:9px; background:#eeefea; color:#354039; box-shadow:none; font-size:14px; font-weight:700; }
.training-bar button { min-width:40px; padding:4px 10px; }
.training-bar button:disabled,.board-menu button:disabled { opacity:.35; cursor:default; }
.training-bar select { width:min(240px,40vw); padding:0 10px; }
.board-count { color:#788179; font-size:12px; font-weight:700; white-space:nowrap; }
.board-menu { position:absolute; top:calc(env(safe-area-inset-top) + 100px); right:12px; z-index:60; width:200px; padding:7px; background:#fbfbf8; border:1px solid #e2e6df; border-radius:14px; box-shadow:0 12px 30px #26352626; }
.board-menu[hidden] { display:none; }
.board-menu button { display:block; width:100%; min-height:44px; text-align:left; border:0; border-radius:8px; background:transparent; box-shadow:none; color:#414b43; font-size:13px; font-weight:700; }
.board-menu .board-delete { color:#a34835; border-top:1px solid #eceee9; border-radius:0 0 8px 8px; }
.ui-hidden .training-bar,.ui-hidden .board-menu { display:none; }
.ui-hidden { grid-template-rows:minmax(0,1fr); }
@media(max-width:760px) { .board-menu { top:calc(env(safe-area-inset-top) + 190px); } }

/* v26: training-focused header, anchored menus and prepared layouts */
.topbar { grid-template-columns:minmax(0,1fr) auto; gap:8px 14px; padding:calc(env(safe-area-inset-top) + 10px) 16px 8px; }
.brand { min-width:0; position:relative; gap:3px; }
.brand .app-signature { color:#7a837b; font-size:9px; font-weight:700; letter-spacing:.12em; }
.brand .byline { font-size:9px; margin-left:4px; letter-spacing:0; }
.brand #training-title { font-size:22px; line-height:1.25; font-weight:800; overflow:hidden; text-overflow:ellipsis; }
.brand #save-status { font-size:10px; font-weight:500; }
.timer { position:relative; background:#eef0ea; padding:6px; gap:2px; }
.timer strong { min-width:79px; font-size:29px; line-height:1.2; letter-spacing:-.04em; }
.timer button { min-height:44px; min-width:38px; }
.timer .timer-toggle { width:40px; }
.timer-settings { position:relative; }
.timer-settings summary { display:grid; place-items:center; width:38px; height:44px; list-style:none; border-radius:8px; cursor:pointer; font-size:23px; font-weight:700; }
.timer-settings summary::-webkit-details-marker { display:none; }
.timer-settings[open] summary { background:#e2e6dc; }
.timer-settings-content { position:absolute; right:0; top:calc(100% + 10px); z-index:70; width:250px; padding:16px; background:#fcfcf9; border:1px solid #e0e4d9; border-radius:14px; box-shadow:0 12px 30px #26352626; display:grid; gap:12px; color:#4a554b; font-size:13px; }
.timer-edit-row { display:flex; align-items:center; justify-content:space-between; gap:5px; }
.timer-edit-row label { display:flex; align-items:center; gap:4px; }
.timer-edit-row button { font-size:12px; background:#edf0e7; padding:4px 7px; }
.timer-alert-row { display:flex; align-items:center; justify-content:space-between; border-top:1px solid #e6e9df; padding-top:8px; }
.mode-actions { grid-column:1 / -1; justify-content:flex-end; flex-wrap:wrap; gap:6px; }
.mode-actions > button { min-height:40px; font-size:12px; }
.mode-switch { margin-left:auto; }
.mode-switch button { min-height:40px; font-size:12px; }
.training-controls { position:relative; z-index:29; min-width:0; }
.training-bar { gap:5px; padding:6px 12px; }
.training-bar select { flex:1; min-width:0; max-width:320px; width:auto; }
.training-bar button { min-height:44px; height:44px; }
.training-bar #layout-restore { font-size:12px; padding-inline:10px; color:#9a5235; background:#f6ece4; }
.board-menu { top:calc(100% + 6px); right:12px; max-height:65dvh; overflow:auto; overscroll-behavior:contain; touch-action:pan-y; }
.board-menu button { min-height:46px; }
.ui-hidden .training-controls { display:none; }
.action-dialog { width:min(400px,calc(100vw - 40px)); max-height:85dvh; padding:24px; border:1px solid #e0e4da; border-radius:20px; background:#fbfcf8; color:#303b32; box-shadow:0 24px 80px #16201640; touch-action:pan-y; }
.action-dialog::backdrop { background:#1b291d66; backdrop-filter:blur(4px); }
.action-dialog form { display:grid; gap:16px; }
.action-dialog h2 { margin:0; font-size:20px; font-weight:800; letter-spacing:-.04em; }
.action-dialog p { margin:0; font-size:14px; line-height:1.7; color:#6d776b; }
.dialog-name-label { display:grid; gap:8px; font-size:12px; font-weight:700; color:#6a7467; }
.dialog-name-label input { width:100%; min-height:48px; padding:10px 12px; border:1px solid #cbd3c3; border-radius:10px; background:#fff; color:#253025; font-size:16px; user-select:text; -webkit-user-select:text; }
.dialog-check-label { display:flex; align-items:center; gap:8px; font-size:13px; color:#505d4d; }
.dialog-check-label input { width:20px; height:20px; accent-color:#ae5c39; }
.action-dialog [hidden] { display:none; }
.dialog-buttons { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:4px; }
.dialog-buttons button { min-height:46px; border:0; border-radius:10px; background:#e9ede3; box-shadow:none; font-size:14px; font-weight:700; }
.dialog-buttons #action-submit { background:#f2e2d5; color:#8e482b; }
.dialog-buttons #action-submit.danger { background:#f5dfd8; color:#9b3e2b; }
button:focus-visible,summary:focus-visible,select:focus-visible,input:focus-visible { outline:2px solid #ac6040; outline-offset:3px; }
.timer.finished strong { color:#b44d2e; }
@media(max-width:760px) { .topbar { grid-template-columns:minmax(0,1fr) auto; } .timer { justify-content:flex-end; } .brand #training-title { font-size:20px; } .board-menu { top:calc(100% + 6px); } }
@media(max-width:480px) { .topbar { gap:8px; padding-left:10px; padding-right:10px; } .timer strong { min-width:66px; font-size:25px; } .timer button { min-width:32px; } .timer-settings summary { width:32px; } .training-bar { gap:3px; padding-inline:7px; } .board-count { display:none; } .training-bar #layout-restore { padding-inline:6px; } }
