:root {
  --bg-deep: #07110f;
  --surface: rgba(11, 24, 21, 0.8);
  --surface-strong: rgba(8, 18, 16, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.14);
  --border-top: rgba(255, 255, 255, 0.24);
  --border-bright: rgba(52, 211, 153, 0.5);
  --text-main: #f4f8f6;
  --text-muted: #a3bab3;
  --accent: #34d399;
  --accent-strong: #059669;
  --gold: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 28px 72px rgba(0, 0, 0, 0.56);
  --font-sans: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Outfit', system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.4;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas.pan-cursor {
  cursor: grab;
}

#game-canvas.pan-cursor:active {
  cursor: grabbing;
}

#labels-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.remote-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 17, 15, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.remote-label .dot-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.hidden {
  display: none !important;
}

.no-margin-bottom {
  margin-bottom: 0 !important;
}

/* Overlays */
.screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 42%, rgba(6, 15, 13, 0.24), rgba(5, 11, 10, 0.68));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keep the Main Menu backdrop razor sharp so the live 3D course shines */
.screen-overlay.menu-showcase {
  background: radial-gradient(circle at 50% 35%, rgba(6, 15, 13, 0.06) 0%, rgba(4, 10, 9, 0.52) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.screen-overlay.active {
  display: flex;
}

.menu-wrapper {
  width: 100%;
  max-width: 930px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(9, 20, 17, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.78rem;
  color: var(--text-muted);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.preview-pill strong {
  color: var(--text-main);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 1.8s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

.glass-card {
  width: 100%;
  background: linear-gradient(165deg, rgba(16, 33, 29, 0.86), rgba(9, 19, 17, 0.9));
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  padding: 22px 24px;
  margin: auto;
}

.modal-animate {
  animation: modalIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-card {
  max-width: 930px;
}

.lobby-card {
  max-width: 720px;
}

.summary-card,
.podium-card {
  max-width: 520px;
  text-align: center;
}

.scorecard-card {
  max-width: 860px;
}

/* Header & Brand */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 6px 14px rgba(16, 185, 129, 0.35));
}

.brand-text {
  text-align: left;
}

.brand-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.6vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand-title span {
  background: linear-gradient(135deg, #34d399, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.38);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.panel-heading {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
}

.panel-desc,
.helper-text {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Menu Grid */
.menu-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.96fr;
  gap: 20px;
  align-items: start;
}

.profile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.name-group {
  flex: 1 1 160px;
  margin-bottom: 0;
}

.swatch-group {
  margin-bottom: 0;
}

.form-group {
  margin-bottom: 14px;
}

input[type="text"],
.select-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.36);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.22);
}

.colour-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.26);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: inset -4px -5px 8px rgba(0, 0, 0, 0.38), inset 3px 3px 6px rgba(255, 255, 255, 0.45);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.swatch-btn:hover {
  transform: scale(1.08);
}

.swatch-btn.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.65), inset -4px -5px 8px rgba(0, 0, 0, 0.35), inset 3px 3px 6px rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.course-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.course-card {
  --card-accent: var(--accent);
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-icon-bg: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  min-height: 70px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 12px rgba(0, 0, 0, 0.24);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.course-card[data-course="grand-tour"] {
  grid-column: 1 / -1;
  min-height: 58px;
  --card-accent: #fbbf24;
  --card-bg: linear-gradient(135deg, rgba(251, 191, 36, 0.18) 0%, rgba(16, 185, 129, 0.14) 55%, rgba(12, 24, 21, 0.56) 100%);
  --card-icon-bg: rgba(251, 191, 36, 0.18);
}

.course-card[data-course="meadow"] {
  --card-accent: #86efac;
  --card-bg: linear-gradient(135deg, rgba(92, 133, 89, 0.3) 0%, rgba(18, 42, 26, 0.56) 100%);
  --card-icon-bg: rgba(134, 239, 172, 0.16);
}

.course-card[data-course="beach"] {
  --card-accent: #7dd3fc;
  --card-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.22) 0%, rgba(217, 119, 6, 0.16) 65%, rgba(22, 33, 44, 0.56) 100%);
  --card-icon-bg: rgba(125, 211, 252, 0.16);
}

.course-card[data-course="boba"] {
  --card-accent: #f9a8d4;
  --card-bg: linear-gradient(135deg, rgba(227, 140, 148, 0.26) 0%, rgba(167, 139, 250, 0.18) 65%, rgba(32, 21, 30, 0.58) 100%);
  --card-icon-bg: rgba(249, 168, 212, 0.16);
}

