/* style.css - Abyss Neuron */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Noto+Sans+JP:wght@400;700&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #141b2d;
  --bg-tertiary: #1e2a45;
  --text-primary: #e2e8f0;
  --text-secondary: #64748b;
  --text-muted: #334155;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.5);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --font-number: 'JetBrains Mono', 'SF Mono', monospace;
  --font-body: 'Noto Sans JP', -apple-system, sans-serif;
}

/* Theme color variants */
[data-theme="emerald"] {
  --accent: #34d399;
  --accent-glow: rgba(52, 211, 153, 0.5);
}
[data-theme="violet"] {
  --accent: #a78bfa;
  --accent-glow: rgba(167, 139, 250, 0.5);
}
[data-theme="amber"] {
  --accent: #fbbf24;
  --accent-glow: rgba(251, 191, 36, 0.5);
}
[data-theme="rose"] {
  --accent: #fb7185;
  --accent-glow: rgba(251, 113, 133, 0.5);
}
[data-theme="crimson"] {
  --accent: #ef4444;
  --accent-glow: rgba(239, 68, 68, 0.5);
}

/* === Opening Cinematic === */
#opening-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 1.5s ease;
  overflow: hidden;
}

#opening-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#opening-overlay.hidden {
  display: none;
}

#opening-content {
  max-width: 340px;
  padding: 0 24px;
  text-align: center;
}

#opening-text {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 2.2;
  color: transparent;
  min-height: 200px;
}

#opening-text .op-line {
  display: block;
  color: #e2e8f0;
  opacity: 0;
  transform: translateY(8px);
  animation: op-fade-in 1.2s ease forwards;
}

#opening-text .op-line.accent {
  color: #38bdf8;
  font-size: 1.3rem;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
}

#opening-text .op-line.dim {
  color: #64748b;
  font-size: 0.9rem;
}

@keyframes op-fade-in {
  to { opacity: 1; transform: translateY(0); }
}

#opening-skip {
  margin-top: 40px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: #334155;
  letter-spacing: 0.1em;
  animation: op-blink 2s ease-in-out infinite;
}

@keyframes op-blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Ambient background pulse */
#game-container::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(56, 189, 248, 0.03), transparent 70%);
  animation: ambient-pulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes ambient-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* === Layout === */
#game-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}

/* Top bar - resource display */
#top-bar {
  padding: 12px 16px;
  text-align: center;
  z-index: 10;
  background: linear-gradient(to bottom, var(--bg-primary), transparent);
}

#thought-value {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 20px var(--accent-glow);
}

#thought-rate {
  font-family: var(--font-number);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 2px;
  transition: color 0.3s, transform 0.3s, text-shadow 0.3s;
}
#thought-rate.rate-highlight {
  color: #4ade80;
  transform: scale(1.3);
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

#thought-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

/* Canvas area */
#grid-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#hex-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

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

/* Bottom bar */
#bottom-bar {
  padding: 8px 16px 16px;
  z-index: 10;
  background: linear-gradient(to top, var(--bg-primary), transparent);
}

/* Progress bar */
#progress-container {
  margin-bottom: 8px;
}

#progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

#progress-fill[data-progress^="9"] {
  animation: progress-throb 0.8s ease-in-out infinite;
}

@keyframes progress-throb {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

#progress-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 3px;
  text-align: center;
}

/* Action buttons */
#action-bar {
  display: flex;
  gap: 8px;
}

.action-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  text-align: center;
}

.action-btn:active {
  transform: scale(0.95);
  background: var(--bg-tertiary);
}

.action-btn.primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.action-btn.primary:active {
  background: #7dd3fc;
}

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

.action-btn.locked-teaser {
  opacity: 0.25;
  border-style: dashed;
  border-color: var(--text-secondary);
  position: relative;
  animation: teaser-pulse 3s ease-in-out infinite;
}

@keyframes teaser-pulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.35; }
}

.action-btn .btn-cost {
  display: block;
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
  font-family: var(--font-number);
}

/* Mode indicator */
#mode-indicator {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 4px;
  min-height: 20px;
}

#mode-indicator.active {
  color: var(--warning);
}

/* === Upgrade Panel (Bottom Sheet) === */
#upgrade-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 20px 20px 0 0;
  z-index: 20;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 60vh;
  overflow-y: auto;
}

#upgrade-panel.open {
  transform: translateY(0);
}

#upgrade-handle {
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  margin: 10px auto;
}

#upgrade-title {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0 16px 8px;
  color: var(--text-secondary);
}

#upgrade-list {
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.upgrade-btn.affordable {
  border-color: var(--accent);
  color: var(--text-primary);
}

.upgrade-btn.affordable:active {
  transform: scale(0.97);
  background: var(--bg-tertiary);
}

.upgrade-btn:disabled {
  cursor: not-allowed;
}

.upgrade-name {
  font-weight: 700;
}

.upgrade-count {
  font-family: var(--font-number);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.upgrade-cost {
  font-family: var(--font-number);
  font-size: 0.85rem;
  color: var(--accent);
}

/* === Overlay (backdrop) === */
#overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#overlay-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* === Return Reward Overlay === */
#return-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 23, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

#return-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#return-overlay .return-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 16px;
}

#return-value {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 2.5rem;
  color: var(--success);
  text-shadow: 0 0 30px rgba(74, 222, 128, 0.5);
}

