:root {
  color-scheme: dark;
  --bg: #070504;
  --card: #18130f;
  --surface: linear-gradient(160deg, #2b2119, #1b1511 55%, #130f0c);
  --bar: rgba(22, 15, 11, .94);
  --line: rgba(255, 240, 214, .1);
  --gold: #c6a36a;
  --gold-soft: #e5c39d;
  --gold-dim: #b6906e;
  --red: #a60d10;
  --red-bright: #e34246;
  --text: #f5ead7;
  --text-2: #c9bba7;
  --text-3: #8e8478;
  --app-max: 480px;
  --nav-h: 48px;
  --cart-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *:before, *:after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}

img { display: block; max-width: 100%; -webkit-user-drag: none; }
button { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
h1, p { margin: 0; }
.icon { display: block; flex: none; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.app-shell {
  position: relative;
  max-width: var(--app-max);
  min-height: 100vh;
  margin: 0 auto;
}

.app-shell:before,
.app-shell:after {
  content: "";
  position: fixed;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: var(--app-max);
  transform: translate(-50%);
  pointer-events: none;
}

.app-shell:before {
  background:
    radial-gradient(140% 60% at 50% -10%, rgba(132, 68, 28, .42), rgba(84, 40, 18, .2) 42%, rgba(40, 20, 10, 0) 82%),
    radial-gradient(100% 42% at 108% 104%, rgba(120, 20, 16, .2), rgba(60, 12, 10, 0) 72%),
    var(--bg);
}

.app-shell:after {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .75 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .07;
}

@media (min-width: 481px) {
  html { background: #020101; }
  .app-shell { box-shadow: 0 0 0 1px #1d1916; }
}

.page-nav {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 90;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  width: 100%;
  max-width: var(--app-max);
  height: calc(var(--nav-h) + var(--safe-top));
  padding: var(--safe-top) 4px 0;
  transform: translate(-50%);
  background: rgba(16, 10, 7, .3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.page-nav h1 {
  color: #f5ead7;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 3px;
  text-indent: 3px;
  text-align: center;
}

.page-nav-side { display: flex; align-items: center; height: 100%; }
.page-nav-back { justify-content: center; width: 44px; color: #f4efec; }
.page-nav-links { justify-content: flex-end; padding-right: 8px; }
.page-nav-links button,
.page-nav-links a { color: var(--gold); font-size: 13px; }
.page-nav-spacer { height: calc(var(--nav-h) + var(--safe-top)); }

.page-pad { padding-left: 16px; padding-right: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  touch-action: manipulation;
  transition: opacity .12s ease;
}

.btn:active { opacity: .8; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-ghost { border: 1px solid var(--gold-dim); color: var(--gold-soft); }
.btn-outline { border: 1px solid var(--gold-dim); border-radius: 999px; color: var(--gold-soft); }
.btn-primary {
  background: linear-gradient(135deg, #c0161b, #8a0b0e);
  box-shadow: inset 0 1px rgba(255, 220, 200, .22), 0 10px 18px -10px rgba(190, 20, 24, .7);
  color: #fff8f3;
}
.btn-block { display: flex; width: 100%; }
.btn-lg { height: 48px; }

[hidden] { display: none !important; }

.login { padding-top: 36px; padding-bottom: 24px; }

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
}

.login-logo {
  width: 84px;
  height: 84px;
  margin-bottom: 6px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .5));
}

.login-brand span {
  color: var(--gold);
  font: 700 30px Georgia, serif;
  letter-spacing: 5px;
}

.login-brand small { color: var(--text-3); font-size: 13px; }

.login-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-tip { color: var(--gold); font-size: 18px; text-align: center; }
.login-sub { color: var(--text-3); font-size: 12px; line-height: 1.6; text-align: center; }

.login-qr {
  width: 200px;
  height: 200px;
  margin: 4px auto;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
}

.login-qr canvas,
.login-qr img { display: block; width: 100% !important; height: 100% !important; }

.beian { margin: 28px 0 0; font-size: 12px; text-align: center; }
.beian a { display: block; color: var(--text-3); white-space: nowrap; }
.beian a + a { margin-top: 4px; }
.beian img { display: inline; height: 14px; margin-right: 4px; vertical-align: -2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  z-index: 200;
  max-width: calc(100% - 64px);
  padding: 9px 16px;
  border: 1px solid rgba(198, 163, 106, .3);
  border-radius: 999px;
  background: rgba(24, 19, 15, .96);
  color: var(--gold-soft);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

.agree {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.agree a { color: var(--gold-soft); }
.login-agree { margin-top: 18px; }
.agree-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.agree-check input { position: absolute; opacity: 0; pointer-events: none; }

.agree-box {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
}

.agree-check input:checked + .agree-box { border-color: var(--gold); background: var(--gold); }

.agree-check input:checked + .agree-box:after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #171514;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.agree-check input:focus-visible + .agree-box { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.login-inviter { margin-top: 14px; text-align: center; }
.login-inviter-toggle { padding: 6px 10px; color: var(--text-3); font-size: 12px; opacity: .7; }

.agreement-view {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-y: auto;
  background: var(--bg);
}

.agreement-view > .page-nav,
.agreement-view > .page-nav-spacer,
.agreement-view > .agreement {
  max-width: var(--app-max);
  margin-left: auto;
  margin-right: auto;
}

.agreement { padding-bottom: 32px; color: var(--text-2); font-size: 14px; line-height: 1.75; }
.agreement-date { margin-bottom: 4px; color: var(--text-3); font-size: 12px; }
.agreement h2 { margin: 18px 0 6px; color: var(--text); font-size: 15px; }
.agreement p + p { margin-top: 6px; }

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
}

.sheet-panel {
  width: 100%;
  max-width: var(--app-max);
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  background: var(--card);
  box-shadow: inset 0 1px rgba(255, 236, 200, .12), 0 -18px 40px rgba(0, 0, 0, .5);
}

.sheet-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sheet-panel header b { font-size: 15px; }
.sheet-panel header button { color: var(--text-3); font-size: 13px; }
.pay-sheet-body { padding: 16px; }
.pay-sheet-amount { text-align: center; }
.pay-sheet-amount span { color: var(--text-3); font-size: 12px; }
.pay-sheet-amount b { display: block; margin-top: 4px; color: var(--gold-soft); font-size: 30px; }
.pay-sheet-amount small { display: block; margin-top: 4px; color: var(--text-3); font-size: 12px; }
.pay-methods { display: flex; gap: 10px; margin-top: 18px; }
.pay-method { flex: 1; padding: 12px 8px; border: 1px solid rgba(255, 240, 214, .14); border-radius: 10px; text-align: center; font-size: 13px; }
.pay-method.is-on { border-color: var(--gold-soft); background: rgba(166, 13, 16, .28); color: #fff4ef; }
.pay-confirm { width: 100%; margin-top: 16px; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  background: rgba(0, 0, 0, .7);
}

.modal-card {
  width: 100%;
  max-width: 340px;
  padding: 24px 18px 18px;
  border: 1px solid rgba(198, 163, 106, .32);
  border-radius: 14px;
  background: #1f1813;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}

.modal-image { display: block; width: 100%; border-radius: 10px; }
.modal-card h2 { margin: 0 0 16px; color: #fff4ef; font-size: 18px; }
.modal-card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.9; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }
.modal-light { background: #fff; border-color: transparent; color: #1a1a1a; }
.modal-light h2 { color: #1a1a1a; }
.modal-light p { color: #444; }
.modal-note { margin-top: 14px !important; padding: 12px; border-radius: 8px; background: #f0f0f0; text-align: left; font-size: 13px !important; }
.modal-check { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; color: #666; font-size: 12px; }
.modal-circle-close { display: grid; place-items: center; width: 50px; height: 50px; border: 1.5px solid #fff; border-radius: 50%; color: #fff; font-size: 24px; }

#boot.hide { display: none; }