.course-card[data-course="garden"] {
  --card-accent: #fca5a5;
  --card-bg: linear-gradient(135deg, rgba(186, 101, 99, 0.26) 0%, rgba(79, 70, 229, 0.18) 60%, rgba(16, 20, 38, 0.62) 100%);
  --card-icon-bg: rgba(252, 165, 165, 0.16);
}

.course-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 20px rgba(0, 0, 0, 0.34);
}

.course-card.selected {
  border-color: var(--card-accent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36), inset 0 0 0 1px var(--card-accent), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.course-card-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-icon-bg);
  color: var(--card-accent);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.course-card.selected .course-card-icon {
  border-color: var(--card-accent);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.course-card-body {
  flex: 1;
  min-width: 0;
}

.course-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.course-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.course-card-holes {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  white-space: nowrap;
}

.course-card.selected .course-card-holes {
  border-color: var(--card-accent);
  color: var(--card-accent);
}

.course-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
}

.course-card-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-card-par {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

/* Mode Tabs */
.menu-actions-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--border);
}

.mode-tab {
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-tab.active {
  background: rgba(52, 211, 153, 0.22);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.45);
}

.mode-panel {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.powerup-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.join-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.join-row input {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-align: center;
}

.controls-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.26);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-text {
  margin: 8px 0 0;
  font-size: 0.84rem;
  min-height: 1.2em;
  color: var(--gold);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease, filter 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
}

.btn-sm {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.84rem;
}

.btn-primary {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #032015;
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.36);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.07);
}

.btn-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 55%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
}

.btn-shine:hover::after {
  left: 140%;
}

.btn-accent {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #031926;
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.3);
}

.host-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-tv {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #261402;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.3);
}

.btn-tv:hover:not(:disabled) {
  filter: brightness(1.07);
}

.tv-join-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 31, 28, 0.72);
  border: 1px solid rgba(251, 191, 36, 0.42);
}

.tv-qr-box {
  flex-shrink: 0;
  width: 112px;
  height: 112px;
  padding: 6px;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tv-join-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tv-join-url {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gold);
  word-break: break-all;
}

body.tv-host-mode .room-code-value {
  font-size: 2.35rem;
}

body.tv-host-mode .hud-mp-panel {
  font-size: 0.92rem;
}

.hud-tv-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-color: rgba(251, 191, 36, 0.48);
}

.hud-tv-badge strong {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 0.12em;
}

.tv-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.9);
}

.tv-director-bar {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
}

.tv-cam-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.tv-cam-chip.active {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.22);
  color: var(--gold);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.19);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* Lobby */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.lobby-title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.pill-badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(52, 211, 153, 0.18);
  color: var(--accent);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.room-code-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-bright);
  margin-bottom: 18px;
}

.room-code-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
}

.room-code-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lobby-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.lobby-section {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.player-roster {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.roster-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.roster-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.roster-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.2);
  color: var(--gold);
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.seg-btn {
  min-height: 38px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--accent);
  color: #042116;
}

.lobby-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.lobby-footer .btn-lg {
  width: auto;
  flex: 1;
}

/* HUD */
.hud-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.glass-pill {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

.hud-hole-card {
  padding: 10px 14px;
  min-width: 185px;
}

.hole-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.theme-tag {
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.18);
  color: var(--accent);
}

.theme-tag.theme-beach {
  background: rgba(110, 169, 181, 0.24);
  color: #7dd3fc;
}

.theme-tag.theme-boba {
  background: rgba(227, 140, 148, 0.24);
  color: #fbcfe8;
}

.theme-tag.theme-garden {
  background: rgba(186, 101, 99, 0.26);
  color: #fda4af;
}

.hole-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hole-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
}

.par-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold);
}

.hud-right-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud-score-card {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 12px;
}

.score-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}

.stat-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.24rem;
  line-height: 1.1;
}

.score-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
}

