@import url("https://fonts.googleapis.com/css2?family=Lilita+One&family=Nunito:wght@700;800;900&display=swap");

:root {
  --ink: #14120e;
  --paper: #fff6ea;
  --night: #10141c;
  --sodium: #ff9d3c;
  --sodium-2: #ffb15a;
  --teal: #1c4d56;
  --teal-deep: #14343c;
  --rain: #8ec9d4;
  color: var(--ink);
  font-family: Nunito, "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html.adult #gate { display: none !important; }

html.adult #game { display: flex !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #07090d;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

button {
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible {
  outline: 3px solid var(--sodium-2);
  outline-offset: 2px;
}

::selection { background: var(--sodium); color: var(--ink); }

.app {
  width: min(100vw, 440px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--night);
  color: var(--paper);
  display: flex;
  flex-direction: column;
}

.screen { min-height: 0; }

#game {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.gate {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(22px + env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse 80% 50% at 50% 16%, rgba(255, 157, 60, 0.42), transparent 62%),
    linear-gradient(180deg, #1c4d56 0%, #10141c 58%);
}

.gate-art {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 180px;
}

.gate-art svg { width: min(260px, 78vw); height: auto; }

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sodium-2);
}

h1, h2 {
  font-family: "Lilita One", "Arial Black", sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
}

.gate h1 {
  font-size: clamp(2.3rem, 12vw, 3.5rem);
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--paper);
  text-shadow: 4px 4px 0 var(--ink);
}

.gate h1 span, .top h1 span { color: var(--sodium); }

.lede {
  margin: 12px 0 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  max-width: 32ch;
}

.fine, .noscript {
  margin: 8px 0 0;
  color: rgba(255, 246, 234, 0.78);
  font-weight: 700;
  line-height: 1.35;
}

.noscript { color: var(--sodium-2); font-weight: 800; }

.gate-actions, .result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  min-height: 52px;
  padding: 12px 16px;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  width: 100%;
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.btn.primary { background: var(--sodium); color: var(--ink); }

.btn.ghost {
  background: transparent;
  color: var(--paper);
  box-shadow: none;
  border-color: rgba(255, 246, 234, 0.4);
}

.btn:disabled {
  opacity: 0.42;
  cursor: default;
  box-shadow: none;
}

.btn.is-ready { animation: nudge 0.4s ease 2; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 14px 0;
}

.top h1 {
  font-size: clamp(1rem, 4.6vw, 1.25rem);
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--paper);
}

.icon-btn {
  width: 52px;
  height: 52px;
  min-height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.icon-btn .snd-off { display: none; }

html.muted .icon-btn .snd-on { display: none; }

html.muted .icon-btn .snd-off { display: inline; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 14px 0;
  font-weight: 900;
  font-size: 0.86rem;
}

.pill {
  background: var(--sodium);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
}

.mood-label { margin-left: auto; color: var(--sodium-2); }

.meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex: 0 0 auto;
  padding: 8px 14px 0;
}

.pip {
  display: block;
  height: 10px;
  border-radius: 99px;
  background: rgba(255, 246, 234, 0.16);
  border: 1px solid rgba(255, 246, 234, 0.2);
}

.pip.on { background: var(--sodium); border-color: var(--sodium); }

