@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=ZCOOL+KuaiLe&display=swap');

/* ============ CSS VARIABLES ============ */
:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-dark: #0d1137;
  --primary-bg: #1a1f4e;
  --accent: #FF8F00;
  --accent-light: #ffa726;
  --accent-dark: #e65100;
  --gold: #FFB300;
  --gold-dark: #FF8F00;
  --dark: #0d1137;
  --parchment: #fff8e1;
  --parchment-dark: #ffe0b2;
  --cork: #bcaaa4;
  --cork-dark: #a1887f;
  --paper: #ffffff;
  --red: #e53935;
  --red-dark: #c62828;
  --green: #43a047;
  --blue: #1e88e5;
  --orange: #fb8c00;
  --pink: #ec407a;
  --text-light: #e8eaf6;
  --text-muted: #9fa8da;
  --text-dark: #263238;
  --card-bg: rgba(26, 31, 78, 0.92);
  --card-border: rgba(255, 179, 0, 0.18);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-gold: 0 4px 20px rgba(255, 179, 0, 0.3);
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ============ RESET & BASE ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'ZCOOL KuaiLe', 'Ma Shan Zheng', cursive, sans-serif;
  background: var(--dark);
  color: #fff;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ============ SCREEN SYSTEM ============ */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
}

canvas#bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(92, 45, 145, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 45, 145, 0.8);
}

/* ============ BUTTONS ============ */
.btn {
  padding: 12px 32px;
  border: 2px solid var(--gold);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--gold);
  font-family: inherit;
  font-size: clamp(1rem, 3vw, 1.3rem);
  cursor: pointer;
  z-index: 2;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(26, 35, 126, 0.4);
  min-width: 180px;
  text-align: center;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn:hover,
.btn:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 179, 0, 0.3);
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-gold {
  background: linear-gradient(135deg, #ffb300, #ff8f00);
  color: var(--primary);
  border-color: #fff;
  font-weight: bold;
  box-shadow: 0 4px 20px rgba(255, 179, 0, 0.4);
}

.btn-gold:hover,
.btn-gold:active {
  background: linear-gradient(135deg, #ffe44d, #ffbb33);
  box-shadow: 0 6px 30px rgba(255, 179, 0, 0.6);
}

.btn-small {
  padding: 8px 20px;
  font-size: 0.9rem;
  min-width: 100px;
  border-radius: 20px;
}

.btn-ad {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-color: #ff6b6b;
  color: #fff;
}

.btn-ad:hover,
.btn-ad:active {
  background: linear-gradient(135deg, #ff6b6b, var(--red));
  box-shadow: 0 6px 25px rgba(231, 76, 60, 0.4);
}

.btn-back {
  background: linear-gradient(135deg, #555, #444);
  border-color: #888;
  color: #ddd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-back:hover,
.btn-back:active {
  background: linear-gradient(135deg, #666, #555);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============ TITLE SCREEN ============ */
#title-screen {
  background: radial-gradient(ellipse at center, var(--primary-bg) 0%, var(--primary-dark) 70%);
  justify-content: center;
  gap: 18px;
}

.title-glow-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, 70vw);
  height: min(360px, 70vw);
  border-radius: 50%;
  border: 2px solid rgba(255, 179, 0, 0.1);
  box-shadow: 0 0 60px rgba(255, 179, 0, 0.08), inset 0 0 60px rgba(255, 179, 0, 0.05);
  pointer-events: none;
  z-index: 0;
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 1;
  }
}

.title-magnifier {
  font-size: clamp(4rem, 12vw, 8rem);
  z-index: 2;
  animation: magnifierFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

@keyframes magnifierFloat {
  0%, 100% {
    transform: translateY(0) rotate(-15deg);
  }
  50% {
    transform: translateY(-18px) rotate(-5deg);
  }
}

.title-logo {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 179, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
  animation: titlePulse 2s ease-in-out infinite;
  z-index: 2;
  letter-spacing: 4px;
}

@keyframes titlePulse {
  0%, 100% {
    transform: scale(1);
    text-shadow: 0 0 30px rgba(255, 179, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
  }
  50% {
    transform: scale(1.05);
    text-shadow: 0 0 50px rgba(255, 179, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.5);
  }
}

.title-subtitle {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--text-muted);
  z-index: 2;
  letter-spacing: 2px;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
  align-items: center;
  margin-top: 10px;
}

/* ============ LEVEL SCREEN ============ */
#level-screen {
  background: radial-gradient(ellipse at center, var(--primary-bg) 0%, var(--primary-dark) 70%);
  padding: 15px;
}

.level-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  z-index: 2;
}

.level-header h2 {
  color: var(--gold);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
}

.stars-display {
  color: var(--gold);
  font-size: 1.2rem;
  background: rgba(92, 45, 145, 0.4);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 179, 0, 0.2);
}

.season-tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  z-index: 2;
  flex-wrap: wrap;
  justify-content: center;
}

