/* Omega Golf – Edles dunkles Night-Lounge Design */
:root {
  --bg-dark: #070a0e;
  --bg-panel: rgba(15, 20, 27, 0.92);
  --bg-panel-solid: #0f151c;
  --bg-card: rgba(23, 31, 41, 0.88);
  --border: rgba(245, 197, 24, 0.22);
  --border-strong: rgba(245, 197, 24, 0.55);
  --gold: #f5c518;
  --gold-soft: #e2c16a;
  --emerald: #22c55e;
  --cyan: #38bdf8;
  --danger: #f87171;
  --text: #edf2f7;
  --muted: #94a3b8;
  --radius: 14px;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.65);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 50% 0%, #10202b 0%, #090d13 50%, #05070a 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.night-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 35% at 50% 0%, rgba(34, 197, 94, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 40% at 10% 90%, rgba(56, 189, 248, 0.07), transparent 70%),
    radial-gradient(ellipse 40% 40% at 90% 85%, rgba(245, 197, 24, 0.07), transparent 70%);
  z-index: 0;
}

.hidden {
  display: none !important;
}

/* TOPBAR */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(8, 11, 16, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-radius: 9999px;
}

.brand:focus-visible {
  outline: 2px solid #8cb3ff;
  outline-offset: 4px;
}

