.tn-console {
  --bv-bg-console: #fef9c3;
  --bv-bg-panel: #fff;
  --bv-bg-card: #fef3c7;
  --bv-border-base: #f59e0b;
  --bv-text-main: #7c2d12;
  --bv-text-muted: #b45309;
  --bv-color-sand: #fde047;
  --bv-color-lines: #06b6d4;
  --bv-color-net: #fff;
  --bv-btn-accent: #0891b2;
  --bv-text-accent: #fff;
  --bv-wood: #7c2d12;
  --bv-shadow: 0 20px 40px rgba(124, 45, 18, 0.2);
  --bv-player-bg: var(--bv-bg-panel);
  --bv-player-stroke: var(--bv-wood);
  --bv-player-text: var(--bv-wood);
  --bv-player-hover-bg: var(--bv-bg-card);
  --bv-btn-bg: var(--bv-bg-card);
  --bv-btn-border: var(--bv-wood);
  --bv-btn-text: var(--bv-wood);
  --bv-btn-hover-bg: var(--bv-wood);
  --bv-btn-hover-text: #fff;

  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  border-radius: 2.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  position: relative;
  background: var(--bv-bg-console);
  border: 6px solid var(--bv-wood);
  box-shadow: var(--bv-shadow);
  color: var(--bv-text-main);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
  .tn-console {
    --bv-bg-console: #1e1b4b;
    --bv-bg-panel: #2e1065;
    --bv-bg-card: #4c1d95;
    --bv-border-base: #a78bfa;
    --bv-text-main: #fbf7ff;
    --bv-text-muted: #f472b6;
    --bv-color-sand: #312e81;
    --bv-color-lines: #ec4899;
    --bv-color-net: #fff;
    --bv-btn-accent: #f472b6;
    --bv-text-accent: #fff;
    --bv-wood: #1e1b4b;
    --bv-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    --bv-player-bg: #4c1d95;
    --bv-player-stroke: #a78bfa;
    --bv-player-text: #fbf7ff;
    --bv-player-hover-bg: #f472b6;
    --bv-btn-bg: #4c1d95;
    --bv-btn-border: #a78bfa;
    --bv-btn-text: #fbf7ff;
    --bv-btn-hover-bg: #a78bfa;
    --bv-btn-hover-text: #1e1b4b;
  }
}

.theme-dark .tn-console {
  --bv-bg-console: #1e1b4b;
  --bv-bg-panel: #2e1065;
  --bv-bg-card: #4c1d95;
  --bv-border-base: #a78bfa;
  --bv-text-main: #fbf7ff;
  --bv-text-muted: #f472b6;
  --bv-color-sand: #312e81;
  --bv-color-lines: #ec4899;
  --bv-color-net: #fff;
  --bv-btn-accent: #f472b6;
  --bv-text-accent: #fff;
  --bv-wood: #1e1b4b;
  --bv-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  --bv-player-bg: #4c1d95;
  --bv-player-stroke: #a78bfa;
  --bv-player-text: #fbf7ff;
  --bv-player-hover-bg: #f472b6;
  --bv-btn-bg: #4c1d95;
  --bv-btn-border: #a78bfa;
  --bv-btn-text: #fbf7ff;
  --bv-btn-hover-bg: #a78bfa;
  --bv-btn-hover-text: #1e1b4b;
}

.tn-header-panel {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.4rem 1.25rem;
  background: var(--bv-bg-panel);
  border-bottom: 4px solid var(--bv-wood);
}

.tn-header-actions {
  display: flex;
  gap: 0.5rem;
}

.tn-action-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  border: 3px solid var(--bv-btn-border);
  background: var(--bv-btn-bg);
  color: var(--bv-btn-text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tn-action-btn:hover {
  background: var(--bv-btn-hover-bg);
  color: var(--bv-btn-hover-text);
  transform: translateY(-2px);
}

.tn-action-btn svg {
  width: 1rem;
  height: 1rem;
}

.tn-beach-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
  position: relative;
}

