:root {
  --bg: #0d0a08;
  --surface: #1a1410;
  --surface2: #221c16;
  --border: #3d2e1e;
  --gold: #c9a84c;
  --gold2: #e8c96a;
  --red: #8b1a1a;
  --red2: #c0392b;
  --text: #f0e6d3;
  --text2: #a89070;
  --green: #2d5a27;
  --green2: #4a8a42;
  --blue: #1a3a5c;
  --blue2: #2e6da4;
  --purple: #3d1a5c;
  --purple2: #7b3fa0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: transparent;
  color: var(--text);
  font-family: 'Frank Ruhl Libre', serif;
  min-height: 100vh;
  direction: rtl;
}

/* ─── SITE NAV LINKS ─── */
.home-link {
  text-decoration: none;
  font-size: 1.5rem;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  transition: background 0.2s;
  flex-shrink: 0;
}
.home-link:hover { background: rgba(255,255,255,0.2); }
.trophy-link {
  text-decoration: none;
  font-size: 1.3rem;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(201,168,76,0.15);
  transition: background 0.2s;
  flex-shrink: 0;
}
.trophy-link:hover { background: rgba(201,168,76,0.3); }

/* ─── INTRO SCREEN ─── */
.intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.intro-nav {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}
.intro-dagger {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(201,168,76,0.5));
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(201,168,76,0.5)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 30px rgba(201,168,76,0.8)); }
}
.intro h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-shadow: 0 0 40px rgba(201,168,76,0.3);
  margin-bottom: 0.3rem;
}
.intro-subtitle {
  color: var(--text2);
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 3rem;
  letter-spacing: 0.1em;
}
.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.setup-card h2 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}
.form-group { margin-bottom: 1.2rem; text-align: right; }
.form-group label {
  display: block;
  color: var(--text2);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}
.form-group input, .form-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1rem;
  direction: rtl;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--gold);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1a0e00;
  width: 100%;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,168,76,0.3); }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.85rem; }
.btn-red { background: var(--red2); color: white; }
.btn-red:hover { background: #e74c3c; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-green { background: var(--green2); color: white; }
.btn-green:hover { background: #5aaa52; }
.btn-submit {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1a0e00;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 2rem;
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,168,76,0.3); }
.btn-skip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
  margin-top: 0.5rem;
  transition: all 0.2s;
}
.btn-skip:hover { border-color: var(--gold); color: var(--gold); }

/* ─── ROOM BACKGROUND ─── */
.room-bg {
  position: fixed !important;  /* #root > * would override without !important */
  inset: 0;
  z-index: 0 !important;
  background-size: cover;
  background-position: center;
  filter: blur(3px) brightness(0.85) saturate(1.1);
  transform: scale(1.04); /* hide blur edges */
  transition: background-image 1.4s ease;
  pointer-events: none;
}
.game-layout { position: relative; z-index: 1; }

/* ─── MAIN GAME LAYOUT ─── */
.game-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 0;
  min-height: 100vh;
}
.mobile-tabs { display: none; }

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "header" "content" "tabs";
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .game-header { grid-area: header; }
  .mobile-tabs { grid-area: tabs; }
  .panel-left, .panel-right, .panel-center { grid-area: content; }
  .panel-left, .panel-right { display: none; overflow-y: auto; }
  .panel-left.mobile-active, .panel-right.mobile-active { display: block; }
  .panel-center { display: none; overflow-y: auto; }
  .panel-center.mobile-active { display: flex; }

  /* Mobile tab bar */
  .mobile-tabs {
    display: flex;
    grid-column: 1 / -1;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0;
  }
  .mobile-tab {
    flex: 1;
    padding: 0.6rem 0;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text2);
    cursor: pointer;
    border: none;
    background: none;
    font-family: 'Frank Ruhl Libre', serif;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
  }
  .mobile-tab.active {
    color: var(--gold);
    background: rgba(201,168,76,0.08);
  }
  .mobile-tab-icon { font-size: 1.2rem; }

  /* Bigger touch targets on mobile */
  .room {
    min-height: 90px;
    padding: 0.8rem;
  }
  .room-icon { font-size: 1.8rem; }
  .room-name { font-size: 0.8rem; }
  .suggestion-form {
    grid-template-columns: 1fr !important;
  }
  .notebook-item {
    padding: 0.55rem 0.5rem;
    min-height: 40px;
  }
  .check-box {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }
  .action-btns {
    flex-direction: column;
  }
  .action-btns .btn {
    width: 100%;
  }
  .game-header {
    padding: 0.5rem 0.8rem;
  }
  .game-header h1 { font-size: 1.1rem; }
  .panel-left, .panel-right, .panel-center {
    padding: 0.8rem;
  }
}

