/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --text: #e0e0e0;
  --text-dim: #888888;
  --border: #444444;
  --panel-bg: rgba(10, 10, 15, 0.92);
  --pixel-border: #5a5a7a;
  --pixel-border-light: #8a8aaa;
  --pixel-border-dark: #2a2a3e;

  --founder-main: #FF4444;
  --founder-sub: #FF8800;
  --hype-color: #FF4444;
  --credibility-color: #44AAFF;
  --product-color: #44FF88;

  --vc-main: #6644FF;
  --vc-sub: #4488FF;
  --conviction-color: #FFD700;
  --reputation-color: #6644FF;
  --diligence-color: #44FFCC;

  --accent: var(--founder-main);
  --accent-sub: var(--founder-sub);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  image-rendering: pixelated;
}

#game-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ===== PIXEL BORDER MIXIN (via box-shadow) ===== */
.pixel-box {
  border: 3px solid var(--pixel-border);
  box-shadow:
    inset 2px 2px 0 var(--pixel-border-light),
    inset -2px -2px 0 var(--pixel-border-dark),
    3px 3px 0 rgba(0,0,0,0.5);
  background: var(--panel-bg);
}

/* ===== TITLE SCREEN ===== */
.title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 20px;
  text-align: center;
  gap: 20px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,68,68,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 70%, rgba(102,68,255,0.06) 0%, transparent 60%),
    var(--bg);
}

.title-main {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  line-height: 1.8;
  color: var(--founder-main);
  text-shadow:
    0 0 20px rgba(255, 68, 68, 0.4),
    2px 2px 0 #880000;
  letter-spacing: 2px;
}

.title-sub {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #d0d0d0;
  line-height: 1.8;
  letter-spacing: 1px;
}

.title-tagline {
  font-size: 14px;
  color: #c0c0c0;
  line-height: 1.7;
  max-width: 340px;
}

.title-vs {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--text-dim);
  margin: 4px 0;
}

/* ===== ROLE SELECT ===== */
.role-select {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.role-card {
  background: var(--panel-bg);
  border: 3px solid var(--border);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  text-align: left;
  min-height: 48px;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.05),
    inset -2px -2px 0 rgba(0,0,0,0.3),
    3px 3px 0 rgba(0,0,0,0.4);
  font-family: inherit;
}

.role-card:hover {
  transform: translateY(-1px);
}

.role-card:active {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 0 rgba(0,0,0,0.3),
    inset -2px -2px 0 rgba(255,255,255,0.05),
    1px 1px 0 rgba(0,0,0,0.4);
}

.role-card.founder { border-color: var(--founder-main); }
.role-card.founder:hover { border-color: var(--founder-sub); }
.role-card.vc { border-color: var(--vc-main); }
.role-card.vc:hover { border-color: var(--vc-sub); }

.role-card .role-emoji {
  font-size: 28px;
  margin-bottom: 6px;
}

.role-card .role-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.role-card.founder .role-name { color: var(--founder-main); }
.role-card.vc .role-name { color: var(--vc-main); }

.role-card .role-quote {
  font-size: 13px;
  color: #b0b0b0;
  line-height: 1.7;
  font-style: italic;
  margin-bottom: 6px;
}

.role-card .role-difficulty {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #a0a0a0;
}

/* ===== DISCLAIMER ===== */
.disclaimer {
  font-size: 12px;
  color: #999;
  max-width: 380px;
  line-height: 1.7;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
}

/* ===== GAME SCREEN ===== */
.game-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ===== STAT BAR (pixel style) ===== */
.stat-bar-container {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0a0a12;
  border-bottom: 3px solid var(--pixel-border);
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  box-shadow: 0 3px 0 rgba(0,0,0,0.4);
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
}

.stat-label {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-label .stat-emoji { font-size: 13px; }

.stat-label .stat-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--text);
}

.stat-track {
  width: 100%;
  height: 10px;
  background: #0a0a1e;
  border: 2px solid var(--pixel-border-dark);
  box-shadow: inset 1px 1px 0 rgba(0,0,0,0.5);
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  transition: width 0.5s ease;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}

/* ===== STAT POPUP ===== */
.stat-popup {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  font-weight: bold;
  animation: statPopup 1.2s ease forwards;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #000;
}

.stat-popup.positive { color: #44FF88; }
.stat-popup.negative { color: #FF4444; }

@keyframes statPopup {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  70% { opacity: 1; transform: translateX(-50%) translateY(-18px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-26px); }
}

/* ===== BACKGROUND SCENE ===== */
.scene-area {
  position: relative;
  width: 100%;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 3px solid var(--pixel-border-dark);
}

.scene-elements {
  font-size: 32px;
  letter-spacing: 12px;
  opacity: 0.6;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.scene-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  position: absolute;
  bottom: 6px;
  right: 8px;
}

.scene-character {
  font-size: 56px;
  margin-top: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
  animation: charBounce 2s ease infinite;
}

.scene-character canvas {
  image-rendering: pixelated;
  display: block;
}

@keyframes charBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ===== CHAPTER TITLE OVERLAY ===== */
.chapter-title-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: chapterFadeIn 0.6s ease forwards;
  cursor: pointer;
}

.chapter-title-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: var(--accent);
  text-align: center;
  line-height: 2.2;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5), 0 0 20px rgba(255,68,68,0.3);
  padding: 0 20px;
}

.chapter-number {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #c0c0c0;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.chapter-continue-hint {
  font-size: 14px;
  color: #888;
  margin-top: 32px;
  animation: chapterHintBlink 1.5s ease infinite;
}

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

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

