:root {
  --bg: #0c0c0b;
  --raised: #141413;
  --panel: #121211;
  --ink: #f3f0e8;
  --muted: #8a877f;
  --faint: #6f6c66;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --paper: #f0d7a8;
  --gold: #f0c36a;
  --ink-on-paper: #1b1712;
  --sage: #b7c7b0;
  --sand: #e2c28a;
  --clay: #e7b2aa;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, sans-serif;
  font-weight: 400;
  letter-spacing: -0.011em;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

::selection { background: rgba(231, 215, 193, 0.28); }

* {
  scrollbar-width: thin;
  scrollbar-color: #6e5c3e transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #6e5c3e;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #f0c36a;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(820px 420px at 0% -8%, rgba(240, 184, 92, 0.14), transparent 55%),
    radial-gradient(760px 460px at 100% 0%, rgba(72, 128, 196, 0.16), transparent 52%),
    radial-gradient(680px 360px at 70% 100%, rgba(196, 92, 122, 0.06), transparent 50%);
}

.preview-bar {
  position: relative;
  z-index: 5;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--sand);
  background: #16140f;
  border-bottom: 1px solid rgba(226, 194, 138, 0.18);
  padding: 8px 16px;
}

.top {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 420px) auto;
  align-items: center;
  gap: 18px;
  height: 68px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 12, 11, 0.86);
  backdrop-filter: blur(16px);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}

.brand em {
  font-family: Fraunces, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--muted);
  font-size: 14px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav a, .tabbar a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 9px;
}

.nav a.on, .tabbar a.on { color: var(--ink); }

.search input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #10100f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a877f' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E") no-repeat 14px 50%;
  color: var(--ink);
  padding: 0 14px 0 38px;
}

.search input::placeholder { color: var(--faint); }