.brand-emblem {
  --brand-stroke: 3px;
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-inline-end: 14px;
  border: var(--brand-stroke) solid transparent;
  border-radius: 9999px;
  transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

.brand:hover .brand-emblem {
  transform: scale(1.02);
}

.brand:active .brand-emblem {
  transform: scale(0.98);
}

.brand-emblem-circle {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: var(--brand-stroke) solid transparent;
  margin-block: calc(-1 * var(--brand-stroke));
  margin-inline-start: calc(-1 * var(--brand-stroke));
  margin-inline-end: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  flex-shrink: 0;
}

.brand-emblem,
.brand-emblem-circle {
  background:
    linear-gradient(#05050d, #05050d) padding-box,
    linear-gradient(90deg, #ff004c 0%, #ffaa00 16.667%, #00ff66 33.333%, #00eaff 50%, #355cff 66.667%, #a600ff 83.333%, #ff004c 100%) border-box;
  background-size: 100% 100%, 300px 100%;
  background-repeat: no-repeat, repeat-x;
  background-position: 0 0, 0px 50%;
  animation: rainbowEmblemFlow 7.5s linear infinite;
  filter: drop-shadow(0 0 3px rgba(140, 179, 255, 0.4));
}

.brand-emblem-img-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #05050d;
}

.brand-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.brand-emblem-frame {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  flex-shrink: 0;
}

.brand-emblem-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f4f6fb;
  white-space: nowrap;
}

.brand-emblem-sub {
  font-weight: 400;
  color: var(--muted);
}

@keyframes rainbowEmblemFlow {
  0% {
    background-position: 0 0, 0px 50%;
  }
  100% {
    background-position: 0 0, 300px 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-emblem,
  .brand-emblem-circle {
    animation: none;
    background-position: 0 0, 0% 50%;
  }
  .brand-emblem {
    transform: none;
    transition: none;
  }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conn-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.78rem;
  color: var(--muted);
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.conn-pill.online .conn-dot {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.conn-pill.offline .conn-dot {
  background: #f87171;
}

/* BUTTONS & INPUTS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
  color: var(--text);
  white-space: nowrap;
}

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

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

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

.btn-gold {
  background: linear-gradient(135deg, #f7d154, #c98f22);
  color: #10151c;
  box-shadow: 0 4px 16px rgba(245, 197, 24, 0.25);
}

.btn-emerald {
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #051e0f;
}

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

.btn-dark {
  background: rgba(7, 11, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.btn-dark.active-lock {
  background: rgba(245, 197, 24, 0.2);
  border-color: var(--gold);
  color: #fde68a;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.84rem;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 0.78rem;
  border-radius: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
}

input[type="text"],
select {
  background: rgba(7, 11, 16, 0.85);
  border: 1px solid rgba(245, 197, 24, 0.26);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  outline: none;
  width: 100%;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.14);
}

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

/* ==================== LOBBY HUB ==================== */
.lobby-view {
  position: relative;
  z-index: 2;
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 20px 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lobby-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.player-identity-card,
.join-code-card,
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.identity-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.player-identity-card label,
.join-code-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-soft);
}

.join-code-card label {
  margin-bottom: 8px;
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 7px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.color-swatch.active {
  border-color: #ffffff;
  transform: scale(1.16);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.65);
}

.identity-row {
  display: flex;
  gap: 10px;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 800;
  text-align: center;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 1.12rem;
  color: #fbe6b0;
  margin-bottom: 3px;
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed rgba(245, 197, 24, 0.22);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-icon {
  font-size: 2.2rem;
}

.room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: border-color 0.15s ease;
}

.room-row:hover {
  border-color: var(--border-strong);
}

.room-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.room-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.room-name {
  font-weight: 700;
  font-size: 1rem;
}

.room-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.room-status-pill.waiting {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.room-status-pill.playing {
  background: rgba(245, 197, 24, 0.16);
  color: #fde68a;
  border: 1px solid rgba(245, 197, 24, 0.35);
}

.room-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.quickplay-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.qp-card:hover {
  border-color: var(--gold);
  background: rgba(30, 42, 56, 0.95);
  transform: translateX(3px);
}

.qp-icon {
  font-size: 1.7rem;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(245, 197, 24, 0.12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.qp-card strong {
  display: block;
  font-size: 0.96rem;
  margin-bottom: 2px;
}

.qp-card span {
  font-size: 0.8rem;
  color: var(--muted);
}

.tip-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(245, 197, 24, 0.07);
  border: 1px solid rgba(245, 197, 24, 0.2);
  font-size: 0.82rem;
  line-height: 1.5;
}

.tip-box ul {
  margin-top: 6px;
  padding-left: 18px;
  color: var(--muted);
}

/* ==================== GAME VIEW ==================== */
.game-view {
  position: relative;
  z-index: 2;
  max-width: 1460px;
  margin: 0 auto;
  padding: 14px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.waiting-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(16, 86, 52, 0.42), rgba(15, 22, 31, 0.95));
  border: 1px solid rgba(74, 222, 128, 0.42);
}

.waiting-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.waiting-left strong {
  display: block;
  color: #bbf7d0;
  font-size: 0.95rem;
}

.waiting-left span {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulseRing 1.7s infinite;
  flex-shrink: 0;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
  70% { box-shadow: 0 0 0 11px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.waiting-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.code-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--gold);
  font-size: 0.8rem;
}

.code-badge strong {
  letter-spacing: 2.5px;
  color: var(--gold);
  font-size: 0.98rem;
}

.mini-select {
  width: auto !important;
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 16px;
  align-items: start;
}

.game-layout.no-chat {
  grid-template-columns: 1fr;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

.table-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* SCOREBOARD */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.players-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.34);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
}

.player-card.active-turn {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.11);
  box-shadow: 0 0 18px rgba(245, 197, 24, 0.16);
}

.player-card.sunk-hole {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(34, 197, 94, 0.08);
}

.player-card.disconnected {
  opacity: 0.45;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-ball-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.player-info-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-name {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.player-total {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 26px;
  text-align: right;
}

.match-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.match-mode-tag {
  font-size: 0.7rem;
  letter-spacing: 1.3px;
  font-weight: 800;
  color: var(--gold-soft);
}

.timer-display {
  font-size: 1.12rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  min-width: 58px;
}

.timer-display.urgent {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.35);
  animation: blinkUrgent 0.8s infinite alternate;
}

@keyframes blinkUrgent {
  from { opacity: 1; }
  to { opacity: 0.55; }
}

.match-sub-tag {
  font-size: 0.75rem;
  color: var(--muted);
}

/* STATUS BAR */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(12, 18, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
}

.status-bar.warn {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.3);
  color: #fecaca;
}

.status-bar.good {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(20, 83, 45, 0.3);
  color: #bbf7d0;
}

.status-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* CANVAS */
.canvas-shell {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.72);
  background: #070a0e;
  border: 1px solid rgba(245, 197, 24, 0.22);
  user-select: none;
  touch-action: none;
}

#golfCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 540;
  cursor: crosshair;
}

/* CALLOUT BANNER */
.callout-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 12px;
  background: rgba(10, 14, 20, 0.9);
  border: 2px solid var(--gold);
  color: #fde68a;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 2px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 15;
  animation: popIn 0.28s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, 12px) scale(0.85); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* OVERLAY */
.match-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 13, 0.82);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 16px;
}

