/* Icy Puzzle shipping shell
   Product register: calm game surfaces around an uninterrupted 3D world. */

:root {
  --shell-ink: oklch(31% 0.035 174);
  --shell-muted: oklch(53% 0.035 174);
  --shell-faint: oklch(72% 0.025 174);
  --shell-paper: oklch(97% 0.012 164);
  --shell-paper-2: oklch(93% 0.022 166);
  --shell-line: oklch(85% 0.025 166);
  --shell-mint: oklch(67% 0.105 170);
  --shell-mint-dark: oklch(42% 0.075 174);
  --shell-gold: oklch(78% 0.15 83);
  --shell-danger: oklch(54% 0.12 35);
  --shell-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shell-nav-height: 72px;
}

body {
  overscroll-behavior: none;
}

button {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

/* Shared meta shell */
.meta-screen,
#collection,
#shop,
#onboarding {
  position: fixed;
  inset: 0;
}

#collection,
#shop {
  z-index: 12;
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 5%, oklch(91% 0.055 167) 0 8%, transparent 8.3%),
    linear-gradient(160deg, var(--shell-paper) 0%, oklch(94% 0.025 183) 100%);
}

.meta-page-shell,
#select .meta-page-shell,
#settings .meta-page-shell {
  width: min(900px, 100%);
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) clamp(20px, 5vw, 56px)
    calc(var(--shell-nav-height) + max(28px, env(safe-area-inset-bottom)));
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: shellEnter 420ms var(--shell-ease) both;
}

.meta-page-head,
#select .meta-page-head,
#settings .meta-page-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 68px;
  margin: 0 0 28px;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid var(--shell-line);
}

.meta-page-head .sheet-title-group {
  min-width: 0;
}

.meta-page-head .sheet-title-group h2,
#select .meta-page-head .sheet-title-group h2,
#settings .meta-page-head .sheet-title-group h2 {
  margin: 2px 0 0;
  color: var(--shell-ink);
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0.12em;
}

.page-kicker,
.home-kicker {
  display: block;
  color: var(--shell-mint-dark);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.meta-page-head .sheet-sub,
#select .meta-page-head .sheet-sub,
#settings .meta-page-head .sheet-sub {
  display: block;
  margin-top: 4px;
  color: var(--shell-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-back,
#select-close.meta-back,
#settings-close.meta-back,
.round-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--shell-line);
  border-radius: 50%;
  background: var(--shell-paper);
  color: var(--shell-ink);
  font: 800 1.1rem/1 var(--font-main);
  cursor: pointer;
  transition: transform 140ms var(--shell-ease), background 180ms var(--shell-ease);
}

.meta-back:active,
.round-icon:active {
  transform: scale(0.92);
}

.page-resource {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid oklch(84% 0.055 83);
  border-radius: 999px;
  background: oklch(94% 0.045 86);
  color: oklch(42% 0.085 76);
  font-size: 0.85rem;
  box-sizing: border-box;
}

.page-resource > span {
  color: var(--shell-gold);
  font-size: 1rem;
}

/* Home: the level remains the hero image */
#menu {
  z-index: 10;
  display: block;
  padding: 0;
  background:
    linear-gradient(180deg, oklch(96% 0.018 165 / 0.94) 0%, oklch(96% 0.018 165 / 0.28) 24%, transparent 45%),
    linear-gradient(0deg, oklch(95% 0.023 170 / 0.97) 0%, oklch(95% 0.023 170 / 0.72) 29%, transparent 57%);
}