/* ─── HEADER ─── */
.game-header {
  grid-column: 1 / -1;
  background: rgba(13, 10, 8, 0.75);
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.game-header h1 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 700;
}
.header-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}
.turn-indicator {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 1.2rem;
  font-size: 0.9rem;
  color: var(--text2);
}
.turn-indicator span { color: var(--gold); font-weight: 700; }
.round-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  color: var(--text2);
}

/* ─── LEFT PANEL ─── */
.panel-left {
  background: rgba(13, 10, 8, 0.40);
  backdrop-filter: none;
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}
.panel-title {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.player-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  margin-bottom: 0.7rem;
  transition: border-color 0.2s;
}
.player-card.active-player { border-color: var(--gold); }
.player-card.eliminated { opacity: 0.4; }
.player-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.player-role { font-size: 0.75rem; color: var(--text2); }
.player-color-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-left: 6px;
}

/* ─── CENTER ─── */
.panel-center {
  padding: 1rem; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1rem;
}
.board-container {
  background: rgba(13, 10, 8, 0.40);
  backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.board-title {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1rem;
}
.mansion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.room {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 80px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
}
.room:hover { border-color: var(--gold); background: rgba(201,168,76,0.05); }
.room.selected { border-color: var(--gold); background: rgba(201,168,76,0.1); box-shadow: 0 0 12px rgba(201,168,76,0.2); }
.room.has-players { border-color: var(--green2); }
.room-icon { font-size: 1.5rem; }
.room-name { font-size: 0.75rem; color: var(--text2); font-weight: 700; }
.room-players { font-size: 0.65rem; color: var(--gold); }
.room.refuted { opacity: 0.35; }
.room.refuted .room-name { text-decoration: line-through; color: var(--red2); }
.room.refuted .room-icon { filter: grayscale(1); }

/* ─── REVEALED CARD MODAL ─── */
.revealed-card-modal { text-align: center; }
.revealed-card-icon { font-size: 4rem; margin: 1rem 0; filter: drop-shadow(0 0 15px rgba(201,168,76,0.4)); }
.revealed-card-name { font-size: 1.3rem; font-weight: 700; color: var(--gold); margin-bottom: 0.5rem; }
.revealed-by { color: var(--text2); font-size: 0.95rem; margin-bottom: 1.5rem; }
.no-disprove-msg { color: var(--gold); font-size: 1.1rem; font-weight: 700; padding: 1.5rem 0; text-align: center; }
.accusation-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.accusation-col { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.accusation-col h4 { font-size: 0.75rem; margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.accusation-col.wrong-col { border-color: var(--red); }
.accusation-col.wrong-col h4 { color: var(--red2); }
.accusation-col.right-col { border-color: var(--green); }
.accusation-col.right-col h4 { color: var(--green2); }
.compare-row { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-bottom: 0.6rem; font-size: 0.9rem; }
.compare-row .match { color: var(--green2); }
.compare-row .mismatch { color: var(--red2); text-decoration: line-through; }

/* ─── ACTION AREA ─── */
.action-area {
  background: rgba(13, 10, 8, 0.55);
  backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.action-title {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  margin-bottom: 1rem;
  font-size: 1rem;
}
.suggestion-form {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.7rem; margin-bottom: 1rem;
}
@media (max-width: 600px) { .suggestion-form { grid-template-columns: 1fr; } }
.suggestion-form select {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 0.6rem; font-family: 'Frank Ruhl Libre', serif; font-size: 0.9rem; direction: rtl;
}
.suggestion-form select:focus { outline: none; border-color: var(--gold); }
.action-btns { display: flex; gap: 0.7rem; flex-wrap: wrap; }

/* ─── LOG ─── */
.game-log {
  background: rgba(13, 10, 8, 0.55); backdrop-filter: none;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; max-height: 200px; overflow-y: auto;
}
.log-entry {
  font-size: 0.82rem; color: var(--text2); padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04); line-height: 1.5;
}
.log-entry.important { color: var(--gold); }
.log-entry.bad { color: var(--red2); }

/* ─── RIGHT PANEL ─── */
.panel-right {
  background: rgba(13, 10, 8, 0.40); border-right: 1px solid var(--border);
  backdrop-filter: none;
  padding: 1rem; overflow-y: auto;
}
.notebook-section { margin-bottom: 1.2rem; }
.notebook-section h3 {
  font-size: 0.8rem; color: var(--text2); letter-spacing: 0.08em;
  margin-bottom: 0.5rem; text-transform: uppercase;
}
.notebook-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.5rem; border-radius: 4px; transition: background 0.15s; cursor: pointer;
}
.notebook-item:hover { background: var(--surface2); }
.notebook-item span { font-size: 0.85rem; flex: 1; }
.check-box {
  width: 18px; height: 18px; border: 1px solid var(--border); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem;
  flex-shrink: 0; transition: all 0.15s;
}
.check-box.confirmed { background: var(--green2); border-color: var(--green2); }
.check-box.ruled-out { background: var(--red); border-color: var(--red); }
.check-box.maybe { background: var(--gold); border-color: var(--gold); color: #1a0e00; }
.notebook-view-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.notebook-item:hover .notebook-view-btn { opacity: 1; }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal {
  background: var(--surface); border: 1px solid var(--gold); border-radius: 12px;
  padding: 2rem; width: 100%; max-width: 480px; box-shadow: 0 0 60px rgba(201,168,76,0.15);
}
.modal h2 {
  font-family: 'Playfair Display', serif; color: var(--gold);
  margin-bottom: 1rem; font-size: 1.5rem;
}
.modal p { color: var(--text2); margin-bottom: 1rem; line-height: 1.6; }
.verdict-box {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem; margin: 1rem 0; text-align: center;
}
.verdict-box .verdict-row { margin-bottom: 0.5rem; }
.verdict-box .label { font-size: 0.75rem; color: var(--text2); }
.verdict-box .value { font-size: 1.1rem; font-weight: 700; color: var(--gold); }
.win-banner { text-align: center; padding: 1rem; }
.win-banner .trophy { font-size: 3rem; margin-bottom: 0.5rem; }
.win-banner h3 { font-family: 'Playfair Display', serif; color: var(--gold); font-size: 1.8rem; }

/* ─── SCORE DISPLAY ─── */
.score-breakdown {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.8rem 1rem; margin: 0.8rem 0;
}
.score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.25rem 0; font-size: 0.85rem; color: var(--text2);
}
.score-row.total {
  border-top: 1px solid var(--border); margin-top: 0.4rem; padding-top: 0.5rem;
  font-size: 1.1rem; font-weight: 700; color: var(--gold);
}
.score-submit-section {
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.score-submit-section h3 {
  font-family: 'Playfair Display', serif; color: var(--gold);
  font-size: 1rem; margin-bottom: 0.8rem;
}
.submit-success {
  text-align: center; padding: 0.8rem;
  color: var(--green2); font-weight: 700; font-size: 0.95rem;
}

/* ─── CARD CHOICE ─── */
.card-choice-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 1rem 0; }
.card-choice-btn {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.9rem 1rem; cursor: pointer; transition: all 0.2s;
  color: var(--text); font-family: 'Frank Ruhl Libre', serif;
  font-size: 1rem; font-weight: 700; text-align: right;
}
.card-choice-btn:hover {
  border-color: var(--gold); background: rgba(201,168,76,0.08); transform: translateX(-3px);
}
.card-choice-btn .card-emoji { font-size: 1.5rem; }
.card-choice-btn.card-choice-3d { padding: 0.5rem 1rem; }

/* ─── 3D ROOM CARD STYLES ─── */
.card-flip-3d { width: 120px; height: 160px; }
.card-flip-3d .card-flip-front { font-size: 1rem; }
.room-3d-thumb { display: flex; align-items: center; justify-content: center; }
.room-3d-thumb img { width: 44px; height: 44px; border-radius: 6px; border: 1.5px solid var(--gold); object-fit: cover; }

/* ─── AI THINKING ─── */
.ai-thinking {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--text2); font-size: 0.85rem; font-style: italic;
}
.dot-pulse span {
  display: inline-block; width: 4px; height: 4px;
  background: var(--gold); border-radius: 50%; animation: dotPulse 1.2s ease-in-out infinite;
}
.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.tag {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700;
}
.tag-ai { background: rgba(123,63,160,0.3); color: #b87fe0; border: 1px solid rgba(123,63,160,0.4); }
.tag-human { background: rgba(46,109,164,0.3); color: #72b0e0; border: 1px solid rgba(46,109,164,0.4); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.divider { height: 1px; background: var(--border); margin: 0.7rem 0; }

.rules-box {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem; margin-bottom: 1.2rem; font-size: 0.8rem;
  color: var(--text2); line-height: 1.6; text-align: right;
}
.rules-box strong { color: var(--gold); }

/* ─── DICE ─── */
.dice-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0;
}
.die {
  font-size: 3.5rem;
  line-height: 1;
  user-select: none;
}
.die.rolling {
  animation: diceShake 0.08s infinite alternate;
}
.die.done {
  animation: diceBounce 0.4s ease-out;
}
@keyframes diceShake {
  from { transform: rotate(-15deg) scale(1.1); }
  to { transform: rotate(15deg) scale(1.1); }
}
@keyframes diceBounce {
  0% { transform: scale(1.3) rotate(10deg); }
  40% { transform: scale(0.9) rotate(-5deg); }
  70% { transform: scale(1.05) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}
.dice-result {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
}
.dice-result-reminder {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}
.btn-dice {
  width: auto;
  padding: 0.6rem 2rem;
}
.current-location {
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

/* ─── MOVEMENT ─── */
.room.reachable {
  border-color: var(--blue2);
  background: rgba(46,109,164,0.12);
  box-shadow: 0 0 12px rgba(46,109,164,0.25);
  animation: roomPulse 1.5s ease-in-out infinite;
}
@keyframes roomPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(46,109,164,0.25); }
  50% { box-shadow: 0 0 20px rgba(46,109,164,0.4); }
}
.room.unreachable {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── SECRET PASSAGES ─── */
.room { position: relative; }
.passage-marker {
  position: absolute;
  top: 3px;
  left: 3px;
  font-size: 0.6rem;
  opacity: 0.6;
}
.passage-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
  border-color: var(--purple2);
  color: var(--purple2);
}
.passage-btn:hover {
  background: rgba(123,63,160,0.1);
  border-color: var(--purple2);
  color: var(--purple2);
}

/* ─── SELECTED ROOM BADGE ─── */
.selected-room-badge {
  background: var(--surface2);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 0.6rem;
  text-align: center;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ─── ANIMATIONS ─── */

/* Card flip on reveal */
.card-flip-container {
  perspective: 600px;
  width: 80px;
  height: 80px;
  margin: 1rem auto;
}
.card-flip-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: cardFlip 0.6s ease-out forwards;
}
@keyframes cardFlip {
  0% { transform: rotateY(180deg) scale(0.8); }
  50% { transform: rotateY(90deg) scale(1.1); }
  100% { transform: rotateY(0deg) scale(1); }
}
.card-flip-front {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  filter: drop-shadow(0 0 15px rgba(201,168,76,0.4));
}

/* Turn transition glow */
.action-area {
  animation: fadeSlideIn 0.3s ease-out;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Active player card glow */
.player-card.active-player {
  border-color: var(--gold);
  animation: activeGlow 2s ease-in-out infinite;
}
@keyframes activeGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(201,168,76,0.2); }
  50% { box-shadow: 0 0 16px rgba(201,168,76,0.4); }
}

/* Modal entrance */
.modal {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 0 60px rgba(201,168,76,0.15);
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Confetti for win */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Accusation dramatic pulse */
.accusation-dramatic {
  animation: dramaticPulse 0.6s ease-in-out;
}
@keyframes dramaticPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.05); }
  60% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* Log entry slide in */
