:root {
  --bg: #121815;
  --surface: #1c241f;
  --surface-raised: #252f28;
  --surface-soft: #151c18;
  --line: #3b4a40;
  --line-soft: #2a352e;
  --text: #f5f6ef;
  --muted: #b3bcb3;
  --quiet: #818c83;
  --accent: #47d182;
  --accent-strong: #dfead8;
  --champagne: #d8c39b;
  --emerald-deep: #0e7b4c;
  --danger: #b9827b;
  --radius-xl: 26px;
  --radius-lg: 19px;
  --radius-md: 14px;
  --safe-top: max(18px, var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(22px, var(--tg-content-safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }

html {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  color-scheme: dark;
}

body {
  position: fixed;
  inset: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 86% 7%, rgba(42, 198, 111, .18), transparent 31%),
    radial-gradient(circle at 12% 24%, rgba(216, 195, 155, .065), transparent 27%),
    linear-gradient(180deg, #111713 0%, var(--bg) 40%, #0f1512 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

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

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  height: var(--tg-viewport-stable-height, 100dvh);
  min-height: 0;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 6px) 18px calc(var(--safe-bottom) + 28px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
}

.shell::-webkit-scrollbar { display: none; }

.interactive-surface,
.section-card,
.section-art,
.hero-visual,
.detail-art {
  touch-action: pan-y;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-bottom: 20px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .18em;
}

.wordmark::before {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(94, 226, 144, .72);
  border-radius: 7px;
  content: "M";
  display: grid;
  place-items: center;
  color: #e8f4e3;
  background: linear-gradient(145deg, rgba(76, 211, 128, .14), rgba(216, 195, 155, .08));
  box-shadow: 0 0 26px rgba(52, 208, 112, .12);
  font-size: 11px;
  letter-spacing: 0;
}

.counter {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
}

.hero-visual {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 0px;
  --my: 0px;
  --shine-x: 50%;
  --shine-y: 50%;
  position: relative;
  height: clamp(205px, 55vw, 292px);
  margin: 0 0 30px;
  overflow: hidden;
  border: 1px solid rgba(115, 213, 151, .3);
  border-radius: var(--radius-xl);
  background: #111713;
  box-shadow:
    0 28px 72px rgba(0, 0, 0, .3),
    0 0 48px rgba(35, 199, 102, .075),
    inset 0 1px rgba(255, 255, 255, .065);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 180ms ease, border-color 180ms ease;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 52% 63%;
  filter: saturate(1.02) contrast(1.03) brightness(1.02);
  transform: translate3d(var(--mx), var(--my), 0) scale(1.075);
  transition: transform 220ms ease-out;
}

.visual-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 11, 9, 0) 49%, rgba(7, 12, 9, .58) 100%),
    linear-gradient(90deg, rgba(8, 13, 10, .14), transparent 58%);
}

.hero-visual::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(191, 226, 202, .085), transparent 32%);
  mix-blend-mode: screen;
}

.visual-index, .visual-caption {
  position: absolute;
  z-index: 2;
  bottom: 17px;
  color: rgba(232, 238, 232, .76);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: .16em;
}

.visual-index { left: 17px; }
.visual-caption { right: 17px; color: var(--accent); }

.access-strip {
  min-height: 42px;
  margin: -16px 5px 29px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(80, 197, 123, .22);
  border-radius: 13px;
  background: linear-gradient(90deg, rgba(41, 103, 65, .22), rgba(83, 69, 48, .16));
  color: #ced8cf;
  font-size: 9px;
  font-weight: 720;
  letter-spacing: .11em;
  box-shadow: inset 0 1px rgba(255, 255, 255, .035);
  overflow: hidden;
}

.access-strip span { min-width: 0; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.access-strip span:last-child { color: var(--champagne); }
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58e693;
  box-shadow: 0 0 0 4px rgba(63, 210, 120, .1), 0 0 16px rgba(63, 210, 120, .52);
}

.hero { margin-bottom: 34px; }
.eyebrow, .item-label, .section-number, .lock-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  width: 100%;
  max-width: 500px;
  margin: 13px 0 15px;
  font-size: clamp(32px, 9vw, 48px);
  line-height: .99;
  letter-spacing: -.045em;
  font-weight: 680;
  overflow-wrap: break-word;
}