.home-topbar {
  position: absolute;
  z-index: 2;
  top: max(18px, env(safe-area-inset-top));
  left: clamp(18px, 4vw, 52px);
  right: clamp(18px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: fadeDown 520ms var(--shell-ease) both;
}

.traveler-profile,
.home-resources {
  display: flex;
  align-items: center;
  gap: 10px;
}

.traveler-profile > span:last-child {
  display: flex;
  flex-direction: column;
  color: var(--shell-ink);
  line-height: 1.12;
}

.traveler-profile small {
  color: var(--shell-muted);
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.traveler-profile b {
  margin-top: 3px;
  font-size: 0.84rem;
}

.traveler-mark {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  overflow: visible;
  border: 2px solid oklch(99% 0.006 165);
  border-radius: 50%;
  background: oklch(82% 0.08 170);
  box-shadow: 0 7px 18px oklch(35% 0.04 170 / 0.18);
}

.traveler-mark::before,
.traveler-mark::after,
.traveler-mark i { display: none; }

.traveler-mark .game-art {
  position: absolute;
  inset: -7px;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

#menu .home-center {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100dvh;
  padding: max(100px, calc(env(safe-area-inset-top) + 78px)) 22px
    calc(var(--shell-nav-height) + max(34px, env(safe-area-inset-bottom)));
  box-sizing: border-box;
  pointer-events: none;
}

#menu .home-head {
  gap: 4px;
  animation: fadeDown 620ms var(--shell-ease) both;
}

#menu .home-title {
  margin: 4px 0 0;
  color: var(--shell-ink);
  font-size: clamp(2.1rem, 7vw, 4rem);
  line-height: 1;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-shadow: 0 4px 22px oklch(98% 0.01 165 / 0.75);
}

#menu .home-sub {
  color: var(--shell-muted);
  font-size: 0.64rem;
  letter-spacing: 0.38em;
}

.home-journey {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(360px, 100%);
  margin: 0 auto;
  pointer-events: auto;
  animation: fadeUp 620ms 80ms var(--shell-ease) both;
}

.next-copy {
  text-align: center;
}

.next-copy > span {
  color: var(--shell-mint-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.next-copy strong {
  display: block;
  margin-top: 5px;
  color: var(--shell-ink);
  font-size: 1.08rem;
  letter-spacing: 0.09em;
}

#menu-progress {
  margin: 7px 0 15px;
  color: var(--shell-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#menu .home-playbtn {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: min(330px, 88vw);
  height: 60px;
  padding: 0 16px 0 24px;
  border: 1px solid oklch(36% 0.055 173);
  border-radius: 20px;
  background: var(--shell-ink);
  color: var(--shell-paper);
  box-shadow: 0 14px 30px oklch(29% 0.04 174 / 0.24);
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  animation: none;
  transition: transform 140ms var(--shell-ease), background 180ms var(--shell-ease);
}

#menu .home-playbtn i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: oklch(97% 0.01 165 / 0.12);
  font: normal 1.65rem/1 var(--font-main);
}

#menu .home-playbtn #home-play-label {
  margin: 0;
  color: var(--shell-paper);
  opacity: 1;
}

#menu .home-playbtn:hover {
  background: var(--shell-mint-dark);
  transform: translateY(-2px);
}

#menu .home-playbtn:active {
  transform: scale(0.975);
}

.quiet-link {
  min-height: 44px;
  margin-top: 4px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--shell-muted);
  font: 700 0.7rem/1 var(--font-main);
  letter-spacing: 0.08em;
  cursor: pointer;
}

/* Persistent game navigation */
#meta-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(540px, calc(100vw - 24px));
  min-height: var(--shell-nav-height);
  padding: 6px;
  border: 1px solid oklch(84% 0.025 170);
  border-radius: 24px;
  background: oklch(97% 0.012 164 / 0.96);
  box-shadow: 0 18px 50px oklch(31% 0.035 174 / 0.19);
  transform: translateX(-50%);
  box-sizing: border-box;
}

#meta-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  padding: 5px 3px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--shell-muted);
  font-family: var(--font-main);
  cursor: pointer;
  transition: color 160ms var(--shell-ease), background 160ms var(--shell-ease), transform 120ms var(--shell-ease);
}

#meta-nav button span {
  font-size: 1.08rem;
  line-height: 1;
}

#meta-nav button b {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.63rem;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#meta-nav button.active {
  background: var(--shell-paper-2);
  color: var(--shell-mint-dark);
}

#meta-nav button:active {
  transform: scale(0.93);
}

body[data-screen="game"] #meta-nav {
  display: none !important;
}

