/* NBA Game — 戰術模擬 / 文字直播 */
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Noto+Sans+TC:wght@400;500;700;900&display=swap");

:root {
  --floor: #c4a574;
  --floor-dark: #a8885a;
  --paint: #e8d4b0;
  --line: rgba(255, 255, 255, 0.85);
  --bubble-sky: #6eb5e0;
  --bubble-sky-deep: #3a7a9e;
  --panel: rgba(12, 18, 28, 0.92);
  --text: #f2f0ea;
  --muted: #9aa3b2;
  --accent: #f0a500;
  --danger: #e85d4c;
  --ok: #3ecf8e;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "Noto Sans TC", sans-serif;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background: #0a0e14;
}

button,
select {
  font-family: inherit;
  cursor: pointer;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
}

/* ========== SETUP ========== */
#setup {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(110, 181, 224, 0.35), transparent 60%),
    linear-gradient(180deg, #1a3040 0%, #0a0e14 55%, #121820 100%);
  position: relative;
  overflow: hidden;
}

#setup::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 48px,
      rgba(255, 255, 255, 0.02) 48px,
      rgba(255, 255, 255, 0.02) 49px
    );
  pointer-events: none;
}

.setup-brand {
  text-align: center;
  z-index: 1;
  animation: brandIn 0.8s ease-out;
}

.setup-brand h1 {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 6.5rem);
  letter-spacing: 0.06em;
  line-height: 0.9;
  background: linear-gradient(180deg, #fff 20%, #f0a500 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.setup-brand p {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

.match-slots {
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  z-index: 1;
  flex-wrap: wrap;
  justify-content: center;
  width: min(920px, 100%);
  animation: slotsIn 0.9s ease-out 0.15s both;
}

.slot {
  flex: 1 1 260px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.25rem 1.4rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.slot::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--slot-color, var(--accent));
}

.slot-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.slot-team-name {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.slot-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.slot select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.95rem;
  border-radius: 2px;
}

.slot select option {
  background: #1a2230;
  color: #fff;
}

.slot-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.btn {
  border: none;
  padding: 0.7rem 1.2rem;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  border-radius: 2px;
  transition: transform 0.15s, filter 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  color: #1a1200;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.vs-badge {
  align-self: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  animation: pulseSoft 2.4s ease-in-out infinite;
}

.setup-cta {
  z-index: 1;
  animation: slotsIn 1s ease-out 0.3s both;
}

.setup-cta .btn-primary {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
}

.setup-hint {
  z-index: 1;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  max-width: 420px;
}

.setup-hint a {
  color: var(--accent);
}

/* ========== GAME ========== */
#game {
  flex-direction: column;
  background: #0a0e14;
}

.game-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 0px;
  min-height: 0;
  transition: grid-template-columns 0.25s ease;
}

.game-body.panel-open {
  grid-template-columns: 1fr 280px;
}

.court-wrap {
  position: relative;
  overflow: hidden;
  background: #1a2a45;
}

.court-wrap::before {
  content: none;
}

#court {
  display: block;
  width: 100%;
  height: 100%;
}

/* 頂部中央計分板 */
.hud-scoreboard {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: linear-gradient(180deg, rgba(20, 28, 42, 0.92), rgba(12, 16, 24, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 0.45rem 0.85rem;
  min-width: 280px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hud-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.hud-core {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.hud-side {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  min-width: 4.5rem;
}

.hud-side--home {
  justify-content: flex-end;
}

.hud-side--away {
  justify-content: flex-start;
}

.hud-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.hud-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.hud-score {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  color: #fff;
}

.hud-mid {
  text-align: center;
  padding: 0 0.4rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 56px;
}

.hud-period {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}

.hud-time {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent);
  line-height: 1.1;
}

.hud-fouls {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: rgba(255, 220, 100, 0.85);
  font-weight: 700;
  margin-top: 0.12rem;
}

.hud-quit {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 6;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.hud-sub-btn {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 6;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  background: radial-gradient(circle at 35% 30%, #e85d4c, #a02820);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, filter 0.15s;
}

.hud-sub-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.08);
}

.hud-sub-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.side-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 0;
  overflow: hidden;
  width: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.game-body.panel-open .side-panel {
  width: auto;
  opacity: 1;
  pointer-events: auto;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 0.7rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

.panel-tab.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.panel-section {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-section.active {
  display: flex;
}

.tactics-hint {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bench-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bench-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 0.5rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.bench-card:hover:not(:disabled) {
  background: rgba(240, 165, 0, 0.12);
  border-color: var(--accent);
}

.bench-card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bench-card .name {
  font-weight: 700;
  font-size: 0.85rem;
}

.bench-card .meta {
  font-size: 0.7rem;
  color: var(--muted);
}

.bench-card .stam {
  grid-column: 1 / -1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.bench-card .stam > i {
  display: block;
  height: 100%;
  background: var(--ok);
  width: 100%;
  transition: width 0.3s, background 0.3s;
}

.live-feed {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.feed-item {
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid rgba(255, 255, 255, 0.15);
  animation: feedIn 0.35s ease-out;
}

.feed-item.score {
  border-left-color: var(--accent);
  background: rgba(240, 165, 0, 0.08);
}

.feed-item.sub {
  border-left-color: var(--ok);
}

.feed-item .t {
  color: var(--muted);
  font-size: 0.7rem;
  margin-right: 0.35rem;
}

.oncourt-hud {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 220px;
  pointer-events: none;
}

.hud-player {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.25rem 0.45rem;
  font-size: 0.7rem;
}

.hud-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  min-width: 60px;
}

.hud-bar > i {
  display: block;
  height: 100%;
  background: var(--ok);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 12, 0.78);
  backdrop-filter: blur(4px);
}

.overlay.active {
  display: flex;
}

.overlay-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 420px;
  animation: slotsIn 0.4s ease-out;
}

.overlay-card h2 {
  font-family: var(--font-display);
  font-size: 3rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.overlay-card p {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

@keyframes brandIn {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slotsIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulseSoft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes feedIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 860px) {
  .game-body.panel-open {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 42vh;
  }

  .hud-scoreboard {
    min-width: 0;
    max-width: 70%;
  }

  .hud-name {
    display: none;
  }

  .oncourt-hud {
    display: none;
  }
}
