@font-face {
  font-family: Display;
  src: url("display.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Sans;
  src: url("sans.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --nacre: #F7F1EA;
  --pink: #E8B4C4;
  --teal: #1F7A7A;
  --gold: #C9A24A;
  --ink: #3B2F2A;
  --soft: #6B5850;
  --rim: 1px solid rgba(201, 162, 74, 0.72);
  --card: linear-gradient(165deg, #FFFDF9 0%, #F7F1EA 46%, #F4E3E8 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  color: var(--ink);
  font-family: Sans, "Segoe UI", sans-serif;
  background: var(--nacre);
}

body {
  overflow-x: hidden;
}

#tide, #blush {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#tide {
  background: url("seablur.png") center / cover no-repeat;
  opacity: 0.55;
}

#blush {
  background: url("pinkglow.png") center / cover no-repeat;
  opacity: 0.28;
}

.layer {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100dvh;
}

.layer.show {
  display: block;
}

#splash {
  display: none;
  place-items: center;
  text-align: center;
  padding: 12vh 24px;
}

#splash.show {
  display: grid;
  animation: fadein 0.4s ease;
}

.splash-orb {
  position: relative;
  width: min(52vw, 240px);
  height: min(52vw, 240px);
  margin: 0 auto 22px;
}

.splash-shell, .splash-pearl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.splash-pearl {
  inset: 28% 30% 22%;
  width: auto;
  height: auto;
  animation: rise 1.4s ease both;
  filter: drop-shadow(0 0 16px rgba(31, 122, 122, 0.35));
}

#splash h1, .club-top h1, .scene-title, .sheet-card h2, #quizAsk, #quizPct {
  font-family: Display, Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#splash h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  color: var(--teal);
}

#splash p, .kicker, .lede, .scene-copy, .bar-note {
  color: var(--soft);
}

#onboard {
  padding: 18px 18px 40px;
}

.nacre-bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFFDF8, #F3E6DC);
  border: var(--rim);
  overflow: hidden;
  box-shadow: inset 0 1px 0 #fff;
}

.nacre-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #F7F1EA, #E8B4C4 38%, #1F7A7A);
  transition: width 0.2s linear;
}

.bar-note {
  margin: 8px 2px 18px;
  font-size: 0.85rem;
}

.scene {
  display: none;
  animation: rise 0.8s ease;
}

.scene.show {
  display: block;
}

.scene-title {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  color: var(--teal);
  margin-bottom: 8px;
}

.scene-copy, .lede {
  margin-bottom: 22px;
  line-height: 1.55;
  font-size: 1.05rem;
}

.open-stage {
  position: relative;
  height: min(46vw, 250px);
  margin: 4px auto 18px;
  max-width: 280px;
}

.open-shell, .open-pearl {
  position: absolute;
  left: 50%;
  object-fit: contain;
}

.open-shell {
  width: 86%;
  top: 0;
  transform: translateX(-50%) scaleY(0.28);
  transform-origin: 50% 78%;
  animation: yawn 1.6s ease forwards;
}

.open-pearl {
  width: 22%;
  top: 58%;
  opacity: 0;
  transform: translate(-50%, 40px);
  animation: pearlout 1.1s 0.35s ease forwards;
  filter: drop-shadow(0 0 18px rgba(31, 122, 122, 0.45));
}

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

.pick-shell, .nacre-card, .sheet-card, .pearl-tile {
  background: var(--card);
  border: var(--rim);
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(201, 162, 74, 0.12);
}