.season-tab {
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(92, 45, 145, 0.5);
  color: var(--text-muted);
  border: 1px solid rgba(255, 179, 0, 0.3);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  position: relative;
}

.season-tab:hover {
  background: rgba(92, 45, 145, 0.7);
  border-color: rgba(255, 179, 0, 0.5);
}

.season-tab.active {
  background: var(--primary);
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(255, 179, 0, 0.3);
}

.season-tab .tab-progress {
  font-size: 0.7rem;
  margin-left: 4px;
  opacity: 0.8;
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 10px;
  width: 100%;
  max-width: 900px;
  z-index: 2;
}

.case-card {
  background: linear-gradient(135deg, rgba(26, 35, 126, 0.8), rgba(13, 17, 55, 0.9));
  border: 2px solid rgba(255, 179, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.case-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 179, 0, 0.05), transparent);
  transition: left 0.5s;
}

.case-card:hover::before {
  left: 100%;
}

.case-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 8px 25px rgba(255, 179, 0, 0.2);
}

.case-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.case-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  z-index: 1;
}

.case-card.solved {
  border-color: var(--green);
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.2), rgba(13, 17, 55, 0.9));
}

.case-card.solved::before {
  content: '�?;
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 1rem;
  z-index: 1;
}

.case-num {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.case-title {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: #fff;
  margin: 5px 0;
  line-height: 1.3;
}

.case-difficulty {
  font-size: 0.7rem;
  margin: 4px 0;
}

.case-stars {
  color: var(--gold);
  font-size: 0.9rem;
}

.case-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 5px;
}

.badge-bronze {
  background: #cd7f32;
  color: #fff;
}

.badge-silver {
  background: #c0c0c0;
  color: #333;
}

.badge-gold {
  background: var(--gold);
  color: var(--primary);
}

/* ============ DAILY CHEST ============ */
.daily-chest-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb300, #ff8c00);
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 10;
  animation: chestBounce 2s ease-in-out infinite;
  box-shadow: 0 4px 20px rgba(255, 179, 0, 0.5);
  transition: transform var(--transition-fast);
}

.daily-chest-btn:active {
  transform: scale(0.9);
}

@keyframes chestBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

/* ============ STORY SCREEN ============ */
#story-screen {
  background: var(--dark);
  justify-content: flex-start;
  padding: 0;
}

.story-canvas-wrap {
  width: 100%;
  height: 45vh;
  position: relative;
  overflow: hidden;
}

.story-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.story-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 24px 20px 20px;
  background: linear-gradient(transparent, rgba(13, 17, 55, 0.95) 30%);
  z-index: 2;
}

.story-case-num {
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 5px;
  opacity: 0.9;
}

.story-title {
  color: #fff;
  font-size: clamp(1.3rem, 4vw, 2rem);
  margin-bottom: 5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.story-text-box {
  width: 100%;
  padding: 20px;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.story-text {
  background: rgba(92, 45, 145, 0.3);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  color: var(--text-light);
  font-size: clamp(0.95rem, 2.8vw, 1.15rem);
  line-height: 1.8;
  width: 100%;
  max-width: 600px;
  min-height: 120px;
  position: relative;
}

.story-text::before {
  content: '📖';
  position: absolute;
  top: -14px;
  left: 15px;
  font-size: 1.3rem;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--gold);
  animation: blink 0.7s infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

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

.story-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============ CLUE BOARD ============ */
#clue-screen {
  background: var(--dark);
  padding: 15px;
  justify-content: flex-start;
}

.cork-board {
  background: linear-gradient(135deg, var(--cork), var(--cork-dark));
  border-radius: var(--radius-md);
  padding: 20px;
  width: 100%;
  max-width: 700px;
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3), 0 4px 20px rgba(0, 0, 0, 0.5);
  margin-top: 10px;
}

.cork-board::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(0, 0, 0, 0.02) 3px, rgba(0, 0, 0, 0.02) 6px);
  border-radius: var(--radius-md);
  pointer-events: none;
}

