/* Rumor - Expo Gradient Glass + iMessage Bubble Fusion */
/* Designed for 9:16 portrait mobile aspect ratio */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0F0F14;
  color: #E8E8EC;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Fill behind notch/safe area */
  padding: 0;
  margin: 0;
}

/* ====== 9:16 ASPECT RATIO CONTAINER ====== */
#game-root {
  width: 100%;
  height: 100dvh;
  max-width: calc(100dvh * 9 / 16);
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #0F0F14;
  overflow: hidden;
  /* Safe area handled at root — injected from React Native as --sat/--sab */
  padding-top: var(--sat, env(safe-area-inset-top, 0px));
  padding-bottom: var(--sab, env(safe-area-inset-bottom, 0px));
}

/* ====== RANDOMIZED GAME BACKGROUND ====== */
.game-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

/* Ensure all content sits above the background */
#game-root > *:not(.game-bg) {
  position: relative;
  z-index: 1;
}

/* On very wide screens, center the game with a subtle border */
@media (min-aspect-ratio: 9/16) {
  #game-root {
    border-left: 1px solid rgba(124, 82, 251, 0.15);
    border-right: 1px solid rgba(124, 82, 251, 0.15);
    box-shadow: 0 0 60px rgba(124, 82, 251, 0.05);
  }
}

/* ====== TITLE SCREEN — Game Card + Play Button ====== */
.title-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 16px;
  padding-bottom: 24px;
  gap: 20px;
  animation: fadeIn 0.5s ease;
}

.title-card-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
}

.title-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 24px;
}

/* ====== GLASSY BUTTON — Frosted glass with gradient border + inner shine ====== */
.btn-glass {
  position: relative;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-weight: 700;
  border: 1px solid rgba(159, 122, 234, 0.4);
  border-top-color: rgba(199, 172, 255, 0.5);
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
  box-shadow:
    0 6px 24px rgba(124, 82, 251, 0.35),
    0 0 40px rgba(124, 82, 251, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Inner glass shine */
.btn-glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
}

/* Subtle gradient glow on bottom edge */
.btn-glass::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.6), transparent);
  pointer-events: none;
}