/* Journey */
#select {
  z-index: 12;
  display: block;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 2%, oklch(91% 0.055 167) 0 7%, transparent 7.3%),
    linear-gradient(160deg, var(--shell-paper) 0%, oklch(94% 0.025 183) 100%);
  backdrop-filter: none;
}

.chapter-intro {
  max-width: 600px;
  margin: 0 auto 18px;
  text-align: center;
}

.chapter-intro > span {
  color: var(--shell-mint-dark);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.35em;
}

.chapter-intro h3 {
  margin: 7px 0 5px;
  color: var(--shell-ink);
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
}

.chapter-intro p {
  margin: 0;
  color: var(--shell-muted);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

#select .chapter-tabs {
  position: sticky;
  z-index: 3;
  top: -1px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(420px, 100%);
  margin: 18px auto 28px;
  padding: 5px;
  border: 1px solid var(--shell-line);
  border-radius: 18px;
  background: var(--shell-paper);
  box-shadow: 0 10px 24px oklch(32% 0.035 174 / 0.08);
}

#select .chap-tab {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--shell-muted);
  font-weight: 800;
}

#select .chap-tab.active {
  background: var(--shell-ink);
  color: var(--shell-paper);
  box-shadow: none;
}

#select-grid.world-path {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 12px 0 28px;
}

#select-grid.world-path::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--shell-line);
  transform: translateX(-50%);
}

#select-grid .lvl-btn {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  width: min(220px, calc(50% - 18px));
  min-height: 70px;
  padding: 11px 13px;
  border: 1px solid var(--shell-line);
  border-radius: 20px;
  background: var(--shell-paper);
  color: var(--shell-ink);
  box-shadow: 0 8px 22px oklch(31% 0.035 174 / 0.08);
  box-sizing: border-box;
  text-align: left;
}

#select-grid .lvl-btn.path-left {
  align-self: flex-start;
}

#select-grid .lvl-btn.path-right {
  align-self: flex-end;
}

#select-grid .lvl-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 1px;
  background: var(--shell-line);
}

#select-grid .lvl-btn.path-left::after { right: -19px; }
#select-grid .lvl-btn.path-right::after { left: -19px; }

#select-grid .lvl-btn .lid {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  align-self: center;
  border-radius: 14px;
  background: var(--shell-paper-2);
  color: var(--shell-mint-dark);
  font-size: 0.95rem;
  font-weight: 850;
}

#select-grid .lvl-btn .lname {
  align-self: end;
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.05em;
}

#select-grid .lvl-btn .lstars {
  align-self: start;
  color: oklch(66% 0.14 82);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

#select-grid .lvl-btn .lpar {
  display: none;
}

#select-grid .lvl-btn.current {
  border-color: var(--shell-mint);
  background: oklch(95% 0.035 170);
  box-shadow: 0 12px 30px oklch(47% 0.07 171 / 0.16);
}

#select-grid .lvl-btn:hover {
  border-color: var(--shell-mint);
  transform: translateY(-2px);
}

/* Collection */
.equipped-showcase {
  position: relative;
  display: grid;
  grid-template-columns: 190px 1fr;
  align-items: center;
  min-height: 185px;
  margin-bottom: 34px;
  padding: 18px clamp(18px, 5vw, 48px);
  overflow: hidden;
  border-radius: 34px;
  background: var(--look-bg, oklch(89% 0.06 170));
  color: var(--shell-ink);
}

.equipped-showcase::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -58px;
  width: 190px;
  height: 190px;
  border: 28px solid oklch(98% 0.01 165 / 0.36);
  border-radius: 50%;
}

.look-figure {
  --look-a: #e99452;
  --look-b: #c66e38;
  --look-c: #fff0d5;
  position: relative;
  display: grid;
  place-items: center;
  width: 176px;
  height: 164px;
  margin: 0 auto;
  filter: drop-shadow(0 14px 12px oklch(30% 0.035 170 / 0.18));
}

.look-figure::before,
.look-figure::after,
.look-figure i,
.look-figure span { display: none; }