.search input:focus, .field:focus, .area:focus {
  outline: none;
  border-color: rgba(231, 215, 193, 0.7);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.balance {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.balance span, .support {
  color: var(--muted);
  font-size: 13px;
}

.support { text-decoration: none; padding: 0 6px; }
.support:hover { color: var(--ink); }

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
}

.account-btn img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.shell {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

body:not([data-view="shop"]) .shell { grid-template-columns: minmax(0, 1fr); }
body:not([data-view="shop"]) .rail { display: none; }

.rail, .stage {
  min-height: 0;
  overflow: auto;
}

.rail {
  padding: 18px 12px 40px;
  border-right: 1px solid var(--line);
}

.rail-label, .rail-sub, .group-label, .kicker {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

.rail-label { margin: 18px 10px 6px; }
.rail-label:first-child { margin-top: 4px; }
.rail-sub { margin: 12px 10px 4px; color: var(--muted); letter-spacing: 0.08em; }

.rail-btn {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #b9b3a8;
  border-radius: 9px;
  padding: 8px 10px;
}

.rail-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-btn small {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.rail-btn.on, .rail-btn[aria-current="true"] {
  background: #242018;
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--gold);
}

.shop { padding: 26px 28px 56px; }

.shop-head h1, .page h1, .drawer h2 {
  font-family: Fraunces, serif;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 0;
}

.shop-head h1 { font-size: clamp(36px, 4vw, 52px); }

.kicker { margin: 0 0 8px; }

.lede, .trust, .fine, .muted { color: var(--muted); }

.lede { margin: 10px 0 0; max-width: 52ch; line-height: 1.5; }

.trust { margin: 10px 0 0; font-size: 13px; color: var(--faint); }

.notice {
  margin: 18px 28px 0;
  padding: 12px 14px;
  border: 1px solid rgba(240, 195, 106, 0.35);
  border-radius: 12px;
  background: rgba(240, 195, 106, 0.08);
  color: #f0d7a8;
  font-size: 14px;
  line-height: 1.45;
}

.notice strong {
  display: block;
  margin-bottom: 2px;
  color: #f0c36a;
  font-weight: 600;
}

.shop-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 14px;
}

#country-filter { max-width: 360px; }

#result-count { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.field, .area, select.field {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #10100f;
  padding: 0 14px;
}

.area { height: auto; padding: 12px 14px; resize: vertical; }

select.field { color-scheme: dark; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 10px;
}

.group-label { grid-column: 1 / -1; margin: 12px 0 0; }
.group-label:first-child { margin-top: 0; }

.country, .product {
  border: 1px solid var(--line);
  background: rgba(20, 20, 19, 0.92);
  color: inherit;
  text-align: left;
  border-radius: 16px;
}

.country {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
}

.country:hover, .product:hover {
  border-color: rgba(240, 195, 106, 0.55);
  background: #1c1914;
}

.flag {
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 22px;
  display: inline-flex;
  align-items: center;
}

.flag-img {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
  display: block;
}

.country-name, .product-name { font-size: 16px; letter-spacing: -0.02em; }

.country-meta, .product-side {
  margin-top: auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 18px;
}

.product > div:not(.product-side) { flex: 1; min-width: 0; }
.product .flag { flex: 0 0 auto; }

.product-list { display: flex; flex-direction: column; gap: 8px; }

.product-side { width: auto; margin: 0; color: var(--gold); font-size: 15px; }

.country-meta span:last-child { color: var(--gold); }

.grid .empty { grid-column: 1 / -1; }
.empty { padding: 36px 4px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 6px; }

.skel {
  height: 118px;
  border-radius: 16px;
  background: linear-gradient(90deg, #141413, #1d1c19, #141413);
  background-size: 200% 100%;
  animation: shine 1.2s linear infinite;
}

@keyframes shine { to { background-position: -200% 0; } }

.mobile-browse { display: none; }

.switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #141413;
  border: 1px solid var(--line);
}

.switch button, .chip {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  height: 36px;
  padding: 0 12px;
}

.switch button[aria-pressed="true"], .chip.on {
  background: #2a2824;
  color: var(--ink);
}

.chips {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}

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

.chip { border: 1px solid var(--line); flex: 0 0 auto; }

.page { max-width: 980px; margin: 0 auto; padding: 28px 22px 72px; }
.page h1 { font-size: clamp(36px, 5vw, 56px); }

.section { margin-top: 32px; }
.section h2 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.hero-num {
  font-family: Fraunces, serif;
  font-weight: 500;
  font-size: clamp(52px, 8vw, 76px);
  letter-spacing: -0.045em;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
}

.amounts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.amount {
  height: 64px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--raised);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.amount[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink-on-paper);
  border-color: transparent;
}

.row-actions, .form-actions, .inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stack { display: grid; gap: 8px; }