#return-overlay .return-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 24px;
}

.count-complete {
  animation: bounce-scale 0.3s ease-out;
}

@keyframes bounce-scale {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* === Floating Text === */
.floating-text {
  position: absolute;
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 1rem;
  pointer-events: none;
  animation: float-up 0.7s ease-out forwards;
  z-index: 6;
  text-shadow: 0 0 8px currentColor;
}

@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  70% { opacity: 1; transform: translateY(-50px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.8); }
}

/* === Particles === */
.particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  animation: particle-burst var(--duration, 0.6s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes particle-burst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--x, 0), var(--y, 0)) scale(0); }
}

/* === Screen Flash === */
.screen-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  animation: flash 0.3s ease-out forwards;
}

@keyframes flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* === Insight Label === */
.insight-label {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 3rem;
  color: var(--warning);
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.6);
  pointer-events: none;
  z-index: 41;
  animation: insight-pop 1s ease-out forwards;
}

@keyframes insight-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

/* === Settings Modal === */
#settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 16px;
  padding: 24px;
  z-index: 30;
  min-width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
}

#settings-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

#settings-modal h3 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.85rem;
}

.setting-row button {
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}

.setting-row button:active {
  background: var(--accent);
  color: var(--bg-primary);
}

.setting-row button.danger {
  color: var(--danger);
}

.setting-row button.danger:active {
  background: var(--danger);
  color: white;
}

.play-time-value {
  font-family: var(--font-number);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.rest-mode-info {
  padding: 8px 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rest-mode-info p {
  margin-bottom: 8px;
}

.rest-duration-picker {
  display: flex;
  gap: 6px;
}

.rest-dur {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
  text-align: center;
}

.rest-dur:active {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Theme color picker */
.theme-picker {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-tertiary);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
}
.theme-swatch:active {
  transform: scale(0.9);
}
.theme-swatch.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}
.theme-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.rest-dur.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* === Secondary Currencies === */
#secondary-currencies {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
}

.currency-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-number);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.currency-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.concept-icon { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.ego-icon { background: #c084fc; box-shadow: 0 0 6px rgba(192, 132, 252, 0.5); }

/* === Noise Bar === */
#noise-container {
  padding: 0 16px;
  min-height: 12px;
}

#noise-bar {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

#noise-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s, background 0.5s;
}

#noise-label {
  font-size: 0.6rem;
  font-family: var(--font-number);
  color: var(--danger);
  text-align: center;
  min-height: 14px;
}

/* === Alignment Gauge === */
#alignment-container {
  padding: 0 16px 2px;
}

#alignment-gauge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.55rem;
  font-family: var(--font-number);
  letter-spacing: 0.05em;
}

#alignment-dark-label {
  color: #f87171;
  min-width: 24px;
  text-align: right;
}

#alignment-light-label {
  color: #38bdf8;
  min-width: 24px;
}

#alignment-bar {
  flex: 1;
  height: 3px;
  background: linear-gradient(to right, #f8717140, #94a3b830, #38bdf840);
  border-radius: 2px;
  position: relative;
}

#alignment-indicator {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  transform: translate(-50%, -50%);
  transition: left 0.5s ease, background 0.3s, box-shadow 0.3s;
  left: 50%;
}

#alignment-bonus {
  font-size: 0.55rem;
  font-family: var(--font-number);
  text-align: center;
  min-height: 12px;
  opacity: 0.8;
}

/* === Action Bar 2 (Prestige/Ego) === */
#action-bar-2 {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.prestige-btn {
  background: linear-gradient(135deg, #1e2a45, #2d1b4e) !important;
  border-color: #c084fc !important;
  color: #c084fc !important;
}

.prestige-btn:active:not(:disabled) {
  background: #c084fc !important;
  color: var(--bg-primary) !important;
}

.ego-btn {
  background: var(--bg-secondary) !important;
  border-color: #c084fc40 !important;
}

/* === Upgrade Panel Selected === */
.upgrade-btn.selected {
  background: var(--bg-tertiary) !important;
  border-width: 2px;
}

/* === Stats === */
#stats-display {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 2px 16px;
  font-family: var(--font-number);
}

/* === Tier Celebration === */
.tier-label {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 41;
  animation: tier-pop 2s ease-out forwards;
}

.tier-prefix {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 4rem;
  text-shadow: 0 0 40px currentColor;
  line-height: 1;
}

.tier-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

.tier-sub {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  opacity: 0.5;
}

/* Scaled up for higher tiers */
.tier-level-2 .tier-prefix { font-size: 5rem; }
.tier-level-3 .tier-prefix { font-size: 6rem; }
.tier-level-4 .tier-prefix { font-size: 7rem; }
.tier-level-2 .tier-name { font-size: 1.2rem; }
.tier-level-3 .tier-name { font-size: 1.4rem; }
.tier-level-4 .tier-name { font-size: 1.6rem; }

.tier-level-2 { animation: tier-pop-epic 2.5s ease-out forwards; }
.tier-level-3 { animation: tier-pop-epic 3s ease-out forwards; }
.tier-level-4 { animation: tier-pop-epic 3.5s ease-out forwards; }

@keyframes tier-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.8); }
}

