html {
  scroll-padding-top: calc(max(12px, env(safe-area-inset-top)) + 60px);
}
#app {
  --page-gutter: clamp(18px, 3.3vw, 50px);
  padding-top: 0;
  padding-inline: var(--page-gutter);
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
.top {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 calc(-1 * var(--page-gutter)) 8px;
  padding: max(12px, env(safe-area-inset-top)) var(--page-gutter) 8px;
  background: #18141e;
  border-bottom: 1px solid var(--edge);
}
.balance-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 15px; border-radius: 24px;
  background: #28232d; color: var(--gold); border: 1px solid #615044;
  font-weight: 600; font-size: 14px;
}
.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 4;
  padding: 7px max(12px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid #433848; background: #18141ef5; backdrop-filter: blur(18px);
}
.tabbar > div { max-width: 610px; margin: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tabbar button {
  min-height: 48px; padding: 6px; display: flex; justify-content: center; align-items: center;
  gap: 7px; background: transparent; color: var(--muted); border-radius: 12px; font-size: 14px;
}
.tabbar button[aria-current=page] { background: #352b35; color: var(--gold); }
.tabbar button:hover,.balance-chip:hover { background: #342b39; }
.wallet { max-width: 860px; margin: 0 auto; }
.wallet-heading h1 { font-size: clamp(38px,6vw,64px); margin: 4px 0 21px; }
.wallet-total {
  position: relative; isolation: isolate; overflow: hidden; display: flex; justify-content: space-between;
  align-items: center; padding: clamp(20px,4vw,34px); border: 1px solid #675365; border-radius: 18px;
  background: linear-gradient(110deg,#352937,#2c2539 70%,#242032); color: var(--gold);
}
.wallet-total span,.wallet-section > span,.checkout p,.preview-note { color: var(--muted); font-size: 14px; }
.wallet-total strong { display: block; font: normal clamp(32px,5vw,50px)/1.15 var(--serif); color: var(--paper); margin-top: 3px; }
.wallet-section,.checkout header,.checkout-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wallet-section { margin: 25px 0 10px; }
.wallet h2,.checkout h2 { font: normal clamp(24px,4vw,34px)/1.1 var(--serif); }
.first-sale,.wallet-notice { color: var(--gold); font-size: 15px; margin: 12px 0; }
.credit-packs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.credit-pack { padding: 18px; background: #241e2a; border: 1px solid var(--edge); border-radius: 15px; }
.pack-symbol { display: inline-flex; color: var(--gold); margin-bottom: 12px; }
.credit-pack h3 { font: normal 27px/1.15 var(--serif); }
.pack-price { display: flex; gap: 9px; align-items: baseline; margin: 9px 0 16px; }
.pack-price strong { color: var(--gold); font-size: 18px; }
.pack-price del { color: var(--muted); font-size: 14px; }
.credit-pack button { width: 100%; }
.preview-note { margin: 14px 0; }
.checkout { width: min(400px,calc(100% - 24px)); border-radius: 16px; padding: 0; color: var(--paper); background: #221c29; border: 1px solid #6a5467; }
.checkout::backdrop { background: #09070ddc; }
.checkout-panel { display: grid; gap: 17px; padding: 20px; }
.checkout-line { border-bottom: 1px solid var(--edge); padding-bottom: 8px; }
.checkout-line span { color: var(--muted); }
.resume { margin-top: 6px; }
@media (max-width: 650px) {
  #app { --page-gutter: 13px; }
  .tabbar button { flex-direction: column; gap: 1px; font-size: 12px; }
  .wallet-section { align-items: baseline; flex-wrap: wrap; }
  .credit-packs { grid-template-columns: 1fr; gap: 8px; }
  .credit-pack { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 14px 15px; }
  .credit-pack .pack-symbol { display: none; }
  .credit-pack h3 { font-size: 23px; }
  .pack-price { margin: 4px 0 0; grid-column: 1; }
  .credit-pack button { grid-column: 2; grid-row: 1 / 3; }
  .brand strong { font-size: clamp(21px,6vw,25px); }
}
.reversed { transform: rotate(180deg); }
.legacy-reading { white-space: pre-wrap; margin-top: 1rem; }
.people-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1rem; }
