*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0e0b24;
  color: #f3ead0;
  font-family: "Noto Sans Bengali", "Noto Sans", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
}

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

button {
  font-family: inherit;
}

#app {
  position: relative;
  height: 100dvh;
  height: 100svh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #3a1848 0%, transparent 55%),
    radial-gradient(90% 60% at 110% 80%, #1a3d32 0%, transparent 50%),
    linear-gradient(180deg, #120c2c 0%, #0e0b24 48%, #160e20 100%);
}

.haze {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(-18deg, transparent 0 11px, rgba(232, 199, 106, 0.025) 11px 12px);
  opacity: 0.7;
  z-index: 0;
}

.filigree {
  pointer-events: none;
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(232, 199, 106, 0.22);
  border-radius: 28px 18px 32px 18px;
  box-shadow: inset 0 0 0 1px rgba(201, 74, 66, 0.12);
  z-index: 1;
}

.filigree::before,
.filigree::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #e8c76a;
}

.filigree::before {
  top: -2px;
  left: -2px;
  border-right: 0;
  border-bottom: 0;
}

.filigree::after {
  right: -2px;
  bottom: -2px;
  border-left: 0;
  border-top: 0;
}

.view,
.shell {
  position: relative;
  z-index: 2;
}

.view {
  display: none;
  height: 100%;
}

