@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Source+Serif+4:wght@300;400;600&display=swap');

:root {
  --bg: #0d0d0d;
  --surface: #141414;
  --surface2: #1c1c1c;
  --border: #2a2a2a;
  --text: #e8e0d5;
  --text-muted: #8a8078;
  --accent: #c8a96e;
  --accent2: #7a4f3a;
  --error: #c0392b;
}

/* HORROR theme */
body.theme-horror {
  --bg: #0a0505;
  --surface: #120808;
  --surface2: #1a0c0c;
  --border: #3a1515;
  --text: #e8d8d0;
  --text-muted: #8a6060;
  --accent: #c84040;
  --accent2: #7a2020;
}

/* COMEDY theme */
body.theme-comedy {
  --bg: #09100d;
  --surface: #101a14;
  --surface2: #18251c;
  --border: #1e3828;
  --text: #ddebd8;
  --text-muted: #6a9070;
  --accent: #4ecb7a;
  --accent2: #2a7a4a;
}

/* DOCUMENTARY theme */
body.theme-documentary {
  --bg: #080c12;
  --surface: #0e141e;
  --surface2: #151e2a;
  --border: #1e2e42;
  --text: #d0dce8;
  --text-muted: #607888;
  --accent: #5a9fd4;
  --accent2: #2a5a8a;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Serif 4', Georgia, serif;
  min-height: 100vh;
  line-height: 1.7;
}

/* SCREENS */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* FBI WARNING */
#fbi-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fbi-flicker 0.15s ease;
}
@keyframes fbi-flicker {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  35%  { opacity: 0.4; }
  50%  { opacity: 1; }
  70%  { opacity: 0.7; }
  100% { opacity: 1; }
}

#fbi-box {
  background: #0a0a1a;
  border: 3px solid #c8c8e8;
  max-width: 620px;
  width: 100%;
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 0 0 1px #444, inset 0 0 60px rgba(0,0,80,0.4);
}

.fbi-seal {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 1.25rem;
}
.fbi-seal-ring {
  position: absolute;
  inset: 0;
  border: 2px solid #c8c8e8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.fbi-seal-ring span {
  font-size: 0.38rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8c8e8;
  font-weight: 700;
  text-align: center;
  padding: 0 4px;
  line-height: 1.4;
}
.fbi-seal-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #c8c8e8;
}

.fbi-header {
  border-top: 2px solid #c8c8e8;
  border-bottom: 2px solid #c8c8e8;
  padding: 0.4rem 0;
  margin-bottom: 1.5rem;
}
.fbi-label {
  font-family: 'Arial Narrow', Arial, sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  color: #c8c8e8;
  text-transform: uppercase;
}

.fbi-body {
  text-align: left;
  font-size: 0.82rem;
  color: #b0b8d0;
  line-height: 1.75;
}
.fbi-body p { margin-bottom: 0.9rem; }
.fbi-body strong { color: #fff; }
.fbi-body em { color: #c8c8e8; font-style: italic; }

.fbi-fine {
  font-size: 0.75rem;
  color: #707890;
  border-top: 1px solid #2a2a4a;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

#fbi-dismiss {
  margin-top: 1.5rem;
  background: transparent;
  border: 2px solid #c8c8e8;
  color: #c8c8e8;
  font-family: 'Arial Narrow', Arial, sans-serif;
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#fbi-dismiss:hover {
  background: #c8c8e8;
  color: #0a0a1a;
}

/* NAME SCREEN */
#name-screen {
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  background: var(--bg);
}

#map-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: grayscale(80%) brightness(0.45) saturate(0.3);
}

.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, rgba(13,13,13,0.15) 0%, rgba(13,13,13,0.72) 100%);
}

#name-screen .name-box {
  position: relative;
  z-index: 2;
}

.name-box {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.lawn-sign {
  display: inline-flex;
  flex-direction: column;
  background: #f5f0e8;
  color: #1a1a1a;
  border: 3px solid #2a2a2a;
  border-radius: 4px;
  padding: 0.5rem 1.5rem;
  margin-bottom: 2rem;
  font-family: 'Arial Narrow', Arial, sans-serif;
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  box-shadow: 0 4px 0 #8a7a5a, 2px 6px 12px rgba(0,0,0,0.5);
  position: relative;
}
.lawn-sign span:first-child { font-size: 1rem; color: #8b1a1a; }
.sign-sub { color: #444; font-size: 0.6rem; }

h1 {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
  line-height: 1.5;
}

.form-group {
  text-align: left;
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.form-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent); }

.error-box {
  background: rgba(192,57,43,0.12);
  border: 1px solid var(--error);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: #e8a090;
  text-align: left;
  line-height: 1.6;
}
.hidden { display: none !important; }

.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  padding: 0.85rem 2rem;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: #d4b878; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.disclaimer {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 1.5rem;
  opacity: 0.6;
}

/* LOADING SCREEN */
#loading-screen {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
}
.loading-content { text-align: center; }
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: var(--text-muted); font-size: 0.9rem; font-style: italic; }

/* STORY SCREEN */
#story-screen {
  flex-direction: column;
  padding: 0;
}

.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }

.genre-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
}
.genre-horror { background: rgba(200,64,64,0.15); color: #e07070; border: 1px solid #c84040; }
.genre-comedy { background: rgba(78,203,122,0.15); color: #70e098; border: 1px solid #4ecb7a; }
.genre-documentary { background: rgba(90,159,212,0.15); color: #80b8e0; border: 1px solid #5a9fd4; }

.scenario-title {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.story-container {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

#story-log { margin-bottom: 2rem; }

.story-segment {
  margin-bottom: 2rem;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.story-segment p {
  margin-bottom: 1em;
  font-size: 1.05rem;
  line-height: 1.85;
}

.player-action {
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--accent);
  font-style: italic;
  border-radius: 0 4px 4px 0;
  animation: fadeIn 0.3s ease;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
  opacity: 0.5;
}

/* CHOICES */
#choices-area { margin-top: 1rem; }

.choice-grid {
  display: grid;
  gap: 0.75rem;
}

.choice-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.85rem 1rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.choice-btn:hover { border-color: var(--accent); background: rgba(200,169,110,0.06); }
.choice-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.choice-label {
  font-weight: 700;
  color: var(--accent);
  min-width: 1.2rem;
  font-family: 'Playfair Display', serif;
}

#free-text-area {
  margin-top: 0.5rem;
}
#free-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 4px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}
.free-text-actions { display: flex; gap: 0.75rem; }

/* TURN LOADING */
.turn-loading {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}
.dot-pulse { display: flex; gap: 6px; align-items: center; }
.dot-pulse span {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ENDING */
.ending-card {
  text-align: center;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.ending-label {
  font-family: 'Playfair Display', serif;
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.1em;
}
.ending-card .btn-primary {
  width: auto;
  padding: 0.85rem 2.5rem;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  h1 { font-size: 2.2rem; }
  .story-container { padding: 1.5rem 1rem 3rem; }
  .story-segment p { font-size: 1rem; }
}