.hud-toolbar {
  pointer-events: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.icon-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  background: var(--surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}

.icon-btn:hover {
  background: rgba(22, 42, 37, 0.9);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn.active {
  border-color: var(--accent);
  background: rgba(52, 211, 153, 0.22);
  color: var(--accent);
}

.icon-btn.btn-danger-soft:hover {
  border-color: rgba(248, 113, 113, 0.65);
  color: var(--danger);
}

/* Hole Intro Banner */
.hole-intro-banner {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 26px;
  border-radius: var(--radius-lg);
  background: rgba(8, 18, 16, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: introSlide 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes introSlide {
  from { opacity: 0; transform: translate(-50%, -62%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.intro-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.intro-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.intro-par {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--gold);
}

/* Multiplayer HUD Panel */
.hud-mp-panel {
  align-self: flex-end;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 240px;
  margin-top: 8px;
}

.mp-mini-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.mp-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
}

.mp-mini-row.active-turn {
  color: var(--gold);
  font-weight: 700;
}

.mp-mini-name {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emote-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.emote-btn {
  min-height: 34px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.emote-btn:hover {
  border-color: var(--accent);
}

.turn-banner {
  align-self: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(11, 22, 20, 0.88);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Bottom Gauge & Power-Up Dock */
.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.skip-flyby-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(9, 19, 17, 0.85);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.skip-flyby-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.active-powerup-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(9, 19, 17, 0.9);
  border: 1px solid var(--gold);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  animation: modalIn 0.2s ease-out;
}

.pu-icon,
.rank-badge,
.mp-sunk-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.rank-badge {
  min-width: 22px;
  font-weight: 700;
  font-size: 0.85rem;
}

.power-gauge {
  width: min(330px, 86vw);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.power-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.power-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.power-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #fbbf24 65%, #f87171);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.6);
  transition: width 0.04s linear;
}

.power-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-evenly;
  pointer-events: none;
}

.power-ticks span {
  width: 1px;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
}

.power-sublabel {
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.powerup-dock {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.powerup-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  background: var(--surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.powerup-btn.armed {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.22);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.38), 0 10px 24px rgba(251, 191, 36, 0.25);
  transform: translateY(-2px);
}

.powerup-count {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

/* Summary, Scorecard & Podium */
.callout-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1d1202;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}

.summary-title,
.podium-headline {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.75rem;
}

.summary-subtext {
  margin: 0 0 18px;
  color: var(--text-muted);
}

.summary-standings,
.podium-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.standing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.standing-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.summary-actions .btn-lg {
  width: auto;
  min-width: 160px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
}

.scorecard-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 520px;
}

.scorecard-table th,
.scorecard-table td {
  padding: 9px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.scorecard-table th:first-child,
.scorecard-table td:first-child {
  text-align: left;
  font-weight: 700;
  position: sticky;
  left: 0;
  background: rgba(10, 20, 18, 0.96);
}

.score-cell-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
}

.cell-eagle { background: rgba(251, 191, 36, 0.25); color: var(--gold); border: 1px solid var(--gold); }
.cell-birdie { background: rgba(52, 211, 153, 0.24); color: var(--accent); border: 1px solid var(--accent); }
.cell-par { background: rgba(255, 255, 255, 0.08); color: var(--text-main); }
.cell-bogey { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }

.scorecard-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-eagle { background: var(--gold); }
.dot-birdie { background: var(--accent); }
.dot-par { background: #cbd5e1; }
.dot-bogey { background: var(--danger); }

.trophy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  filter: drop-shadow(0 6px 18px rgba(251, 191, 36, 0.35));
}

/* Toasts */
.toast-container {
  position: absolute;
  top: calc(74px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 380px);
}

.toast {
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(9, 19, 17, 0.92);
  border: 1px solid var(--border-bright);
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive Breakpoints */
@media (max-width: 760px) {
  .glass-card {
    padding: 16px;
    border-radius: 18px;
  }

  .menu-grid,
  .lobby-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .hud-hole-card {
    min-width: 0;
    padding: 8px 10px;
  }

  .hole-title-row {
    font-size: 0.88rem;
    gap: 6px;
  }

  .hud-score-card {
    padding: 6px 10px;
    gap: 8px;
  }

  .icon-btn .btn-label {
    display: none;
  }

  .hud-mp-panel {
    max-width: 190px;
  }
}

@media (max-width: 440px) {
  .brand-header {
    margin-bottom: 10px;
  }

  .course-card {
    padding: 8px 9px;
    min-height: 58px;
  }

  .course-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .course-card-title {
    font-size: 0.82rem;
  }

  .course-card-sub {
    display: none;
  }

  .mode-panel {
    padding: 12px;
  }

  .controls-summary {
    display: none;
  }

  .hud-top {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .hud-hole-card {
    padding: 7px 10px;
  }

  .hud-right-group {
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .hud-score-card {
    padding: 4px 7px;
    gap: 6px;
  }

  .icon-btn {
    min-width: 34px;
    min-height: 36px;
    padding: 0 6px;
  }

  .hud-toolbar {
    gap: 4px;
  }

  .host-actions-row {
    grid-template-columns: 1fr;
  }

  .tv-join-card {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-height: 520px) {
  .screen-overlay {
    align-items: flex-start;
  }

  .brand-header {
    margin-bottom: 8px;
  }

  .brand-title {
    font-size: 1.6rem;
  }
}