@keyframes tier-pop-epic {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); filter: blur(8px); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); filter: blur(0); }
  20% { transform: translate(-50%, -50%) scale(0.95); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

/* Expanding ring effect */
.tier-ring {
  position: fixed;
  top: 38%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
  z-index: 40;
  transform: translate(-50%, -50%);
  animation: tier-ring-expand 1.2s ease-out forwards;
}

@keyframes tier-ring-expand {
  0% { width: 20px; height: 20px; opacity: 0.8; border-width: 3px; }
  100% { width: 300px; height: 300px; opacity: 0; border-width: 1px; }
}

.tier-bounce {
  animation: tier-bounce-anim 0.6s ease-out;
}

.tier-bounce-epic {
  animation: tier-bounce-epic-anim 1s ease-out;
}

@keyframes tier-bounce-anim {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes tier-bounce-epic-anim {
  0% { transform: scale(1); }
  15% { transform: scale(1.6); }
  30% { transform: scale(0.9); }
  45% { transform: scale(1.2); }
  60% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* Heavy screen shake for T+ tiers */
.screen-shake-heavy {
  animation: shake-heavy 0.8s ease-out;
}

@keyframes shake-heavy {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-6px, 4px); }
  20% { transform: translate(5px, -5px); }
  30% { transform: translate(-4px, 3px); }
  40% { transform: translate(6px, -2px); }
  50% { transform: translate(-3px, 5px); }
  60% { transform: translate(4px, -3px); }
  70% { transform: translate(-2px, 2px); }
  80% { transform: translate(1px, -1px); }
}

/* === Memory Toast === */
.memory-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 45;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.1);
  transition: bottom 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.memory-toast.show {
  bottom: 100px;
}

.memory-toast.hide {
  animation: toast-hide 0.5s ease-in forwards;
}

@keyframes toast-hide {
  from { opacity: 1; bottom: 100px; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; bottom: 100px; transform: translateX(-50%) translateY(-30px); }
}

.memory-icon {
  font-size: 1.5rem;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
  flex-shrink: 0;
}

.memory-hint {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.memory-text {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-style: italic;
}

/* === Prestige Memory Toast === */
.memory-toast.prestige-memory {
  border-color: #fbbf24;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(251, 191, 36, 0.25);
}

.memory-toast.prestige-memory .memory-icon {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.memory-toast.prestige-memory .memory-text {
  font-size: 0.85rem;
  color: #fde68a;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

.memory-toast.prestige-memory .memory-hint {
  color: #fbbf24;
}

/* === Memory Collection Items === */
.memory-item {
  padding: 12px 14px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 10px;
  background: var(--bg-primary);
}

.memory-item.collected {
  border-color: rgba(56, 189, 248, 0.2);
}

.memory-item.locked {
  opacity: 0.4;
}

.memory-item-hint {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.memory-item-text {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-style: italic;
}

.memory-item.locked .memory-item-text {
  color: var(--text-muted);
  font-style: normal;
}

/* === Return Orb === */
.return-orb {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-bottom: 20px;
  animation: orb-pulse 2s ease-in-out infinite;
  background: radial-gradient(circle, var(--accent), transparent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.return-orb.medium {
  width: 80px;
  height: 80px;
}

.return-orb.large {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, var(--success), transparent);
  box-shadow: 0 0 50px rgba(74, 222, 128, 0.5);
}

.return-orb.massive {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--warning), rgba(251, 191, 36, 0.3), transparent);
  box-shadow: 0 0 80px rgba(251, 191, 36, 0.5);
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* === Top-right Buttons === */
.top-right-btns {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 25;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font-number);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* === Help Modal === */
#help-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10, 14, 23, 0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#help-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.help-scroll {
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  -webkit-overflow-scrolling: touch;
}

.help-scroll h3 {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 20px;
  text-align: center;
}

.help-section {
  margin-bottom: 18px;
}

.help-section h4 {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.help-section p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.help-warn {
  color: var(--danger) !important;
  margin-top: 4px;
}

.help-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.78rem;
}

.help-list dt {
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.help-list dd {
  color: var(--text-secondary);
  line-height: 1.5;
}

.help-ui-guide {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-ui-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 3px solid var(--bg-tertiary);
}
.help-ui-label {
  min-width: 80px;
  font-family: var(--font-number);
  font-size: 0.85rem;
  text-align: center;
  flex-shrink: 0;
}
.help-ui-desc {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
}
.help-ui-desc strong {
  color: var(--text-primary);
}

.help-close-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
}

.help-close-btn:active {
  background: var(--accent);
  color: var(--bg-primary);
}

/* === Background Glow Evolution === */
#game-container::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-glow, transparent);
  pointer-events: none;
  z-index: 0;
  transition: background 2s;
}

/* === Tutorial (Coach Marks) === */
/* Raise tutorial target + its ancestors above overlay */
.tut-elevated {
  z-index: 65 !important;
  position: relative !important;
}

#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.4s;
}

#tutorial-overlay.active {
  opacity: 1;
}

#tutorial-overlay.leaving {
  opacity: 0;
  pointer-events: none;
}

#tut-spotlight {
  position: fixed;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.82);
  border: 2px solid var(--accent);
  pointer-events: none;
  z-index: 60;
  transition: left 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              top 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

#tut-spotlight.tut-enter {
  animation: tut-glow 2s ease-in-out infinite;
}

