:root {
  --bg-deep: #06121b;
  --glass-bg: rgba(10, 23, 36, 0.80);
  --glass-strong: rgba(11, 25, 39, 0.92);
  --glass-border: rgba(245, 197, 66, 0.24);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --gold: #f5c542;
  --gold-bright: #fde68a;
  --emerald: #10b981;
  --crimson: #ef4444;
  --sky: #38bdf8;
  --text: #f8fafc;
  --muted: #94a3b8;
  --radius: 16px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#canvas-wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hidden {
  display: none !important;
}

.muted-text {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.small-note {
  font-size: 0.8rem;
  margin-top: 8px;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55);
}

/* ==================== BUTTONS & INPUTS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, background 0.16s ease, border-color 0.16s ease;
  color: var(--text);
  white-space: nowrap;
}

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

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

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

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #fbbf24 55%, #d97706);
  color: #1c1002;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.32);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 0.96rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 9px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 0.74rem;
  border-radius: 7px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  border-color: var(--gold);
  background: rgba(30, 41, 59, 0.92);
}

.text-input, .select-input, .textarea-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.text-input:focus, .select-input:focus, .textarea-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.15);
}

.textarea-input {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

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

/* ==================== OVERLAYS ==================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  overflow-y: auto;
  padding: 20px;
  background: radial-gradient(circle at 50% 20%, rgba(7, 25, 38, 0.56), rgba(4, 11, 18, 0.84));
}

.overlay.visible {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ==================== LOBBY PINTU SERVER ==================== */
.lobby-shell {
  width: min(1220px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  background: rgba(245, 197, 66, 0.14);
  border: 1px solid rgba(245, 197, 66, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.brand-title {
  font-size: clamp(1.7rem, 3.2vw, 2.55rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.brand-title span {
  background: linear-gradient(120deg, #fde68a, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 0.92rem;
  max-width: 640px;
}

.lobby-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  transition: transform 0.14s, background 0.16s;
}

.conn-pill:hover {
  transform: translateY(-1px);
  background: rgba(245, 158, 11, 0.24);
}

.conn-pill.online {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
}

.conn-dot, .conn-dot-mini {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
  display: inline-block;
}

.conn-pill.online .conn-dot, .conn-dot-mini.online {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.stat-pill {
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border-subtle);
  font-size: 0.84rem;
}

/* Profile & Quick Join Strip */
.profile-strip {
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1.15fr 1.5fr 0.95fr 1.65fr;
  gap: 14px;
  align-items: end;
}

.picker-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pawn-chip {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.78);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s, border-color 0.14s, background 0.14s;
}

.pawn-chip:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.pawn-chip.selected {
  border-color: var(--gold);
  background: rgba(245, 197, 66, 0.22);
  box-shadow: 0 0 12px rgba(245, 197, 66, 0.35);
}

.color-row {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 38px;
}

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

.color-swatch:hover {
  transform: scale(1.14);
}

.color-swatch.selected {
  transform: scale(1.18);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.55);
}

.inline-form {
  display: flex;
  gap: 8px;
}

.code-input {
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
  width: 130px;
}

/* Doors Gallery */
.doors-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.section-bar h2 {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.door-filter-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-pill.active {
  background: rgba(245, 197, 66, 0.2);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.doors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.door-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.door-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 197, 66, 0.65);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.62);
}

.door-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--door-accent, var(--gold));
}

.door-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.door-portal {
  width: 54px;
  height: 62px;
  border-radius: 27px 27px 8px 8px;
  border: 2px solid var(--door-accent, var(--gold));
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.16), rgba(15, 23, 42, 0.92));
  box-shadow: inset 0 0 18px rgba(245, 197, 66, 0.22), 0 0 16px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.door-info {
  flex: 1;
  min-width: 0;
}

