:root {
  --ink: #06110B;
  --felt: #0C2418;
  --felt-deep: #08170F;
  --gold: #E8C547;
  --gold-deep: #B8892A;
  --cream: #F4EBD4;
  --mute: #C9BFA6;
  --green: #1FA64A;
  --ruby: #C41E3A;
  --rail: #16110A;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --plaque: 3.15rem;
  --bracelet: 4.7rem;
}

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

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: Outfit, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
h2,
h3 {
  font-family: Fraunces, serif;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
}

p {
  margin: 0;
}

#app {
  position: relative;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(232, 197, 71, 0.16), transparent 46%),
    radial-gradient(90% 50% at 100% 100%, rgba(31, 166, 74, 0.18), transparent 42%),
    var(--ink);
}

.felt-grain,
.gold-haze {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.felt-grain {
  opacity: 0.22;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 4px);
}

.gold-haze {
  background: radial-gradient(ellipse at 50% 120%, rgba(232, 197, 71, 0.12), transparent 55%);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: calc(var(--safe-t) + 1rem) 1.2rem 1.2rem;
}

.screen.is-on {
  display: grid;
}

.boot-seal {
  width: min(100%, 22rem);
  text-align: center;
}

.seal-ring {
  width: 7.4rem;
  height: 7.4rem;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 0 18px rgba(232, 197, 71, 0.35));
}

.mark-5151 {
  width: 100%;
  height: 100%;
}

.boot-house {
  color: var(--gold);
  letter-spacing: 0.46em;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

#screen-boot h1 {
  font-size: clamp(2rem, 8vw, 2.7rem);
  font-weight: 800;
  margin-bottom: 0.7rem;
}