@keyframes tut-glow {
  0%, 100% { border-color: var(--accent); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.82), 0 0 16px var(--accent-glow); }
  50% { border-color: #7dd3fc; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.82), 0 0 32px var(--accent-glow); }
}

#tut-tooltip {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  padding: 16px 18px;
  max-width: 320px;
  width: calc(100% - 40px);
  z-index: 70;
  pointer-events: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.1);
  animation: tut-tooltip-in 0.3s ease-out;
}

@keyframes tut-tooltip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#tut-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 10px;
}

#tut-hint {
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 8px;
  animation: tut-hint-pulse 1.5s ease-in-out infinite;
}

@keyframes tut-hint-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

#tut-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#tut-counter {
  font-family: var(--font-number);
  font-size: 0.72rem;
  color: var(--text-muted);
}

#tut-skip {
  background: none;
  border: 1px solid var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.15s;
}

#tut-skip:active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* === Prestige Confirm Modal === */
#prestige-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#prestige-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.prestige-modal-inner {
  width: calc(100% - 48px);
  max-width: 340px;
  background: var(--bg-secondary);
  border: 1.5px solid rgba(192, 132, 252, 0.4);
  border-radius: 16px;
  padding: 28px 24px 20px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow:
    0 0 40px rgba(192, 132, 252, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

#prestige-modal.active .prestige-modal-inner {
  transform: scale(1);
}

.prestige-modal-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  animation: prestige-icon-spin 3s linear infinite;
}

@keyframes prestige-icon-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.prestige-modal-title {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 1.1rem;
  color: #c084fc;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.prestige-modal-body {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.prestige-modal-reward {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 2rem;
  color: #c084fc;
  text-shadow: 0 0 20px rgba(192, 132, 252, 0.5);
  margin-bottom: 4px;
}

.prestige-modal-warn {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.prestige-modal-actions {
  display: flex;
  gap: 10px;
}

.prestige-modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--bg-tertiary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.prestige-modal-btn.cancel {
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.prestige-modal-btn.cancel:active {
  background: var(--bg-tertiary);
}

.prestige-modal-btn.confirm {
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  color: white;
  border-color: #c084fc;
}

.prestige-modal-btn.confirm:active {
  filter: brightness(1.2);
}

/* === Rank Badge === */
#rank-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 2px;
}

#rank-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px var(--rank-glow, transparent));
}

#rank-letter {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--rank-color, #64748b);
  text-shadow: 0 0 12px var(--rank-glow, transparent);
  letter-spacing: 0.05em;
  transition: color 0.3s, text-shadow 0.3s;
}

#rank-title {
  font-size: 0.6rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* === System Window === */
#system-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  min-width: 280px;
  max-width: 360px;
  background: rgba(10, 14, 30, 0.95);
  border: 1.5px solid rgba(56, 140, 248, 0.6);
  border-radius: 4px;
  z-index: 48;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow:
    0 0 20px rgba(56, 140, 248, 0.2),
    0 0 60px rgba(56, 140, 248, 0.1),
    inset 0 0 30px rgba(56, 140, 248, 0.05);
}

#system-window.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.sys-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(56, 140, 248, 0.3);
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 0.75rem;
  color: rgba(56, 180, 248, 0.9);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.sys-icon {
  color: rgba(56, 180, 248, 0.7);
  font-size: 0.6rem;
  animation: sys-icon-pulse 2s ease-in-out infinite;
}

@keyframes sys-icon-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.sys-body {
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.6;
  text-align: center;
}

.sys-body .sys-highlight {
  color: #38bdf8;
  font-weight: 700;
  font-family: var(--font-number);
}

.sys-body .sys-value {
  display: block;
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 1.8rem;
  color: #38bdf8;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
  margin: 8px 0;
}

.sys-footer {
  padding: 8px 16px 12px;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-number);
  letter-spacing: 0.1em;
}

/* System window scan line effect */
#system-window::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 180, 248, 0.6), transparent);
  animation: sys-scan 2s linear infinite;
}

@keyframes sys-scan {
  0% { top: 0; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* === Rank Up Overlay === */
#rankup-overlay {
  position: fixed;
  inset: 0;
  z-index: 52;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

#rankup-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.rankup-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(56, 180, 248, 0.3), transparent 70%);
  animation: rankup-flash-anim 1.5s ease-out;
}

@keyframes rankup-flash-anim {
  0% { opacity: 0; transform: scale(0.5); }
  30% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.3; transform: scale(1); }
}

.rankup-content {
  text-align: center;
  z-index: 1;
}

.rankup-pre {
  font-family: var(--font-number);
  font-size: 0.8rem;
  color: rgba(56, 180, 248, 0.7);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 12px;
  animation: rankup-pre-in 0.6s ease-out;
}

