:root {
  --bg: #10160f;
  --panel: #1a2318;
  --maroon: #5c1a1a;
  --maroon-light: #7a2727;
  --gold: #c9a24b;
  --parchment: #ece2c6;
  --parchment-dim: #cfc4a3;
  --ink: #241c14;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--parchment);
  font-family: 'Cormorant Garamond', Georgia, serif;
}

h1, h2 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--gold);
  margin: 0 0 0.4em;
}

.screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 4vh 5vw;
  animation: fadeIn 0.6s ease;
}
.screen.active {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
}
#screen-title.active,
#screen-done.active {
  display: flex;
  justify-content: center;
}

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

.title-card {
  max-width: 640px;
  text-align: center;
  background: radial-gradient(ellipse at top, var(--panel), var(--bg));
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 3rem 2.5rem;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
}
.title-card h1 { font-size: 2.6rem; letter-spacing: 0.03em; }
.kicker {
  font-family: 'Courier New', monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  font-size: 0.8rem;
}
.subtitle { font-size: 1.2rem; font-style: italic; color: var(--parchment-dim); }

.scene-image {
  flex: 1 1 380px;
  min-width: 300px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--gold);
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
.scene-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-placeholder {
  display: none;
  width: 100%; height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(201,162,75,0.15), transparent 60%),
    linear-gradient(160deg, var(--maroon-light), var(--panel) 60%, var(--bg));
  color: var(--parchment-dim);
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  text-align: center;
  padding: 1rem;
}
.scene-placeholder span { font-size: 3rem; }

.hotspot {
  position: absolute;
  top: 32%; left: 64%;
  width: 18%; height: 18%;
  border-radius: 50%;
  border: 2px dashed var(--gold);
  background: rgba(201,162,75,0.15);
  cursor: pointer;
  animation: pulse 2s infinite;
}
.hotspot:hover { background: rgba(201,162,75,0.3); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,162,75,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(201,162,75,0); }
}

.scene-panel {
  flex: 1 1 420px;
  min-width: 300px;
  max-width: 560px;
}
.location {
  font-family: 'Courier New', monospace;
  color: var(--gold);
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.narrative { font-size: 1.15rem; line-height: 1.5; }
.narrative.small { font-size: 1rem; color: var(--parchment-dim); }
.evidence {
  font-family: 'Courier New', monospace;
  background: var(--ink);
  border-left: 3px solid var(--maroon-light);
  padding: 0.8rem 1rem;
  color: var(--parchment);
  font-size: 0.95rem;
}
.cipher {
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  background: var(--ink);
  padding: 0.5rem 1rem;
  display: inline-block;
  border-radius: 3px;
}
.clues { padding-left: 1.2rem; color: var(--parchment-dim); }
.clues li { margin-bottom: 0.5rem; }
.closing { font-style: italic; color: var(--gold); font-size: 1.2rem; margin-top: 1.5rem; }

.hidden { display: none !important; }

.code-entry, .lineup {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.code-entry label, .lineup label {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--parchment-dim);
}
.code-entry input, .lineup select {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  padding: 0.5rem 0.7rem;
  background: var(--ink);
  color: var(--parchment);
  border: 1px solid var(--parchment-dim);
  border-radius: 3px;
}
.code-entry input:focus, .lineup select:focus { outline: none; border-color: var(--gold); }

.btn {
  align-self: flex-start;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  padding: 0.6rem 1.4rem;
  background: var(--maroon);
  color: var(--parchment);
  border: 1px solid var(--gold);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn:hover { background: var(--maroon-light); }

.error-msg {
  display: none;
  color: #d98787;
  font-size: 0.9rem;
  font-style: italic;
}
.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.casefile { border-color: var(--maroon-light); }
