/* ============================================
   MIND GAMES — Futuristic Minimal Interface
   mind.yaslioglu.com
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Inter:wght@200;300;400;600;700;900&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --text-primary: #e8e6e3;
  --text-secondary: #8a8a9a;
  --text-dim: #4a4a5a;
  --accent-red: #ff2d55;
  --accent-blue: #00d4ff;
  --accent-amber: #ffb800;
  --accent-green: #00ff88;
  --accent-purple: #a855f7;
  --border-subtle: rgba(255,255,255,0.06);
  --border-active: rgba(255,255,255,0.12);
  --glow-red: 0 0 30px rgba(255,45,85,0.3);
  --glow-blue: 0 0 30px rgba(0,212,255,0.3);
  --glow-amber: 0 0 30px rgba(255,184,0,0.3);
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* --- Scanline Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* --- Noise Texture --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
}

/* --- Container --- */
.app-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- Screen States --- */
.screen {
  display: none;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

.screen.active {
  display: block;
}

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

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

/* ============================================
   LANDING SCREEN
   ============================================ */

.landing-logo {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.landing-logo .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-red);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,45,85,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 8px rgba(255,45,85,0); }
}

.landing-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fff 0%, #888 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 16px;
}

.landing-warning {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-red);
  letter-spacing: 0.05em;
  margin-bottom: 48px;
  padding: 12px 16px;
  border-left: 2px solid var(--accent-red);
  background: rgba(255,45,85,0.04);
  line-height: 1.6;
}

.landing-warning .blink {
  animation: blink 1s step-end infinite;
}

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

/* --- CTA Button --- */
.btn-start {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 40px;
  background: transparent;
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-medium);
  overflow: hidden;
}

.btn-start::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,45,85,0.1), rgba(0,212,255,0.1));
  opacity: 0;
  transition: opacity var(--transition-medium);
}

.btn-start:hover {
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
}

.btn-start:hover::before {
  opacity: 1;
}

.btn-start .arrow {
  font-size: 1.2rem;
  transition: transform var(--transition-fast);
}

.btn-start:hover .arrow {
  transform: translateX(4px);
}

/* --- Landing Footer --- */
.landing-footer {
  margin-top: 80px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  line-height: 2;
}

/* ============================================
   LOADING / TRANSITION SCREEN
   ============================================ */

.loading-screen {
  text-align: center;
}

.loading-ring {
  width: 60px;
  height: 60px;
  margin: 0 auto 32px;
  position: relative;
}

.loading-ring::before,
.loading-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 50%;
}

.loading-ring::before {
  border-top-color: var(--accent-red);
  animation: spin 1.2s linear infinite;
}

.loading-ring::after {
  border-bottom-color: var(--accent-blue);
  animation: spin 1.2s linear infinite reverse;
  inset: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
}

.loading-text .dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ============================================
   SCENARIO SCREEN
   ============================================ */

.scenario-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.scenario-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-blue);
}

.scenario-progress {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.progress-bar {
  width: 100%;
  height: 2px;
  background: var(--border-subtle);
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-blue));
  transition: width var(--transition-slow);
  position: relative;
}

.progress-bar .fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  box-shadow: var(--glow-red);
}

/* --- Narrative Text --- */
.narrative {
  margin-bottom: 40px;
}

.narrative-situation {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.narrative-crisis {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
  padding: 20px 24px;
  border-left: 3px solid var(--accent-amber);
  background: rgba(255,184,0,0.04);
  margin-bottom: 8px;
}

/* --- Typewriter Effect --- */
.typewriter {
  overflow: hidden;
  white-space: normal;
  opacity: 0;
}

.typewriter.active {
  opacity: 1;
}

.typewriter .char {
  opacity: 0;
  display: inline;
  animation: charAppear 0.02s forwards;
}

@keyframes charAppear {
  to { opacity: 1; }
}

/* --- Timer Pressure --- */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-red);
}

.timer-bar .timer-icon {
  animation: pulse-dot 1s infinite;
}

.timer-bar .timer-track {
  flex: 1;
  height: 3px;
  background: rgba(255,45,85,0.15);
  border-radius: 2px;
  overflow: hidden;
}

.timer-bar .timer-fill {
  height: 100%;
  background: var(--accent-red);
  border-radius: 2px;
  transition: width 1s linear;
  box-shadow: 0 0 10px rgba(255,45,85,0.5);
}

/* --- Choice Buttons --- */
.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

.choice-btn {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-medium);
  overflow: hidden;
}

.choice-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background var(--transition-fast);
}

.choice-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateX(4px);
}