.look-figure .game-art-hero {
  width: 184px;
  height: 184px;
  object-fit: contain;
}

.showcase-copy {
  position: relative;
  z-index: 1;
}

.showcase-copy .page-kicker {
  margin-bottom: 6px;
}

.showcase-copy h3 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0.12em;
}

.showcase-copy p {
  max-width: 38ch;
  margin: 8px 0 0;
  color: var(--shell-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.collection-section + .collection-section {
  margin-top: 34px;
}

.collection-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.collection-section-head h3 {
  margin: 0;
  color: var(--shell-ink);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.collection-section-head span {
  color: var(--shell-muted);
  font-size: 0.68rem;
}

.collection-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.collection-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--shell-line);
  border-radius: 20px;
  background: var(--shell-paper);
  color: var(--shell-ink);
  text-align: left;
  cursor: pointer;
}

.collection-item.locked {
  color: var(--shell-faint);
}

.item-swatch {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: var(--swatch, var(--shell-paper-2));
  color: var(--shell-paper);
  font-size: 1rem;
}

.collection-item strong,
.shop-item strong {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.collection-item small,
.shop-item small {
  display: block;
  margin-top: 4px;
  color: var(--shell-muted);
  font-size: 0.65rem;
  line-height: 1.35;
}

.item-state {
  color: var(--shell-mint-dark);
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.collection-item.equipped {
  border-color: var(--shell-mint);
  background: oklch(95% 0.035 170);
}

/* Shop */
.shop-ledger {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 20px;
  margin-bottom: 30px;
  padding: 24px clamp(20px, 5vw, 40px);
  overflow: hidden;
  border-radius: 28px;
  background: var(--shell-ink);
  color: var(--shell-paper);
}

.shop-ledger::after {
  content: "";
  position: absolute;
  right: 17%;
  top: -38px;
  color: oklch(97% 0.01 165 / 0.08);
  font-size: 8rem;
}

.shop-ledger > span {
  align-self: end;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.shop-ledger strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: oklch(87% 0.13 84);
  font-size: 1.8rem;
}

.shop-ledger p {
  max-width: 52ch;
  margin: 0;
  color: oklch(84% 0.02 166);
  font-size: 0.7rem;
  line-height: 1.45;
}

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

.shop-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 154px;
  padding: 16px;
  border: 1px solid var(--shell-line);
  border-radius: 24px;
  background: var(--shell-paper);
  color: var(--shell-ink);
  box-sizing: border-box;
}

.shop-item .item-swatch {
  width: 90px;
  height: 104px;
  border-radius: 22px;
}

.shop-item p {
  margin: 5px 0 10px;
  color: var(--shell-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.buy-button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--shell-line);
  border-radius: 13px;
  background: var(--shell-paper-2);
  color: var(--shell-ink);
  font: 800 0.7rem/1 var(--font-main);
  cursor: pointer;
}

.buy-button.can-buy {
  border-color: var(--shell-ink);
  background: var(--shell-ink);
  color: var(--shell-paper);
}

.buy-button:disabled {
  cursor: default;
  opacity: 0.62;
}

/* Settings */
#settings {
  z-index: 14;
  display: block;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(160deg, var(--shell-paper) 0%, oklch(94% 0.025 183) 100%);
  backdrop-filter: none;
}

#howto {
  z-index: 42;
  padding: 18px;
  background: oklch(25% 0.035 174 / 0.46);
}

#howto .sheet {
  border-color: oklch(99% 0.008 165);
  background: var(--shell-paper);
}

.settings-page {
  width: min(760px, 100%);
}

.settings-group {
  margin-top: 26px;
}

.settings-group h3 {
  margin: 0 0 10px 4px;
  color: var(--shell-muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
}

#settings .opt-row {
  min-height: 66px;
  margin: 0;
  padding: 10px 4px;
  border-bottom: 1px solid var(--shell-line);
  color: var(--shell-ink);
}

#settings .opt-row > span:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-right: 14px;
}

#settings .opt-row b {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
}