.log-entry {
  font-size: 0.82rem;
  color: var(--text2);
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  line-height: 1.5;
  animation: logSlide 0.2s ease-out;
}
@keyframes logSlide {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Room hover transition */
.room {
  position: relative;
  transition: all 0.25s ease;
}

/* Smooth player token appearance */
.room-players {
  font-size: 0.65rem;
  color: var(--gold);
  animation: tokenPop 0.3s ease-out;
}
@keyframes tokenPop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* ─── TUTORIAL OVERLAY ─── */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}
.tutorial-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  pointer-events: auto;
}
.tutorial-highlight {
  position: fixed;
  border: 2px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(201,168,76,0.5);
  pointer-events: none;
  transition: all 0.4s ease;
}
.tutorial-tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 1.2rem;
  max-width: 320px;
  min-width: 240px;
  pointer-events: auto;
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tutorial-tooltip h3 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}
.tutorial-tooltip p {
  color: var(--text2);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}
.tutorial-step-indicator {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.8rem;
}
.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s;
}
.tutorial-dot.active {
  background: var(--gold);
  transform: scale(1.3);
}
.tutorial-dot.done {
  background: var(--green2);
}
.tutorial-btns {
  display: flex;
  gap: 0.5rem;
}
.tutorial-btns .btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}
.tutorial-badge {
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(201,168,76,0.15);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.tutorial-badge:hover {
  background: rgba(201,168,76,0.25);
  border-color: var(--gold);
}

/* ─── MOBILE OVERRIDES (must be last to win cascade) ─── */
@media (max-width: 900px) {
  .panel-left, .panel-right {
    display: none;
  }
  .panel-center {
    display: none;
  }
  .panel-left.mobile-active,
  .panel-right.mobile-active {
    display: block;
  }
  .panel-center.mobile-active {
    display: flex;
  }
}

/* ─── 3D ROOM VIEWER POPUP ─── */
.viewer3d-overlay {
  background: rgba(0,0,0,0.85);
  z-index: 1000;
}
.viewer3d-modal {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 14px;
  width: min(90vw, 560px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 20px rgba(201,168,76,0.15);
  overflow: hidden;
  animation: fadeSlideIn 0.2s ease-out;
}
.viewer3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.viewer3d-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 700;
}
.viewer3d-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--text2);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.viewer3d-close:hover { border-color: var(--gold); color: var(--gold); }
.viewer3d-canvas {
  background: #111;
  min-height: 380px;
  display: flex; align-items: center; justify-content: center;
}
.viewer3d-no-model {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  color: var(--text2); font-size: 0.9rem;
}
.viewer3d-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text2);
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  font-style: italic;
}
/* Badge on room tile indicating 3D is available */
.room-3d-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  font-size: 0.6rem;
  color: var(--gold);
  opacity: 0.7;
  pointer-events: none;
}
.room-3d-thumb { position: relative; }

