:root {
  --ink: #2e2430;
  --muted: #705f72;
  --paper: rgba(255, 253, 249, 0.96);
  --accent: #da6f9d;
  --accent-dark: #a84f75;
  --soft: #f7d9e7;
  --shadow: 0 18px 50px rgba(73, 42, 61, 0.15);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(145deg, #fff7fb, #f8eefc 45%, #fff4e8);
}

button { font: inherit; }
.app-shell { min-height: 100svh; }
.screen { display: none; min-height: 100svh; }
.screen.is-active { display: grid; }
.is-hidden { display: none !important; }

.title-screen {
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 16% 18%, rgba(255,255,255,.92) 0 5%, transparent 6%),
    linear-gradient(145deg, #fff7fb, #f4e4f5 48%, #ffeeda);
}

.paper-card {
  width: min(680px, 100%);
  background: var(--paper);
  border: 1px solid rgba(88, 55, 77, .12);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.title-card {
  text-align: center;
  padding: clamp(34px, 7vw, 72px);
  transform: rotate(-0.35deg);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 5.6rem);
  line-height: .92;
  letter-spacing: -.06em;
}

.title-kicker {
  margin: 10px 0 0;
  color: var(--accent-dark);
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 900;
}

.subtitle {
  max-width: 510px;
  margin: 24px auto 30px;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.22rem);
}

.tiny-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.primary-button,
.next-button,
.choice-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.primary-button {
  padding: 15px 24px;
  color: white;
  background: var(--accent);
  box-shadow: 0 9px 22px rgba(218, 111, 157, .3);
  font-weight: 900;
}

.primary-button:hover,
.next-button:hover,
.choice-button:hover { transform: translateY(-2px); }

