/* ---------------------------------------------------------------
   Adventure — shared styles for every phase page.
   Deliberately plain: the TOP SECRET mark is the only loud thing.
   --------------------------------------------------------------- */

:root {
  --paper: #faf8f4;
  --ink:   #17140f;
  --muted: #8b8579;
  --rule:  #e3ded3;
  --red:   #d3190f;
  --red-d: #a91109;
  --font:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 40px 20px 64px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 19.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.gate {
  width: 100%;
  max-width: 600px;
  text-align: center;
}

.mark {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: -18px auto 18px;
  user-select: none;
  -webkit-user-drag: none;
}

.rule {
  height: 1px;
  margin: 0 0 26px;
  background: var(--rule);
  border: 0;
}

.lede {
  margin: 0 0 6px;
  font-size: 19.5px;
}

.lede--muted {
  color: var(--muted);
  font-size: 17.5px;
}

/* ---------- form ---------- */

.form { margin: 30px 0 0; }

.label {
  display: block;
  margin: 0 0 10px;
  font-size: 14.5px;
  letter-spacing: 0.22em;
  color: var(--muted);
}

/* section kickers inside the unlocked panel */
.label--section {
  margin: 30px 0 8px;
  color: var(--red);
}

.input {
  display: block;
  width: 100%;
  padding: 10px 4px 12px;
  border: 0;
  border-bottom: 1.5px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 24.5px;
  letter-spacing: 0.14em;
  text-align: center;
  transition: border-color 140ms ease;
}

.input::placeholder { color: #c8c2b5; letter-spacing: 0.1em; }
.input:focus { outline: 0; border-bottom-color: var(--ink); }

.gate.is-denied .input { border-bottom-color: var(--red); }

.btn {
  display: block;
  width: 100%;
  margin: 24px 0 0;
  padding: 13px 16px;
  border: 0;
  border-radius: 2px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-size: 15.5px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.btn:hover  { background: var(--red-d); }
.btn:active { background: var(--red-d); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- status / hint ---------- */

.status {
  min-height: 1.7em;
  margin: 18px 0 0;
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--red);
}

.hint {
  margin: 4px 0 0;
  font-size: 16px;
  color: var(--muted);
}

.hint[hidden] { display: none; }

/* ---------- unlocked ---------- */

.granted {
  margin: 0 0 14px;
  font-size: 17px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--red);
}

.footer {
  margin: 40px 0 0;
  font-size: 13.5px;
  letter-spacing: 0.22em;
  color: #b8b2a5;
}

/* small re-lock control at the foot of the unlocked panel */
.lockbtn {
  display: inline-block;
  margin: 28px 0 0;
  padding: 7px 14px;
  border: 1.5px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}

.lockbtn:hover { color: var(--ink); border-color: var(--muted); }
.lockbtn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

[hidden] { display: none !important; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* page-load stagger: mark, rule, then each line of the locked panel */
  .mark, .rule, [data-role="locked"] > * {
    animation: rise 520ms cubic-bezier(.2,.7,.3,1) backwards;
  }
  .mark { animation-delay: 60ms; }
  .rule { animation-delay: 150ms; }
  [data-role="locked"] > *:nth-child(1) { animation-delay: 210ms; }
  [data-role="locked"] > *:nth-child(2) { animation-delay: 260ms; }
  [data-role="locked"] > *:nth-child(3) { animation-delay: 320ms; }
  [data-role="locked"] > *:nth-child(4) { animation-delay: 380ms; }
  [data-role="locked"] > *:nth-child(5) { animation-delay: 420ms; }
  [data-role="locked"] > *:nth-child(6) { animation-delay: 460ms; }

  .gate.is-denied { animation: shake 380ms ease; }

  /* unlock reveal: no delay, it should answer the click instantly */
  .panel--granted { animation: rise 460ms cubic-bezier(.2,.7,.3,1) backwards; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