/* ─── CLUE CARD MODAL ─────────────────────────────────────────────────────── */
.clue-card-modal {
  background: linear-gradient(150deg, #1a0d06 0%, #2c1a0e 45%, #1a0d06 100%);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 2rem 2rem 1.6rem;
  max-width: 370px;
  width: 92%;
  text-align: center;
  box-shadow: 0 0 50px rgba(201,168,76,0.35), 0 0 100px rgba(0,0,0,0.9);
  animation: clueCardReveal 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}
@keyframes clueCardReveal {
  from { transform: rotateY(90deg) scale(0.6); opacity: 0; }
  to   { transform: rotateY(0deg) scale(1);   opacity: 1; }
}
.clue-card-header {
  font-size: 0.68rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.6;
  margin-bottom: 1rem;
}
.clue-card-icon {
  font-size: 3.2rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 10px rgba(201,168,76,0.6));
  animation: clueIconPop 0.4s 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes clueIconPop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.clue-card-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--gold);
  font-family: 'Playfair Display', serif;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
}
.clue-card-divider {
  color: var(--gold);
  opacity: 0.35;
  letter-spacing: 3px;
  margin: 0.6rem 0;
  font-size: 0.9rem;
}
.clue-card-text {
  font-size: 0.97rem;
  color: var(--text1, var(--text));
  line-height: 1.65;
  font-style: italic;
  padding: 0 0.4rem;
  margin-bottom: 0.5rem;
}
.clue-card-reveal {
  margin-top: 1rem;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  animation: fadeSlideIn 0.3s 0.3s ease-out both;
}
.clue-card-reveal-label {
  font-size: 0.78rem;
  color: var(--text2);
  margin-bottom: 0.45rem;
}
.clue-card-reveal-card {
  font-size: 1.2rem;
  color: var(--gold);
  font-weight: 700;
}
.clue-card-reveal-note {
  font-size: 0.7rem;
  color: var(--text2);
  margin-top: 0.3rem;
  font-style: italic;
}