.pick-shell {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 16px 8px 14px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pick-shell img {
  width: 72%;
  max-height: 92px;
  object-fit: contain;
}

.pick-shell.on {
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px var(--teal), 0 14px 30px rgba(31, 122, 122, 0.18);
}

.pick-hint {
  margin-top: 14px;
  text-align: center;
  color: var(--teal);
}

.hold-board {
  position: relative;
  height: 240px;
  border-radius: 28px;
  overflow: hidden;
  border: var(--rim);
  background:
    radial-gradient(circle at 70% 20%, rgba(232, 180, 196, 0.35), transparent 42%),
    linear-gradient(180deg, rgba(247, 241, 234, 0.4), rgba(31, 122, 122, 0.18)),
    url("seablur.png") center / cover;
  touch-action: none;
}

.hold-board.tall {
  height: min(52vh, 380px);
}

.teal-zone {
  position: absolute;
  left: 28%;
  top: 28%;
  width: 44%;
  height: 44%;
  border-radius: 40% 48% 42% 50%;
  background: rgba(31, 122, 122, 0.28);
  box-shadow: inset 0 0 0 2px rgba(31, 122, 122, 0.85), 0 0 28px rgba(31, 122, 122, 0.25);
  animation: zonepulse 3.4s ease-in-out infinite;
}

.teal-zone.wide {
  left: 22%;
  width: 56%;
}

.drift-pearl {
  position: absolute;
  width: 58px;
  height: 58px;
  object-fit: contain;
  left: 12%;
  top: 16%;
  filter: drop-shadow(0 8px 10px rgba(59, 47, 42, 0.18));
  pointer-events: none;
  z-index: 2;
}

.hold-meta, .stat-row {
  display: flex;
  gap: 10px;
  margin: 12px 0 16px;
}

.hold-meta span, .stat-row strong {
  font-family: Display, Georgia, serif;
  color: var(--teal);
}

.hold-meta {
  justify-content: space-between;
  color: var(--soft);
}

.quiz-ask, #quizAsk {
  font-size: 1.45rem;
  margin: 8px 0 18px;
}

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quiz-grid button, .teal-btn, .gold-btn, .sheet-x {
  font: inherit;
  cursor: pointer;
  border-radius: 16px;
}

.quiz-grid button {
  background: var(--card);
  border: var(--rim);
  color: var(--ink);
  padding: 14px 10px;
}

.quiz-grid button.ok {
  background: var(--teal);
  color: #F7F1EA;
}

.quiz-grid button.bad {
  opacity: 0.45;
}

.gate-note {
  margin-top: 14px;
  min-height: 1.2em;
  color: var(--teal);
}

#club {
  padding: 16px 16px 128px;
}

.club-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.club-top .mark {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.club-top h1 {
  font-size: 1.7rem;
  color: var(--teal);
}

.shell-rail {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.shell-tab {
  flex: 0 0 auto;
  width: 104px;
  border: 0;
  background: transparent;
  color: var(--soft);
  font: inherit;
  cursor: pointer;
}

.valve {
  position: relative;
  display: block;
  height: 78px;
  transform: scaleY(0.78) rotate(-6deg);
  transform-origin: 50% 86%;
  transition: transform 0.45s ease;
  filter: saturate(0.86);
}

.valve-shell, .valve-pearl {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  object-fit: contain;
}

.valve-shell {
  width: 86px;
  top: 0;
}

.valve-pearl {
  width: 22px;
  top: 34px;
  opacity: 0;
  filter: sepia(0.4) hue-rotate(118deg) saturate(2.4);
}

.shell-tab.on {
  color: var(--teal);
}

.shell-tab.on .valve {
  transform: scaleY(1) rotate(0deg);
  filter: none;
}

.shell-tab.on .valve-pearl {
  opacity: 1;
  animation: bob 2.2s ease-in-out infinite;
}

.tab-name {
  display: block;
  margin-top: 4px;
  font-size: 0.86rem;
  font-weight: 700;
}

p, li, .tab-name, .pick-hint, .bar-note {
  word-spacing: 0.12em;
}

.lede {
  margin-bottom: 14px;
  line-height: 1.45;
}

.pearl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.pearl-tile {
  position: relative;
  padding: 14px 12px 12px;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.pearl-tile img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
}

.pearl-tile h3 {
  font-family: Display, Georgia, serif;
  font-size: 1.2rem;
}

.pearl-tile .pin-dot {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 74, 0.2);
  display: none;
}

.pearl-tile.pinned .pin-dot {
  display: block;
}

.stat-row .nacre-card {
  flex: 1;
  padding: 10px 12px;
}

.nacre-card.slim small {
  display: block;
  color: var(--soft);
  font-size: 0.72rem;
}

.nacre-card.slim strong {
  font-size: 1.25rem;
}

.teal-btn, .gold-btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: var(--rim);
  margin: 8px 0 12px;
}