.tn-beach-controls {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

.tn-beach-btn {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 3px solid var(--bv-btn-border);
  background: var(--bv-btn-bg);
  color: var(--bv-btn-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.tn-beach-btn:hover {
  transform: scale(1.1);
  background: var(--bv-btn-hover-bg);
  color: var(--bv-btn-hover-text);
}

.tn-beach-btn svg {
  width: 1.5rem;
  height: 1.5rem;
}

.tn-beach-set-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.tn-beach-set-lbl {
  font-size: 1.5rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bv-wood);
}

.tn-beach-set-history {
  display: flex;
  gap: 0.5rem;
}

.tn-score-pill {
  padding: 0.25rem 0.75rem;
  background: var(--bv-bg-panel);
  border: 2px solid var(--bv-wood);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.tn-interactive-court-wrapper {
  width: 100%;
  max-width: 34rem;
}

.tn-court-aspect-ratio {
  width: 100%;
  position: relative;
  border: 6px solid var(--bv-wood);
  border-radius: 2rem;
  overflow: hidden;
  box-shadow: var(--bv-shadow);
}

.tn-beach-court-svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bv-color-sand);
  transition: transform 0.6s cubic-bezier(0.68, -0.6, 0.27, 1.55);
}

.tn-court-swapped {
  transform: rotate(180deg);
}

.tn-court-swapped .tn-sand-score,
.tn-court-swapped .tn-player-node,
.tn-court-swapped #tn-sets-group-a,
.tn-court-swapped #tn-sets-group-b {
  transform: rotate(180deg);
  transform-origin: center;
  transform-box: fill-box;
}

.tn-sand-bg {
  fill: var(--bv-color-sand);
}

.tn-beach-wave {
  fill: #06b6d4;
  opacity: 0.35;
}

.tn-court-boundary {
  fill: none;
  stroke: var(--bv-color-lines);
  stroke-width: 5px;
  stroke-linecap: round;
}

.tn-court-net-line {
  fill: none;
  stroke: var(--bv-color-net);
  stroke-width: 5px;
  stroke-dasharray: 6, 6;
}

.tn-net-post {
  fill: var(--bv-wood);
}

.tn-court-click-zone {
  fill: transparent;
  cursor: pointer;
  transition: fill 0.15s ease;
}

.tn-court-click-zone:hover {
  fill: rgba(255, 255, 255, 0.1);
}