/* ===== EVENT AREA ===== */
.event-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ===== NARRATION (pixel RPG style) ===== */
.narration-box {
  font-size: 14px;
  color: #c0c0c0;
  font-style: italic;
  line-height: 1.8;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 2px solid var(--pixel-border-dark);
  cursor: pointer;
}

/* ===== DIALOGUE BOX (Pokemon style) ===== */
.dialogue-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--panel-bg);
  border: 3px solid var(--pixel-border);
  margin: 8px 10px;
  box-shadow:
    inset 2px 2px 0 var(--pixel-border-light),
    inset -2px -2px 0 var(--pixel-border-dark),
    3px 3px 0 rgba(0,0,0,0.5);
  cursor: pointer;
}

.dialogue-portrait {
  font-size: 28px;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a1e;
  border: 2px solid var(--pixel-border-dark);
  box-shadow: inset 1px 1px 0 rgba(0,0,0,0.5);
}

.dialogue-portrait canvas {
  image-rendering: pixelated;
}

.dialogue-content { flex: 1; min-width: 0; }

.dialogue-speaker {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.dialogue-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}

.typing-cursor {
  display: inline-block;
  width: 8px;
  height: 2px;
  background: var(--accent);
  animation: blink 0.5s step-end infinite;
  vertical-align: baseline;
  margin-left: 2px;
}

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

/* ===== CHOICES (pixel buttons) ===== */
.choices-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 16px;
}

.choice-btn {
  background: var(--panel-bg);
  border: 3px solid var(--border);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
  min-height: 48px;
  font-family: inherit;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.04),
    inset -2px -2px 0 rgba(0,0,0,0.2),
    2px 2px 0 rgba(0,0,0,0.3);
}

.choice-btn:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.choice-btn:active {
  box-shadow:
    inset 2px 2px 0 rgba(0,0,0,0.2),
    inset -2px -2px 0 rgba(255,255,255,0.04);
  transform: translate(1px, 1px);
}

/* ===== RESULT BOX ===== */
.result-box {
  padding: 12px 14px;
  margin: 8px 10px;
  background: var(--panel-bg);
  border: 3px solid var(--accent);
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.06),
    inset -2px -2px 0 rgba(0,0,0,0.3),
    3px 3px 0 rgba(0,0,0,0.4);
}

.result-speaker {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.result-text {
  font-size: 15px;
  line-height: 1.8;
}

.continue-btn {
  display: block;
  margin: 10px auto 16px;
  padding: 10px 28px;
  background: transparent;
  border: 3px solid var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  min-height: 48px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  transition: background 0.1s;
}

.continue-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.continue-btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* ===== ENDING SCREEN ===== */
.ending-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
  text-align: center;
  gap: 16px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,0.03) 0%, transparent 70%),
    var(--bg);
}

.ending-header {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  line-height: 1.8;
}

.ending-emoji { font-size: 56px; }

.ending-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--accent);
  line-height: 1.8;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

.ending-description {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  max-width: 340px;
}

.ending-stats {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
  padding: 12px;
  border: 3px solid var(--pixel-border-dark);
  background: rgba(0,0,0,0.3);
  box-shadow: inset 1px 1px 0 rgba(0,0,0,0.3);
}

.ending-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ending-stat-emoji {
  font-size: 14px;
  width: 22px;
}

.ending-stat-track {
  flex: 1;
  height: 10px;
  background: #0a0a1e;
  border: 2px solid var(--pixel-border-dark);
  overflow: hidden;
}

.ending-stat-fill {
  height: 100%;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}

.ending-stat-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  width: 28px;
  text-align: right;
}

.ending-quote {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.7;
  max-width: 300px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(0,0,0,0.2);
}

/* ===== SHARE BUTTONS ===== */
.share-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 4px 0;
}

.share-btn {
  padding: 8px 14px;
  border: 2px solid var(--pixel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  min-height: 36px;
  transition: border-color 0.1s, background 0.1s;
}

.share-btn:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.share-btn:active {
  transform: translate(1px, 1px);
}

.ending-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
  margin-top: 4px;
}

.ending-btn {
  padding: 12px 16px;
  border: 3px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  min-height: 48px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  transition: border-color 0.1s;
}

.ending-btn:hover {
  border-color: var(--accent);
}

.ending-btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.ending-btn.primary {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== GAME OVER ===== */
.gameover-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 20px;
  text-align: center;
  gap: 16px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,0,0,0.06) 0%, transparent 60%),
    var(--bg);
}

.gameover-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #FF4444;
  text-shadow: 2px 2px 0 #880000, 0 0 20px rgba(255, 68, 68, 0.3);
}

.gameover-reason {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ===== SOUND TOGGLE ===== */
.sound-toggle {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 300;
  background: rgba(10, 10, 15, 0.8);
  border: 2px solid var(--pixel-border-dark);
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sound-toggle:hover {
  border-color: var(--pixel-border);
}

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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

/* ===== SCANLINE EFFECT (subtle) ===== */
.game-screen::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: 1000;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 481px) {
  #game-container {
    border-left: 2px solid var(--pixel-border-dark);
    border-right: 2px solid var(--pixel-border-dark);
  }
}

@media (max-width: 360px) {
  .title-main { font-size: 14px; }
  .stat-bar-container { padding: 6px 8px; gap: 6px; }
  .stat-label .stat-value { font-size: 8px; }
  .scene-area { height: 140px; }
  .scene-character { font-size: 44px; }
  .dialogue-box { padding: 10px 12px; }
}