.hero-copy {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.progress-track {
  height: 3px;
  margin: 27px 0 0;
  overflow: hidden;
  background: var(--line-soft);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #29b969, #77e6a0 74%, var(--champagne));
  box-shadow: 0 0 16px rgba(57, 212, 117, .34);
  transform-origin: left;
  transition: width 260ms ease;
}

.section-list { display: grid; gap: 15px; perspective: 1000px; }

.section-card {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 0px;
  --my: 0px;
  --shine-x: 50%;
  --shine-y: 50%;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 1px solid rgba(114, 142, 123, .27);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(34, 44, 37, .99), rgba(22, 29, 24, .99));
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 22px 46px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .055);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.section-card::before {
  position: absolute;
  z-index: 3;
  inset: 0;
  content: "";
  border-radius: inherit;
  background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(174, 215, 187, .07), transparent 34%);
  pointer-events: none;
}

.section-card:active { transform: perspective(900px) scale(.988) rotateX(var(--rx)) rotateY(var(--ry)); }
.section-card.unlocked { border-color: rgba(78, 204, 124, .42); }
.section-card.current { background: var(--surface-raised); border-color: #3a473e; }

.section-art {
  position: relative;
  height: clamp(145px, 39vw, 205px);
  overflow: hidden;
  border-bottom: 1px solid rgba(132, 181, 148, .19);
  background: #111713;
}

.section-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 57%;
  filter: saturate(1.04) contrast(1.03) brightness(1.01);
  transform: translate3d(var(--mx), var(--my), 0) scale(1.1);
  transition: transform 220ms ease-out, filter 220ms ease;
}

.section-card:nth-child(2) .section-art img { object-position: 50% 54%; }
.section-card:nth-child(3) .section-art img { object-position: 50% 50%; }

.section-art-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 51%, rgba(8, 14, 10, .56) 100%),
    linear-gradient(90deg, rgba(9, 15, 11, .08), transparent 55%);
}

.section-art-index {
  position: absolute;
  right: 15px;
  bottom: 12px;
  color: var(--champagne);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .18em;
}

.section-card-body { padding: 17px 18px 19px; }

.section-card-head, .item-head, .requirement, .detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
}

.section-state::before {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
}

.unlocked .section-state { color: var(--accent-strong); }
.unlocked .section-state::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 12px rgba(71, 209, 130, .36); }

.section-card h2 {
  margin: 19px 0 8px;
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: -.025em;
  font-weight: 640;
}

.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.footer-note {
  margin: 27px 3px 0;
  color: var(--quiet);
  font-size: 11px;
  line-height: 1.5;
}

.detail-view { animation: enter 210ms ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.back-button {
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.detail-top { margin-bottom: 32px; }
.detail-title { margin-bottom: 26px; }
.detail-title h1 { margin-bottom: 12px; }

.detail-art {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 0px;
  --my: 0px;
  --shine-x: 50%;
  --shine-y: 50%;
  position: relative;
  height: clamp(178px, 49vw, 270px);
  margin: -12px 0 27px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: #111713;
  box-shadow: 0 24px 56px rgba(0, 0, 0, .24);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 180ms ease;
}

.detail-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(1.04) contrast(1.03) brightness(1.01);
  transform: translate3d(var(--mx), var(--my), 0) scale(1.09);
  transition: transform 220ms ease-out;
}

.detail-art::after {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(181, 219, 191, .075), transparent 33%);
  pointer-events: none;
}

.detail-art-code {
  position: absolute;
  z-index: 2;
  right: 15px;
  bottom: 13px;
  color: rgba(231, 236, 231, .58);
  font-size: 9px;
  font-weight: 740;
  letter-spacing: .16em;
}

.item-list { display: grid; gap: 12px; counter-reset: material; }
.item-card {
  position: relative;
  overflow: hidden;
  padding: 19px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(67, 181, 108, .13), transparent 42%),
    linear-gradient(145deg, #202921, #171e19);
  box-shadow: 0 15px 38px rgba(0, 0, 0, .14);
  counter-increment: material;
  transition: border-color 180ms ease, transform 180ms ease;
}

.item-card::after {
  position: absolute;
  top: 15px;
  right: 16px;
  content: counter(material, decimal-leading-zero);
  color: rgba(154, 176, 160, .34);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .14em;
}

.item-card:active { transform: scale(.992); border-color: #354139; }

.item-heading {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-height: 48px;
  margin-bottom: 13px;
}

.item-logo {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  overflow: hidden;
  border: 1px solid rgba(122, 226, 161, .28);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 25%, rgba(255, 255, 255, .18), rgba(35, 49, 39, .82) 58%, #111713);
  box-shadow: 0 9px 22px rgba(0, 0, 0, .24), 0 0 20px rgba(57, 205, 114, .1), inset 0 1px rgba(255, 255, 255, .12);
  transform: translateZ(0);
  transition: transform 190ms ease, border-color 190ms ease, box-shadow 190ms ease;
}

.item-logo::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  content: "";
  background: linear-gradient(135deg, rgba(255, 255, 255, .14), transparent 43%);
  pointer-events: none;
}