.view.is-on {
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-card {
  text-align: center;
  padding: 24px 20px;
  width: min(86%, 340px);
}

.boot-card img {
  width: 108px;
  height: 108px;
  margin: 0 auto 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #e8c76a, 0 0 28px rgba(201, 74, 66, 0.45);
}

.mark {
  display: block;
  color: #e8c76a;
  font-family: Cinzel, "Noto Serif Bengali", serif;
  letter-spacing: 0.28em;
  font-size: 11px;
  text-transform: uppercase;
}

.boot-card h1,
.brand strong,
.hero-copy h1,
.page h1,
.page h2 {
  font-family: Cinzel, "Noto Serif Bengali", serif;
}

.boot-card h1 {
  margin: 6px 0 10px;
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 800;
  color: #f3ead0;
}

.boot-line {
  margin: 0 0 16px;
  color: #cbbd93;
  font-size: 14px;
}

.boot-track {
  height: 6px;
  border-radius: 99px;
  background: #24183a;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 106, 0.35);
}

.boot-track i {
  display: block;
  height: 100%;
  width: 8%;
  background: linear-gradient(90deg, #c94a42, #e8c76a);
  border-radius: 99px;
  animation: bootFill 1.6s ease forwards;
}

@keyframes bootFill {
  to {
    width: 100%;
  }
}

.shell {
  display: none;
  height: 100%;
  flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 0 calc(8px + env(safe-area-inset-bottom));
}

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

.collar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 6px;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #e8c76a;
}

.brand strong {
  display: block;
  font-size: clamp(12px, 3.8vw, 15px);
  line-height: 1.1;
  white-space: nowrap;
}

.gear {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(232, 199, 106, 0.45);
  background:
    radial-gradient(circle at 30% 30%, #5a2140, #2a1238);
  color: #e8c76a;
  font-size: 18px;
  flex: 0 0 auto;
}

.pendants {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding: 2px 8px 8px;
  flex: 0 0 auto;
  overflow: hidden;
}

.pendants::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e8c76a 18%, #c94a42 50%, #e8c76a 82%, transparent);
}

.pendant {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: none;
  color: #cbbd93;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.cab {
  width: 22px;
  height: 30px;
  border-radius: 12px 12px 14px 14px;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.7), var(--gem) 42%, #140816);
  box-shadow:
    0 7px 0 #b48a2e,
    inset 0 -5px 8px rgba(0, 0, 0, 0.35);
  transform: translateY(-6px);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.pendant small {
  font-size: clamp(8px, 2.4vw, 10px);
  letter-spacing: 0;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pendant.is-on .cab {
  transform: translateY(6px) scale(1.12);
  box-shadow:
    0 0 16px var(--gem),
    0 4px 0 #e8c76a;
}

.pendant.is-on small {
  color: #e8c76a;
}

.pages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.page {
  display: none;
  height: 100%;
  overflow: auto;
  overflow-x: hidden;
  padding: 4px 12px 12px;
  -webkit-overflow-scrolling: touch;
}

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

#page-play.is-on {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 6px;
}

.hero-copy {
  text-align: center;
  padding-bottom: 8px;
}

.hero-copy h1 {
  margin: 4px 0 8px;
  font-size: clamp(22px, 7vw, 34px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.lede {
  margin: 0 auto 12px;
  max-width: 34em;
  color: #d8d0b4;
  font-size: clamp(12px, 3.5vw, 14px);
  line-height: 1.55;
}

.hero-well {
  position: relative;
  height: clamp(140px, 36vw, 210px);
  margin: 8px 0 16px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 106, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

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

.lozenge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 10px;
  background: linear-gradient(180deg, #2eb872, #1e8f5a);
  color: #f7fff6;
  box-shadow: 0 8px 0 #0f5a38, 0 0 18px rgba(46, 184, 114, 0.25);
}

.lozenge img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.lozenge span {
  min-width: 0;
  text-align: left;
}

.lozenge em {
  font-style: normal;
  display: block;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 700;
}

.lozenge small {
  display: block;
  opacity: 0.85;
  font-size: 11px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 10px;
}

.stat {
  background: linear-gradient(180deg, rgba(232, 199, 106, 0.12), rgba(20, 10, 36, 0.6));
  border: 1px solid rgba(232, 199, 106, 0.22);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  min-width: 0;
}

.stat b {
  display: block;
  color: #e8c76a;
  font-family: Cinzel, serif;
  font-size: 18px;
}

.stat span {
  font-size: 11px;
  color: #cbbd93;
}

.tease {
  display: grid;
  gap: 8px;
}

.facet {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(22, 16, 46, 0.72);
  border: 1px solid rgba(201, 74, 66, 0.28);
  border-radius: 14px;
  padding: 10px;
}

.facet img {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  flex: 0 0 auto;
  object-fit: cover;
}

.facet h2 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #e8c76a;
}

.facet p {
  margin: 0;
  font-size: 12px;
  color: #d8d0b4;
  line-height: 1.4;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.hud h2 {
  margin: 0;
  font-size: 16px;
  color: #e8c76a;
}

.lives {
  display: flex;
  gap: 4px;
}

.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a2448;
  box-shadow: inset 0 0 0 1px rgba(232, 199, 106, 0.3);
}

.pip.is-on {
  background: #c94a42;
  box-shadow: 0 0 8px #c94a42;
}

.meter {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 99px;
  background: #24183a;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 106, 0.3);
}

.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c94a42, #e8c76a);
  transition: width 0.25s ease;
}

.pressure {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 99px;
  background: #24183a;
  overflow: hidden;
}

.pressure i {
  display: block;
  height: 100%;
  width: 0;
  background: #c94a42;
  transition: width 0.2s ease;
}

#board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lattice {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(4px, 1.6vw, 10px);
  overflow: hidden;
}

.stack {
  flex: 1 1 0;
  max-width: 72px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  position: relative;
  min-height: 84px;
}

.stack.is-locked {
  filter: grayscale(0.4) brightness(0.7);
}

.chain {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.chain img {
  width: 78%;
  height: auto;
  border-radius: 10px;
  opacity: 0.92;
}

.token {
  border: 0;
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  max-height: 15vh;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2), #1a1230);
  box-shadow:
    0 0 0 1px var(--hue),
    0 4px 0 rgba(0, 0, 0, 0.4);
}

.token img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.token.is-back {
  opacity: 0.72;
  transform: scale(0.92);
}

.token.is-front {
  transform: scale(1);
  box-shadow:
    0 0 0 2px #e8c76a,
    0 6px 14px rgba(232, 199, 106, 0.28);
}

.empty-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px dashed rgba(232, 199, 106, 0.2);
}

.wells {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 0 0 auto;
}

.well {
  border: 1px solid rgba(232, 199, 106, 0.35);
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 199, 106, 0.16), #140c28 62%);
  border-radius: 16px 16px 22px 22px;
  padding: 6px 6px 8px;
  color: inherit;
  min-width: 0;
}

.well.is-open {
  box-shadow: 0 0 0 2px #2eb872, 0 0 16px rgba(46, 184, 114, 0.35);
}

.well.is-hint {
  animation: pulse 0.8s ease 2;
}

@keyframes pulse {
  50% {
    transform: translateY(-3px);
  }
}

.well-n {
  display: block;
  font-family: Cinzel, serif;
  font-size: 10px;
  color: #e8c76a;
}

.well-hold {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  min-height: 78px;
}