.btn-glass:active,
.btn-glass.pressed {
  transform: scale(0.96);
  background: rgba(124, 82, 251, 0.22);
  box-shadow:
    0 2px 12px rgba(124, 82, 251, 0.5),
    0 0 30px rgba(124, 82, 251, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-play {
  font-size: 20px;
  padding: 16px 64px;
  margin-bottom: 12px;
}

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

@keyframes btn-bounce {
  0%   { transform: scale(1); }
  25%  { transform: scale(0.90); }
  55%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.btn-glass.btn-bounce {
  animation: btn-bounce 0.35s ease-out;
}

/* ====== GRADIENT TEXT UTILITY ====== */
.gradient-text {
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ====== HEADER — Glass ====== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(124, 82, 251, 0.2);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  flex-shrink: 0;
  position: relative;
}

/* Safe area top is handled by #game-root padding-top */

.game-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.game-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.stat {
  font-size: 13px;
  color: #9898A6;
}

.stat-value {
  color: #E8E8EC;
  font-weight: 600;
}

.btn-exit {
  position: relative;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid rgba(159, 122, 234, 0.4);
  border-top-color: rgba(199, 172, 255, 0.5);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
  box-shadow:
    0 4px 16px rgba(124, 82, 251, 0.3),
    0 0 20px rgba(124, 82, 251, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-exit::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 10px 10px 0 0;
}

.btn-exit:active,
.btn-exit.pressed {
  transform: scale(0.92);
  background: rgba(124, 82, 251, 0.22);
  box-shadow:
    0 2px 8px rgba(124, 82, 251, 0.5),
    0 0 20px rgba(124, 82, 251, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ====== CHARACTER MONTAGE — Meet the Rumor Mill ====== */
.montage-screen {
  position: absolute !important;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 20, 0.55);
  z-index: 50 !important;
  padding: 24px;
  padding-top: max(24px, var(--sat, env(safe-area-inset-top, 24px)));
  padding-bottom: max(24px, var(--sab, env(safe-area-inset-bottom, 24px)));
}

.montage-fade-out {
  animation: montageFadeOut 0.5s ease forwards;
  pointer-events: none;
}

.montage-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.montage-counter {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #7A7A8A;
  margin-bottom: 16px;
}

.montage-card-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 340px;
}

.montage-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  width: 100%;
}

.montage-video-wrap {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(124, 82, 251, 0.5);
  box-shadow: 0 0 30px rgba(124, 82, 251, 0.25), 0 0 60px rgba(124, 82, 251, 0.1);
  flex-shrink: 0;
}

.montage-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
}

.montage-rumor {
  font-size: 13px;
  color: #9A9AAA;
  font-style: italic;
  line-height: 1.5;
  max-width: 300px;
  text-align: center;
  padding: 10px 16px;
  background: rgba(22, 22, 32, 0.6);
  border-radius: 10px;
  border-left: 2px solid rgba(124, 82, 251, 0.3);
  margin-top: 14px;
  margin-bottom: 0;
}

.montage-name {
  font-size: 28px;
  font-weight: 700;
}

.montage-archetype {
  font-size: 15px;
  color: #9F7AEA;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.montage-desc {
  font-size: 13px;
  color: #7A7A8A;
  line-height: 1.5;
  max-width: 280px;
}

.btn-skip-intro {
  margin-top: 12px;
  padding: 14px 40px;
  font-size: 15px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-skip-intro:hover,
.btn-skip-intro:active,
.btn-skip-intro.pressed {
  opacity: 1;
}

/* Fade-in animation for each character card */
.montage-fade-in {
  animation: montageFadeIn 0.5s ease both;
}

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

@keyframes montageFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ====== ROUND INTRO — Glass Card ====== */
.round-intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.round-number {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.round-setting {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.round-setting-desc {
  font-size: 13px;
  color: #7A7A8A;
  margin-bottom: 12px;
  max-width: 320px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Town backstory lore card */
.backstory-card {
  background: rgba(22, 22, 32, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 82, 251, 0.15);
  border-left: 2px solid rgba(124, 82, 251, 0.4);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  max-width: 340px;
  font-size: 12px;
  color: #8A8A9A;
  line-height: 1.6;
  font-style: italic;
  text-align: left;
  animation: fadeIn 0.6s ease 0.2s both;
}

.round-topic-hint {
  font-size: 15px;
  color: #B8B8C4;
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid rgba(124, 82, 251, 0.25);
  border-left: 3px solid #7C52FB;
  margin-bottom: 32px;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-start {
  font-size: 16px;
  padding: 14px 40px;
}

.btn-start:active,
.btn-start.pressed {
  transform: scale(0.96);
}

/* ====== CHARACTER GRID — Glass Cards with Thumbnails ====== */
.investigation-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px 12px 0;
  overflow: hidden;
  min-height: 0;
}

.instruction-bar {
  text-align: center;
  font-size: 13px;
  color: #9898A6;
  padding: 2px 0;
  margin-bottom: 2px;
  flex-shrink: 0;
}

/* Round countdown timer — glass button style, centered in footer */
.round-timer {
  position: relative;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: #fff;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(159, 122, 234, 0.4);
  border-top-color: rgba(199, 172, 255, 0.5);
  border-radius: 14px;
  padding: 8px 20px;
  min-width: 72px;
  text-align: center;
  overflow: hidden;
  box-shadow:
    0 6px 24px rgba(124, 82, 251, 0.35),
    0 0 40px rgba(124, 82, 251, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Inner glass shine */
.round-timer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
}

/* Subtle gradient glow on bottom edge */
.round-timer::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.6), transparent);
  pointer-events: none;
}

.round-timer.warning {
  color: #F59E0B;
  border-color: rgba(245, 158, 11, 0.4);
  border-top-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  box-shadow:
    0 6px 24px rgba(245, 158, 11, 0.3),
    0 0 40px rgba(245, 158, 11, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: pulse 1.5s infinite;
}

.round-timer.critical {
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.4);
  border-top-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
  box-shadow:
    0 6px 24px rgba(239, 68, 68, 0.3),
    0 0 40px rgba(239, 68, 68, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: pulse 0.8s infinite;
}

.character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.character-card {
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 82, 251, 0.25);
  border-top-color: rgba(159, 122, 234, 0.4);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 6px 10px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  min-height: min(240px, 28vh);
}

/* Inner glass shine */
.character-card .card-shine {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
  z-index: 1;
}

.character-card:active {
  transform: scale(0.95);
}

.character-card.talked {
  border-color: rgba(124, 82, 251, 0.6);
  background: rgba(124, 82, 251, 0.12);
  box-shadow: 0 0 20px rgba(124, 82, 251, 0.2), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.character-card.active {
  border-color: #7C52FB;
  box-shadow: 0 0 24px rgba(124, 82, 251, 0.4);
}

.character-card.highlighted {
  border-color: #F5A623;
  animation: pulse 1.5s infinite;
}

/* Character thumbnail on grid cards */
.character-thumb-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
  min-height: 0;
  padding-top: 8px;
}

.character-thumb {
  width: 125%;
  height: 125%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 12px;
}

/* Emoji avatar fallback */
.character-avatar {
  font-size: 32px;
  margin-bottom: 6px;
}

.character-name {
  font-size: 20px;
  font-weight: 600;
  color: #E8E8EC;
  text-align: center;
  line-height: 1.2;
  margin-top: 4px;
  flex-shrink: 0;
  z-index: 2;
}

.character-role {
  font-size: 10px;
  color: #7C52FB;
  margin-top: 2px;
}

/* Interaction counter badge (top-left) */
.interaction-counter {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(124, 82, 251, 0.25);
  border: 1px solid rgba(124, 82, 251, 0.5);
  color: #E8E8EC;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

/* Depleted character card (no interactions left) */
.character-card.depleted {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.6);
}

.character-card.depleted .interaction-counter {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #EF4444;
}

/* Archetype name label */
.character-archetype-label {
  font-size: 15px;
  color: #9F7AEA;
  text-align: center;
  line-height: 1.2;
  margin-top: 1px;
  flex-shrink: 0;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Character short description */
.character-desc {
  font-size: 14px;
  color: #7A7A8A;
  text-align: center;
  line-height: 1.2;
  margin-top: 1px;
  flex-shrink: 0;
  z-index: 2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Talked badge — animated purple ring */
.talked-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7C52FB;
  box-shadow: 0 0 0 0 rgba(124, 82, 251, 0.5);
  animation: pulseRing 2s infinite;
  z-index: 3;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(124, 82, 251, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(124, 82, 251, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 82, 251, 0); }
}

/* ====== DIALOGUE — iMessage Chat Thread with Portrait ====== */
.dialogue-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 20, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 200;
  padding: 4px;
  padding-top: 30px;
  padding-bottom: 0;
  overflow: hidden;
}

.dialogue-box {
  background: rgba(22, 22, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(124, 82, 251, 0.25);
  border-top-color: rgba(159, 122, 234, 0.4);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: calc(100vh * 9 / 16);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.5), 0 0 30px rgba(124, 82, 251, 0.1);
  position: relative;   /* positioning context for the full-bleed .dialogue-bg layer */
  isolation: isolate;
}

/* Character image as the FULL-BLEED chat background (replaces the old portrait box that ate
   vertical space) + a scrim so the message text stays legible over the photo. */
.dialogue-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 18%;
  background-repeat: no-repeat;
  pointer-events: none;
}
.dialogue-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 15, 20, 0.45) 0%, rgba(15, 15, 20, 0.68) 42%, rgba(18, 18, 28, 0.9) 100%);
}