.choice-btn:hover::before {
  background: var(--accent-blue);
}

.choice-btn .choice-key {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-active);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: all var(--transition-fast);
}

.choice-btn:hover .choice-key {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.choice-btn .choice-label {
  flex: 1;
  padding-top: 2px;
}

.choice-btn.selected {
  border-color: var(--accent-blue);
  background: rgba(0,212,255,0.06);
}

.choice-btn.selected::before {
  background: var(--accent-blue);
}

/* --- Framing Hint (subtle manipulation) --- */
.framing-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 20px;
  letter-spacing: 0.05em;
  opacity: 0.6;
  font-style: italic;
}

/* ============================================
   REPORT / MIRROR SCREEN
   ============================================ */

.report-screen {
  padding-bottom: 80px;
}

.report-header {
  text-align: center;
  margin-bottom: 56px;
}

.report-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent-red);
  margin-bottom: 16px;
}

.report-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.report-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* --- MQ Score --- */
.mq-container {
  text-align: center;
  margin: 48px 0;
  padding: 40px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.mq-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.mq-score {
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 900;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mq-score.high {
  background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mq-score.mid {
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mq-rank {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
}

/* --- Bias Cards --- */
.biases-section {
  margin: 48px 0;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.bias-card {
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: all var(--transition-medium);
}

.bias-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.bias-card .bias-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.bias-card .bias-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.bias-card .bias-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.bias-card .bias-evidence {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-amber);
  padding: 8px 12px;
  background: rgba(255,184,0,0.06);
  border-left: 2px solid var(--accent-amber);
  line-height: 1.6;
}

/* --- Metrics Radar --- */
.metrics-section {
  margin: 48px 0;
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.metric-label {
  flex-shrink: 0;
  width: 200px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.metric-track {
  flex: 1;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.metric-fill.low { background: var(--accent-red); }
.metric-fill.mid { background: var(--accent-amber); }
.metric-fill.high { background: var(--accent-green); }

.metric-value {
  flex-shrink: 0;
  width: 40px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

/* --- Verdict Section --- */
.verdict-section {
  margin: 48px 0;
  padding: 32px;
  border: 1px solid var(--accent-red);
  background: rgba(255,45,85,0.04);
  position: relative;
}

.verdict-section::before {
  content: '// CRITICAL_ASSESSMENT';
  position: absolute;
  top: -10px;
  left: 24px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--accent-red);
  background: var(--bg-primary);
  padding: 0 8px;
}

.verdict-quote {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.7;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 16px;
}

.verdict-advice {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 16px;
  border-left: 2px solid var(--accent-blue);
}

/* --- Restart Button --- */
.restart-section {
  text-align: center;
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border-subtle);
}

.btn-restart {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  background: transparent;
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-medium);
}

.btn-restart:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--glow-blue);
}

/* ============================================
   GLITCH EFFECT
   ============================================ */

.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch::before {
  animation: glitch-1 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  -webkit-text-fill-color: var(--accent-red);
  opacity: 0.8;
}

.glitch::after {
  animation: glitch-2 3s infinite linear alternate-reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  -webkit-text-fill-color: var(--accent-blue);
  opacity: 0.8;
}

@keyframes glitch-1 {
  0%, 90%, 100% { transform: none; }
  92% { transform: translate(2px, -1px); }
  94% { transform: translate(-2px, 1px); }
  96% { transform: translate(1px, 2px); }
  98% { transform: translate(-1px, -2px); }
}

@keyframes glitch-2 {
  0%, 90%, 100% { transform: none; }
  91% { transform: translate(-2px, 1px); }
  93% { transform: translate(2px, -1px); }
  95% { transform: translate(-1px, -2px); }
  97% { transform: translate(1px, 2px); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .app-container {
    padding: 24px 16px;
  }

  .landing-title {
    font-size: 2.2rem;
  }

  .choice-btn {
    padding: 16px 18px;
    font-size: 0.88rem;
  }

  .metric-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .metric-label {
    width: auto;
  }

  .metric-track {
    width: 100%;
  }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

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

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

/* --- Vignette for atmosphere --- */
.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
  z-index: 9997;
}

/* --- Heartbeat for time pressure --- */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  56% { transform: scale(1); }
}

.heartbeat {
  animation: heartbeat 1.2s ease-in-out infinite;
}

/* --- Decision flash --- */
@keyframes decisionFlash {
  0% { opacity: 0; }
  10% { opacity: 1; background: rgba(0,212,255,0.08); }
  100% { opacity: 0; background: transparent; }
}

.decision-flash {
  animation: decisionFlash 0.8s ease-out forwards;
}