.door-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.door-title-row h3 {
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.door-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.tag-pill.gold {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.tag-pill.emerald {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.tag-pill.crimson {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.door-status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.door-status-badge.open {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.door-status-badge.playing {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.door-status-badge.full {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.door-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  min-height: 34px;
}

.door-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.seat-pips {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.pip {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  background: transparent;
}

.pip.filled {
  border-color: transparent;
  box-shadow: 0 0 8px currentColor;
}

.lobby-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: #94a3b8;
  padding-top: 4px;
}

/* ==================== WAITING ROOM ==================== */
.room-shell {
  width: min(980px, 100%);
  padding: 22px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.room-badges {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.room-code-box {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px;
}

.code-display-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-display-row strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
}

.room-body {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}

.sub-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.seats-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.seat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.seat-row.empty {
  border-style: dashed;
  opacity: 0.58;
}

.seat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
}

.seat-meta {
  flex: 1;
}

.seat-meta strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.94rem;
}

.room-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.room-chat-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(8, 17, 28, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 13px;
}

.chat-feed {
  flex: 1;
  min-height: 220px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: 4px;
}

.chat-feed.compact {
  min-height: 180px;
  max-height: 250px;
}

.chat-msg {
  font-size: 0.82rem;
  line-height: 1.38;
  background: rgba(30, 41, 59, 0.55);
  padding: 6px 10px;
  border-radius: 9px;
  word-break: break-word;
}

.chat-msg strong {
  margin-right: 5px;
}

.chat-input-row {
  display: flex;
  gap: 7px;
}

/* ==================== IN-GAME 3D HUD ==================== */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.hud-top {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
}

.hud-top-left, .hud-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
}

.hud-door-pill, .hud-jackpot-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  font-size: 0.84rem;
}

.hud-door-pill code {
  color: var(--gold-bright);
  font-weight: 800;
}

.hud-jackpot-pill strong {
  color: #6ee7b7;
}

.cam-group {
  display: inline-flex;
  background: var(--glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}

.cam-btn {
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.cam-btn.active {
  background: rgba(245, 197, 66, 0.24);
  color: var(--gold-bright);
}

/* Left Players Panel */
.hud-left-panel {
  position: absolute;
  top: 66px;
  left: 14px;
  width: 244px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--gold-bright);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.mini-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 197, 66, 0.16);
  color: var(--gold-bright);
}

.hud-players-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.player-hud-card {
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.player-hud-card.active {
  border-color: var(--p-color, var(--gold));
  box-shadow: 0 0 18px rgba(245, 197, 66, 0.28);
  transform: translateX(3px);
}

.player-hud-card.bankrupt {
  opacity: 0.42;
  filter: grayscale(0.8);
}

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

.ph-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.86rem;
  min-width: 0;
}

.ph-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ph-money {
  margin-top: 4px;
  font-size: 0.96rem;
  font-weight: 900;
  color: #6ee7b7;
}

.ph-sub {
  margin-top: 3px;
  font-size: 0.73rem;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

/* Right Log & Chat Panel */
.hud-right-panel {
  position: absolute;
  top: 66px;
  right: 14px;
  width: 274px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.tab-btn {
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.tab-btn.active {
  background: rgba(245, 197, 66, 0.2);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  margin-left: 4px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.tab-pane.active {
  display: flex;
}

.log-list {
  max-height: 290px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 3px;
}

.log-item {
  font-size: 0.77rem;
  line-height: 1.35;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.7);
  border-left: 3px solid var(--log-c, #f5c542);
}

.quick-emotes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.emote-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 0.71rem;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.75);
  color: #e2e8f0;
  cursor: pointer;
}

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

/* Floating Event Banner */
.event-banner {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(460px, 90vw);
  padding: 10px 18px;
  border-radius: 13px;
  background: rgba(11, 25, 39, 0.92);
  border: 1px solid var(--gold);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}

.event-banner strong {
  color: var(--gold-bright);
  font-size: 0.92rem;
}

.event-banner span {
  font-size: 0.8rem;
  color: #e2e8f0;
}

/* Bottom Action Dock */
.hud-bottom {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.hud-bottom > * {
  pointer-events: auto;
}

.decision-card {
  background: rgba(11, 25, 39, 0.95);
  backdrop-filter: blur(18px);
  border: 1.5px solid var(--gold);
  border-radius: 15px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65);
  flex-wrap: wrap;
}

.decision-card.debt {
  border-color: #ef4444;
  background: rgba(40, 12, 18, 0.95);
}

.decision-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}

.decision-swatch {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.decision-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-dock {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.turn-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}

.dice-readout {
  display: flex;
  gap: 6px;
}

.die-chip {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff, #e5dcc5);
  color: #111827;
  font-weight: 900;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d4af37;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.turn-title {
  font-weight: 800;
  font-size: 0.94rem;
}

.turn-sub {
  font-size: 0.78rem;
  color: #cbd5e1;
}

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

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(3, 8, 15, 0.74);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-sm {
  width: min(430px, 100%);
}

.modal-lg {
  width: min(860px, 100%);
}

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

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  cursor: pointer;
  font-weight: 700;
}

.close-btn:hover {
  border-color: var(--gold);
  color: #fff;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

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

.modal-footer.center {
  justify-content: center;
}

/* Deed Card */
.deed-banner {
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  color: #ffffff;
}

.deed-banner .deed-icon {
  font-size: 2rem;
}

.deed-banner h3 {
  font-size: 1.2rem;
  margin-top: 4px;
}

.deed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.deed-table tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.deed-table td {
  padding: 6px 4px;
}

.deed-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--gold-bright);
}

/* Portfolio Grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.prop-card {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.prop-card-head {
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.prop-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
}

.prop-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Card Reveal */
.card-reveal {
  text-align: center;
  border-width: 2px;
}

.card-reveal-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.card-reveal-icon {
  font-size: 3rem;
  margin: 4px 0;
}

/* Firebase Modal */
.fb-banner {
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 600;
}

.fb-banner.local {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.fb-banner.online {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.fb-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 18px;
}

.guide-steps {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.83rem;
  color: #cbd5e1;
  margin-top: 8px;
  line-height: 1.45;
}

.code-box {
  margin-top: 6px;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 8px;
}

.code-box pre {
  font-size: 0.72rem;
  color: #6ee7b7;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 6px;
}

.fb-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fb-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Winner Modal */
.winner-card {
  text-align: center;
}

.winner-crown {
  font-size: 3.4rem;
}

.rankings-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  font-size: 0.86rem;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--gold);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.22s ease;
}

.toast.error {
  border-color: #ef4444;
  color: #fecaca;
}

.toast.success {
  border-color: #10b981;
  color: #a7f3d0;
}

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

.hud-right-panel.panel-hidden {
  display: none !important;
}

.hud-right-panel.panel-forced-open {
  display: flex !important;
  z-index: 25;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 980px) {
  .profile-strip {
    grid-template-columns: 1fr 1fr;
  }
  .room-body, .fb-layout {
    grid-template-columns: 1fr;
  }
  .hud-left-panel {
    width: 196px;
  }
  .hud-right-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .overlay {
    padding: 12px;
  }
  .profile-strip, .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .hud-left-panel {
    top: auto;
    bottom: 112px;
    left: 10px;
    right: 10px;
    width: auto;
    flex-direction: row;
    overflow-x: auto;
  }
  .hud-players-list {
    flex-direction: row;
  }
  .player-hud-card {
    min-width: 148px;
  }
}