.btn {
  appearance: none;
  border: 0;
  background: var(--paper);
  color: var(--ink-on-paper);
  height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 600;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn.danger {
  background: transparent;
  color: var(--clay);
  border: 1px solid rgba(231, 178, 170, 0.35);
}

.btn.full { width: 100%; }

.cards { display: flex; flex-direction: column; gap: 8px; }

.card {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 16px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: center;
}

.card h3 { margin: 0; font-size: 16px; font-weight: 500; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #1c1b18;
  color: #d9d3c7;
  text-transform: capitalize;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.completed, .pill.paid { color: var(--sage); }
.pill.pending, .pill.processing, .pill.confirming { color: var(--sand); }
.pill.failed, .pill.expired, .pill.refunded, .pill.cancelled { color: var(--clay); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 14px;
  padding: 14px 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-family: Fraunces, serif;
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px; vertical-align: top; }
th { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
tr:last-child td { border-bottom: 0; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-size: 12px; }

pre {
  overflow: auto;
  margin: 0;
  padding: 14px 16px;
  background: #10100f;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: #e6e1d6;
  font-size: 12px;
  line-height: 1.55;
}

.docs { display: grid; gap: 14px; color: var(--muted); line-height: 1.55; }
.docs h2 { margin: 18px 0 0; }
.docs h2:first-child { margin-top: 0; }
.docs a { color: var(--paper); }
.docs p { margin: 0; }

.access-card {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(20, 20, 19, 0.92);
}

.access-card h2 { margin: 0 0 8px; }
.access-card .btn { margin-top: 14px; }
.key-list { margin-top: 8px; }

.country-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.country-title h1 { margin: 0; }
.shop-head .linkish { margin-bottom: 8px; }

.endpoint { padding-top: 12px; border-top: 1px solid var(--line); }
.endpoint p { margin-top: 6px; }
.endpoint-head { display: flex; align-items: center; gap: 10px; }
.verb {
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  min-width: 46px;
}

.key-reveal {
  border: 1px solid rgba(226, 194, 138, 0.4);
  background: #1a1712;
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
}

.key-reveal code {
  display: block;
  margin: 8px 0 12px;
  color: var(--paper);
  word-break: break-all;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.key-row code { color: var(--ink); }
.key-row span { flex: 1; }

.form-grid { display: grid; gap: 8px; }
.form-grid.cols-2 { grid-template-columns: 1fr; }

.notice {
  border: 1px solid rgba(226, 194, 138, 0.28);
  background: #1a1712;
  color: var(--sand);
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.5;
}

.drawer { position: fixed; inset: 0; z-index: 30; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drawer.open .drawer-backdrop { opacity: 1; }

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: auto;
  padding: 22px 22px 32px;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.drawer.open .drawer-panel { transform: none; opacity: 1; }

.drawer.menu .drawer-panel {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(560px, calc(100% - 32px));
  height: auto;
  max-height: min(680px, calc(100vh - 48px));
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  transform: translate(-50%, -46%);
}

.drawer.menu.open .drawer-panel {
  transform: translate(-50%, -50%);
  opacity: 1;
}

.drawer.menu .linkish { display: inline-block; margin-bottom: 10px; }
.drawer.menu .field { width: 100%; margin-bottom: 12px; }
.drawer.menu .product { padding: 12px 14px; }
.drawer.menu .group-label { margin: 16px 0 0; }

.catalog-meta {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.drawer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.close-x {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  flex: 0 0 auto;
}

.drawer h2 { font-size: 34px; line-height: 1.05; }
.dial { margin: 8px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.choices { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }

.choice {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
}

.choice[aria-pressed="true"] { border-color: var(--paper); }

.buy-box { margin-top: 22px; display: grid; gap: 12px; }

.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 18px;
}
.qty strong { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }

.price-lg {
  font-family: Fraunces, serif;
  font-size: 42px;
  margin: 0;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.price-lg s { color: var(--faint); font-size: 22px; margin-right: 8px; }

.totals { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }

.popover {
  position: fixed;
  top: 108px;
  right: 18px;
  width: min(320px, calc(100vw - 24px));
  z-index: 25;
  background: #161614;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.popover h3 { margin: 0; font-size: 16px; font-weight: 500; }
.popover p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.popover .stack { margin-top: 12px; }
.popover a.btn, .popover button.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  z-index: 50;
  max-width: min(440px, calc(100vw - 32px));
  background: #f3f0e8;
  color: #1b1712;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show { opacity: 1; transform: translateX(-50%); }

.tabbar { display: none; }

.linkish {
  border: 0;
  background: none;
  color: var(--paper);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 800px) {
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 980px) {
  .top { grid-template-columns: 1fr auto; height: auto; padding: 12px 14px 14px; }
  .search { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 860px) {
  body { height: auto; overflow: auto; }
  .shell { display: block; min-height: auto; }
  .nav { display: none; }
  .rail { display: none !important; }
  .stage { overflow: visible; }
  .mobile-browse { display: block; margin-bottom: 16px; }
  .shop { padding: 16px 14px 24px; }
  .notice { margin: 12px 14px 0; }
  .support { display: none; }
  .balance span { display: none; }
  .shop-tools { flex-direction: column; align-items: stretch; }
  #country-filter { max-width: none; }
  .amounts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: rgba(12, 12, 11, 0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { text-align: center; font-size: 12px; padding: 10px 4px; }
  .stage { padding-bottom: 76px; }
  .toast { bottom: 84px; }
  .drawer-panel {
    top: auto;
    left: 0;
    right: 0;
    width: auto;
    max-height: 88vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    transform: translateY(24px);
  }
  .card { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .drawer-panel, .drawer-backdrop, .toast { transition: none; }
}