/* Die glows gold when showing 🔍 */
.die.clue-die {
  filter: drop-shadow(0 0 14px rgba(201,168,76,0.8));
  animation: clueGlow 0.5s ease-out;
}
@keyframes clueGlow {
  0%   { transform: scale(1);    filter: drop-shadow(0 0 0px rgba(201,168,76,0)); }
  50%  { transform: scale(1.35); filter: drop-shadow(0 0 20px rgba(201,168,76,1)); }
  100% { transform: scale(1);    filter: drop-shadow(0 0 14px rgba(201,168,76,0.8)); }
}
.dice-result-clue {
  color: var(--gold) !important;
  font-weight: 900;
  font-size: 1.05rem !important;
  letter-spacing: 0.03em;
}

/* ─── CLUE CARD PICKER (type 1 & 2 interactive phases) ─────────────────────── */
.clue-card-modal--wide {
  max-width: 520px;
}
.clue-card-instruction {
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
  margin: 0.8rem 0 0.3rem;
  direction: rtl;
}
.clue-picker-note {
  font-size: 0.75rem;
  color: var(--text2);
  margin-bottom: 0.5rem;
  direction: rtl;
}
.clue-card-picker {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem 0.1rem;
  margin-top: 0.3rem;
}
.clue-picker-section {
  width: 100%;
}
.clue-picker-cat {
  font-size: 0.72rem;
  color: var(--text2);
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
  direction: rtl;
  text-align: right;
}
.clue-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  direction: rtl;
}
.clue-pick-btn {
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.5);
  color: var(--gold);
  border-radius: 8px;
  padding: 0.38rem 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  direction: rtl;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.clue-pick-btn:hover {
  background: rgba(201,168,76,0.28);
  border-color: var(--gold);
  transform: translateY(-1px);
}
.clue-pick-btn:active {
  transform: translateY(0);
}
/* reveal variant — slightly different accent */
.clue-pick-btn--reveal {
  background: rgba(100,180,255,0.08);
  border-color: rgba(100,180,255,0.4);
  color: #8ecfff;
}
.clue-pick-btn--reveal:hover {
  background: rgba(100,180,255,0.2);
  border-color: #8ecfff;
}
/* envelope result styling */
.clue-card-reveal--envelope {
  background: rgba(200,110,30,0.12) !important;
  border-color: #c47a30 !important;
}