/* All chat chrome sits above the background image. */
.dialogue-header,
.chat-thread,
.options-bar,
.dialogue-actions {
  position: relative;
  z-index: 1;
}

/* Character trait line in the header (e.g. "Barely talks, but always honest"). */
.dialogue-trait {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 1px;
}


/* Chat thread header (pinned) */
.dialogue-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(124, 82, 251, 0.15);
  background: rgba(15, 15, 20, 0.5);
  flex-shrink: 0;
}

.dialogue-avatar {
  font-size: 36px;
}

.dialogue-name {
  font-size: 16px;
  font-weight: 700;
}

.dialogue-archetype {
  font-size: 11px;
  color: #9F7AEA;
}

/* Scrollable chat thread area */
.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* We pin scroll to the bottom manually (DialogueBox._stickToBottom); disable the
     browser's own scroll anchoring so it doesn't compete and re-introduce jumps. */
  overflow-anchor: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Ensure children inherit pan-y so touch scrolling works inside the thread */
.chat-thread * {
  touch-action: pan-y;
}

/* ====== iMessage BUBBLES ====== */
.bubble-row {
  display: flex;
  flex-direction: column;
  animation: slideInBubble 0.25s ease;
}

.bubble-row.sent {
  align-items: flex-end;
}

.bubble-row.received {
  align-items: flex-start;
}

/* Circle thumbnail next to cross-ref / follow-up option bubbles */
.option-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  pointer-events: none;
  border: 1px solid rgba(124, 82, 251, 0.3);
}

/* When a bubble-row has an option-thumb, lay out horizontally */
.bubble-row.received:has(.option-thumb) {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.bubble-name {
  font-size: 11px;
  color: #9F7AEA;
  margin-bottom: 2px;
  padding: 0 8px;
}

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  margin: 2px 0;
}

