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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #14060a;
  color: #fff3d1;
  font-family: "Noto Sans Myanmar", "Myanmar Text", "Padauk", 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;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
}

#app {
  position: relative;
  height: 100dvh;
  height: 100svh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(90% 50% at 50% -8%, #6a1420 0%, transparent 52%),
    radial-gradient(70% 40% at 100% 90%, #1f4a38 0%, transparent 46%),
    linear-gradient(180deg, #1c0a10 0%, #14060a 48%, #0c0406 100%);
}

.velvet {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(118deg, transparent 0 13px, rgba(212, 160, 23, 0.03) 13px 14px);
  z-index: 0;
}

.rivet-frame {
  pointer-events: none;
  position: absolute;
  inset: 7px;
  border: 1.5px solid rgba(212, 160, 23, 0.38);
  border-radius: 22px 28px 18px 26px;
  box-shadow: inset 0 0 0 1px rgba(196, 30, 58, 0.16);
  z-index: 1;
}

.rivet-frame::before,
.rivet-frame::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f2d06b, #8a6a12);
  box-shadow: 0 0 0 2px #14060a;
}

.rivet-frame::before {
  top: -5px;
  left: 18%;
}

.rivet-frame::after {
  right: 16%;
  bottom: -5px;
}

.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: 22px 18px;
  width: min(86%, 320px);
}

.boot-card img {
  width: 112px;
  height: 112px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid #d4a017;
  box-shadow: 0 0 24px rgba(196, 30, 58, 0.35);
}

.mark {
  display: inline-block;
  letter-spacing: 0.28em;
  font-size: 10px;
  text-transform: uppercase;
  color: #f2d06b;
  font-family: Cinzel, serif;
}

h1 {
  margin: 6px 0 8px;
  font-family: Cinzel, "Noto Sans Myanmar", serif;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
  color: #f2d06b;
  text-shadow: 0 2px 0 #6a0e18;
}

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

.boot-track {
  height: 6px;
  border-radius: 99px;
  background: #2a0c12;
  border: 1px solid rgba(212, 160, 23, 0.4);
  overflow: hidden;
}

.boot-track i {
  display: block;
  height: 100%;
  width: 34%;
  background: linear-gradient(90deg, #c41e3a, #f2d06b);
  animation: bootFill 1.4s ease-in-out infinite;
}

@keyframes bootFill {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.shell {
  display: none;
  height: 100%;
  flex-direction: column;
  padding:
    max(10px, env(safe-area-inset-top))
    12px
    0;
}

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

.crown {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 4px 2px 8px;
}

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

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid #d4a017;
}

.brand strong {
  display: block;
  font-family: Cinzel, serif;
  font-size: 14px;
  color: #f2d06b;
  line-height: 1.1;
}

.lantern-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 160, 23, 0.7);
  background: radial-gradient(circle at 40% 30%, #4a1418, #14060a);
  display: grid;
  place-items: center;
}

.lantern-btn img {
  width: 26px;
  height: 26px;
}

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

.page {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
}

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

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

.kicker {
  display: block;
  font-size: 11px;
  color: #c41e3a;
  letter-spacing: 0.08em;
}

.lede {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #f0d8c4;
}

.hero-copy h1 {
  margin-top: 2px;
}

.hero-well {
  height: min(28vh, 210px);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(212, 160, 23, 0.7);
  box-shadow: inset 0 0 0 1px rgba(196, 30, 58, 0.25);
  margin-bottom: 12px;
}

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

.enter {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px 40px 14px 40px;
  background:
    linear-gradient(180deg, #8a1a28 0%, #4a0c14 100%);
  border: 1.5px solid #d4a017;
  box-shadow: 0 8px 0 #2a060c, 0 0 16px rgba(196, 30, 58, 0.35);
  margin-bottom: 12px;
}

.enter img {
  width: 36px;
  height: 36px;
}

.enter em {
  display: block;
  font-style: normal;
  font-size: 16px;
  font-weight: 700;
}

.enter small {
  display: block;
  color: #f2d06b;
  font-size: 11px;
}

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

.stat {
  text-align: center;
  padding: 8px 4px;
  background: rgba(20, 6, 10, 0.55);
  border: 1px solid rgba(212, 160, 23, 0.35);
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
}

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

.stat span {
  font-size: 10px;
  color: #e0c4b0;
}

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

.facet {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: linear-gradient(90deg, rgba(196, 30, 58, 0.14), rgba(20, 6, 10, 0.4));
  border: 1px solid rgba(212, 160, 23, 0.28);
  border-radius: 14px 8px 18px 8px;
}

.facet img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

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

.facet p,
.vein-card p,
.tale-card p,
.rule-card p,
.shaft-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #ead0bc;
}

.hud {
  flex: 0 0 auto;
  padding-bottom: 6px;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud h2 {
  margin: 0;
  font-size: 14px;
  color: #f2d06b;
}

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

.lives i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a1214;
  border: 1px solid #8a4a28;
}