.board-title {
  color: var(--primary);
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 15px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.board-progress {
  text-align: center;
  font-size: 0.8rem;
  color: #8B6914;
  margin-bottom: 12px;
}

.clue-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clue-card {
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  cursor: pointer;
  position: relative;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 10px;
}

.clue-card:hover {
  transform: translateY(-2px);
}

.clue-card.locked {
  background: #d4c4a8;
  opacity: 0.75;
}

.clue-card.locked .clue-text {
  color: #999;
}

.clue-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.clue-text {
  font-size: 0.95rem;
  color: var(--text-dark);
  flex: 1;
  font-family: 'Ma Shan Zheng', cursive;
  line-height: 1.4;
}

.clue-pin {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
}

.clue-lock {
  font-size: 1.2rem;
  color: var(--red);
  flex-shrink: 0;
}

.clue-ad-btn {
  padding: 5px 12px;
  font-size: 0.75rem;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.clue-ad-btn:hover {
  background: #ff6b6b;
  transform: scale(1.05);
}

/* ============ SUSPECT SCREEN ============ */
#suspect-screen {
  background: var(--dark);
  padding: 15px;
  justify-content: flex-start;
  gap: 10px;
}

.suspects-title {
  color: var(--gold);
  font-size: 1.3rem;
  z-index: 2;
  text-align: center;
}

.suspects-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 2;
  width: 100%;
  max-width: 750px;
}

.suspect-card {
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 14px;
  width: 180px;
  cursor: pointer;
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-normal);
  position: relative;
}

.suspect-card:hover {
  transform: translateY(-5px) rotate(-1deg);
  box-shadow: 5px 8px 20px rgba(0, 0, 0, 0.4);
}

.suspect-card.selected {
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(255, 179, 0, 0.4);
}

.polaroid-wrap {
  text-align: center;
  margin-bottom: 8px;
  position: relative;
}

.polaroid-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  border: 3px solid #ddd;
  background: #f0f0f0;
  transition: transform var(--transition-normal);
}

.suspect-card:hover .polaroid-img {
  transform: scale(1.08);
}

.suspect-name {
  font-size: 1.1rem;
  color: var(--primary);
  text-align: center;
  font-weight: bold;
}

.suspect-statement {
  font-size: 0.85rem;
  color: #555;
  font-style: italic;
  margin-top: 6px;
  line-height: 1.4;
  min-height: 50px;
  font-family: 'Ma Shan Zheng', cursive;
}

.deep-interrogate-btn {
  margin-top: 8px;
  width: 100%;
  padding: 6px;
  font-size: 0.8rem;
  border-radius: 12px;
  background: var(--primary);
  color: var(--gold);
  border: 1px solid var(--gold);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.deep-interrogate-btn:hover {
  background: var(--primary-light);
}

/* ============ SETTINGS SCREEN ============ */
.settings-header {
  text-align: center;
  margin-bottom: 20px;
}

.settings-header h2 {
  font-size: 1.5rem;
  color: var(--gold);
  margin: 0;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-item:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

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

.settings-item-icon {
  font-size: 1.3rem;
}

.settings-item-label {
  font-size: 0.95rem;
  color: var(--text-light);
  font-weight: 500;
}

.settings-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-item-value {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.settings-item-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============ LANGUAGE SCREEN ============ */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-item:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.lang-item.active {
  border-color: var(--gold);
  background: rgba(255, 179, 0, 0.08);
}

.lang-flag {
  font-size: 1.6rem;
}

.lang-name {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 500;
  flex: 1;
}

.lang-check {
  font-size: 1.1rem;
}

.deep-interrogate-btn.used {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.deep-info {
  margin-top: 6px;
  padding: 8px;
  background: #e8eaf6;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--primary);
  display: none;
  line-height: 1.4;
  border-left: 3px solid var(--primary);
}

.deep-info.show {
  display: block;
  animation: fadeInDown 0.3s ease-out;
}

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

/* ============ QUESTION SCREEN ============ */
#question-screen {
  background: var(--dark);
  padding: 15px;
  justify-content: flex-start;
  gap: 15px;
}

.question-progress {
  color: var(--text-muted);
  font-size: 0.9rem;
  z-index: 2;
  background: rgba(92, 45, 145, 0.3);
  padding: 6px 16px;
  border-radius: 15px;
}

.question-box {
  background: rgba(92, 45, 145, 0.4);
  border: 2px solid rgba(255, 179, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  width: 100%;
  max-width: 600px;
  z-index: 2;
}

.question-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-bottom: 10px;
  font-weight: bold;
  letter-spacing: 1px;
}

.type-math {
  background: var(--blue);
  color: #fff;
}

.type-chinese {
  background: var(--red);
  color: #fff;
}

.type-logic {
  background: var(--green);
  color: #fff;
}

.type-observe {
  background: var(--orange);
  color: #fff;
}

.type-common {
  background: #8e44ad;
  color: #fff;
}

.question-text {
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: #fff;
  line-height: 1.6;
  margin-bottom: 15px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 179, 0, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-light);
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-normal);
  text-align: left;
  position: relative;
}

.option-btn:hover {
  background: rgba(255, 179, 0, 0.12);
  border-color: rgba(255, 179, 0, 0.5);
  transform: translateX(4px);
}

.option-btn.correct {
  background: rgba(39, 174, 96, 0.3);
  border-color: var(--green);
  color: #fff;
  animation: correctPulse 0.5s;
}

.option-btn.wrong {
  background: rgba(231, 76, 60, 0.3);
  border-color: var(--red);
  color: #fff;
  animation: wrongShake 0.5s;
}

.option-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
  text-decoration: line-through;
}