.item-logo img {
  width: 68%;
  height: 68%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .3));
}

.item-logo-fallback {
  color: #dcebdc;
  font-size: 18px;
  font-weight: 760;
}

.item-card:active .item-logo {
  border-color: rgba(117, 231, 160, .58);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .25), 0 0 28px rgba(57, 205, 114, .18);
  transform: scale(.93) rotate(-4deg);
}

.item-card h3 {
  margin: 5px 0 0;
  font-size: 21px;
  font-weight: 640;
  letter-spacing: -.025em;
}

.item-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 17px 0 0;
  border-top: 1px solid var(--line-soft);
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  color: #c9cec8;
  font-size: 13px;
  line-height: 1.45;
  counter-increment: step;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  color: var(--quiet);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}

.text-link, .primary-button, .secondary-button {
  min-height: 46px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
}

.text-link {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: linear-gradient(180deg, #171c18, #121613);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.source-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  margin-top: 17px;
}

.text-link:active { transform: scale(.99); border-color: #425047; }

.lock-panel {
  position: relative;
  overflow: hidden;
  padding: 23px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 100% 0, rgba(55, 192, 107, .17), transparent 42%),
    var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .2);
}

.lock-panel h2 {
  margin: 13px 0 10px;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -.035em;
}

.lock-panel > p { color: var(--muted); line-height: 1.55; }
.requirements { display: grid; gap: 8px; margin: 24px 0; }
.requirement {
  min-height: 57px;
  padding: 10px 12px 10px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  color: #cbd0cb;
  font-size: 13px;
}

.requirement.done { color: var(--accent-strong); border-color: #39473d; }
.requirement a { color: inherit; text-decoration: none; }
.status-dot { width: 8px; height: 8px; border: 1px solid var(--quiet); border-radius: 50%; }
.done .status-dot { border-color: var(--accent); background: var(--accent); }

.button-stack { display: grid; gap: 9px; }
.primary-button {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #c1d6ba, #8eaa8a);
  color: #0d120e;
  box-shadow: 0 12px 30px rgba(111, 147, 112, .16), inset 0 1px rgba(255, 255, 255, .32);
  transition: transform 150ms ease, filter 150ms ease;
}
.primary-button:active { transform: scale(.988); filter: brightness(.94); }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--text); }
.primary-button:disabled { opacity: .55; cursor: wait; }

.club-cta {
  position: relative;
  overflow: hidden;
  margin: 19px 0 10px;
  padding: 22px 20px;
  border: 1px solid rgba(71, 209, 130, .42);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 100% 0, rgba(71, 209, 130, .24), transparent 42%),
    linear-gradient(135deg, rgba(23, 54, 34, .96), rgba(17, 25, 20, .98));
  box-shadow: 0 22px 54px rgba(0, 0, 0, .24), inset 0 1px rgba(255, 255, 255, .06);
}

.club-cta h2 {
  margin: 11px 0 9px;
  color: var(--accent-strong);
  font-size: 25px;
  line-height: 1.06;
  letter-spacing: -.03em;
}

.club-cta p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.52;
}

.club-cta .primary-button { width: 100%; }

.review-note {
  margin: 15px 0;
  padding: 13px 14px;
  border-left: 2px solid var(--accent);
  background: #19221c;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dev-panel {
  margin-top: 28px;
  padding: 15px;
  border: 1px dashed #354038;
  border-radius: var(--radius-md);
}
.dev-panel-title { margin: 0 0 11px; color: var(--quiet); font-size: 10px; letter-spacing: .12em; }
.dev-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.dev-actions button { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 11px; }

.loading-view, .error-view {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.brand-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 18px;
  color: var(--accent-strong);
  font-size: 25px;
  font-weight: 680;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(18px + var(--tg-safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px);
  transform: translate(-50%, 18px);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #202621;
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  .shell { padding-inline: 26px; }
  .section-art { height: 225px; }
}

@media (max-width: 390px) {
  .shell { padding-inline: 14px; }
  .access-strip { padding-inline: 10px; font-size: 8px; letter-spacing: .075em; }
  h1 { font-size: 34px; }
}

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