#settings .opt-row small {
  margin-top: 4px;
  color: var(--shell-muted);
  font-size: 0.67rem;
  font-weight: 550;
  line-height: 1.35;
}

#settings .opt-row button,
#settings .opt-row .seg {
  flex: 0 0 auto;
  background: var(--shell-paper-2);
  color: var(--shell-ink);
}

#settings .opt-row > button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 13px;
}

#settings .opt-row .seg button {
  min-height: 44px;
}

#settings .opt-row .seg button.active {
  background: var(--shell-paper);
  color: var(--shell-mint-dark);
}

.status-ok {
  flex: 0 0 auto;
  color: var(--shell-mint-dark) !important;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

#settings .opt-row.danger b,
#settings .opt-row.danger > button {
  color: var(--shell-danger);
}

#settings .settings-version {
  padding: 28px 0 8px;
  color: var(--shell-faint);
  line-height: 1.8;
}

/* First run and end states */
#onboarding {
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 20px max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom));
  background: oklch(25% 0.035 174 / 0.48);
  box-sizing: border-box;
}

.onboarding-card {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid oklch(99% 0.008 165);
  border-radius: 30px;
  background: var(--shell-paper);
  box-shadow: 0 28px 80px oklch(24% 0.035 174 / 0.32);
  box-sizing: border-box;
  animation: sheetUp 420ms var(--shell-ease) both;
}

.onboarding-glyph {
  display: block;
  margin-bottom: 18px;
  color: var(--shell-mint);
  font-size: 2rem;
  letter-spacing: 0.25em;
}

.onboarding-card h2 {
  margin: 7px 0 10px;
  color: var(--shell-ink);
  font-size: 1.45rem;
  letter-spacing: 0.1em;
}

.onboarding-card > p:not(.page-kicker) {
  margin: 0;
  color: var(--shell-muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

#btn-onboarding-start {
  width: 100%;
  min-height: 52px;
  margin-top: 22px;
  border: 0;
  border-radius: 17px;
  background: var(--shell-ink);
  color: var(--shell-paper);
  font: 800 0.86rem/1 var(--font-main);
  letter-spacing: 0.14em;
  cursor: pointer;
}

#win .card,
#fail .card,
#pause .card {
  border-radius: 30px;
  background: var(--shell-paper);
  color: var(--shell-ink);
}

#win .win-reward {
  display: inline-flex;
  margin: 12px 0 2px;
  padding: 8px 14px;
  border-radius: 999px;
  background: oklch(94% 0.045 86);
  color: oklch(43% 0.085 76);
  font-weight: 850;
}

#win-auto:not(.hidden) {
  display: block;
  margin-top: 8px;
}

/* Night shell */
body[data-theme="night"] #menu {
  background:
    linear-gradient(180deg, oklch(27% 0.045 255 / 0.92) 0%, transparent 42%),
    linear-gradient(0deg, oklch(24% 0.045 255 / 0.96) 0%, oklch(24% 0.045 255 / 0.64) 30%, transparent 58%);
}

body[data-theme="night"] #menu .home-title,
body[data-theme="night"] .traveler-profile > span:last-child,
body[data-theme="night"] .next-copy strong {
  color: oklch(94% 0.015 230);
}

body[data-theme="night"] #menu .home-sub,
body[data-theme="night"] .traveler-profile small,
body[data-theme="night"] .next-copy > span,
body[data-theme="night"] #menu-progress,
body[data-theme="night"] .quiet-link {
  color: oklch(76% 0.045 226);
}

body[data-theme="night"] #menu .home-playbtn {
  border-color: oklch(84% 0.03 228);
  background: oklch(90% 0.025 225);
  color: oklch(25% 0.045 255);
}

body[data-theme="night"] #menu .home-playbtn #home-play-label {
  color: oklch(25% 0.045 255);
}