@keyframes rankup-pre-in {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.rankup-letter {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 8rem;
  line-height: 1;
  color: var(--rank-color, #38bdf8);
  text-shadow:
    0 0 40px var(--rank-glow, rgba(56, 189, 248, 0.6)),
    0 0 80px var(--rank-glow, rgba(56, 189, 248, 0.3));
  animation: rankup-letter-in 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rankup-letter-in {
  0% { opacity: 0; transform: scale(3) rotate(-5deg); filter: blur(10px); }
  50% { opacity: 1; transform: scale(0.9) rotate(0); filter: blur(0); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.rankup-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  letter-spacing: 0.2em;
  margin-top: 8px;
  animation: rankup-title-in 0.8s 0.3s ease-out both;
}

@keyframes rankup-title-in {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.rankup-sub {
  font-family: var(--font-number);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 24px;
  letter-spacing: 0.15em;
  animation: rankup-sub-in 0.6s 0.8s ease-out both;
}

@keyframes rankup-sub-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Screen shake */
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-4px, 2px); }
  20% { transform: translate(4px, -2px); }
  30% { transform: translate(-3px, -3px); }
  40% { transform: translate(3px, 3px); }
  50% { transform: translate(-2px, 1px); }
  60% { transform: translate(2px, -1px); }
  70% { transform: translate(-1px, 2px); }
  80% { transform: translate(1px, -2px); }
  90% { transform: translate(-1px, -1px); }
}

.screen-shake {
  animation: screen-shake 0.5s ease-out;
}

/* Rank colors */
.rank-E { --rank-color: #64748b; --rank-glow: rgba(100, 116, 139, 0.3); }
.rank-D { --rank-color: #4ade80; --rank-glow: rgba(74, 222, 128, 0.4); }
.rank-C { --rank-color: #38bdf8; --rank-glow: rgba(56, 189, 248, 0.4); }
.rank-B { --rank-color: #a78bfa; --rank-glow: rgba(167, 139, 250, 0.4); }
.rank-A { --rank-color: #fbbf24; --rank-glow: rgba(251, 191, 36, 0.5); }
.rank-S { --rank-color: #f97316; --rank-glow: rgba(249, 115, 22, 0.5); }
.rank-SS { --rank-color: #f43f5e; --rank-glow: rgba(244, 63, 94, 0.5); }
.rank-SSS { --rank-color: #e879f9; --rank-glow: rgba(232, 121, 249, 0.6); }
.rank-EX {
  --rank-color: #22d3ee; --rank-glow: rgba(34, 211, 238, 0.7);
}
.rank-EX #rank-letter {
  text-shadow: 0 0 12px rgba(34,211,238,0.8), 0 0 24px rgba(34,211,238,0.4);
}
.rank-INF {
  --rank-color: #facc15; --rank-glow: rgba(250, 204, 21, 0.7);
}
.rank-INF #rank-letter {
  text-shadow: 0 0 16px rgba(250,204,21,0.9), 0 0 32px rgba(250,204,21,0.5);
  animation: rank-inf-pulse 1.5s ease-in-out infinite;
}
@keyframes rank-inf-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}
.rank-ABYSS {
  --rank-color: #ff0044; --rank-glow: rgba(255, 0, 68, 0.8);
}
.rank-ABYSS #rank-letter {
  background: linear-gradient(135deg, #ff0044, #e879f9, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(255,0,68,0.6));
  animation: rank-abyss-shift 3s ease-in-out infinite;
}
@keyframes rank-abyss-shift {
  0% { filter: drop-shadow(0 0 8px rgba(255,0,68,0.6)) hue-rotate(0deg); }
  50% { filter: drop-shadow(0 0 16px rgba(232,121,249,0.8)) hue-rotate(30deg); }
  100% { filter: drop-shadow(0 0 8px rgba(255,0,68,0.6)) hue-rotate(0deg); }
}

/* New ranks beyond Abyss */
.rank-VOID {
  --rank-color: #6366f1; --rank-glow: rgba(99, 102, 241, 0.8);
}
.rank-VOID #rank-letter {
  background: linear-gradient(135deg, #6366f1, #312e81);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(99,102,241,0.7));
  animation: rank-void-pulse 2.5s ease-in-out infinite;
}
@keyframes rank-void-pulse {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(99,102,241,0.7)); opacity: 1; }
  50% { filter: drop-shadow(0 0 20px rgba(99,102,241,0.9)); opacity: 0.85; }
}

.rank-PRIMORDIAL {
  --rank-color: #d946ef; --rank-glow: rgba(217, 70, 239, 0.8);
}
.rank-PRIMORDIAL #rank-letter {
  background: linear-gradient(135deg, #d946ef, #f97316, #facc15);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(217,70,239,0.8));
  animation: rank-primordial-shift 4s ease-in-out infinite;
}
@keyframes rank-primordial-shift {
  0% { filter: drop-shadow(0 0 14px rgba(217,70,239,0.8)) hue-rotate(0deg); }
  33% { filter: drop-shadow(0 0 20px rgba(249,115,22,0.9)) hue-rotate(40deg); }
  66% { filter: drop-shadow(0 0 18px rgba(250,204,21,0.8)) hue-rotate(80deg); }
  100% { filter: drop-shadow(0 0 14px rgba(217,70,239,0.8)) hue-rotate(0deg); }
}

.rank-SINGULARITY {
  --rank-color: #ffffff; --rank-glow: rgba(255, 255, 255, 0.9);
}
.rank-SINGULARITY #rank-letter {
  color: #fff;
  text-shadow: 0 0 20px #fff, 0 0 40px rgba(255,255,255,0.6), 0 0 60px rgba(200,200,255,0.3);
  animation: rank-singularity-glow 2s ease-in-out infinite;
}
@keyframes rank-singularity-glow {
  0%, 100% { text-shadow: 0 0 20px #fff, 0 0 40px rgba(255,255,255,0.6); }
  50% { text-shadow: 0 0 30px #fff, 0 0 60px rgba(255,255,255,0.8), 0 0 80px rgba(200,200,255,0.4); }
}

.rank-NULL {
  --rank-color: #000000; --rank-glow: rgba(100, 100, 100, 0.5);
}
.rank-NULL #rank-letter {
  background: linear-gradient(135deg, #1a1a2e, #0f0f23, #16213e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(100,100,100,0.5));
  animation: rank-null-flicker 3s steps(4) infinite;
}
@keyframes rank-null-flicker {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 8px rgba(100,100,100,0.5)); }
  25% { opacity: 0.6; filter: drop-shadow(0 0 4px rgba(50,50,50,0.3)); }
  50% { opacity: 0.9; filter: drop-shadow(0 0 12px rgba(150,150,150,0.6)); }
  75% { opacity: 0.7; filter: drop-shadow(0 0 6px rgba(80,80,80,0.4)); }
}

/* Entropy bar (Abyssal Resonance) */
#entropy-container {
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#entropy-bar {
  flex: 1;
  height: 8px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
#entropy-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #d946ef, #ef4444);
  border-radius: 4px;
  transition: width 0.3s ease;
}
#entropy-label {
  font-size: 0.65rem;
  color: #c084fc;
  white-space: nowrap;
  min-width: 90px;
}
.release-btn {
  background: linear-gradient(135deg, #6366f1, #d946ef);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  animation: release-pulse 1.5s ease-in-out infinite;
}
@keyframes release-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 16px rgba(217, 70, 239, 0.7); }
}

/* Resonance button */
.resonance-btn {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(217,70,239,0.2)) !important;
  border-color: #6366f1 !important;
}
.resonance-btn:not(:disabled):hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.4), rgba(217,70,239,0.4)) !important;
}
.resonance-btn.resonance-active {
  animation: resonance-btn-glow 2s ease-in-out infinite;
}
@keyframes resonance-btn-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(99,102,241,0.3); }
  50% { box-shadow: 0 0 16px rgba(217,70,239,0.5); }
}