.text-button {
  display: block;
  margin: 16px auto 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.game-screen {
  grid-template-rows: auto 1fr;
  padding: 14px;
  gap: 10px;
}

.game-hud {
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-pill,
.hud-button {
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(88,55,77,.12);
  box-shadow: 0 6px 18px rgba(73,42,61,.08);
}

.hud-pill { padding: 8px 13px; }
.hud-button { padding: 8px 13px; cursor: pointer; color: var(--ink); }

.scene {
  position: relative;
  width: min(980px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(330px, 1fr) auto;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(88,55,77,.13);
  background: #f4d9e4;
}

.scene-art {
  position: relative;
  isolation: isolate;
  min-height: 360px;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  transition: background .35s ease;
}

.scene-art::before {
  content: attr(data-symbol);
  position: absolute;
  z-index: -1;
  right: 7%;
  bottom: 4%;
  font-size: clamp(7rem, 26vw, 15rem);
  line-height: 1;
  opacity: .2;
  filter: saturate(.8);
  transform: rotate(-5deg);
}

.scene-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(to top, rgba(37,27,38,.12), transparent 45%);
}

.scene-art[data-theme="bedroom"] { background: linear-gradient(150deg, #ead7df, #d9c7dc 48%, #c2d5e0); }
.scene-art[data-theme="bathroom"] { background: linear-gradient(145deg, #e9f2f4, #c8d8dc 58%, #f3e5dc); }
.scene-art[data-theme="kitchen"] { background: linear-gradient(145deg, #f6e4c9, #e5c4b1 55%, #d5d9c8); }
.scene-art[data-theme="hide"] { background: linear-gradient(155deg, #d9c9d9, #b9c3d1 52%, #d7d0be); }
.scene-art[data-theme="closet"] { background: linear-gradient(145deg, #d1bca9, #a99a92 58%, #c9c3bb); }
.scene-art[data-theme="memories"] { background: linear-gradient(145deg, #f5dfc6, #d7b7c7 48%, #bdceda); }
.scene-art[data-theme="strange"] { background: linear-gradient(145deg, #b6a8b4, #756b7b 58%, #433d48); }
.scene-art[data-theme="security"] { background: linear-gradient(145deg, #66746d, #34423d 52%, #111b18); }
.scene-art[data-theme="door"] { background: linear-gradient(145deg, #d6c7c0, #b4a9ae 55%, #8d95a2); }
.scene-art[data-theme="rain"] { background: linear-gradient(155deg, #9eabb5, #6f8290 52%, #52636d); }
.scene-art[data-theme="cvs"] { background: linear-gradient(145deg, #e8e8dc, #d3d7d4 48%, #a9c4bc); }
.scene-art[data-theme="train"] { background: linear-gradient(145deg, #b8c1c7, #7d8992 52%, #555d65); }
.scene-art[data-theme="corona"] { background: linear-gradient(145deg, #e4d0b4, #c9b07f 50%, #9faf8b); }
.scene-art[data-theme="detectives"] { background: linear-gradient(145deg, #b6a990, #6e716a 52%, #343b3a); }
.scene-art[data-theme="gym"] { background: linear-gradient(145deg, #aeb2b7, #747b82 52%, #434a50); }
.scene-art[data-theme="badchish"] { background: linear-gradient(145deg, #8f6c75, #553c48 55%, #2e2027); }
.scene-art[data-theme="home"] { background: linear-gradient(145deg, #ead9cd, #d7bfc5 55%, #c8cdb8); }
.scene-art[data-theme="birthday"] {
  background:
    radial-gradient(circle at 25% 30%, rgba(255,255,255,.65) 0 4%, transparent 5%),
    radial-gradient(circle at 72% 22%, rgba(255,255,255,.5) 0 3%, transparent 4%),
    linear-gradient(145deg, #ffd9e8, #efb9d1 48%, #f9ddbd);
}

.scene-label {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 18px;
  max-width: calc(100% - 36px);
  padding: 8px 12px;
  background: rgba(255,255,255,.88);
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  box-shadow: 0 4px 18px rgba(52,35,48,.08);
}

.hotspot {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.95);
  background: rgba(218,111,157,.9);
  color: white;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(52,35,48,.25);
  animation: bob 2s ease-in-out infinite;
  transform: translate(-50%, -50%);
}

.hotspot.is-found {
  opacity: .42;
  animation: none;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-6px); }
}

.dialogue-panel {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 15px;
  min-height: 190px;
  padding: 20px;
  background: var(--paper);
  backdrop-filter: blur(12px);
}

.portrait {
  align-self: start;
  width: 82px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 22px 22px 9px 22px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 2.1rem;
  font-weight: 950;
  overflow: hidden;
  border: 1px solid rgba(88,55,77,.08);
}

.portrait[data-character="chris"] { background: #d8e1e8; color: #485b68; }
.portrait[data-character="bad"] { background: #61424e; color: #fff; }
.portrait[data-character="booboo"] { background: #d8cfca; }
.portrait[data-character="parrot"] { background: #d9e8d2; }
.portrait[data-character="tom"], .portrait[data-character="zendaya"] { background: #e1d9e8; color: #5c4e68; }
.portrait[data-character="rust"], .portrait[data-character="marty"], .portrait[data-character="boyd"] { background: #d3d2c8; color: #4f5149; }

.speaker {
  margin: 0 0 6px;
  font-weight: 950;
  color: var(--accent-dark);
}

.line {
  min-height: 50px;
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.52;
}

.next-button {
  float: right;
  margin-top: 14px;
  padding: 10px 17px;
  color: white;
  background: var(--ink);
  font-weight: 850;
}

.choices {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.choice-button {
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(88,55,77,.15);
  box-shadow: 0 4px 12px rgba(73,42,61,.05);
}

.memory-toast {
  position: absolute;
  z-index: 8;
  top: 18px;
  right: 18px;
  max-width: min(320px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(46,36,48,.94);
  color: white;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.memory-toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 640px) {
  .title-screen { padding: 15px; }
  .title-card { padding: 38px 22px; }
  .game-screen { padding: 7px; }
  .game-hud { padding: 0 2px; font-size: .88rem; }
  .scene { border-radius: 20px; grid-template-rows: minmax(285px, 1fr) auto; }
  .scene-art { min-height: 300px; }
  .scene-label { top: 12px; left: 12px; font-size: .67rem; }
  .dialogue-panel { grid-template-columns: 54px 1fr; gap: 11px; padding: 15px; min-height: 205px; }
  .portrait { width: 54px; border-radius: 15px 15px 7px 15px; font-size: 1.45rem; }
  .hotspot { width: 49px; height: 49px; font-size: 1.15rem; }
  .line { font-size: 1rem; line-height: 1.46; }
  .next-button { padding: 9px 15px; }
}

@media (max-height: 740px) and (max-width: 640px) {
  .scene-art { min-height: 245px; }
  .dialogue-panel { min-height: 185px; }
}