.lives i.on {
  background: radial-gradient(circle at 35% 30%, #ff6a6a, #c41e3a);
  box-shadow: 0 0 8px #c41e3a;
}

.meters {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 6px;
  margin-top: 6px;
}

.meter,
.pulse-meter {
  height: 7px;
  border-radius: 99px;
  background: #2a0c12;
  border: 1px solid rgba(212, 160, 23, 0.35);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c41e3a, #d4a017);
}

.pulse-meter i {
  display: block;
  height: 100%;
  width: 0;
  background: #6a4a18;
}

.pulse-meter i.hot {
  background: #f2d06b;
}

.hud-bits {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 5px;
  font-size: 11px;
  color: #e8c8b0;
}

#stageWrap {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid rgba(212, 160, 23, 0.45);
  background: #0a0306;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.shaft-list,
.vein-grid,
#taleList,
#ruleList {
  display: grid;
  gap: 8px;
}

.shaft-card,
.vein-card,
.tale-card,
.rule-card {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(28, 10, 16, 0.72);
  border: 1px solid rgba(212, 160, 23, 0.28);
}

.shaft-card img,
.vein-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.shaft-card h2,
.vein-card h2,
.tale-card h2,
.rule-card h2 {
  margin: 0 0 3px;
  font-size: 14px;
  color: #f2d06b;
}

.shaft-card small {
  display: block;
  margin-top: 4px;
  color: #d4a017;
  font-size: 11px;
}

.shaft-card.is-lock {
  opacity: 0.45;
}

.shaft-card.is-now {
  border-color: #f2d06b;
  box-shadow: 0 0 0 1px rgba(242, 208, 107, 0.25);
}

.vein-card span {
  display: block;
  font-size: 10px;
  color: #c41e3a;
  margin-bottom: 2px;
}

.tale-card,
.rule-card {
  grid-template-columns: 1fr;
}

.rule-card {
  grid-template-columns: 28px 1fr;
}

.rule-card b {
  font-family: Cinzel, serif;
  color: #d4a017;
  font-size: 16px;
}

.toggle,
.danger,
.ghost {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  margin: 8px 0;
}

.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(28, 10, 16, 0.8);
  border: 1px solid rgba(212, 160, 23, 0.4);
}

.keep-card {
  padding: 10px;
  border: 1px solid rgba(212, 160, 23, 0.3);
  border-radius: 14px;
  text-align: center;
}

.keep-card img {
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.danger {
  background: #4a0c14;
  border: 1px solid #c41e3a;
  color: #ffd0c4;
}

.ghost {
  background: transparent;
  border: 1px solid rgba(212, 160, 23, 0.5);
}

.cage-rail {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 8px 2px max(10px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, #3a120c 0%, #14060a 100%);
  border-top: 2px solid #d4a017;
  box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.35);
}

.cage-car {
  position: absolute;
  top: 6px;
  left: 0;
  width: calc(100% / 6);
  height: calc(100% - 14px - env(safe-area-inset-bottom, 0px));
  border: 2px solid #f2d06b;
  border-radius: 10px;
  pointer-events: none;
  box-shadow: inset 0 0 10px rgba(242, 208, 107, 0.25);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
  z-index: 1;
}

.hex {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px 4px;
}

.hex b {
  width: 18px;
  height: 18px;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
  box-shadow: 0 0 0 1px #d4a017;
}

.hex:nth-child(2) b { background: #8a1a28; }
.hex:nth-child(3) b { background: #d4a017; }
.hex:nth-child(4) b { background: #1f6b4a; }
.hex:nth-child(5) b { background: #c41e3a; }
.hex:nth-child(6) b { background: #3a2a78; }
.hex:nth-child(7) b { background: #8a4a18; }

.hex.is-on b {
  background: radial-gradient(circle at 40% 30%, #f2d06b, #c41e3a);
}

.hex small {
  font-size: 9px;
  line-height: 1.2;
  color: #e8c8b0;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
}

.hex.is-on small {
  color: #f2d06b;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  padding: 8px 14px;
  border-radius: 99px;
  background: rgba(20, 6, 10, 0.92);
  border: 1px solid #d4a017;
  font-size: 12px;
  max-width: 86%;
  transition: 0.2s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

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

.modal {
  width: min(100%, 320px);
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #2a0c12, #14060a);
  border: 2px solid #d4a017;
  text-align: center;
}

.modal img {
  width: 84px;
  height: 84px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.modal h2 {
  margin: 0 0 6px;
  color: #f2d06b;
  font-size: 18px;
}

.modal p {
  margin: 0 0 12px;
  font-size: 13px;
}

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

@media (max-height: 640px) {
  .hero-well {
    height: min(22vh, 150px);
  }

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

  h1 {
    font-size: 22px;
  }

  .facet img,
  .shaft-card img,
  .vein-card img {
    width: 48px;
    height: 48px;
  }

  .shaft-card,
  .vein-card {
    grid-template-columns: 48px 1fr;
  }
}

@media (min-width: 400px) {
  .hex small {
    font-size: 10px;
  }

  .lede {
    font-size: 14px;
  }
}

@media (max-width: 340px) {
  .stat span {
    font-size: 9px;
  }

  .hex small {
    font-size: 8px;
  }

  .crown {
    min-height: 42px;
  }
}