/* Rank badge pulse on rank-up */
#rank-badge.rank-pulse #rank-letter {
  animation: rank-pulse-anim 1s ease-out;
}

@keyframes rank-pulse-anim {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* === Responsive === */
@media (min-width: 768px) {
  #game-container {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--bg-tertiary);
    border-right: 1px solid var(--bg-tertiary);
  }

  #thought-value {
    font-size: 2.5rem;
  }

  #upgrade-panel {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }

  #upgrade-panel.open {
    transform: translateX(-50%) translateY(0);
  }
}

/* Small phones */
@media (max-height: 680px) {
  #top-bar { padding: 8px 12px; }
  #thought-value { font-size: 1.6rem; }
  .action-btn { padding: 10px 8px; font-size: 0.8rem; }
  #bottom-bar { padding: 6px 12px 12px; }
}

/* === Activity Log === */
#activity-log {
  padding: 0 16px;
  max-height: 52px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#activity-log::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: linear-gradient(to bottom, var(--bg-primary), transparent);
  z-index: 1;
  pointer-events: none;
}

.activity-msg {
  font-size: 0.65rem;
  font-family: var(--font-number);
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: activity-in 0.4s ease-out;
  padding: 1px 0;
}

.activity-msg.highlight {
  color: var(--text-secondary);
}

.activity-msg .activity-accent {
  color: var(--accent);
}

.activity-msg .activity-success {
  color: var(--success);
}

.activity-msg .activity-warning {
  color: var(--warning);
}

.activity-msg .activity-ego {
  color: #c084fc;
}

@keyframes activity-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* === Inline Type Selector === */
#type-selector {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 16px;
  min-height: 28px;
}

.type-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 14px;
  border: 1.5px solid var(--bg-tertiary);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.type-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.type-chip.selected {
  border-color: var(--chip-color, var(--accent));
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 15%, var(--bg-secondary));
  color: var(--text-primary);
  box-shadow: 0 0 8px color-mix(in srgb, var(--chip-color, var(--accent)) 30%, transparent);
}

.type-chip:active {
  transform: scale(0.95);
}

/* === Concept Upgrade Panel Styles === */
.concept-upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.concept-upgrade-btn.affordable {
  border-color: var(--accent);
}

.concept-upgrade-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.concept-upgrade-btn .tier-badge {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: bold;
  margin-right: 8px;
  flex-shrink: 0;
}