.tn-sand-score {
  font-size: 8rem;
  font-weight: 950;
  fill: var(--bv-wood);
  fill-opacity: 0.25;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.tn-sets-bg-rect {
  fill: var(--bv-bg-panel);
  stroke: var(--bv-btn-border);
  stroke-width: 2px;
  rx: 8px;
  transition: all 0.3s ease;
}

.tn-sets-title {
  font-size: 0.5rem;
  font-weight: 900;
  fill: var(--bv-text-muted);
  text-anchor: middle;
  letter-spacing: 0.05em;
}

.tn-sets-count {
  font-size: 1.5rem;
  font-weight: 950;
  fill: var(--bv-text-main);
  text-anchor: middle;
  dominant-baseline: middle;
}

.tn-player-node {
  cursor: pointer;
  transition: all 0.3s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.tn-player-circle {
  fill: var(--bv-player-bg);
  stroke: var(--bv-player-stroke);
  stroke-width: 3px;
  transition: all 0.2s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.tn-player-node:hover .tn-player-circle {
  fill: var(--bv-player-hover-bg);
  transform: scale(1.1);
}

.tn-player-initials {
  font-size: 0.75rem;
  font-weight: 900;
  fill: var(--bv-player-text);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.tn-player-ring {
  fill: none;
  stroke: var(--bv-btn-accent);
  stroke-width: 2px;
  stroke-dasharray: 2, 2;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tn-player-node-active-server .tn-player-ring {
  opacity: 1;
}

.tn-serving-ball {
  fill: #f59e0b;
  stroke: #fff;
  stroke-width: 1.5px;
  display: none;
  animation: tn-ball-bounce 1s infinite alternate ease-in-out;
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes tn-ball-bounce {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-4px);
  }
}



.tn-lineup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124, 45, 18, 0.4);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.tn-lineup-card {
  background: var(--bv-bg-panel);
  border: 4px solid var(--bv-wood);
  border-radius: 2rem;
  padding: 2rem;
  width: 90%;
  max-width: 24rem;
  text-align: center;
  box-shadow: var(--bv-shadow);
  animation: tn-card-pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tn-card-pop-in {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.tn-lineup-title {
  font-size: 1.5rem;
  font-weight: 950;
  text-transform: uppercase;
  color: var(--bv-wood);
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.tn-lineup-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.tn-lineup-team-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tn-team-name-hdr {
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--bv-text-muted);
  text-align: left;
  margin-left: 0.25rem;
}

.tn-beach-input {
  background: var(--bv-bg-card);
  border: 2px solid var(--bv-btn-border);
  border-radius: 0.75rem;
  color: var(--bv-text-main);
  font-size: 1rem;
  font-weight: 800;
  padding: 0.6rem 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.tn-beach-input:focus {
  border-color: var(--bv-btn-accent);
  background: #fff;
}

.tn-floating-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

.tn-btn-control {
  padding: 0.8rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  border-radius: 1rem;
  border: 3px solid var(--bv-btn-border);
  background: var(--bv-btn-bg);
  color: var(--bv-btn-text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.tn-btn-control:hover {
  transform: translateY(-2px);
  background: var(--bv-btn-hover-bg);
  color: var(--bv-btn-hover-text);
  box-shadow: 0 6px 12px rgba(124, 45, 18, 0.2);
}

.tn-swap-banner {
  width: 100%;
  background: #f59e0b;
  color: #fff;
  padding: 1rem;
  text-align: center;
  font-weight: 900;
  font-size: 0.95rem;
  text-transform: uppercase;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-bottom: 4px solid var(--bv-wood);
  animation: tn-banner-slide 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tn-banner-slide {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(0);
  }
}

.tn-btn-banner {
  background: #fff;
  color: #f59e0b;
  border: 2px solid #f59e0b;
  padding: 0.4rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.tn-btn-banner:hover {
  transform: scale(1.05);
}

.tn-winner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124, 45, 18, 0.95);
  z-index: 300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  backdrop-filter: blur(5px);
}

@media (prefers-color-scheme: dark) {
  .tn-winner-overlay {
    background: rgba(30, 27, 75, 0.95);
  }
}

.tn-winner-active {
  display: flex;
}

.tn-winner-title {
  color: #fff;
  font-size: 3rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tn-winner-name {
  color: #f59e0b;
  font-size: 2.25rem;
  font-weight: 950;
}

.tn-particle-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  overflow: hidden;
}

.tn-sand-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  animation: tn-sand-rise 0.8s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tn-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.tn-reset-active {
  opacity: 1;
  pointer-events: auto;
}

.tn-modal-box {
  background: var(--bv-bg-panel);
  border: 4px solid var(--bv-wood);
  border-radius: 2rem;
  padding: 2rem;
  max-width: 22rem;
  width: 90%;
  text-align: center;
  box-shadow: var(--bv-shadow);
}

.tn-modal-text {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  color: var(--bv-text-main);
}

.tn-modal-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.tn-modal-btn {
  padding: 0.75rem 1.75rem;
  font-size: 0.9rem;
  font-weight: 900;
  border-radius: 0.75rem;
  border: 2px solid var(--bv-wood);
  cursor: pointer;
  text-transform: uppercase;
}

.tn-btn-confirm {
  background: var(--bv-btn-accent);
  color: #fff;
}

.tn-btn-cancel {
  background: var(--bv-border-base);
  color: var(--bv-text-muted);
}

.tn-console.tn-shaking {
  animation: tn-shake-box 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.tn-pop-anim {
  animation: tn-score-pop-up 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  display: inline-block;
}

.tn-undo-anim {
  animation: tn-undo-rewind-blur 0.35s ease-in-out both;
}

@keyframes tn-shake-box {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-5px, 5px) rotate(-1deg);
  }
  40% {
    transform: translate(5px, -5px) rotate(1deg);
  }
  60% {
    transform: translate(-5px, -5px) rotate(-0.5deg);
  }
  80% {
    transform: translate(5px, 5px) rotate(0.5deg);
  }
}

@keyframes tn-score-pop-up {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.4);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes tn-undo-rewind-blur {
  0% {
    filter: blur(0) brightness(1);
    transform: scale(1);
  }
  50% {
    filter: blur(4px) brightness(1.25);
    transform: scale(0.97);
  }
  100% {
    filter: blur(0) brightness(1);
    transform: scale(1);
  }
}

.tn-btn-press-anim {
  animation: tn-btn-press-click 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes tn-btn-press-click {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.85);
  }
  100% {
    transform: scale(1);
  }
}