/* Sent bubble — purple gradient, right-aligned */
.bubble.sent {
  background: linear-gradient(135deg, #7C52FB, #6A42E0);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.bubble.sent::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent #6A42E0;
}

/* Received bubble — gray glass, left-aligned */
.bubble.received {
  background: rgba(58, 58, 72, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #D8D8E2;
  border-bottom-left-radius: 6px;
}

.bubble.received::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent rgba(58, 58, 72, 0.6) transparent transparent;
}

/* Tappable follow-up pill (received style) */
.bubble.received.tappable {
  cursor: pointer;
  border: 1px solid rgba(124, 82, 251, 0.3);
  transition: background 0.15s, border-color 0.15s;
}

.bubble.received.tappable:active {
  background: rgba(124, 82, 251, 0.2);
  border-color: rgba(124, 82, 251, 0.5);
}

.bubble.received.locked {
  opacity: 0.35;
  pointer-events: none;
}

/* Cross-reference bubble — slight purple tint to distinguish from "Ask about" */
.bubble.received.tappable.cross-ref {
  border-color: rgba(159, 122, 234, 0.4);
  background: rgba(124, 82, 251, 0.08);
}

.bubble.received.tappable.cross-ref:active {
  background: rgba(124, 82, 251, 0.2);
  border-color: rgba(159, 122, 234, 0.6);
}

/* ====== PROBE PILLS ====== */
.probe-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}

.probe-pill {
  background: transparent;
  border: 1px solid rgba(124, 82, 251, 0.4);
  color: #9F7AEA;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.probe-pill:active {
  background: rgba(124, 82, 251, 0.15);
}

.probe-pill.used {
  opacity: 0.3;
  pointer-events: none;
}

.probe-pill.insufficient {
  opacity: 0.4;
  pointer-events: none;
  border-color: rgba(124, 82, 251, 0.2);
}

/* Token cost indicator — red icon signals deduction */
.token-cost {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.token-cost-icon {
  width: 13px;
  height: 13px;
  fill: #EF4444;
  flex-shrink: 0;
}

.bubble.received.tappable.insufficient {
  opacity: 0.45;
  pointer-events: none;
}

.stat.token-stat {
  color: #22C55E;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat.token-stat .token-icon {
  vertical-align: middle;
  flex-shrink: 0;
}

/* Options container spacing */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideInBubble 0.25s ease;
}

/* Persistent quick-reply region pinned below the scroll thread (texting-app style).
   Lives OUTSIDE .chat-thread so showing/hiding options never changes the thread's
   scrollHeight — that remove/re-add churn was what made the view lurch and bury new
   answers above the fold. Its children are swapped each turn; the node itself stays. */
.options-bar {
  flex-shrink: 0;
  max-height: min(42vh, 300px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 14px 0;
}

/* Typewriter cursor inside bubble */
.dialogue-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: rgba(255, 255, 255, 0.8);
  margin-left: 2px;
  animation: blink 0.8s infinite;
  vertical-align: text-bottom;
}

/* ====== Chat-app "typing…" indicator ======
   Shown inside the character's bubble first; then the char-by-char typewriter types the
   message out. Makes the exchange read like a texting thread. */
.bubble.bubble-typing {
  min-width: 40px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.typing-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Dialogue actions (dismiss button area) */
.dialogue-actions {
  padding: 8px 12px;
  border-top: 1px solid rgba(124, 82, 251, 0.1);
  flex-shrink: 0;
}

.btn-followup {
  background: #16161D;
  border: 1px solid #3A3A48;
  color: #B8B8C4;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.btn-followup:active {
  background: #2A2A35;
}

.btn-followup.locked {
  opacity: 0.4;
  pointer-events: none;
}

.btn-dismiss {
  position: relative;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px;
  border: 1px solid rgba(159, 122, 234, 0.4);
  border-top-color: rgba(199, 172, 255, 0.5);
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
  box-shadow:
    0 6px 24px rgba(124, 82, 251, 0.35),
    0 0 40px rgba(124, 82, 251, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-dismiss::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 12px 12px 0 0;
}

.btn-dismiss::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.6), transparent);
  pointer-events: none;
}