.pip.miss { background: #1f5c66; border-color: var(--rain); }

.pip.now { box-shadow: inset 0 0 0 2px var(--paper); animation: pulse 1.2s ease-in-out infinite; }

.stage {
  flex: 0 1 38%;
  min-height: 168px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  background: #10242a;
  margin-top: 6px;
}

.speech {
  position: relative;
  z-index: 4;
  margin: 8px 12px 0;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px 16px 16px 6px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 10px;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.speech.is-fresh { animation: nudge 0.35s ease; }

.scene {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #16383f 0%, #10141c 70%);
}

.tenement {
  position: absolute;
  z-index: 0;
  inset: 0 0 14% 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 7px 8px;
  padding: 10px 12px 8px;
  background: linear-gradient(#1a3338, #14262b);
  border-bottom: 4px solid #0c1014;
}

.tenement span {
  background:
    linear-gradient(#0b1418, #0b1418) center / 3px 100% no-repeat,
    linear-gradient(#0b1418, #0b1418) center / 100% 3px no-repeat,
    #102228;
  border: 3px solid #0c1418;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(126, 200, 212, 0.08);
}

.tenement span.lit {
  position: relative;
  background:
    linear-gradient(#8a4a12, #8a4a12) center / 3px 100% no-repeat,
    linear-gradient(#8a4a12, #8a4a12) center / 100% 3px no-repeat,
    linear-gradient(#fff1d0, #ff9d3c);
  border-color: #6a3810;
  box-shadow: 0 0 20px 5px rgba(255, 157, 60, 0.7);
}

.tenement span.lit::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28%;
  background: rgba(120, 50, 10, 0.28);
}

.aerial {
  position: absolute;
  z-index: 1;
  top: 4px;
  right: 8%;
  width: 3px;
  height: 14px;
  background: #0c1014;
}

.aerial::before {
  content: "";
  position: absolute;
  top: 0;
  left: -12px;
  width: 28px;
  height: 3px;
  background: #0c1014;
}

.lamp {
  position: absolute;
  z-index: 2;
  left: 7%;
  bottom: 10%;
  width: 8px;
  height: 42%;
  background: #14120e;
  border-radius: 4px;
}

.lamp::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -16px;
  width: 40px;
  height: 14px;
  background: var(--sodium-2);
  border: 3px solid var(--ink);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 0 24px 8px rgba(255, 154, 60, 0.65);
}

.lamp::after {
  content: "";
  position: absolute;
  top: -28px;
  left: -46px;
  width: 100px;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(255, 157, 60, 0.4), transparent 70%);
  pointer-events: none;
}

.scene::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  pointer-events: none;
  border-top: 4px solid #0c1014;
  background:
    radial-gradient(ellipse at 22% 30%, rgba(255, 170, 80, 0.55), transparent 46%),
    linear-gradient(#2a403f, #151b20);
}

.muckle {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
}

.muckle-svg {
  width: auto;
  height: 100%;
  max-width: 100%;
  display: block;
}

.muckle.is-pop .muckle-svg { animation: pop 0.35s ease; }

.rain {
  position: absolute;
  inset: -30% -20%;
  pointer-events: none;
  background-repeat: repeat;
  animation: rain 0.9s linear infinite;
}

.rain-back {
  z-index: 1;
  opacity: 0.55;
  background-image: repeating-linear-gradient(
    112deg,
    transparent 0 16px,
    rgba(186, 226, 232, 0.8) 16px 18px
  );
  animation-duration: 1.05s;
}

.rain-front {
  z-index: 3;
  opacity: 0.32;
  background-image: repeating-linear-gradient(
    104deg,
    transparent 0 26px,
    rgba(236, 250, 252, 0.95) 26px 28px
  );
  animation-duration: 0.62s;
}

.brow-set, .mouth, .drips { display: none; }

.mood-smug .brow-smug,
.mood-smug .mouth-smug,
.mood-crabbit .brow-crabbit,
.mood-crabbit .mouth-crabbit,
.mood-soaking .brow-soaking,
.mood-soaking .mouth-soaking,
.mood-soaking .drips,
.mood-betrayed .brow-betrayed,
.mood-betrayed .mouth-betrayed { display: block; }

.brow-set, .eyes, .mouth, .drop {
  transform-box: fill-box;
  transform-origin: center;
}

.mood-smug .eyes { transform: scaleY(0.86); }
.mood-crabbit .eyes { transform: scaleY(0.58); }
.mood-soaking .eyes { transform: scaleY(0.7); }
.mood-betrayed .eyes { transform: scaleY(1.08); }

.mood-smug .pupil-l { transform: translate(1px, -2px); }
.mood-smug .pupil-r { transform: translate(3px, -2px); }
.mood-betrayed .pupil { transform: translate(0, 3px); }
.mood-soaking .pupil { transform: translate(0, 2px); }

.stage.is-perfect.mood-smug .brow-smug { transform: translateY(-9px); }

.mood-soaking .drop { animation: drip 1.3s ease-in infinite; }
.mood-soaking .d2 { animation-delay: 0.35s; }
.mood-soaking .d3 { animation-delay: 0.6s; }

.panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: #0e141b;
  border-top: 4px solid var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--sodium) #10141c;
}

.panel h2 {
  font-size: clamp(1.45rem, 6vw, 1.7rem);
  line-height: 0.95;
  text-transform: uppercase;
  margin: 0 0 8px;
  text-shadow: 3px 3px 0 var(--ink);
}

.kicker {
  margin: 0 0 2px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sodium-2);
}

.panel p, .help {
  margin: 0 0 10px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.help { color: rgba(255, 246, 234, 0.78); font-size: 0.92rem; }

.blurb p { margin: 0 0 8px; }

.blurb p:last-child { margin-bottom: 0; }

#continue, #enough, #start, #after { margin-top: 10px; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clue, .choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
  min-height: 52px;
  padding: 10px 12px;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  overflow-wrap: break-word;
}

.clue:active:not(:disabled),
.choice:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.choice:disabled { cursor: default; }

.clue-name, .choice-name { font-weight: 900; line-height: 1.2; }

.clue-hint, .choice-detail {
  font-size: 0.82rem;
  font-weight: 800;
  color: #5c5148;
}

.clue-body {
  display: block;
  margin-top: 6px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
}

.clue.is-open { background: #fffdf8; }

.clue.is-gloss {
  background: #fff4d8;
  box-shadow: 4px 4px 0 #e09a45;
}

.choice.is-right { background: #ffe1b5; }

.choice.is-wrong { background: #d5e3e6; }

.choice.is-walked {
  background: #fff6ea;
  box-shadow: 4px 4px 0 var(--sodium);
}

.tag {
  margin-top: 4px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.is-walked .tag { background: var(--sodium); color: var(--ink); }

.verdict {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: #1a242c;
}

.verdict.is-closed { background: #1c2c24; }

.verdict.is-walks { background: #1a2830; }

.stamp {
  font-family: "Lilita One", "Arial Black", sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.stamp.is-closed { color: var(--sodium-2); }

.stamp.is-walks { color: var(--rain); }

.result h2 {
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  text-transform: uppercase;
  line-height: 0.95;
  margin-bottom: 8px;
  text-shadow: 3px 3px 0 var(--ink);
}

.score-num {
  font-family: "Lilita One", "Arial Black", sans-serif;
  font-size: 2.6rem;
  color: var(--sodium-2);
  margin: 0 0 4px;
}

.share-note {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
  color: var(--sodium-2);
  user-select: text;
  overflow-wrap: anywhere;
}

.verdict, .blurb, .clue-body, .share-note, #intro-copy, #result-copy { user-select: text; }

@keyframes rain {
  to { background-position: 0 252px; }
}

@keyframes pop {
  0% { transform: translateY(8px) scale(0.98); }
  45% { transform: translateY(-6px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-3px); }
  70% { transform: translateX(3px); }
}

@keyframes drip {
  0% { transform: translateY(0); opacity: 1; }
  75% { transform: translateY(18px); opacity: 0; }
  100% { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (max-height: 700px) {
  .stage { min-height: 142px; max-height: 36%; }
  .gate h1 { font-size: 2.2rem; }
  .gate-art { min-height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