/* Desktop composition */
@media (min-width: 760px) {
  #menu .home-head {
    align-items: flex-start;
    width: min(1180px, calc(100vw - 104px));
    margin: 8px auto 0;
    text-align: left;
  }

  #menu .home-title {
    text-indent: 0;
  }

  #menu .home-sub {
    text-indent: 0;
  }

  .home-journey {
    align-items: flex-start;
    width: min(1180px, calc(100vw - 104px));
  }

  .next-copy {
    text-align: left;
  }
}

/* Narrow phones */
@media (max-width: 620px) {
  :root { --shell-nav-height: 66px; }

  .home-topbar {
    left: 16px;
    right: 16px;
  }

  .traveler-profile small {
    display: none;
  }

  .traveler-mark {
    width: 38px;
    height: 38px;
  }

  .traveler-mark .game-art { inset: -6px; width: 50px; height: 50px; }

  #menu .home-center {
    padding-left: 16px;
    padding-right: 16px;
  }

  #menu .home-title {
    font-size: clamp(2rem, 10.5vw, 2.8rem);
  }

  .meta-page-shell,
  #select .meta-page-shell,
  #settings .meta-page-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .meta-page-head,
  #select .meta-page-head,
  #settings .meta-page-head {
    gap: 10px;
    margin-bottom: 20px;
  }

  .meta-page-head .sheet-title-group h2,
  #select .meta-page-head .sheet-title-group h2,
  #settings .meta-page-head .sheet-title-group h2 {
    font-size: 1.2rem;
  }

  #select-grid .lvl-btn {
    width: calc(50% - 14px);
    grid-template-columns: 37px minmax(0, 1fr);
    padding: 9px;
    border-radius: 17px;
  }

  #select-grid .lvl-btn::after { width: 14px; }
  #select-grid .lvl-btn.path-left::after { right: -15px; }
  #select-grid .lvl-btn.path-right::after { left: -15px; }

  .equipped-showcase {
    grid-template-columns: 124px 1fr;
    min-height: 160px;
    padding: 14px;
    border-radius: 26px;
  }

  .look-figure {
    width: 128px;
    transform: none;
  }

  .showcase-copy p {
    font-size: 0.7rem;
  }

  .collection-list,
  .shop-grid {
    grid-template-columns: 1fr;
  }

  .shop-ledger {
    grid-template-columns: 1fr;
  }

  .shop-ledger strong {
    grid-row: auto;
    grid-column: auto;
    margin: 4px 0;
  }

  #settings .opt-row {
    gap: 10px;
  }

  #settings .opt-row small {
    max-width: 32ch;
  }
}

@media (max-width: 360px) {
  .page-resource { padding: 0 10px; }
  .meta-page-head .sheet-sub { max-width: 170px; }
  #meta-nav { width: calc(100vw - 14px); bottom: max(6px, env(safe-area-inset-bottom)); }
  #meta-nav button b { letter-spacing: 0; }
  .equipped-showcase { grid-template-columns: 106px 1fr; }
  .look-figure { width: 112px; margin-left: -8px; transform: none; }
  #settings .theme-row { align-items: flex-start; flex-direction: column; }
}

@media (orientation: landscape) and (max-height: 650px) {
  #menu .home-center {
    padding-top: 84px;
  }

  #menu .home-head {
    align-items: flex-start;
    margin-left: 4vw;
  }

  #menu .home-title { font-size: 2rem; }
  .home-journey { align-items: flex-end; margin-right: 4vw; }
  .next-copy { text-align: right; }
  #meta-nav { min-height: 60px; --shell-nav-height: 60px; }
  #meta-nav button { min-height: 48px; }
}

@media (hover: hover) and (pointer: fine) {
  .collection-item:hover,
  .shop-item:hover {
    border-color: var(--shell-mint);
  }

  #meta-nav button:hover {
    color: var(--shell-mint-dark);
  }
}

@media (prefers-reduced-motion: reduce) {
  .meta-page-shell,
  #select .meta-page-shell,
  #settings .meta-page-shell,
  .home-topbar,
  #menu .home-head,
  .home-journey,
  .onboarding-card {
    animation: none !important;
  }
}