.teal-btn {
  background: var(--teal);
  color: var(--nacre);
}

.gold-btn {
  background: linear-gradient(180deg, #F7F1EA, #E8B4C4);
  color: var(--ink);
}

.teal-btn:disabled {
  opacity: 0.45;
}

.quiz-card, .result-card {
  padding: 18px;
}

.quiz-step {
  color: var(--pink);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card {
  text-align: center;
}

.result-card img {
  width: 120px;
  margin: 8px auto 10px;
}

#quizPct {
  font-size: 3rem;
  color: var(--teal);
}

.stamp-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.stamp {
  aspect-ratio: 1;
  border-radius: 14px 14px 40% 40%;
  border: var(--rim);
  background: var(--card);
  display: grid;
  place-items: center;
}

.stamp img {
  width: 70%;
  opacity: 0.22;
}

.stamp.lit img {
  opacity: 1;
  filter: sepia(0.25) hue-rotate(110deg) saturate(1.6);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: end center;
  background: rgba(59, 47, 42, 0.28);
  padding: 16px;
}

.sheet.show {
  display: grid;
}

.sheet-card {
  width: min(520px, 100%);
  padding: 22px 18px 20px;
  position: relative;
}

.sheet-card img {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.sheet-card ol {
  margin: 12px 0 18px 18px;
  color: var(--soft);
  line-height: 1.5;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sheet-x {
  position: absolute;
  right: 12px;
  top: 12px;
  border: var(--rim);
  background: #FFFDF9;
  padding: 6px 10px;
}

.view {
  display: none;
}

.view.show {
  display: block;
  animation: rise 0.45s ease;
}

@keyframes yawn {
  0% { transform: translateX(-50%) scaleY(0.24) rotate(-8deg); }
  55% { transform: translateX(-50%) scaleY(0.86) rotate(2deg); }
  100% { transform: translateX(-50%) scaleY(1) rotate(0deg); }
}

@keyframes pearlout {
  0% { opacity: 0; transform: translate(-50%, 46px) scale(0.4); }
  40% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -18px) scale(1); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bob {
  50% { transform: translate(-50%, -5px); }
}

@keyframes zonepulse {
  50% { transform: scale(1.04); background: rgba(31, 122, 122, 0.36); }
}

@media (min-width: 860px) {
  #club {
    max-width: 920px;
    margin: 0 auto;
    padding-bottom: 40px;
  }

  .pearl-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .shell-rail {
    position: sticky;
    top: 0;
    z-index: 4;
    backdrop-filter: blur(10px);
  }

  .shell-tab {
    width: 130px;
  }

  .valve {
    height: 96px;
  }

  .valve-shell {
    width: 104px;
  }
}

@media (max-width: 859px) {
  .shell-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(247, 241, 234, 0), rgba(247, 241, 234, 0.94) 28%, #F7F1EA);
    border-top: var(--rim);
    overflow: visible;
  }

  .shell-tab {
    width: auto;
    align-self: end;
  }

  .valve {
    height: 70px;
    transform: scaleY(1) rotate(0deg);
    transform-origin: 50% 100%;
  }

  .shell-tab .valve {
    filter: saturate(0.9);
  }

  .shell-tab.on .valve {
    transform: scale(1.08) translateY(-6px);
  }

  .valve-shell {
    width: 68px;
    bottom: 0;
    top: auto;
  }

  .valve-pearl {
    top: auto;
    bottom: 18px;
  }

  .tab-name {
    order: -1;
    margin: 0 0 2px;
    font-size: 0.72rem;
  }

  .pick-row {
    grid-template-columns: 1fr;
  }

  .pick-shell {
    grid-template-columns: 64px 1fr;
    justify-items: start;
    padding: 10px 14px;
  }

  .pick-shell img {
    width: 56px;
    max-height: 56px;
  }

  #club {
    padding-bottom: 168px;
  }

  .hold-board.tall {
    height: 210px;
  }

  .stat-row {
    margin-bottom: 10px;
  }
}

@media (max-width: 859px) {
  .quiz-grid {
    grid-template-columns: 1fr;
  }

  .quiz-card, .result-card {
    margin-bottom: 12px;
  }
}
