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

html {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100%;
  font-family: Outfit, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #f4f1e8;
  background:
    radial-gradient(120% 42% at 50% -12%, rgba(255, 209, 0, 0.16), transparent 46%),
    #07080c;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

img {
  max-width: 100%;
  display: block;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

:focus-visible {
  outline: 2px solid #ffd100;
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: rgba(7, 8, 12, 0.94);
  border-bottom: 1px solid rgba(255, 209, 0, 0.32);
  box-shadow: inset 0 -2px 0 rgba(255, 209, 0, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.mark svg,
.seal svg,
.dock svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-family: Oswald, sans-serif;
  letter-spacing: 0.14em;
  color: #ffd100;
  font-size: 14px;
  font-weight: 700;
}

.brand-copy em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: #f4f1e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 209, 0, 0.55);
  color: #1a1402;
  background: #ffd100;
  border-radius: 999px;
  padding: 7px 10px;
  font-family: Oswald, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.page {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 14px 14px calc(124px + env(safe-area-inset-bottom));
}

.kicker {
  margin: 0 0 6px;
  color: #ffd100;
  font-family: Oswald, sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero-copy h1,
.page h1 {
  font-family: Oswald, sans-serif;
  font-weight: 700;
  font-size: clamp(34px, 10vw, 54px);
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.lede {
  margin: 0 0 14px;
  color: #d9d3c7;
  font-size: 15px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  font-family: Oswald, sans-serif;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  text-align: center;
}

.btn-gold {
  background: linear-gradient(#ffe14a, #ffd100 46%, #e0ac00);
  color: #1a1402;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 18px rgba(255, 209, 0, 0.16);
}

.btn-ghost {
  background: transparent;
  color: #ffd100;
  border: 1px solid rgba(255, 209, 0, 0.55);
}

.btn-dark {
  background: #1a1408;
  color: #ffd100;
  border: 1px solid rgba(255, 209, 0, 0.28);
}

.btn:active {
  transform: translateY(1px);
}

.hero-figure,
.banner-figure,
.vault-figure {
  width: 100%;
  height: clamp(150px, 32vh, 240px);
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(255, 209, 0, 0.28);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.stats div {
  min-width: 0;
  background: #12151c;
  border: 1px solid rgba(255, 209, 0, 0.28);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
}

.stats strong {
  display: block;
  font-family: Oswald, sans-serif;
  font-size: 20px;
  color: #ffd100;
}

.stats span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b7b1a4;
}

.section {
  margin-top: 22px;
}

.section h2,
.rite h2,
.dossier h2 {
  font-family: Oswald, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: clamp(22px, 6vw, 30px);
  margin: 0 0 10px;
}

.ledger {
  border: 1px solid rgba(255, 209, 0, 0.32);
  border-radius: 16px;
  overflow: hidden;
  background: #10141c;
}

.ledger-row {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 0;
  border-top: 1px solid rgba(255, 209, 0, 0.16);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ledger-row:first-child {
  border-top: 0;
}

.ledger-row:active {
  background: rgba(255, 209, 0, 0.08);
}

.ledger-index {
  font-family: Oswald, sans-serif;
  color: #ffd100;
  font-size: 18px;
}

.ledger-row h3 {
  margin: 0;
  font-family: Oswald, sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-row p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #b7b1a4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge {
  font-family: Oswald, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd100;
  border: 1px solid rgba(255, 209, 0, 0.4);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}

.is-locked {
  opacity: 0.48;
}

.is-cleared .badge,
.badge.is-kept {
  background: #ffd100;
  color: #1a1402;
  border-color: #ffd100;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule,
.rite,
.dossier,
.quote,
.banner {
  background: #12151c;
  border: 1px solid rgba(255, 209, 0, 0.28);
  border-radius: 16px;
}

.rule {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
}

.rule > span {
  font-family: Oswald, sans-serif;
  color: #ffd100;
  font-size: 20px;
}

.rule h3,
.codex-block h3 {
  margin: 0 0 4px;
  font-family: Oswald, sans-serif;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rule p,
.codex-block p,
.rite p,
.dossier p,
.quote p {
  margin: 0;
  color: #d5d0c6;
  font-size: 14px;
}

.banner,
.dossier,
.quote {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
  align-items: center;
}

.banner img,
.dossier img,
.quote img {
  width: 96px;
  height: 112px;
  object-fit: cover;
  border-radius: 12px;
}

.rite {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rite .btn {
  width: 100%;
}

.codex-block {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 209, 0, 0.16);
}

.demo-marks {
  display: flex;
  gap: 3px;
  max-width: 220px;
  margin: 8px 0;
}

.demo-marks i,
.marks i {
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: #1d2433;
  box-shadow: inset 0 0 0 1px rgba(255, 209, 0, 0.28);
}

.demo-marks i.on,
.marks i.on {
  background: #ffd100;
  box-shadow: none;
}

.swatch-row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.swatch {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255, 209, 0, 0.35);
  flex: 0 0 auto;
}

.swatch-seam {
  background: linear-gradient(#1a2230, #0c1018);
  box-shadow: inset 18px 0 0 #243044, inset 22px 0 0 #0c1018;
}

.swatch-bridge {
  background:
    repeating-linear-gradient(90deg, transparent 0 6px, rgba(255, 209, 0, 0.35) 6px 8px),
    #3a3010;
}

.swatch-grate {
  background: #1a120c;
  box-shadow: inset 0 0 0 3px #5a3418, inset 0 0 12px #e85d4c;
}

.sockets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.socket {
  min-width: 0;
  padding: 10px;
  border-radius: 16px;
  background: #12151c;
  border: 1px solid rgba(255, 209, 0, 0.28);
  text-align: center;
}

.socket img,
.emblem {
  width: 100%;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
}

.emblem {
  display: block;
  margin: 0 auto;
  border: 1px solid rgba(255, 209, 0, 0.45);
  background:
    radial-gradient(circle at 40% 35%, rgba(255, 209, 0, 0.35), transparent 42%),
    #17140e;
  position: relative;
  height: 88px;
}

.emblem::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  border: 2px solid #ffd100;
  border-radius: 50%;
}

.emblem-nail::before {
  width: 8px;
  height: 36px;
  border-radius: 4px;
  background: #ffd100;
}

.emblem-filigree::before {
  border-radius: 40% 40% 50% 50%;
  box-shadow: 8px 0 0 -6px #ffd100, -8px 0 0 -6px #ffd100;
}

.emblem-bell::before {
  border-radius: 16px 16px 10px 10px;
  background: #ffd100;
  height: 22px;
}

.emblem-sun::before {
  background: #ffd100;
  box-shadow: 0 0 0 6px rgba(255, 209, 0, 0.25);
}

.emblem-moon::before {
  border-radius: 50%;
  background: transparent;
  box-shadow: inset -8px 0 0 #ffd100;
}

.socket h3 {
  margin: 8px 0 4px;
  font-family: Oswald, sans-serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.socket p {
  margin: 0;
  color: #b7b1a4;
  font-size: 12px;
}

.socket.is-locked img,
.socket.is-locked .emblem {
  filter: grayscale(1) brightness(0.4);
}

.colophon {
  margin-top: 22px;
  text-align: center;
  color: #8d887c;
  font-size: 12px;
}

.colophon a {
  color: #ffd100;
}

.dock {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  min-height: 68px;
  padding: 8px 4px;
  border-radius: 22px;
  background: linear-gradient(180deg, #1c2114, #0c0e14);
  border: 1px solid rgba(255, 209, 0, 0.5);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 209, 0, 0.25);
}

.dock a {
  min-width: 0;
  text-decoration: none;
  color: #b7b1a4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  font-family: Oswald, sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 2px;
}

.dock a svg {
  width: 18px;
  height: 18px;
}

.dock a.is-active {
  color: #ffd100;
}

.dock .tick {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}

.dock a.is-active .tick {
  background: #ffd100;
}

.dock .seal {
  width: 58px;
  height: 58px;
  margin-top: -30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 32%, #ffe56a, #ffd100 42%, #c8960a);
  color: #1a1402;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  padding: 0;
}

.dock .seal svg {
  width: 34px;
  height: 34px;
}

body.is-play {
  overflow: hidden;
  height: 100%;
  background: #07080c;
}

#play-root {
  height: 100%;
  height: 100dvh;
}

.play-shell {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  padding-top: env(safe-area-inset-top);
  user-select: none;
  -webkit-user-select: none;
}

.play-hud {
  flex: 0 0 auto;
  padding: 8px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-top,
.hud-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hud-title {
  min-width: 0;
  flex: 1;
}

.hud-title span {
  display: block;
  color: #ffd100;
  font-family: Oswald, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hud-title strong {
  display: block;
  font-family: Oswald, sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pause {
  width: 44px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 209, 0, 0.45);
  background: #12151c;
  color: #ffd100;
  font-family: Oswald, sans-serif;
  letter-spacing: 0.12em;
}

.pips {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.pip {
  width: 12px;
  height: 12px;
  border: 1px solid #ffd100;
}

.pip.sun {
  border-radius: 2px;
}

.pip.moon {
  border-radius: 50%;
}

.pip.on {
  background: #ffd100;
}

.steps {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #b7b1a4;
  white-space: nowrap;
}

.beat {
  display: none;
  gap: 4px;
}

.beat.is-on {
  display: flex;
}

.beat i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #1d2433;
  box-shadow: inset 0 0 0 1px rgba(255, 209, 0, 0.35);
}

.beat i.on {
  background: #ffd100;
}

.beat i.hot {
  background: #e85d4c;
}

.marks {
  display: flex;
  gap: 3px;
  min-width: 0;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  touch-action: none;
}

.stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage.is-shake {
  animation: nudge 0.18s linear;
}

@keyframes nudge {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.whisper {
  min-height: 18px;
  font-size: 12px;
  text-align: center;
  color: #f4f1e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 12px calc(8px + env(safe-area-inset-bottom));
}

.pad {
  display: grid;
  grid-template-columns: 64px 64px 64px;
  grid-template-areas:
    ". up ."
    "left wait right"
    ". down .";
  gap: 6px;
  justify-content: center;
}

.pad button {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 209, 0, 0.45);
  background: #171b26;
  color: #ffd100;
  font-family: Oswald, sans-serif;
  font-size: 18px;
}

.pad .up { grid-area: up; }
.pad .down { grid-area: down; }
.pad .left { grid-area: left; }
.pad .right { grid-area: right; }
.pad .wait {
  grid-area: wait;
  background: #ffd100;
  color: #1a1402;
  border: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.controls .btn {
  width: 100%;
}

.picker {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
}

.picker h1 {
  font-size: clamp(32px, 9vw, 46px);
}

.text-home {
  color: #ffd100;
  font-family: Oswald, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  font-size: 13px;
}

.note {
  margin: 0 0 10px;
  color: #ffd100;
  font-size: 14px;
}

.veil {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(7, 8, 12, 0.78);
  padding: 16px;
  overflow: auto;
  align-items: center;
  justify-content: center;
}

.veil.is-open {
  display: flex;
}

.sheet {
  width: min(440px, 100%);
  max-height: calc(100% - 8px);
  overflow: auto;
  background: #12151c;
  border: 1px solid rgba(255, 209, 0, 0.45);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.sheet h2 {
  margin: 0 0 8px;
  font-family: Oswald, sans-serif;
  font-size: clamp(26px, 8vw, 36px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sheet p {
  margin: 0 0 8px;
  color: #d9d3c7;
}

.sheet .btn {
  width: 100%;
  margin-top: 8px;
}

.tips {
  margin: 8px 0;
  padding-left: 18px;
  color: #d5d0c6;
}

.tips li {
  margin: 4px 0;
}

@media (max-width: 340px) {
  .banner,
  .dossier,
  .quote {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .banner img,
  .dossier img,
  .quote img {
    width: 72px;
    height: 92px;
  }

  .pad {
    grid-template-columns: 56px 56px 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
