/* Kreivi Dickin kartano — Dick Johnson brand: dark UI, red accent, Oswald/Poppins.
   Candlelit gothic palette for the card chrome. Portrait phones first. */

@font-face { font-family: Oswald;  font-weight: 700; font-display: swap; src: url("../assets/fonts/oswald-700.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url("../assets/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url("../assets/fonts/poppins-700.woff2") format("woff2"); }

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

:root {
  --bg: #101010;
  --card: rgba(16, 10, 24, 0.88);   /* deep purple-black, lets the milieu glow through */
  --text: #ffffff;
  --muted: #b9a9cc;
  --accent: #ff1818;               /* dickjohnson.fi primary button red */
  --accent-dark: #d42110;
  --line: #3a2a4d;
  --candle: #f2b134;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  display: flex;
  justify-content: center;
}

#app { width: 100%; max-width: 480px; min-width: 0; min-height: 100dvh; display: flex; }

/* flex items default to min-width:auto, which lets a wide sprite blow the column past the viewport */
.screen, .stage, .card, .sprite { min-width: 0; }
body { overflow-x: hidden; }

/* the milieu: engine sets background-image inline from assets/bg/<name>.webp */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 24px;
  background: var(--bg) center top / cover no-repeat;
  animation: fade-in 0.35s ease both;
}
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* language switcher (hidden by the engine while only FI exists) */
.lang-switch { align-self: flex-end; display: flex; gap: 6px; min-height: 0; }
.lang-btn {
  background: rgba(0,0,0,0.45); color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.lang-btn.active { color: #fff; border-color: var(--accent); background: var(--accent-dark); }

/* sprite stage: hero alone, or host character + hero side by side */
.stage { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; min-height: 180px; padding: 8px 0; }
.sprite {
  display: block; width: auto; height: auto;
  max-height: 36dvh; max-width: 62%;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.55));
}
.stage.duo .sprite.host { max-width: 58%; max-height: 38dvh; }
.stage.duo .sprite.hero { max-width: 36%; max-height: 26dvh; animation: bob 3s ease-in-out infinite; }
.stage:not(.duo) .sprite.hero { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* title screen */
.kicker {
  font-family: Poppins, sans-serif; font-weight: 700; font-size: 11px;
  letter-spacing: 5px; text-transform: uppercase; color: var(--candle);
  text-align: center; margin-top: 4px; text-shadow: 0 0 12px rgba(0,0,0,0.9);
}
.title {
  font-family: Oswald, sans-serif; font-weight: 700; text-transform: uppercase;
  font-size: 40px; line-height: 1.05; letter-spacing: 0.5px; text-align: center;
  margin-top: 10px; color: var(--accent);
  text-shadow: 3px 3px 0 #000, 0 0 30px rgba(255, 24, 24, 0.5);
  transform: rotate(-2deg);
}
.tagline { color: #fff; text-align: center; margin: 10px 0 24px; text-shadow: 0 1px 6px rgba(0,0,0,0.9); }
.title-screen .sprite { filter: drop-shadow(0 0 24px rgba(255, 24, 24, 0.55)) drop-shadow(0 10px 14px rgba(0,0,0,0.6)); }
.title-screen .btn.primary { animation: pulse-red 1.8s ease-in-out infinite; border: 2px solid #000; box-shadow: 4px 4px 0 #000; }
@keyframes pulse-red {
  0%, 100% { box-shadow: 4px 4px 0 #000, 0 0 0 rgba(255,24,24,0.0); }
  50% { box-shadow: 4px 4px 0 #000, 0 0 26px rgba(255,24,24,0.65); }
}

/* card + narration */
.card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.narration { line-height: 1.5; margin-bottom: 6px; white-space: pre-line; }

/* buttons — full width, >=48px tap target; store button style */
.btn {
  display: block; width: 100%; min-height: 48px;
  background: #1f1527; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  font-family: Poppins, sans-serif; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 12px 16px;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn.primary:active { background: var(--accent-dark); }

/* PREP toggles */
.btn.toggle[aria-pressed="true"] { border-color: var(--accent); background: #2e1111; color: #ffc9c9; box-shadow: inset 0 0 0 1px var(--accent); }
.btn.toggle[aria-pressed="true"]::after { content: " ✓"; color: var(--accent); }

/* ending screen */
.the-end { font-family: Oswald, sans-serif; font-size: 15px; font-weight: 700; letter-spacing: 4px; color: var(--accent); text-align: center; }
.code-label { color: var(--muted); font-size: 13px; text-align: center; margin-top: 4px; }
.loot { list-style: none; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.loot li { font-size: 14px; color: var(--candle); }
.loot li::before { content: "✦ "; color: var(--accent); }
.code {
  align-self: center; background: transparent; color: #fff;
  border: 2px dashed var(--accent); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px; font-weight: 700; letter-spacing: 2px;
  padding: 10px 22px; cursor: pointer;
}

@media (min-width: 600px) {
  #app { padding: 24px 0; }
  .screen { border-radius: 20px; }
}