@keyframes correctPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrongShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

.hint-area {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(255, 179, 0, 0.1);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-size: 0.9rem;
  display: none;
  border-left: 3px solid var(--gold);
}

.hint-area.show {
  display: block;
  animation: fadeInDown 0.3s ease-out;
}

.question-actions {
  display: flex;
  gap: 10px;
  z-index: 2;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============ ACCUSE SCREEN ============ */
#accuse-screen {
  background: var(--dark);
  padding: 15px;
  justify-content: center;
  gap: 15px;
}

.accuse-title {
  color: var(--gold);
  font-size: 1.5rem;
  z-index: 2;
  text-align: center;
}

.accuse-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 2;
  text-align: center;
}

.accuse-suspects {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 2;
}

.accuse-card {
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 16px;
  width: 140px;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.3);
  border: 3px solid transparent;
}

.accuse-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(255, 179, 0, 0.3);
  border-color: rgba(255, 179, 0, 0.4);
}

.accuse-card.chosen {
  border-color: var(--red);
  animation: accuseGlow 1s ease-in-out infinite;
}

@keyframes accuseGlow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.6);
  }
}

.accuse-avatar {
  font-size: 3rem;
  margin-bottom: 8px;
}

.accuse-name {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: bold;
}

/* ============ RESULT SCREEN ============ */
#result-screen {
  background: var(--dark);
  justify-content: center;
  gap: 15px;
  padding: 20px;
}

.result-icon {
  font-size: clamp(4rem, 12vw, 6rem);
  z-index: 2;
  animation: resultBounce 1s ease-out;
}

@keyframes resultBounce {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.result-title {
  color: var(--gold);
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  z-index: 2;
  text-align: center;
}

.result-text {
  color: var(--text-light);
  font-size: 1rem;
  z-index: 2;
  text-align: center;
  max-width: 500px;
  line-height: 1.8;
  padding: 15px;
  background: rgba(92, 45, 145, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 179, 0, 0.2);
}

.result-stars {
  z-index: 2;
  font-size: 2rem;
  letter-spacing: 4px;
}

.result-badge {
  z-index: 2;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 1.1rem;
  animation: resultBounce 0.8s ease-out 0.3s both;
}

.result-buttons {
  display: flex;
  gap: 12px;
  z-index: 2;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============ COLLECTION SCREEN ============ */
#collection-screen {
  background: var(--dark);
  padding: 15px;
  justify-content: flex-start;
  gap: 10px;
}

.collection-title {
  color: var(--gold);
  font-size: 1.5rem;
  z-index: 2;
}

.collection-tabs {
  display: flex;
  gap: 8px;
  z-index: 2;
}

.collection-tab {
  padding: 6px 16px;
  border-radius: 15px;
  background: rgba(92, 45, 145, 0.5);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 179, 0, 0.2);
  transition: all var(--transition-normal);
}

.collection-tab.active {
  background: var(--primary);
  color: var(--gold);
  border-color: var(--gold);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 700px;
  z-index: 2;
  padding: 10px;
}

.collection-item {
  background: rgba(92, 45, 145, 0.4);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
  transition: all var(--transition-fast);
  cursor: default;
}

.collection-item.clickable {
  cursor: pointer;
}

.collection-item.clickable:hover {
  background: rgba(92, 45, 145, 0.6);
  border-color: rgba(255, 179, 0, 0.4);
  transform: translateY(-2px);
}

.collection-item .emoji {
  font-size: 2rem;
  margin-bottom: 5px;
}

/* ============ AD MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

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

.modal-box {
  background: linear-gradient(135deg, var(--primary), #0d1b5e);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 25px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-title {
  color: var(--gold);
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.modal-text {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 15px;
  line-height: 1.5;
}

.modal-countdown {
  font-size: 2rem;
  color: var(--gold);
  margin: 10px 0;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 15px;
}

/* ============ VISUAL EFFECTS ============ */
.float-star {
  position: fixed;
  pointer-events: none;
  z-index: 99;
  font-size: 1.5rem;
  animation: floatUp 1.5s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) scale(1.5);
  }
}

.flash-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  pointer-events: none;
  z-index: 98;
  animation: flashAnim 0.5s ease-out forwards;
}

@keyframes flashAnim {
  0% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
  }
}

.handcuff-anim {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5rem;
  z-index: 97;
  animation: handcuffSlam 0.8s ease-out;
}

