/* Base Variables & Theme */
:root {
  --bg-color: #0F1219;
  --primary: #64748B;
  --secondary: #94A3B8;
  --accent: #38BDF8;
  --real-color: #10B981; /* Green */
  --ai-color: #8B5CF6;   /* Purple */
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --card-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  overscroll-behavior: none;
}

/* Canvas for Particles */
#effects-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

/* Main Container */
#game-container {
  width: 100%;
  max-width: 500px;
  height: 100%;
  max-height: 800px;
  position: relative;
  overflow: hidden;
  z-index: 10;
  display: flex;
  flex-direction: column;
  will-change: transform; /* For screen shake */
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
  z-index: 10;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.1;
  letter-spacing: -1px;
}

h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

p {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.accent { color: var(--accent); text-shadow: 0 0 10px rgba(56, 189, 248, 0.5); }
.text-real { color: var(--real-color); font-weight: bold; }
.text-ai { color: var(--ai-color); font-weight: bold; }
.hint { font-size: 0.9rem; opacity: 0.7; margin-bottom: 3rem; }

/* Buttons */
.btn {
  padding: 16px 32px;
  border-radius: 12px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  margin-bottom: 16px;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

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

.btn-primary {
  background: var(--accent);
  color: #0F1219;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--primary);
}

.btn-small {
  padding: 10px 20px;
  font-size: 0.9rem;
  max-width: 150px;
}

.btn-icon {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.2);
}

.mt-4 { margin-top: 24px; }
.mt-2 { margin-top: 12px; }

/* Game HUD */
.hud {
  position: absolute;
  top: 20px;
  left: 0;
  width: 100%;
  padding: 0 20px;
}

.stats {
  display: flex;
  justify-content: space-between;
  background: var(--card-bg);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.stat-box {
  font-family: 'JetBrains Mono', monospace;
  font-weight: bold;
  font-size: 1.1rem;
}

#streak-display { color: #F59E0B; }

/* Cards */
#card-container {
  width: 100%;
  perspective: 1000px;
  margin-bottom: 40px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  padding: 24px;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 300ms ease, opacity 300ms ease;
  transform-origin: center bottom;
  will-change: transform;
}

.card-header {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hash {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tag {
  background: rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  line-height: 1.5;
  text-align: center;
  color: #fff;
  margin-top: 20px;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.btn-guess {
  max-width: 100%;
  padding: 20px;
  font-size: 1.2rem;
  color: #fff;
}

.btn-real {
  background: var(--real-color);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.btn-ai {
  background: var(--ai-color);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 300ms ease;
}

.modal.visible {
  display: flex;
  opacity: 1;
}

.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.score-list {
  text-align: left;
  margin-top: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-family: 'JetBrains Mono', monospace;
}

.score-item:nth-child(1) { color: #FFD700; font-weight: bold; font-size: 1.1rem; }
.score-item:nth-child(2) { color: #C0C0C0; font-weight: bold; }
.score-item:nth-child(3) { color: #CD7F32; font-weight: bold; }

/* Name Input */
#name-input-container {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

input[type="text"] {
  width: 80%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  margin-bottom: 16px;
  text-align: center;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Swipe animations classes */
.swipe-left { animation: swipeOutLeft 300ms forwards; }
.swipe-right { animation: swipeOutRight 300ms forwards; }
.slide-in { animation: slideInBottom 300ms forwards; }

@keyframes swipeOutLeft {
  to { transform: translateX(-150%) rotate(-15deg); opacity: 0; }
}
@keyframes swipeOutRight {
  to { transform: translateX(150%) rotate(15deg); opacity: 0; }
}
@keyframes slideInBottom {
  from { transform: translateY(50px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