/* ── Multiplayer Setup ──────────────────────────────────────────────────── */
.setup-mode-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 1.2rem;
}
.setup-tab {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(201,168,76,0.25);
  color: var(--text2);
  border-radius: 24px;
  padding: 0.5rem 1.4rem;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.setup-tab.active {
  background: rgba(201,168,76,0.18);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
}
.setup-tab:hover:not(.active) {
  background: rgba(201,168,76,0.09);
  border-color: rgba(201,168,76,0.5);
  color: var(--text1);
}
.player-count-picker {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.4rem;
}
.count-btn {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1.5px solid rgba(201,168,76,0.35);
  background: rgba(255,255,255,0.05);
  color: var(--text2);
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.count-btn.active {
  background: rgba(201,168,76,0.25);
  border-color: var(--gold);
  color: var(--gold);
  transform: scale(1.08);
}
.count-btn:hover:not(.active) {
  background: rgba(201,168,76,0.1);
  border-color: rgba(201,168,76,0.6);
  color: var(--text1);
}
.multi-names {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.multi-name-row label {
  font-size: 0.8rem;
  color: var(--text2);
}
.game-code-box {
  background: rgba(201,168,76,0.08);
  border: 1.5px solid rgba(201,168,76,0.3);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  margin: 0.5rem 0;
}
.game-code-label {
  font-size: 0.78rem;
  color: var(--text2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.game-code-number {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 6px;
  font-family: 'Playfair Display', serif;
  margin-bottom: 0.2rem;
}
.game-code-note {
  font-size: 0.75rem;
  color: var(--text2);
  margin-bottom: 0.75rem;
}
.game-code-copy {
  font-size: 0.85rem;
  padding: 0.4rem 1.1rem;
}

/* ── Pass-Device Modal ──────────────────────────────────────────────────── */
.pass-device-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,8,5,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}
.pass-device-card {
  background: var(--surface1);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 0 40px rgba(201,168,76,0.25);
}
.pass-device-emoji {
  font-size: 4rem;
  margin-bottom: 0.75rem;
}
.pass-device-title {
  font-size: 1rem;
  color: var(--text2);
  font-weight: 400;
  margin: 0 0 0.4rem;
  letter-spacing: 1px;
}
.pass-device-name {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--gold);
  margin: 0 0 0.3rem;
  font-family: 'Playfair Display', serif;
}
.pass-device-hint {
  font-size: 0.88rem;
  color: var(--text2);
  margin: 0 0 1.5rem;
}

/* ─── LOBBY SCREEN ─────────────────────────────────────────────────────────── */
.lobby-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.lobby-card {
  background: var(--surface1);
  border: 1.5px solid var(--border1);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 0 40px rgba(0,0,0,0.4);
}
.lobby-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--gold);
  text-align: center;
  margin: 0 0 0.3rem;
}
.lobby-subtitle {
  text-align: center;
  color: var(--text2);
  font-size: 0.88rem;
  margin: 0 0 1.5rem;
}
.lobby-code-box {
  background: var(--surface2);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.lobby-code-label {
  font-size: 0.78rem;
  color: var(--text2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.lobby-code-number {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--gold);
  font-family: 'Playfair Display', serif;
}
.lobby-code-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.6rem;
}
.lobby-players-title {
  font-size: 0.82rem;
  color: var(--text2);
  letter-spacing: 1px;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}
.lobby-players {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}
.lobby-player {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border1);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
}
.lobby-player--me {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
}
.lobby-player--ai {
  border-style: dashed;
  opacity: 0.7;
}
.lobby-player-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.lobby-player-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
}
.lobby-player-tag {
  font-size: 0.72rem;
  background: var(--gold);
  color: #1a1206;
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.lobby-waiting {
  text-align: center;
  color: var(--text2);
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.lobby-error {
  color: var(--red2);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(220,53,69,0.1);
  border-radius: 8px;
  border: 1px solid rgba(220,53,69,0.25);
}