.overlay-card {
  background: var(--bg-panel-solid);
  border: 1.5px solid var(--gold);
  border-radius: 18px;
  padding: 24px 30px;
  text-align: center;
  width: min(440px, 100%);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overlay-trophy {
  font-size: 2.8rem;
}

.standings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
}

.standing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.9rem;
}

.standing-row.winner {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.14);
}

.overlay-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* CONTROLS DOCK */
.controls-dock {
  display: grid;
  grid-template-columns: auto 1.4fr auto;
  gap: 14px;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ctrl-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.angle-readout,
.power-readout {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.aim-buttons-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.power-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#powerSlider {
  flex: 1;
  accent-color: var(--gold);
  height: 8px;
  cursor: pointer;
}

.shoot-btn {
  min-width: 108px;
}

.theme-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.theme-dot.active {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(245, 197, 24, 0.6);
}

.theme-emerald { background: linear-gradient(135deg, #104930, #092418); }
.theme-midnight { background: linear-gradient(135deg, #133658, #08182b); }
.theme-obsidian { background: linear-gradient(135deg, #2b2b36, #111118); }

/* CHAT PANEL */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 650px;
  max-height: calc(100vh - 115px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
}

.chat-header h3 {
  font-size: 0.96rem;
  color: #fbe6b0;
}

.chat-room-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.chat-close-mobile {
  display: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  line-height: 1.35;
  word-break: break-word;
}

.chat-msg.mine {
  background: rgba(245, 197, 24, 0.14);
  border: 1px solid rgba(245, 197, 24, 0.25);
  align-self: flex-end;
  max-width: 90%;
}

.chat-msg.theirs {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  align-self: flex-start;
  max-width: 90%;
}

.chat-msg.system {
  background: rgba(34, 197, 94, 0.11);
  border: 1px solid rgba(34, 197, 94, 0.24);
  color: #d1fae5;
  font-size: 0.79rem;
  text-align: center;
}

.chat-msg-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--gold-soft);
  margin-bottom: 3px;
}

.chat-time {
  color: var(--muted);
}

.quick-chat-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.2);
}

.quick-chip {
  border: 1px solid rgba(245, 197, 24, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.73rem;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.quick-chip:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.15);
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
}

.chat-form input {
  padding: 8px 10px;
  font-size: 0.85rem;
}

/* MODAL & SCORECARD */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-panel-solid);
  border: 1.5px solid var(--border-strong);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.82);
}

.modal-wide {
  max-width: 840px;
}

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

.modal-header h2 {
  font-size: 1.18rem;
  color: #fbe6b0;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-soft);
}

.two-col,
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seg-btn {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.83rem;
  cursor: pointer;
}

.seg-btn.active {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.18);
  color: #fde68a;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.scorecard-wrap {
  overflow-x: auto;
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

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

.scorecard-table th {
  color: var(--gold-soft);
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.76rem;
}

.scorecard-table td:first-child,
.scorecard-table th:first-child {
  text-align: left;
  padding-left: 10px;
  font-weight: 700;
}

.sc-hio { color: #fde047; font-weight: 900; background: rgba(234, 179, 8, 0.16); }
.sc-birdie { color: #86efac; font-weight: 800; background: rgba(34, 197, 94, 0.14); }
.sc-par { color: #cbd5e1; }
.sc-bogey { color: #fca5a5; background: rgba(239, 68, 68, 0.12); }

.scorecard-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.76rem;
}

.sc-chip {
  padding: 3px 9px;
  border-radius: 6px;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  padding: 10px 15px;
  border-radius: 10px;
  background: #131b24;
  border: 1px solid var(--gold);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
  animation: toastIn 0.2s ease;
}

.toast.error {
  border-color: var(--danger);
  color: #fecaca;
}

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

.badge-unread {
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
}

/* RESPONSIVE */
@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .chat-toggle-mobile {
    display: inline-flex !important;
  }
  .chat-panel {
    position: fixed;
    right: 12px;
    bottom: 12px;
    width: min(350px, calc(100vw - 24px));
    height: 460px;
    z-index: 40;
  }
  .chat-panel.mobile-collapsed {
    display: none !important;
  }
  .chat-close-mobile {
    display: grid;
  }
  .controls-dock {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .lobby-hero,
  .lobby-grid,
  .rules-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
  .scoreboard {
    grid-template-columns: 1fr;
  }
  .match-center {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
  }
  .controls-dock {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 10px 14px;
  }
}