@keyframes handcuffSlam {
  0% {
    transform: translate(-50%, -50%) scale(3) rotate(180deg);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1.2) rotate(-10deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

.think-cloud {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 96;
  animation: thinkFade 2s ease-out forwards;
}

.think-cloud .bubble {
  background: #fff;
  color: var(--primary);
  padding: 15px 25px;
  border-radius: 20px;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  position: relative;
}

.think-cloud .bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 30px;
  border: 8px solid transparent;
  border-top-color: #fff;
}

@keyframes thinkFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.super-detective {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 97;
  text-align: center;
  animation: superAppear 2s ease-out forwards;
}

.super-detective .hat {
  font-size: 5rem;
  animation: hatSpin 1s ease-out;
}

.super-detective .label {
  color: var(--gold);
  font-size: 2rem;
  text-shadow: 0 0 20px rgba(255, 179, 0, 0.8);
}

@keyframes superAppear {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes hatSpin {
  0% {
    transform: rotateY(0);
  }
  100% {
    transform: rotateY(720deg);
  }
}

.certificate {
  background: linear-gradient(135deg, #fff8e7, #f5e6c8);
  border: 4px double var(--gold);
  border-radius: var(--radius-md);
  padding: 25px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(255, 179, 0, 0.3);
  animation: certAppear 1s ease-out;
}

@keyframes certAppear {
  0% {
    transform: scale(0) rotateY(90deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotateY(0);
    opacity: 1;
  }
}

.certificate h3 {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.certificate p {
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
}

.certificate .stamp {
  font-size: 3rem;
  margin-top: 10px;
}

.page-turn {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 95;
  pointer-events: none;
  animation: pageFlip 0.8s ease-in-out forwards;
}

.page-turn-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(245, 230, 200, 0.95), rgba(200, 180, 140, 0.95));
  transform-origin: left center;
}

@keyframes pageFlip {
  0% {
    clip-path: inset(0 100% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

/* ============ PARCHMENT TEXTURE ============ */
.parchment-bg {
  background: linear-gradient(135deg, #f5e6c8 0%, #e8d5a8 25%, #f0dbb8 50%, #e5cfa0 75%, #f5e6c8 100%);
  position: relative;
}

.parchment-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(139, 119, 80, 0.03) 2px, rgba(139, 119, 80, 0.03) 4px);
  pointer-events: none;
  z-index: 1;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
  .suspect-card {
    width: 150px;
    padding: 10px;
  }

  .cases-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .accuse-card {
    width: 110px;
    padding: 10px;
  }

  .btn {
    min-width: 140px;
    padding: 10px 24px;
  }

  .story-canvas-wrap {
    height: 35vh;
  }

  .modal-box {
    padding: 20px;
  }

  .title-logo {
    letter-spacing: 2px;
  }
}

@media (min-width: 768px) {
  .cases-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .suspect-card {
    width: 200px;
  }

  .accuse-card {
    width: 160px;
  }
}

@media (min-width: 1024px) {
  .cases-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============ DYNAMIC UI CLASSES (used by JS) ============ */

/* Story Screen */
.story-header { text-align: center; padding: 20px 15px 10px; z-index: 2; }
.story-badge { display: inline-block; padding: 4px 14px; background: rgba(26,35,126,0.5); border-radius: 15px; color: var(--gold); font-size: 0.9rem; margin-bottom: 8px; }
.story-difficulty { margin-top: 5px; }
.story-scroll { flex: 1; width: 100%; max-width: 600px; padding: 0 15px; overflow-y: auto; z-index: 2; }
.story-actions { display: flex; gap: 10px; margin: 15px 0 25px; flex-wrap: wrap; justify-content: center; z-index: 2; }
.btn-skip { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); color: #aaa; }

/* Clue Board */
.clue-header { text-align: center; padding: 15px; z-index: 2; }
.clue-header h2 { color: var(--gold); font-size: 1.4rem; }
.clue-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.clue-board { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 600px; padding: 10px 15px; z-index: 2; }
.clue-card { background: var(--paper); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 2px 3px 8px rgba(0,0,0,0.2); transition: all var(--transition-normal); }
.clue-card.locked { background: #d4c4a8; opacity: 0.75; }
.clue-card.revealed { border-left: 4px solid var(--green); }
.clue-icon { font-size: 1.6rem; flex-shrink: 0; }
.clue-text { font-size: 0.95rem; color: var(--text-dark); flex: 1; font-family: 'Ma Shan Zheng', cursive; line-height: 1.4; }
.clue-card.locked .clue-text { color: #999; }
.clue-actions { display: flex; gap: 10px; margin: 15px 0 25px; flex-wrap: wrap; justify-content: center; z-index: 2; }

/* Interrogate */
.interrogate-header { text-align: center; padding: 15px; z-index: 2; }
.interrogate-header h2 { color: var(--gold); font-size: 1.4rem; }
.interrogate-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.suspects-grid { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; z-index: 2; width: 100%; max-width: 750px; padding: 10px; }
.suspect-card { background: var(--paper); border-radius: var(--radius-md); padding: 16px; width: 200px; box-shadow: 3px 4px 12px rgba(0,0,0,0.3); transition: all var(--transition-normal); position: relative; }
.suspect-card:hover { transform: translateY(-4px); box-shadow: 5px 8px 20px rgba(0,0,0,0.4); }
.suspect-avatar { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.suspect-name { font-size: 1.1rem; color: var(--primary); text-align: center; font-weight: bold; }
.suspect-statement { font-size: 0.85rem; color: #555; font-style: italic; margin: 8px 0; line-height: 1.4; min-height: 45px; font-family: 'Ma Shan Zheng', cursive; }
.btn-deep { width: 100%; margin-top: 6px; font-size: 0.8rem; background: var(--primary); color: var(--gold); border-color: var(--gold); }
.deep-info { display: block; margin-top: 8px; padding: 8px 10px; background: #e8eaf6; border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--primary); line-height: 1.4; border-left: 3px solid var(--primary); animation: fadeInDown 0.3s ease-out; }
.interrogate-actions { display: flex; gap: 10px; margin: 15px 0 25px; flex-wrap: wrap; justify-content: center; z-index: 2; }

/* Reasoning */
.reasoning-header { text-align: center; padding: 15px; z-index: 2; }
.reasoning-header h2 { color: var(--gold); font-size: 1.4rem; }
.q-progress { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.q-progress-dot { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 2px solid rgba(255,215,0,0.2); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--text-muted); }
.q-progress-dot.current { background: var(--primary); border-color: var(--gold); color: var(--gold); }
.q-progress-dot.answered { background: var(--green); border-color: var(--green); color: #fff; }
.q-type-badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 0.8rem; font-weight: bold; letter-spacing: 1px; margin: 5px 0; }
.question-card { background: rgba(26,35,126,0.4); border: 2px solid rgba(255,179,0,0.3); border-radius: var(--radius-md); padding: 20px; width: 100%; max-width: 600px; z-index: 2; }
.question-text { font-size: clamp(1rem, 3vw, 1.2rem); color: #fff; line-height: 1.6; margin-bottom: 15px; }
.question-options { display: flex; flex-direction: column; gap: 10px; }
.btn-option { padding: 12px 15px; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,215,0,0.2); border-radius: var(--radius-md); color: var(--text-light); font-size: 1rem; cursor: pointer; font-family: inherit; transition: all var(--transition-normal); text-align: left; }
.btn-option:hover { background: rgba(255,215,0,0.12); border-color: rgba(255,215,0,0.5); transform: translateX(4px); }
.btn-option.correct { background: rgba(39,174,96,0.3); border-color: var(--green); color: #fff; }
.btn-option.wrong { background: rgba(231,76,60,0.3); border-color: var(--red); color: #fff; }
.btn-option.eliminated { opacity: 0.25; pointer-events: none; text-decoration: line-through; }
.btn-option:disabled { opacity: 0.5; cursor: not-allowed; }
.reasoning-actions { display: flex; gap: 10px; margin: 15px 0 25px; flex-wrap: wrap; justify-content: center; z-index: 2; }
.btn-hint { background: rgba(255,215,0,0.15); border-color: rgba(255,215,0,0.4); color: var(--gold); }
.btn-key-clue { background: rgba(108,92,231,0.15); border-color: rgba(108,92,231,0.4); color: #6c5ce7; }
.hint-text { margin-top: 12px; padding: 10px 14px; background: rgba(255,215,0,0.1); border-radius: var(--radius-sm); color: var(--gold); font-size: 0.9rem; border-left: 3px solid var(--gold); animation: fadeInDown 0.3s ease-out; }

/* Accuse */
.accuse-header { text-align: center; padding: 15px; z-index: 2; }
.accuse-header h2 { color: var(--gold); font-size: 1.5rem; }
.accuse-subtitle { color: var(--text-muted); font-size: 1rem; margin-top: 4px; }
.accuse-grid { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; z-index: 2; padding: 10px; }
.accuse-card { background: var(--paper); border-radius: var(--radius-md); padding: 20px; width: 150px; cursor: pointer; transition: all var(--transition-normal); text-align: center; box-shadow: 3px 4px 12px rgba(0,0,0,0.3); border: 3px solid transparent; }
.accuse-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(255,215,0,0.3); border-color: rgba(255,215,0,0.4); }
.accuse-card.correct-accuse { border-color: var(--green); background: rgba(39,174,96,0.15); animation: correctPulse 0.5s; }
.accuse-card.wrong-accuse { border-color: var(--red); background: rgba(231,76,60,0.15); animation: wrongShake 0.5s; }
.accuse-card.real-culprit { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,215,0,0.5); }
.accuse-avatar { font-size: 3.5rem; margin-bottom: 8px; }
.accuse-name { color: var(--primary); font-size: 1.1rem; font-weight: bold; }
.accuse-actions { display: flex; gap: 10px; margin: 15px 0 25px; flex-wrap: wrap; justify-content: center; z-index: 2; }

/* Result */
.result-header { text-align: center; padding: 15px; z-index: 2; }
.result-header h2 { color: var(--gold); font-size: 1.6rem; }
.result-icon { font-size: clamp(4rem, 12vw, 6rem); animation: resultBounce 1s ease-out; }
.result-truth { background: rgba(26,35,126,0.3); border: 1px solid rgba(255,179,0,0.2); border-radius: var(--radius-md); padding: 18px; max-width: 550px; width: 90%; z-index: 2; }
.result-truth h3 { color: var(--gold); margin-bottom: 8px; }
.result-truth p { color: var(--text-light); line-height: 1.7; }
.result-culprit { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px; background: rgba(231,76,60,0.15); border-radius: var(--radius-sm); }
.result-culprit-avatar { font-size: 2rem; }
.result-culprit-name { color: var(--red); font-weight: bold; }
.result-rewards { text-align: center; z-index: 2; }
.result-rewards h3 { color: var(--gold); margin-bottom: 8px; }
.reward-stars { font-size: 1.8rem; color: var(--gold); display: inline-flex; align-items: center; gap: 4px; }
.reward-stars .anim-star {
  display: inline-block; opacity: 0; transform: scale(0) rotate(-30deg);
  animation: starPopIn 0.6s cubic-bezier(.34,1.56,.64,1) forwards;
  filter: drop-shadow(0 0 8px rgba(255,215,0,0.7));
}
@keyframes starPopIn {
  0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
  60%  { opacity: 1; transform: scale(1.4) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
/* ★ 星星持续闪烁光晕 */
.reward-stars .anim-star::after {
  content: ''; position: absolute; inset: -6px;
  background: radial-gradient(circle, rgba(255,215,0,0.5) 0%, transparent 70%);
  border-radius: 50%; animation: starGlow 1.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes starGlow {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%     { opacity: 0.8; transform: scale(1.3); }
}
/* ★ Perfect星星额外金光 */
.reward-stars .anim-star.perfect::after {
  background: radial-gradient(circle, rgba(255,215,0,0.8) 0%, rgba(255,180,0,0.3) 50%, transparent 70%);
  animation: perfectStarPulse 0.8s ease-in-out infinite;
}
@keyframes perfectStarPulse {
  0%,100% { opacity: 0.5; transform: scale(1); }
  50%     { opacity: 1; transform: scale(1.5); }
}
.reward-badge { display: inline-block; padding: 6px 16px; border-radius: 15px; font-size: 1rem; margin-top: 5px; }
.result-retry-hint { color: var(--text-muted); z-index: 2; }
.result-actions { display: flex; gap: 12px; margin: 15px 0 25px; flex-wrap: wrap; justify-content: center; z-index: 2; }

/* Collection */
.collection-header { text-align: center; padding: 15px; z-index: 2; }
.collection-header h2 { color: var(--gold); font-size: 1.5rem; }
.collection-stats { display: flex; gap: 15px; justify-content: center; z-index: 2; padding: 10px; }
.stat-card { background: rgba(26,35,126,0.4); border: 1px solid rgba(255,179,0,0.2); border-radius: var(--radius-md); padding: 16px 24px; text-align: center; min-width: 120px; }
.stat-value { font-size: 1.5rem; color: var(--gold); font-weight: bold; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.collection-badges { z-index: 2; text-align: center; padding: 10px; }
.collection-badges h3 { color: var(--gold); margin-bottom: 10px; }
.badges-grid { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.badge-item { background: rgba(26,35,126,0.4); border: 1px solid rgba(255,179,0,0.2); border-radius: var(--radius-md); padding: 14px 20px; text-align: center; min-width: 90px; }
.badge-icon { font-size: 2rem; }
.badge-label { font-size: 0.85rem; color: var(--text-light); margin-top: 4px; }
.badge-count { font-size: 1.2rem; color: var(--gold); font-weight: bold; }

/* Toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-120px); padding: 12px 24px; border-radius: 25px; font-family: inherit; font-size: 1rem; z-index: 200; transition: transform 0.4s ease; pointer-events: none; white-space: nowrap; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-info { background: rgba(52,152,219,0.9); color: #fff; }
.toast-success { background: rgba(39,174,96,0.9); color: #fff; }
.toast-warning { background: rgba(243,156,18,0.9); color: #fff; }
.toast-error { background: rgba(231,76,60,0.9); color: #fff; }

/* Confetti */
.confetti { position: fixed; top: -10px; z-index: 150; pointer-events: none; animation: confettiFall linear forwards; border-radius: 2px; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

/* Star Burst */
.star-burst { position: fixed; pointer-events: none; z-index: 150; font-size: 1.2rem; animation: starBurst 0.8s ease-out forwards; }
@keyframes starBurst { 0% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); } }

/* Shake */
.shake { animation: shakeAnim 0.5s ease; }
@keyframes shakeAnim { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Pulse */
.pulse { animation: pulseAnim 0.6s ease; }
@keyframes pulseAnim { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* Ad Overlay */
.ad-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(4px); animation: fadeIn 0.3s ease-out; }
.ad-box { background: linear-gradient(135deg, var(--primary), #0d1b5e); border: 2px solid var(--gold); border-radius: var(--radius-lg); padding: 30px; text-align: center; max-width: 360px; width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.5); animation: modalSlideIn 0.4s ease-out; }
.ad-icon { font-size: 3rem; margin-bottom: 10px; }
.ad-box p { color: var(--text-light); font-size: 1rem; margin-bottom: 15px; line-height: 1.5; }
.ad-watch-btn { margin-bottom: 8px; }
.ad-skip-btn { background: transparent; border-color: rgba(255,255,255,0.3); color: #aaa; }

/* Case Card (JS rendered) */
.case-card-number { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.case-card-title { font-size: clamp(0.85rem, 2.5vw, 1rem); color: #fff; margin: 5px 0; line-height: 1.3; }
.case-card-diff { font-size: 0.75rem; margin: 4px 0; }
.case-card-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; display: inline-block; margin-top: 5px; background: rgba(255,255,255,0.1); color: var(--text-light); }
.case-card-solved { font-size: 0.8rem; color: var(--green); margin-top: 6px; }
.case-card-locked { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* Lock icon in season tab */
.lock-icon { font-size: 0.8rem; }

/* Story text in story screen */
#story-screen .story-text { background: rgba(26,35,126,0.3); border: 1px solid rgba(255,179,0,0.2); border-radius: var(--radius-md); padding: 20px; color: var(--text-light); font-size: clamp(0.95rem, 2.8vw, 1.15rem); line-height: 1.8; width: 100%; max-width: 600px; min-height: 100px; }
#story-screen .story-title { color: #fff; font-size: clamp(1.3rem, 4vw, 2rem); text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

/* Clue screen background */
#clue-screen { background: var(--dark); padding: 15px; justify-content: flex-start; }
#interrogate-screen { background: var(--dark); padding: 15px; justify-content: flex-start; }
#reasoning-screen { background: var(--dark); padding: 15px; justify-content: flex-start; }
#accuse-screen { background: var(--dark); padding: 15px; justify-content: center; }
#result-screen { background: var(--dark); padding: 20px; justify-content: center; }
#collection-screen { background: var(--dark); padding: 15px; justify-content: flex-start; }

/* Clue Link Section */
.clue-link-section { width: 100%; max-width: 600px; padding: 10px 15px; z-index: 2; margin-top: 5px; }
.clue-link-section h3 { color: var(--gold); font-size: 1rem; margin-bottom: 4px; }
.clue-link-desc { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 8px; }
.clue-link-item { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,215,0,0.15); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; transition: all var(--transition-normal); }
.clue-link-item.linked { background: rgba(39,174,96,0.1); border-color: rgba(39,174,96,0.4); }
.clue-link-num { font-weight: bold; color: var(--gold); font-size: 0.85rem; }
.clue-link-status { font-size: 0.8rem; color: var(--text-muted); }
.clue-link-item.linked .clue-link-status { color: var(--green); }
.clue-link-insight { width: 100%; font-size: 0.85rem; color: #a0d8ef; line-height: 1.4; padding-top: 4px; border-top: 1px dashed rgba(255,255,255,0.1); }

/* Free Clue Hint */
.clue-free-hint { font-size: 0.75rem; color: var(--green); padding: 4px 10px; background: rgba(39,174,96,0.1); border-radius: 10px; white-space: nowrap; }

/* Red Herring Clue */
.clue-card.red-herring { border-left: 4px solid var(--orange); background: #fff3e0; }
.red-herring-tag { font-size: 0.7rem; color: var(--orange); padding: 2px 8px; background: rgba(230,126,34,0.1); border-radius: 8px; white-space: nowrap; margin-left: auto; }

/* Perfect Clear Badge */
.perfect-badge { display: inline-block; padding: 6px 18px; background: linear-gradient(135deg, #ffb300, #FFA500); color: #1a0a2e; border-radius: 20px; font-size: 0.95rem; font-weight: bold; margin-top: 8px; animation: pulseAnim 1s ease infinite; box-shadow: 0 4px 15px rgba(255,215,0,0.4); }
.perfect-bonus { font-size: 0.8rem; color: var(--gold); font-weight: normal; }