.btn-dismiss:active,
.btn-dismiss.pressed {
  transform: scale(0.92);
  background: rgba(124, 82, 251, 0.22);
  box-shadow:
    0 2px 12px rgba(124, 82, 251, 0.5),
    0 0 30px rgba(124, 82, 251, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ====== SOLVE BAR — Glass ====== */
.solve-bar {
  background: rgba(22, 22, 32, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(124, 82, 251, 0.2);
  padding: 2px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.solve-hint {
  font-size: 12px;
  color: #9898A6;
  flex: 1;
  text-align: left;
}

/* Solve button — glass style matching btn-glass */
.btn-solve {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Wrapper to mirror solve-hint width so timer stays centered */
.solve-btn-wrap {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.btn-solve:disabled {
  background: rgba(58, 58, 72, 0.4);
  border-color: rgba(58, 58, 72, 0.3);
  color: #6A6A78;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-solve:disabled::before,
.btn-solve:disabled::after {
  display: none;
}

.btn-solve:active:not(:disabled),
.btn-solve.pressed:not(:disabled) {
  transform: scale(0.96);
}

/* ====== SOLVE OVERLAY — Glass ====== */
/* Solve overlay — backdrop */
.solve-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 20, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 0.25s ease;
  padding: 24px;
}

/* Solve panel — windowed container */
.solve-panel {
  background: rgba(22, 22, 32, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(124, 82, 251, 0.3);
  border-top-color: rgba(159, 122, 234, 0.5);
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(124, 82, 251, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
}

.solve-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.5), transparent);
}

.solve-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.solve-subtitle {
  font-size: 14px;
  color: #9898A6;
  margin-bottom: 20px;
}

.solve-character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
}

/* 50% larger character buttons */
.solve-character-btn {
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 82, 251, 0.25);
  border-top-color: rgba(159, 122, 234, 0.4);
  border-radius: 14px;
  padding: 12px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.solve-character-btn:active {
  border-color: #7C52FB;
  background: rgba(124, 82, 251, 0.15);
  box-shadow: 0 0 20px rgba(124, 82, 251, 0.25);
}

.solve-character-btn .character-avatar {
  font-size: 42px;
}

.solve-character-btn .character-name {
  font-size: 13px;
}

/* Highlighted originator in truth prompt */
.solve-character-btn.solve-highlighted {
  border-color: #7C52FB;
  background: rgba(124, 82, 251, 0.2);
  box-shadow: 0 0 20px rgba(124, 82, 251, 0.35);
}

.solve-character-btn.solve-dimmed {
  opacity: 0.35;
}

/* Solve panel thumbnails — 50% larger */
.solve-thumb-wrap {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
}

.solve-thumb {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 10px;
}

.truth-prompt {
  text-align: center;
  margin-bottom: 16px;
  margin-top: 4px;
}

.truth-question {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.truth-rumor {
  font-size: 14px;
  color: #B8B8C4;
  font-style: italic;
  max-width: 320px;
  margin: 0 auto 16px;
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(124, 82, 251, 0.15);
}

.truth-buttons {
  display: flex;
  gap: 16px;
}

/* Glass-styled truth buttons */
.btn-truth {
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  color: #fff;
  letter-spacing: 0.5px;
}

.btn-truth.true-btn {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.5), rgba(22, 163, 74, 0.4));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-top-color: rgba(74, 222, 128, 0.6);
  box-shadow:
    0 4px 16px rgba(34, 197, 94, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-truth.true-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(74, 222, 128, 0.6), transparent);
}

.btn-truth.true-btn::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 20%;
  right: 20%;
  height: 8px;
  background: rgba(34, 197, 94, 0.3);
  filter: blur(8px);
  border-radius: 50%;
}

.btn-truth.false-btn {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.5), rgba(220, 38, 38, 0.4));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-top-color: rgba(252, 129, 129, 0.6);
  box-shadow:
    0 4px 16px rgba(239, 68, 68, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-truth.false-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252, 129, 129, 0.6), transparent);
}

.btn-truth.false-btn::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 20%;
  right: 20%;
  height: 8px;
  background: rgba(239, 68, 68, 0.3);
  filter: blur(8px);
  border-radius: 50%;
}

.btn-truth:active {
  transform: scale(0.95);
}

.btn-back-investigate {
  font-size: 13px;
  padding: 10px 24px;
  margin-top: 12px;
}

/* Wrong guess feedback inside solve panel */
.solve-feedback-slot {
  width: 100%;
}