@keyframes shellEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bespoke icon language: chunky ice, dark wood outline, three-tone faces. */
.icy-icon {
  display: block;
  width: 1.55em;
  height: 1.55em;
  flex: 0 0 auto;
  overflow: visible;
  pointer-events: none;
}

#boot .spin .icy-icon {
  width: 52px;
  height: 52px;
}

.banner-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 28px;
}

.banner-ornament i {
  width: 34px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
}

.banner-ornament .icy-icon {
  width: 25px;
  height: 25px;
}

#view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

#view-toggle button .icy-icon {
  width: 21px;
  height: 21px;
}

#lvl-chip .chip-icon,
#gems-chip .icy-icon {
  width: 20px;
  height: 20px;
  font-size: inherit;
}

.meta-back,
#select-close.meta-back,
#settings-close.meta-back,
.round-icon,
#btn-menu,
#btn-pause {
  border-width: 2px;
  border-color: oklch(48% 0.04 67 / 0.42);
  border-radius: 16px 16px 19px 13px;
  background: oklch(96% 0.02 167);
  box-shadow:
    inset 0 2px 0 oklch(99% 0.01 165),
    0 7px 0 oklch(56% 0.035 69 / 0.16),
    0 12px 22px oklch(31% 0.035 174 / 0.11);
}

.meta-back .icy-icon,
.round-icon .icy-icon,
#btn-menu .icy-icon,
#btn-pause .icy-icon,
#howto-close .icy-icon {
  width: 25px;
  height: 25px;
}

.meta-back:active,
.round-icon:active,
#btn-menu:active,
#btn-pause:active {
  transform: translateY(4px) scale(0.98);
  box-shadow:
    inset 0 2px 0 oklch(99% 0.01 165),
    0 3px 0 oklch(56% 0.035 69 / 0.16),
    0 6px 12px oklch(31% 0.035 174 / 0.1);
}

.page-resource {
  min-height: 42px;
  border-width: 2px;
  border-color: oklch(62% 0.07 75 / 0.48);
  border-radius: 14px 18px 14px 18px;
  background: oklch(94% 0.045 86);
  box-shadow: inset 0 2px 0 oklch(99% 0.018 86 / 0.8), 0 4px 0 oklch(62% 0.07 75 / 0.13);
  justify-self: end;
}

.collection-page .meta-page-head,
.shop-page .meta-page-head {
  grid-template-columns: minmax(0, 1fr) auto;
}

.page-resource > .icy-icon {
  width: 22px;
  height: 22px;
}

#menu .home-playbtn .play-sigil {
  width: 42px;
  height: 38px;
  border: 1px solid oklch(83% 0.03 168 / 0.25);
  border-radius: 13px 16px 13px 16px;
  background: oklch(97% 0.01 165 / 0.1);
}

#menu .home-playbtn .play-sigil .icy-icon {
  width: 28px;
  height: 28px;
}

#meta-nav {
  padding: 7px 8px 9px;
  border: 2px solid oklch(48% 0.04 67 / 0.33);
  border-radius: 21px 21px 29px 29px;
  background: oklch(96% 0.018 166);
  box-shadow:
    inset 0 2px 0 oklch(99% 0.01 165),
    0 7px 0 oklch(54% 0.03 69 / 0.16),
    0 18px 38px oklch(31% 0.035 174 / 0.17);
}

#meta-nav button {
  border-radius: 14px 14px 18px 12px;
}

#meta-nav button .icy-icon {
  width: 27px;
  height: 27px;
  transform-origin: 50% 75%;
  transition: transform 180ms var(--shell-ease), filter 180ms var(--shell-ease);
}

#meta-nav button.active {
  background: oklch(89% 0.055 171);
  box-shadow: inset 0 2px 0 oklch(98% 0.015 168 / 0.75);
}

#meta-nav button.active .icy-icon {
  transform: translateY(-2px) scale(1.08);
  filter: drop-shadow(0 3px 2px oklch(31% 0.035 174 / 0.13));
}

#howto-close {
  display: inline-grid;
  place-items: center;
}