.well-hold .token,
.socket {
  height: 24px;
  max-height: 24px;
  aspect-ratio: auto;
  width: 100%;
}

.socket {
  display: block;
  border-radius: 8px;
  border: 1px dashed rgba(232, 199, 106, 0.25);
  height: 24px;
}

.tools {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.9fr 0.9fr;
  gap: 6px;
  flex: 0 0 auto;
}

.niche,
.hand-dock,
.tool-btn {
  border: 1px solid rgba(232, 199, 106, 0.3);
  background: #16102e;
  color: #f3ead0;
  border-radius: 12px;
  min-width: 0;
  padding: 6px;
}

.niche,
.hand-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.niche small,
.hand-dock small {
  font-size: 10px;
  color: #e8c76a;
}

.niche .token,
.hand-dock .token,
.niche .socket,
.hand-dock .socket {
  width: 36px;
  height: 36px;
}

.niche.is-open,
.hand-dock.is-held {
  box-shadow: 0 0 0 2px #e8c76a;
}

.tool-btn {
  font-size: 12px;
  font-weight: 700;
}

.tool-btn:disabled {
  opacity: 0.4;
}

.room-grid,
.codex-grid {
  display: grid;
  gap: 10px;
}

.room-card,
.codex-card,
.chapter,
.guide-card,
.mark-row {
  background: rgba(22, 16, 46, 0.8);
  border: 1px solid rgba(232, 199, 106, 0.22);
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
}

.room-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  color: inherit;
  text-align: left;
}

.room-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
}

.room-card.is-lock {
  opacity: 0.55;
}

.room-card h3,
.codex-card h3,
.chapter h3,
.guide-card h3 {
  margin: 0 0 4px;
  font-family: "Noto Serif Bengali", serif;
  font-size: 16px;
  color: #e8c76a;
}

.room-card p,
.codex-card p,
.chapter p,
.guide-card p {
  margin: 0;
  font-size: 12px;
  color: #d8d0b4;
  line-height: 1.45;
}

.codex-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
}

.codex-card img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
}

.guide-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: start;
}

.guide-card b {
  font-family: Cinzel, serif;
  color: #c94a42;
  font-size: 18px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
}

.danger {
  width: 100%;
  border: 1px solid #c94a42;
  background: rgba(201, 74, 66, 0.15);
  color: #f3ead0;
  border-radius: 12px;
  padding: 12px;
}

.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 8;
  background: #1a1238;
  border: 1px solid #e8c76a;
  color: #f3ead0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 0.2s ease;
}

.toast.is-on {
  opacity: 1;
  transform: none;
}

.veil {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 9;
  background: rgba(8, 6, 20, 0.72);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  width: min(100%, 340px);
  background: linear-gradient(180deg, #24143a, #120c24);
  border: 1px solid #e8c76a;
  border-radius: 20px;
  padding: 18px;
  text-align: center;
}

.modal img {
  width: 88px;
  height: 88px;
  margin: 0 auto 10px;
  border-radius: 16px;
}

.modal h3 {
  margin: 0 0 8px;
  color: #e8c76a;
}

.modal p {
  margin: 0 0 14px;
  font-size: 13px;
  color: #d8d0b4;
}

.modal-row {
  display: flex;
  gap: 8px;
}

.modal-row button {
  flex: 1;
  border: 0;
  border-radius: 12px;
  padding: 12px 8px;
  font-weight: 700;
}

.btn-gold {
  background: linear-gradient(180deg, #e8c76a, #b48a2e);
  color: #1a1020;
}

.btn-ruby {
  background: #c94a42;
  color: #fff;
}

.page h1 {
  margin: 4px 0 10px;
  font-size: 22px;
}

.kicker {
  color: #c94a42;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: Cinzel, serif;
}

@media (max-height: 700px) {
  .hero-well {
    height: 132px;
  }

  .well-hold {
    min-height: 66px;
  }

  .boot-card img {
    width: 88px;
    height: 88px;
  }
}

@media (max-width: 360px) {
  .pendant small {
    font-size: 9px;
  }

  .brand strong {
    font-size: 13px;
  }

  .facet,
  .codex-card,
  .room-card {
    grid-template-columns: 52px 1fr;
  }

  .facet img,
  .room-card img,
  .codex-card img {
    width: 52px;
    height: 52px;
  }
}

@media (min-width: 420px) {
  .lattice {
    gap: 12px;
  }

  .stack {
    max-width: 80px;
  }
}