.concept-upgrade-btn .tier-badge.t1 { background: #1e3a5f; color: #38bdf8; }
.concept-upgrade-btn .tier-badge.t2 { background: #3b1f5e; color: #c084fc; }
.concept-upgrade-btn .tier-badge.t3 { background: #5e3b1f; color: #fbbf24; }
.concept-upgrade-btn .tier-badge.t4 { background: #1f5e3b; color: #4ade80; }
.concept-upgrade-btn .tier-badge.t5 {
  background: linear-gradient(135deg, #5e1f3b, #3d0f25);
  color: #f472b6;
  box-shadow: 0 0 6px rgba(244,114,182,0.3);
}
.concept-upgrade-btn .tier-badge.t6 {
  background: linear-gradient(135deg, #5e4a1f, #3d2f0f);
  color: #fcd34d;
  box-shadow: 0 0 8px rgba(252,211,77,0.4);
  animation: tier6-shimmer 2s ease-in-out infinite;
}
@keyframes tier6-shimmer {
  0%, 100% { box-shadow: 0 0 8px rgba(252,211,77,0.4); }
  50% { box-shadow: 0 0 16px rgba(252,211,77,0.7); }
}

/* T5+ Upgrade celebration */
.concept-celebrate {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: celebrate-fade 2.5s ease-out forwards;
}
.concept-celebrate-tier {
  font-family: var(--font-number);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0;
  animation: celebrate-slide-in 0.6s 0.2s ease-out forwards;
}
.concept-celebrate-name {
  font-family: var(--font-number);
  font-size: 2rem;
  font-weight: 900;
  text-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
  opacity: 0;
  transform: scale(0.5);
  animation: celebrate-pop 0.5s 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.concept-celebrate-level {
  font-family: var(--font-number);
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 8px;
  opacity: 0;
  animation: celebrate-slide-in 0.5s 0.7s ease-out forwards;
}
@keyframes celebrate-fade {
  0% { background: rgba(5,8,18,0.6); }
  70% { background: rgba(5,8,18,0.6); }
  100% { background: transparent; }
}
@keyframes celebrate-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes celebrate-pop {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

/* Safe area for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  #top-bar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  #bottom-bar {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .top-right-btns {
    top: calc(10px + env(safe-area-inset-top));
  }
}

/* === Mutation System === */

/* Helix Fragment currency icon */
.helix-icon {
  background: linear-gradient(135deg, #c084fc, #38bdf8);
  box-shadow: 0 0 6px rgba(192, 132, 252, 0.5);
}

/* Mutation button in action bar */
.mutation-btn {
  background: linear-gradient(135deg, #1a1040, #0a1830) !important;
  border-color: rgba(192, 132, 252, 0.4) !important;
  color: #c084fc !important;
  position: relative;
  overflow: hidden;
}

.mutation-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(192,132,252,0.08), rgba(56,189,248,0.08));
  pointer-events: none;
}

.mutation-btn:active:not(:disabled) {
  background: linear-gradient(135deg, #c084fc, #38bdf8) !important;
  color: var(--bg-primary) !important;
}

/* Convert Ego to Helix button */
.mutation-convert-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1.5px dashed rgba(192, 132, 252, 0.3);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(192,132,252,0.05), rgba(56,189,248,0.05));
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mutation-convert-btn.affordable {
  border-color: rgba(192, 132, 252, 0.6);
  color: var(--text-primary);
}

.mutation-convert-btn.affordable:active {
  background: rgba(192, 132, 252, 0.15);
}

.mutation-convert-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mutation-helix-icon {
  font-size: 1.2rem;
}

/* Mutation item */
.mutation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  margin-bottom: 8px;
  border: 1.5px solid var(--bg-tertiary);
  border-radius: 12px;
  background: var(--bg-primary);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.mutation-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* Tier coloring */
.mutation-tier-1::before { background: linear-gradient(135deg, rgba(56,189,248,0.05), transparent); }
.mutation-tier-2::before { background: linear-gradient(135deg, rgba(192,132,252,0.05), transparent); }
.mutation-tier-3::before { background: linear-gradient(135deg, rgba(251,191,36,0.05), transparent); }

.mutation-item::before { opacity: 1; }

.mutation-item.affordable {
  cursor: pointer;
}

.mutation-item.affordable.mutation-tier-1 { border-color: rgba(56,189,248,0.5); }
.mutation-item.affordable.mutation-tier-2 { border-color: rgba(192,132,252,0.5); }
.mutation-item.affordable.mutation-tier-3 { border-color: rgba(251,191,36,0.5); }

.mutation-item.affordable:active {
  transform: scale(0.98);
}

/* Unlocked mutation glow */
.mutation-item.unlocked {
  border-color: rgba(192,132,252,0.3);
}

.mutation-item.unlocked.mutation-tier-1 {
  box-shadow: 0 0 12px rgba(56,189,248,0.15), inset 0 0 20px rgba(56,189,248,0.05);
  border-color: rgba(56,189,248,0.4);
}

.mutation-item.unlocked.mutation-tier-2 {
  box-shadow: 0 0 12px rgba(192,132,252,0.15), inset 0 0 20px rgba(192,132,252,0.05);
  border-color: rgba(192,132,252,0.4);
}

.mutation-item.unlocked.mutation-tier-3 {
  box-shadow: 0 0 16px rgba(251,191,36,0.2), inset 0 0 20px rgba(251,191,36,0.05);
  border-color: rgba(251,191,36,0.4);
  animation: mutation-gold-glow 3s ease-in-out infinite;
}

@keyframes mutation-gold-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(251,191,36,0.15), inset 0 0 20px rgba(251,191,36,0.05); }
  50% { box-shadow: 0 0 20px rgba(251,191,36,0.25), inset 0 0 30px rgba(251,191,36,0.08); }
}

/* Mutation badge icon */
.mutation-badge-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  transition: filter 0.3s;
}

.mutation-item:not(.unlocked):not(.affordable) .mutation-badge-icon {
  filter: grayscale(1) brightness(0.4);
}

.mutation-item.unlocked .mutation-badge-icon {
  filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.4));
}

/* Tier badge (legacy, kept for compatibility) */
.mutation-tier-badge {
  display: none;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 6px;
  font-family: var(--font-number);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mutation-tier-badge.tier-1 {
  background: linear-gradient(135deg, #1e3a5f, #0f2640);
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56,189,248,0.2);
}

.mutation-tier-badge.tier-2 {
  background: linear-gradient(135deg, #3b1f5e, #250f3d);
  color: #c084fc;
  box-shadow: 0 0 8px rgba(192,132,252,0.2);
}

.mutation-tier-badge.tier-3 {
  background: linear-gradient(135deg, #5e3b1f, #3d250f);
  color: #fbbf24;
  box-shadow: 0 0 8px rgba(251,191,36,0.2);
}

/* Mutation info */
.mutation-info {
  flex: 1;
  min-width: 0;
}

.mutation-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.mutation-item:not(.unlocked):not(.affordable) .mutation-name {
  color: var(--text-secondary);
}

.mutation-desc {
  font-size: 0.65rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Mutation status */
.mutation-status {
  text-align: right;
  flex-shrink: 0;
}

.mutation-active {
  font-family: var(--font-number);
  font-size: 0.7rem;
  font-weight: 700;
  color: #4ade80;
  text-shadow: 0 0 8px rgba(74,222,128,0.4);
  letter-spacing: 0.05em;
}

.mutation-cost {
  font-family: var(--font-number);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.mutation-item.affordable .mutation-cost {
  color: #c084fc;
  text-shadow: 0 0 6px rgba(192,132,252,0.3);
}

/* Swap mode button */
.mutation-swap-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  border: 1.5px solid rgba(192,132,252,0.4);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(192,132,252,0.1), rgba(56,189,248,0.1));
  color: #c084fc;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.mutation-swap-btn:active {
  background: rgba(192,132,252,0.2);
  transform: scale(0.97);
}

/* === Pathology Challenge System === */

/* Codex Button */
.codex-btn {
  background: linear-gradient(135deg, #1e2a45, #1b2e3e) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.codex-btn:active:not(:disabled) {
  background: var(--accent) !important;
  color: var(--bg-primary) !important;
}

/* Pathology Banner */
#pathology-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11;
  padding: 4px 16px;
  background: linear-gradient(90deg, rgba(248,113,113,0.15), rgba(248,113,113,0.05));
  border-bottom: 1px solid rgba(248,113,113,0.3);
  font-family: var(--font-number);
  font-size: 0.65rem;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
}

.pathology-banner-name {
  color: #f87171;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pathology-banner-progress {
  color: var(--text-secondary);
}

/* Pathology Modal */
#pathology-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#pathology-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.pathology-modal-inner {
  width: calc(100% - 32px);
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1.5px solid rgba(248, 113, 113, 0.4);
  border-radius: 16px;
  padding: 24px 20px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow:
    0 0 40px rgba(248, 113, 113, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

#pathology-modal.active .pathology-modal-inner {
  transform: scale(1);
}

.pathology-modal-title {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 1rem;
  color: #f87171;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 4px;
}

.pathology-modal-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 16px;
}

/* Pathology Items */
.pathology-item {
  padding: 14px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  background: var(--bg-primary);
  margin-bottom: 10px;
}

.pathology-item.completed {
  border-color: rgba(74, 222, 128, 0.3);
  opacity: 0.8;
}

.pathology-item.active {
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.1);
}

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

.pathology-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.pathology-badge {
  font-family: var(--font-number);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}

.completed-badge {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.active-badge {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
  animation: active-badge-pulse 2s ease-in-out infinite;
}

@keyframes active-badge-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.pathology-constraint {
  font-size: 0.75rem;
  color: #f87171;
  margin-bottom: 4px;
  padding-left: 8px;
  border-left: 2px solid #f87171;
}

.pathology-target {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.pathology-reward {
  font-size: 0.72rem;
  color: #4ade80;
  margin-bottom: 10px;
  font-style: italic;
}

.pathology-start-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #f87171;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(248, 113, 113, 0.05));
  color: #f87171;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.pathology-start-btn:active {
  background: #f87171;
  color: var(--bg-primary);
}

.pathology-abandon-btn {
  display: block;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pathology-abandon-btn:active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* === Codex Modal === */
#codex-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#codex-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.codex-modal-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 75vh;
  overflow-y: auto;
}

.codex-modal-title {
  font-family: var(--font-number);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 4px;
}

.codex-modal-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.codex-filter-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.codex-filter {
  flex: 1;
  padding: 5px 4px;
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.7rem;
  cursor: pointer;
  text-align: center;
}

.codex-filter.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent);
}

.codex-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.codex-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-primary);
  border-left: 3px solid var(--bg-tertiary);
  opacity: 0.4;
}

.codex-item.discovered {
  opacity: 1;
}

.codex-item.rarity-1.discovered { border-left-color: #4ade80; }
.codex-item.rarity-2.discovered { border-left-color: #c084fc; }
.codex-item.rarity-3.discovered {
  border-left-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}

.codex-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.codex-stars {
  font-size: 0.7rem;
}

.codex-item.rarity-1 .codex-stars { color: #4ade80; }
.codex-item.rarity-2 .codex-stars { color: #c084fc; }
.codex-item.rarity-3 .codex-stars { color: #fbbf24; }

.codex-name {
  color: var(--text-primary);
}

.codex-item:not(.discovered) .codex-name {
  color: var(--text-secondary);
}

.codex-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.codex-hint {
  font-style: italic;
  opacity: 0.7;
}