.solve-wrong-card {
  background: rgba(239, 68, 68, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease;
  box-shadow:
    0 4px 16px rgba(239, 68, 68, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.solve-wrong-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #EF4444;
}

.solve-wrong-msg {
  font-size: 14px;
  color: #F8B4B4;
  text-align: center;
  font-weight: 500;
}

.solve-wrong-dismiss {
  font-size: 12px;
  padding: 8px 24px;
  margin-top: 4px;
}

/* Wrong guess flash on character button */
.solve-character-btn.solve-wrong-flash {
  border-color: #EF4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  animation: wrongFlash 0.6s ease;
}

@keyframes wrongFlash {
  0%, 100% { border-color: rgba(239, 68, 68, 0.6); }
  50% { border-color: rgba(239, 68, 68, 1); box-shadow: 0 0 30px rgba(239, 68, 68, 0.5); }
}

/* ====== RESULT SCREEN — Glass ====== */
.result-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 24px 24px;
  text-align: center;
  animation: fadeIn 0.5s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.result-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-title.win {
  background: linear-gradient(135deg, #22C55E, #4ADE80);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-title.lose {
  color: #EF4444;
}

/* Originator video on win screen — inherits montage-video-wrap base styles */
.result-video-wrap {
  margin-bottom: 16px;
  position: relative;
}

.result-video-name {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.result-explanation {
  font-size: 14px;
  color: #B8B8C4;
  max-width: 440px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.result-chain {
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 82, 251, 0.25);
  border-top-color: rgba(159, 122, 234, 0.4);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(124, 82, 251, 0.08);
}

.result-chain-title {
  font-size: 15px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chain-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.chain-node {
  font-size: 14px;
  background: rgba(58, 58, 72, 0.5);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(124, 82, 251, 0.15);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chain-node.originator {
  background: linear-gradient(135deg, #7C52FB, #6A42E0);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(124, 82, 251, 0.3);
}

/* Chain node thumbnails */
.chain-node-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}

.chain-arrow {
  color: #7C52FB;
  font-size: 16px;
}

.result-score {
  font-size: 15px;
  color: #9898A6;
  margin-bottom: 24px;
}

.result-score strong {
  color: #F5A623;
}

.btn-next-round {
  font-size: 16px;
  padding: 14px 40px;
}

/* ====== DECEPTION REPORT (Result Screen) ====== */
.deception-report {
  width: 100%;
  max-width: 440px;
  margin-bottom: 24px;
}

.deception-report-title {
  font-size: 15px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #EF4444, #F59E0B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.deception-card {
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 82, 251, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}

.deception-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.deception-card-thumb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.deception-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #E8E8EC;
}

.deception-card-archetype {
  font-size: 13px;
  color: #9F7AEA;
  margin-left: auto;
}

.deception-card-summary {
  font-size: 13px;
  color: #9898A6;
  margin-left: auto;
}

.deception-probes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deception-probe-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
}

.probe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.probe-dot.truth {
  background: #22C55E;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.probe-dot.lie {
  background: #EF4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.probe-label-text {
  color: #B8B8C4;
  min-width: 36px;
}

.probe-truth {
  color: #22C55E;
}

.probe-lie {
  color: #EF4444;
}

.deception-correction {
  font-style: italic;
  color: #9898A6;
  font-size: 13px;
  margin-left: 14px;
  margin-top: 1px;
}

/* ====== RULES SCREEN (full-screen dedicated) ====== */
.rules-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.rules-box {
  background: rgba(22, 22, 32, 0.95);
  border: 1px solid rgba(124, 82, 251, 0.3);
  border-top-color: rgba(159, 122, 234, 0.5);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 475px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5), 0 0 40px rgba(124, 82, 251, 0.1);
  animation: scaleIn 0.3s ease;
}

.rules-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.rules-item {
  font-size: 14px;
  color: #B8B8C4;
  line-height: 1.4;
  padding-left: 16px;
  position: relative;
}

.rules-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
}

/* ====== WRONG GUESS TOAST ====== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 400;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.5s forwards;
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(245, 166, 35, 0.2); }
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ====== HEADER RIGHT BUTTON GROUP ====== */
.header-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ====== VOLUME CONTROL BUTTON ====== */
.volume-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(30, 30, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 82, 251, 0.25);
  color: #B8B8C4;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  line-height: 1;
}

.volume-btn:active {
  background: rgba(124, 82, 251, 0.2);
  border-color: rgba(124, 82, 251, 0.5);
}

.volume-btn.muted {
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ====== NOTEBOOK BUTTON ====== */
.notebook-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(159, 122, 234, 0.4);
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
  box-shadow:
    0 4px 16px rgba(124, 82, 251, 0.3),
    0 0 20px rgba(124, 82, 251, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 0;
  line-height: 1;
}

.notebook-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 50% 50% 0 0;
}

.notebook-btn:active {
  transform: scale(0.88);
  background: rgba(124, 82, 251, 0.22);
  box-shadow:
    0 2px 8px rgba(124, 82, 251, 0.5),
    0 0 20px rgba(124, 82, 251, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.notebook-btn.has-entries {
  border-color: rgba(124, 82, 251, 0.5);
  color: #9F7AEA;
}

/* ====== CLUE NOTEBOOK PANEL ====== */
.notebook-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 20, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 550;
  padding: 16px;
  padding-top: 14px;
}

.notebook-panel {
  background: rgba(22, 22, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(124, 82, 251, 0.25);
  border-top-color: rgba(159, 122, 234, 0.4);
  border-radius: 20px;
  width: 100%;
  max-width: calc(100vh * 9 / 16);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.5), 0 0 30px rgba(124, 82, 251, 0.1);
}

.notebook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(124, 82, 251, 0.15);
  flex-shrink: 0;
}

.notebook-title {
  font-size: 18px;
  font-weight: 700;
}

.notebook-close {
  background: none;
  border: none;
  color: #9898A6;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.notebook-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  padding-bottom: 80px; /* Space for native banner ad at bottom */
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.notebook-empty {
  text-align: center;
  color: #7A7A8A;
  font-size: 13px;
  padding: 40px 20px;
  line-height: 1.5;
}

.notebook-char-section {
  background: rgba(30, 30, 42, 0.5);
  border: 1px solid rgba(124, 82, 251, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
}

.notebook-char-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(124, 82, 251, 0.1);
}

.notebook-char-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.notebook-char-name {
  font-size: 13px;
  font-weight: 600;
  color: #E8E8EC;
}

.notebook-trust {
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

.notebook-pin {
  font-size: 12px;
}

.notebook-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.notebook-entry.contradicted {
  background: rgba(239, 68, 68, 0.06);
  border-radius: 6px;
  padding: 6px;
  border-bottom: none;
}

.notebook-probe-label {
  color: #9F7AEA;
  font-weight: 600;
  min-width: 36px;
  flex-shrink: 0;
}

.notebook-entry-text {
  color: #B8B8C4;
  line-height: 1.4;
}

.notebook-flag {
  color: #F59E0B;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ====== CHARACTER MOOD INDICATORS ====== */
.character-mood {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 12px;
  z-index: 3;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* ====== CHARACTER TRUST BAR ====== */
.trust-bar-wrap {
  width: 100%;
  height: 3px;
  background: rgba(58, 58, 72, 0.4);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 2;
}

.trust-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}

/* ====== PINNED SUSPECT INDICATOR ====== */
.suspect-pin {
  position: absolute;
  top: 6px;
  right: 26px;
  font-size: 11px;
  z-index: 3;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* ====== SCREEN SHAKE ====== */
.screen-shake {
  animation: shake 0.4s ease;
}

/* ====== RELATIONSHIP BADGE ====== */
.relationship-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 10px;
  background: rgba(124, 82, 251, 0.2);
  border: 1px solid rgba(124, 82, 251, 0.3);
  border-radius: 8px;
  padding: 1px 5px;
  color: #9F7AEA;
  z-index: 3;
  white-space: nowrap;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ====== CONFRONTATION PANEL ====== */
.confrontation-hint {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 12px;
  color: #F59E0B;
  text-align: center;
  animation: slideInBubble 0.3s ease;
}

.btn-confront {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  transition: transform 0.1s;
}

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

/* ====== GAME OVER / RANKING SCREEN ====== */
.game-over-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  animation: fadeIn 0.6s ease;
  background: linear-gradient(180deg, #0F0F14 0%, #1A1025 40%, #0F0F14 100%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.game-over-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #9898A6;
  margin-bottom: 8px;
}

.game-over-video-wrap {
  width: 160px;
  height: 160px;
  margin-bottom: 12px;
}

.ranking-badge {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 16px;
  border: 3px solid rgba(124, 82, 251, 0.4);
  box-shadow: 0 0 40px rgba(124, 82, 251, 0.2);
  animation: scaleIn 0.5s ease 0.2s both;
}

.ranking-badge.tier-s {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(245, 158, 11, 0.15));
  border-color: #EAB308;
  box-shadow: 0 0 50px rgba(234, 179, 8, 0.3);
}

.ranking-badge.tier-a {
  background: linear-gradient(135deg, rgba(124, 82, 251, 0.2), rgba(159, 122, 234, 0.15));
  border-color: #9F7AEA;
  box-shadow: 0 0 40px rgba(124, 82, 251, 0.3);
}

.ranking-badge.tier-b {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(74, 222, 128, 0.1));
  border-color: #22C55E;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.2);
}

.ranking-badge.tier-c {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.1));
  border-color: #F59E0B;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.2);
}

.ranking-badge.tier-d {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(248, 113, 113, 0.1));
  border-color: #EF4444;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}

.ranking-tier-label {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 4px;
  animation: fadeIn 0.5s ease 0.3s both;
}

.ranking-tier-label.tier-s { color: #EAB308; }
.ranking-tier-label.tier-a { color: #9F7AEA; }
.ranking-tier-label.tier-b { color: #22C55E; }
.ranking-tier-label.tier-c { color: #F59E0B; }
.ranking-tier-label.tier-d { color: #EF4444; }

.ranking-tier-name {
  font-size: 22px;
  font-weight: 700;
  color: #E8E8EC;
  margin-bottom: 16px;
  animation: fadeIn 0.5s ease 0.4s both;
}

.ranking-score-summary {
  font-size: 15px;
  color: #9898A6;
  margin-bottom: 8px;
}

.ranking-score-summary strong {
  color: #F5A623;
}

.ranking-blurb {
  font-size: 14px;
  color: #B8B8C4;
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 32px;
  font-style: italic;
  background: rgba(30, 30, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(124, 82, 251, 0.15);
  animation: fadeIn 0.5s ease 0.5s both;
}

.btn-play-again {
  background: linear-gradient(135deg, #7C52FB, #9F7AEA);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  padding: 16px 48px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(124, 82, 251, 0.35);
  transition: transform 0.1s;
  letter-spacing: 0.5px;
  animation: fadeIn 0.5s ease 0.6s both;
}

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

/* ====== LEADERBOARD SCREEN ====== */
.leaderboard-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 16px;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
  background: linear-gradient(180deg, #0F0F14 0%, #1A1025 40%, #0F0F14 100%);
}

.leaderboard-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.leaderboard-spinner {
  color: #9898A6;
  font-size: 14px;
  padding: 40px 0;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  width: 100%;
  max-width: 475px;
  flex: 1;
  min-height: 0;
  padding-bottom: 8px;
}

.leaderboard-empty {
  text-align: center;
  color: #7A7A8A;
  font-size: 14px;
  padding: 40px 20px;
  line-height: 1.5;
}

.leaderboard-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: rgba(22, 22, 32, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(124, 82, 251, 0.2);
  border-radius: 12px;
  padding: 12px;
  animation: fadeIn 0.3s ease;
}

.leaderboard-rank {
  font-size: 24px;
  font-weight: 600;
  color: rgba(124, 82, 251, 0.7);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.leaderboard-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(124, 82, 251, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(124, 82, 251, 0.25);
}

.leaderboard-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.leaderboard-avatar-initials {
  font-size: 14px;
  font-weight: 700;
  color: rgba(124, 82, 251, 0.7);
}

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

.leaderboard-name {
  font-size: 15px;
  font-weight: 600;
  color: #E8E8EC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-stats {
  font-size: 12px;
  color: #9898A6;
  margin-top: 2px;
}

.btn-scores {
  font-size: 16px;
  padding: 12px 40px;
  flex-shrink: 0;
}

/* Trust score indicator in dialogue header */
.trust-indicator {
  display: inline-block;
  margin-left: 4px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ====== CONFRONTATION SYSTEM ====== */
.contradiction-alert {
  background: rgba(255, 60, 60, 0.12);
  border: 1px solid rgba(255, 60, 60, 0.3);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0;
}

.contradiction-title {
  color: #ff4444;
  font-weight: 700;
  font-size: 0.9em;
  margin-bottom: 8px;
  text-align: center;
}

.contradiction-comparison {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.contradiction-quote {
  font-size: 0.82em;
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.contradiction-vs {
  text-align: center;
  font-size: 0.75em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
}

.contradiction-choices {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.contradiction-confront {
  background: rgba(255, 60, 60, 0.3);
  color: #ff6666;
  border: 1px solid rgba(255, 60, 60, 0.4);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8em;
  font-weight: 600;
  cursor: pointer;
}

.contradiction-note {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8em;
  cursor: pointer;
}

.breaking-banner {
  text-align: center;
  color: #ff9800;
  font-weight: 700;
  font-size: 0.85em;
  padding: 8px;
  margin: 8px 0;
  background: rgba(255, 152, 0, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.confession-bubble {
  border-left: 3px solid #ff9800 !important;
}

.defiance-bubble {
  border-left: 3px solid #ff4444 !important;
}