#settings .opt-row > button,
#settings .opt-row .seg button,
.settings-link,
.buy-button,
.shop-ledger strong,
#win-gems,
#win-reward {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

#settings .opt-row > button .icy-icon,
#settings .opt-row .seg button .icy-icon {
  width: 23px;
  height: 23px;
}

.settings-link .icy-icon {
  width: 22px;
  height: 22px;
}

.item-swatch {
  border: 2px solid oklch(99% 0.008 165 / 0.72);
  border-radius: 15px 18px 15px 18px;
  background: color-mix(in oklch, var(--swatch, var(--shell-paper-2)) 76%, var(--shell-paper));
  box-shadow: inset 0 2px 0 oklch(99% 0.006 165 / 0.5), 0 4px 0 oklch(42% 0.04 70 / 0.12);
  box-sizing: border-box;
  overflow: visible;
  isolation: isolate;
}

.item-swatch .icy-icon {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 3px 2px oklch(31% 0.035 174 / 0.16));
}

.game-art {
  display: block;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 4px 3px oklch(31% 0.035 174 / 0.2));
}

.item-swatch .game-art-compact {
  width: 70px;
  height: 70px;
}

.shop-item .item-swatch .game-art-card {
  width: 104px;
  height: 112px;
  margin: -4px -7px;
}

.item-swatch-skin .icy-icon,
.item-swatch-trail .icy-icon {
  width: 36px;
  height: 36px;
}

.shop-item .item-swatch .icy-icon {
  width: 38px;
  height: 38px;
}

.win-character-art {
  display: grid;
  place-items: center;
  width: 116px;
  height: 94px;
  margin: -16px auto -4px;
}

.win-character-art .game-art-card {
  width: 124px;
  height: 124px;
  object-fit: contain;
}

.buy-button .icy-icon {
  width: 20px;
  height: 20px;
}

.shop-ledger::after {
  content: "";
  width: 92px;
  height: 122px;
  right: 17%;
  top: -31px;
  border-radius: 30px 30px 46px 46px;
  background: oklch(88% 0.08 83 / 0.08);
  clip-path: polygon(50% 0, 100% 40%, 72% 100%, 28% 100%, 0 40%);
  transform: rotate(13deg);
}

.shop-ledger strong .icy-icon {
  width: 31px;
  height: 31px;
}

.crystal-rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.crystal-rating .icy-icon {
  width: 1em;
  height: 1em;
}

#select-grid .lvl-btn .lstars {
  display: flex;
  align-items: center;
}

#select-grid .lvl-btn .lstars .crystal-rating {
  gap: 1px;
}

#select-grid .lvl-btn .lstars .icy-icon {
  width: 15px;
  height: 15px;
}

#select-grid .lvl-btn .lock {
  display: grid;
  place-items: center;
}

#select-grid .lvl-btn .lock .icy-icon {
  width: 28px;
  height: 28px;
}

.onboarding-glyph {
  display: grid;
  place-items: center;
}

.onboarding-glyph .icy-icon {
  width: 72px;
  height: 48px;
}

.card .ring {
  display: grid;
  place-items: center;
  min-height: 56px;
}

.card .ring .icy-icon {
  width: 55px;
  height: 55px;
  filter: drop-shadow(0 7px 5px oklch(31% 0.035 174 / 0.16));
}

#win-stars .crystal-rating {
  gap: 7px;
}

#win-stars .icy-icon {
  width: 36px;
  height: 36px;
}

#win-gems .icy-icon,
#win-reward .icy-icon {
  width: 25px;
  height: 25px;
}

body[data-theme='night'] .meta-back,
body[data-theme='night'] .round-icon,
body[data-theme='night'] #btn-menu,
body[data-theme='night'] #btn-pause {
  border-color: oklch(76% 0.035 187 / 0.45);
  background: oklch(29% 0.035 246);
  box-shadow: inset 0 2px 0 oklch(67% 0.04 226 / 0.2), 0 7px 0 oklch(13% 0.025 248 / 0.46);
}

body[data-theme='night'] #view-toggle button.active {
  color: oklch(94% 0.015 202);
}