.boot-line {
  color: var(--mute);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.boot-track {
  height: 0.28rem;
  border-radius: 99px;
  background: rgba(232, 197, 71, 0.18);
  overflow: hidden;
}

.boot-track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.site-shell {
  display: none;
  height: 100%;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.site-shell.is-on {
  display: flex;
}

.plaque {
  flex: 0 0 auto;
  min-height: calc(var(--plaque) + var(--safe-t));
  padding: calc(var(--safe-t) + 0.45rem) 0.85rem 0.4rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(#1c160c, #120e08);
  border-bottom: 1px solid rgba(232, 197, 71, 0.45);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.plaque-left {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

.house {
  color: var(--gold);
  font-family: Fraunces, serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
}

.plaque strong {
  font-family: Fraunces, serif;
  font-size: 1.05rem;
  font-weight: 650;
  white-space: nowrap;
}

.gear-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid rgba(232, 197, 71, 0.4);
  color: var(--gold);
  display: grid;
  place-items: center;
}

.gear-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

#pages {
  flex: 1;
  min-height: 0;
  position: relative;
}

.page {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

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

.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.85rem 0.95rem 1.1rem;
}

.kicker {
  color: var(--gold);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

h2 {
  font-size: clamp(1.45rem, 6vw, 1.9rem);
  line-height: 1.12;
  margin-bottom: 0.45rem;
}

.lead,
.hall-copy p {
  color: var(--mute);
  font-size: 0.92rem;
  line-height: 1.45;
}

.hero-well {
  margin: 0 0 0.95rem;
  position: relative;
  border-radius: 1.15rem;
  overflow: hidden;
  border: 1px solid rgba(232, 197, 71, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  aspect-ratio: 16 / 11;
}

.hero-well img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 62%;
}

.hero-well figcaption {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--cream);
  text-shadow: 0 1px 8px #000;
}

.hero-well em {
  font-style: normal;
  color: var(--gold);
  letter-spacing: 0.16em;
  font-weight: 700;
}

.hall-copy {
  margin-bottom: 0.9rem;
}

.stat-plates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.95rem;
}

.plate {
  background: linear-gradient(180deg, rgba(232, 197, 71, 0.12), rgba(12, 36, 24, 0.7));
  border: 1px solid rgba(232, 197, 71, 0.28);
  border-radius: 0.85rem;
  padding: 0.55rem 0.4rem 0.5rem;
  text-align: center;
  min-width: 0;
}

.plate b {
  display: block;
  font-family: Fraunces, serif;
  font-size: 0.82rem;
  color: var(--gold);
  overflow: hidden;
  line-height: 1.15;
}

.plate span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.gold-cta,
.ghost-cta,
.modal-actions button {
  display: block;
  width: 100%;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gold-cta {
  background: linear-gradient(180deg, #F3D56A, var(--gold) 42%, var(--gold-deep));
  color: #1a1204;
  box-shadow: 0 8px 0 #6d4e12, 0 12px 18px rgba(0, 0, 0, 0.35);
  margin-bottom: 1rem;
}

.gold-cta:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 #6d4e12;
}

.ghost-cta {
  border: 1px solid rgba(232, 197, 71, 0.4);
  color: var(--gold);
  margin-top: 0.7rem;
}

.camara-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.seal {
  border-radius: 0.9rem;
  padding: 0.55rem 0.4rem 0.6rem;
  background: var(--felt);
  border: 1px solid rgba(232, 197, 71, 0.22);
  text-align: center;
  min-width: 0;
}

.seal.is-open {
  border-color: rgba(232, 197, 71, 0.55);
}

.seal.is-done {
  border-color: var(--green);
}

.seal.is-locked {
  opacity: 0.45;
}

.seal img {
  width: 2.1rem;
  height: 2.1rem;
  margin: 0 auto 0.25rem;
  object-fit: cover;
  border-radius: 50%;
}

.seal b {
  display: block;
  font-size: 0.68rem;
  line-height: 1.2;
}

.seal small {
  display: block;
  margin-top: 0.15rem;
  color: var(--mute);
  font-size: 0.62rem;
}

.site-shell.is-mesa .plaque {
  display: none;
}

.page-mesa {
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(232, 197, 71, 0.1), transparent 55%),
    var(--felt-deep);
  padding-top: var(--safe-t);
}

.mesa-hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 2.3rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.7rem 0.2rem;
}

.chip-btn {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(232, 197, 71, 0.45);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hud-mid {
  min-width: 0;
}

.camara-name {
  font-family: Fraunces, serif;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camara-goal {
  color: var(--mute);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-score {
  text-align: right;
}

.hud-score span {
  font-family: Fraunces, serif;
  color: var(--gold);
  font-size: 1.15rem;
}

.hud-score small {
  display: block;
  color: var(--mute);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.echo-strip {
  margin: 0.25rem 0.7rem 0.2rem;
  height: 1.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(232, 197, 71, 0.25);
  position: relative;
  overflow: hidden;
}

.echo-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.echo-strip span {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.3rem;
}

.mesa-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0.2rem 0.55rem 0.15rem;
}

.board-well {
  position: relative;
  width: min(100%, calc((100dvh - 11.2rem) * 5 / 6));
  max-height: 100%;
  aspect-ratio: 5 / 6;
}

.echo-ring {
  position: absolute;
  inset: -0.45rem;
  border-radius: 1.15rem;
  border: 2px solid transparent;
  pointer-events: none;
  opacity: 0;
}

.board-well.is-echo .echo-ring {
  opacity: 1;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(31, 166, 74, 0.35), 0 0 22px rgba(232, 197, 71, 0.55);
}

.board {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 0.28rem;
  padding: 0.38rem;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(232, 197, 71, 0.08), transparent 30%),
    var(--felt);
  border: 2px solid rgba(232, 197, 71, 0.55);
  box-shadow: inset 0 0 0 3px rgba(12, 20, 12, 0.8), 0 10px 24px rgba(0, 0, 0, 0.4);
}

.cell {
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.35));
  border: 1px solid rgba(232, 197, 71, 0.12);
  min-width: 0;
  min-height: 0;
  touch-action: none;
}

.stone {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  overflow: hidden;
  background: #050807;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}

.stone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.cell.is-on .stone {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(232, 197, 71, 0.7);
}

.cell.is-pair .stone {
  box-shadow: 0 0 0 2px var(--green);
}

.cell.is-pulse .stone {
  animation: gem-pulse 1.1s ease-in-out infinite;
}

html.reduce-motion .cell.is-pulse .stone,
html.reduce-motion .board-well.is-echo .echo-ring {
  animation: none;
}

@keyframes gem-pulse {
  0%,
  100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.hint-line {
  flex: 0 0 auto;
  text-align: center;
  color: var(--mute);
  font-size: 0.72rem;
  padding: 0.15rem 0.7rem 0.25rem;
  min-height: 1.1rem;
}

.jewel-case {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.9rem 0 0.85rem;
}

.well {
  background: radial-gradient(circle at 50% 30%, rgba(232, 197, 71, 0.12), var(--felt));
  border: 1px solid rgba(232, 197, 71, 0.28);
  border-radius: 1rem;
  padding: 0.7rem 0.55rem 0.65rem;
  text-align: center;
  min-width: 0;
}

.well.is-locked {
  filter: grayscale(1) brightness(0.55);
}

.well img {
  width: 4.4rem;
  height: 4.4rem;
  margin: 0 auto 0.4rem;
  object-fit: cover;
  border-radius: 50%;
}

.well b {
  display: block;
  font-size: 0.82rem;
  line-height: 1.2;
}

.well small {
  display: block;
  margin-top: 0.2rem;
  color: var(--mute);
  font-size: 0.68rem;
}

.note-card {
  background: rgba(8, 23, 15, 0.75);
  border: 1px solid rgba(232, 197, 71, 0.25);
  border-radius: 1rem;
  padding: 0.85rem;
}

.note-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.note-card p {
  color: var(--mute);
  font-size: 0.88rem;
  line-height: 1.4;
}

.lore-block {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  margin: 0.85rem 0;
  padding: 0.7rem;
  border-radius: 1rem;
  background: rgba(12, 36, 24, 0.7);
  border: 1px solid rgba(232, 197, 71, 0.2);
}

.lore-block.reverse {
  grid-template-columns: minmax(0, 1fr) 4.6rem;
}

.lore-block.reverse img {
  order: 2;
}

.lore-block img {
  width: 4.6rem;
  height: 4.6rem;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(232, 197, 71, 0.35);
}

.lore-block h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.lore-block p {
  color: var(--mute);
  font-size: 0.84rem;
  line-height: 1.4;
}

.method-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 1rem;
}

.method-list li {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.65rem;
  border-radius: 1rem;
  background: var(--felt);
  border: 1px solid rgba(232, 197, 71, 0.22);
}

.method-list img {
  width: 3.4rem;
  height: 3.4rem;
  object-fit: cover;
  border-radius: 50%;
}

.method-list h3 {
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.method-list p {
  color: var(--mute);
  font-size: 0.84rem;
  line-height: 1.4;
}

.toggle-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.8rem;
  border-radius: 1rem;
  background: var(--felt);
  border: 1px solid rgba(232, 197, 71, 0.25);
}

.toggle-row i {
  width: 2.5rem;
  height: 1.35rem;
  border-radius: 99px;
  background: #2a2410;
  position: relative;
  border: 1px solid rgba(232, 197, 71, 0.3);
}

.toggle-row i::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.12rem;
  width: 1.02rem;
  height: 1.02rem;
  border-radius: 50%;
  background: var(--mute);
}

.toggle-row.is-on i {
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.toggle-row.is-on i::after {
  left: auto;
  right: 0.12rem;
  background: #1a1204;
}

.fineprint {
  margin-top: 0.8rem;
  color: var(--mute);
  font-size: 0.78rem;
  line-height: 1.4;
}

.bracelet {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.15rem;
  min-height: calc(var(--bracelet) + var(--safe-b));
  padding: 0.35rem 0.45rem calc(0.4rem + var(--safe-b));
  background:
    linear-gradient(180deg, #2a1c0c, var(--rail) 38%, #0b0906);
  border-top: 2px solid var(--gold);
  box-shadow:
    0 -10px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(243, 213, 106, 0.45);
}

.cabochon {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  color: var(--mute);
}

.cabochon img {
  width: 2.15rem;
  height: 2.15rem;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(232, 197, 71, 0.35);
  background: #050807;
}

.cabochon span {
  font-size: 0.6rem;
  letter-spacing: 0;
  text-transform: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cab-mesa img {
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -0.35rem;
  border-width: 3px;
}

.cabochon.is-on {
  color: var(--gold);
}

.cabochon.is-on img {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(232, 197, 71, 0.55);
  transform: translateY(-0.18rem);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 1.1rem;
  background: rgba(6, 17, 11, 0.72);
}

.overlay[hidden] {
  display: none;
}

.modal {
  width: min(100%, 22rem);
  background: linear-gradient(180deg, #1a160c, #0d120e);
  border: 1px solid var(--gold);
  border-radius: 1.15rem;
  padding: 1.1rem 1rem 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.modal h2 {
  margin-bottom: 0.4rem;
}

.modal p {
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.4;
}

.modal-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.modal-actions .gold-cta {
  margin-bottom: 0;
}

@media (max-width: 360px) {
  :root {
    --bracelet: 4.35rem;
  }

  .cabochon img {
    width: 1.9rem;
    height: 1.9rem;
  }

  .cab-mesa img {
    width: 2.4rem;
    height: 2.4rem;
  }

  .hero-well {
    aspect-ratio: 16 / 10;
  }

  .stat-plates,
  .camara-row {
    gap: 0.35rem;
  }

  .lore-block,
  .lore-block.reverse {
    grid-template-columns: 3.6rem minmax(0, 1fr);
  }

  .lore-block.reverse img {
    order: 0;
  }

  .lore-block img {
    width: 3.6rem;
    height: 3.6rem;
  }
}

@media (max-height: 680px) {
  :root {
    --plaque: 2.85rem;
    --bracelet: 4.2rem;
  }

  .hero-well {
    aspect-ratio: 16 / 9;
  }

  .board-well {
    width: min(100%, calc((100dvh - 10.4rem) * 5 / 6));
  }
}

@media (max-height: 600px) {
  .cabochon span {
    display: none;
  }

  .hint-line {
    display: none;
  }

  .board-well {
    width: min(100%, calc((100dvh - 9.2rem) * 5 / 6));
  }
}

html.reduce-motion * {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}
