:root {
  color-scheme: dark;
  --bg: #0d1114;
  --surface: #12171b;
  --panel: #171d22;
  --panel-2: #20272d;
  --line: #2c353c;
  --text: #f3f6f7;
  --muted: #9aa7b0;
  --soft: #c5cdd2;
  --accent: #48d6bf;
  --accent-dark: #102b27;
  --gold: #f2c35f;
  --danger: #f07972;
  --shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
.stage-banner {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: #4a221f;
  color: #ffd8d4;
  border-bottom: 1px solid rgba(240, 121, 114, .45);
  font-size: .9rem;
  font-weight: 850;
}
.dev-testbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px clamp(16px, 4vw, 52px);
  background: #172128;
  border-bottom: 1px solid rgba(72, 214, 191, .22);
  overflow-x: auto;
}
.dev-testbar strong {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: .86rem;
}
.dev-testbar form { flex: 0 0 auto; }
.dev-testbar button {
  min-height: 34px;
  padding: 0 10px;
  font-size: .84rem;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
img { display: block; max-width: 100%; }
p { color: var(--muted); line-height: 1.55; margin: 0; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2.15rem, 5vw, 4.5rem); line-height: 1; max-width: 760px; }
h2 { font-size: 1rem; line-height: 1.25; }
ul { margin: 12px 0 0; color: var(--soft); line-height: 1.8; }

button, .button, input, select, textarea {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}
button, .button {
  cursor: pointer;
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
}
button:hover, .button:hover { border-color: var(--accent); }
input, select, textarea { width: 100%; padding: 12px 13px; outline: none; }
select, input[type="checkbox"], input[type="radio"], label:has(input[type="checkbox"]), label:has(input[type="radio"]) { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(72, 214, 191, .14); }
label { display: grid; gap: 7px; color: var(--muted); font-size: .92rem; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px clamp(16px, 4vw, 52px);
  background: rgba(13, 17, 20, .9);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(16px);
}
.brand, .nav, .cart-link { display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 850; min-width: 0; }
.brand small { display: block; color: var(--muted); font-weight: 650; line-height: 1.1; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: .78rem;
}
.nav { color: var(--muted); font-weight: 700; }
.nav a { min-height: 40px; display: flex; align-items: center; padding: 0 8px; }
.nav a:hover { color: var(--text); }
.cart-link span {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #07110f;
}

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 60px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
  gap: 28px;
  align-items: end;
  padding: 22px 0 24px;
}
.hero p:not(.eyebrow) { max-width: 680px; font-size: 1.05rem; }
.eyebrow, .category {
  color: var(--accent);
  font-weight: 800;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.trust-row span, .product-facts span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255, 255, 255, .025);
  font-size: .88rem;
}
.search {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.search strong { font-size: .95rem; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-actions button, .filter-actions .button {
  justify-content: center;
  flex: 1;
}
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 22px;
  scrollbar-width: thin;
}
.category-tabs a {
  white-space: nowrap;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .018);
}
.category-tabs a.active { color: #06110f; background: var(--accent); border-color: var(--accent); }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
}
.product-card {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: rgba(72, 214, 191, .55); background: #192026; }
.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--panel-2);
}
.product-card a { display: grid; }
.product-card-body { display: grid; gap: 8px; padding: 12px 12px 8px; min-height: 94px; }
.product-card h2 { font-size: 1rem; }
.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  padding: 0 12px 14px;
  font-size: .92rem;
}
.card-meta strong, .price { color: var(--gold); font-weight: 850; }

.back-link { display: inline-flex; margin: 0 0 18px; color: var(--muted); font-weight: 700; }
.back-link:hover { color: var(--text); }
.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 24px;
  align-items: start;
}
.main-image, .gallery, .buy-box, .cart-row, .summary, .checkout-form, .empty, .placeholder-panel {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.gallery { overflow: hidden; }
.main-image-wrap { position: relative; background: var(--panel-2); }
.main-image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--panel-2); }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  min-height: 46px;
  padding: 0;
  border-color: rgba(255,255,255,.28);
  background: rgba(12,14,16,.72);
  color: var(--text);
  font-size: 2rem;
  z-index: 2;
}
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; padding: 8px; }
.thumb-button {
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
}
.thumb-button.active { border-color: var(--accent); }
.thumbs img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.buy-box { padding: 20px; display: grid; gap: 16px; position: sticky; top: 86px; }
.buy-box h1 { font-size: clamp(2rem, 4vw, 3.25rem); }
.price { font-size: 1.28rem; }
.description { color: var(--soft); line-height: 1.6; }
.product-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.buy-form, .checkout-form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.primary { background: var(--accent); border-color: var(--accent); color: #07110f; }
.notice {
  border-left: 3px solid var(--gold);
  padding: 10px 0 10px 12px;
  color: var(--soft);
  background: rgba(242, 195, 95, .07);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 18px 0 24px;
}
.page-head h1 { font-size: clamp(2rem, 4vw, 3rem); }
.cart-list { display: grid; gap: 12px; }
.cart-group {
  display: grid;
  gap: 8px;
}
.cart-group-set {
  padding: 10px;
  border: 1px solid rgba(248, 193, 74, .32);
  border-radius: 8px;
  background: rgba(248, 193, 74, .045);
}
.cart-set-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 4px 2px 8px;
}
.cart-set-head div {
  display: grid;
  gap: 3px;
}
.cart-set-head span,
.cart-set-head small {
  color: var(--muted);
}
.cart-set-head strong {
  color: var(--gold);
}
.cart-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 130px minmax(96px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px;
}
.cart-row img { width: 82px; height: 82px; object-fit: cover; border-radius: 6px; }
.cart-image-link { display: block; cursor: pointer; }
.cart-row h2 a:hover { color: var(--accent); }
.cart-row p { margin-top: 4px; font-size: .92rem; }
.cart-quantity {
  display: grid;
  gap: 8px;
}
.cart-quantity label {
  font-size: .82rem;
}
.cart-remove-button {
  width: 100%;
  justify-content: center;
}
.cart-total, .summary-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  font-size: 1.2rem;
}
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.checkout-form, .summary, .empty, .placeholder-panel { padding: 18px; }
.checkout-hint { font-size: .9rem; }
.summary { display: grid; gap: 12px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; }
.legal-panel { display: grid; gap: 20px; }
.legal-panel article { display: grid; gap: 8px; }
.legal-panel h2 { color: var(--text); }

.admin-list { display: grid; gap: 10px; }
.admin-product {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.admin-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 90px 100px minmax(160px, 240px) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}
.admin-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.image-manager {
  border-top: 1px solid var(--line);
  padding: 0 12px 12px;
}
.image-manager summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--accent);
  font-weight: 850;
}
.image-upload,
.image-edit-row,
.image-edit-row form:first-of-type {
  display: grid;
  gap: 10px;
}
.image-upload {
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 1fr) 150px 110px 110px auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.image-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.image-edit-row {
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .02);
}
.image-edit-row img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
}
.image-edit-row form:first-of-type {
  grid-template-columns: minmax(150px, 1fr) 150px 90px 110px auto;
  align-items: center;
}
.danger-button {
  border-color: rgba(240, 121, 114, .55);
  color: #ffd8d4;
}
.checkline { display: flex; align-items: center; gap: 8px; color: var(--text); }
.checkline input { width: auto; }
.notice-inline { color: var(--gold); margin: 6px 0 0; }
.variant-options { display: grid; gap: 12px; }
.variant-summary {
  color: var(--gold);
  font-weight: 850;
}
.size-mode-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.size-mode-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.size-mode-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(72, 214, 191, .08);
}
.size-mode-card strong { color: var(--text); }
.size-mode-card small { color: var(--muted); }
.custom-size-panel {
  padding: 12px;
  border: 1px solid rgba(72, 214, 191, .26);
  border-radius: 8px;
  background: rgba(72, 214, 191, .05);
}
.variant-audit-list { display: grid; gap: 16px; }
.variant-audit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  display: grid;
  gap: 16px;
}
.variant-audit-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}
.variant-dimensions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.variant-dimensions div,
.variant-review-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
}
.variant-dimensions strong,
.variant-dimensions span {
  display: block;
}
.variant-dimensions span { color: var(--muted); margin-top: 4px; }
.variant-table {
  width: 100%;
  border-collapse: collapse;
}
.variant-table th,
.variant-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
.variant-table th {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
}
.variant-table code,
.variant-review-box code {
  color: var(--soft);
  font-size: .82rem;
}
.variant-review-box h3 { margin-bottom: 8px; }

.footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.build-info {
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.build-info-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}
.build-info-button:hover { color: var(--text); }
.changelog-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .66);
}
.changelog-modal[hidden] { display: none; }
.changelog-dialog {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.changelog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 1.1rem;
}
.changelog-body {
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 16px;
}
.changelog-entry {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.changelog-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.changelog-entry header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}
.changelog-entry time { color: var(--muted); font-size: .9rem; }
.changelog-entry ul { margin: 0; padding-left: 18px; }
.changelog-entry li { color: var(--soft); margin: 6px 0; }
.changelog-tag {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
}

.set-info {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  border-radius: 8px;
}
.set-info p {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
}
.set-info span,
.discount-note {
  color: var(--accent);
  font-weight: 700;
}
.set-price-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(248, 193, 74, .28);
  border-radius: 8px;
  background: rgba(248, 193, 74, .055);
}
.set-price-list { display: grid; gap: 8px; }
.set-price-row {
  display: grid;
  grid-template-columns: minmax(70px, .6fr) minmax(0, 1.4fr) minmax(90px, .7fr);
  gap: 8px;
  align-items: center;
}
.set-price-row small {
  display: block;
  grid-column: 2 / -1;
  color: var(--muted);
}
.set-price-row strong { color: var(--gold); }
.old-price {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: line-through;
}
.muted-total {
  color: var(--soft);
}
.buy-form small,
.cart-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.payment-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.payment-choice legend { color: var(--soft); font-weight: 700; padding: 0 6px; }
.payment-choice label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: start; }
.payment-choice input { margin-top: 3px; }
.payment-choice small { grid-column: 2; color: var(--muted); }
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  margin-top: 16px;
}
.debug-json {
  overflow: auto;
  max-height: 420px;
  padding: 12px;
  border-radius: 8px;
  background: #050607;
  color: var(--soft);
  font-size: .82rem;
}
.log-entry {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.log-entry header { display: flex; justify-content: space-between; gap: 12px; }

@media (max-width: 820px) {
  .topbar { min-height: auto; align-items: flex-start; flex-direction: column; }
  .nav { width: 100%; justify-content: space-between; gap: 4px; }
  .nav a { padding: 0 4px; font-size: .94rem; }
  .shell { width: min(100% - 22px, 1180px); padding-top: 14px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { flex-direction: column; align-items: stretch; }
  .hero, .product-detail, .checkout-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .size-mode-control { grid-template-columns: 1fr; }
  .set-price-row { grid-template-columns: 1fr; }
  .set-price-row small { grid-column: 1; }
  .hero { gap: 18px; }
  .buy-box { position: static; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card-body { min-height: 104px; }
  .card-meta { display: grid; }
  .cart-set-head { display: grid; }
  .cart-row { grid-template-columns: 64px minmax(0, 1fr); }
  .cart-row img { width: 64px; height: 64px; }
  .cart-quantity, .cart-row strong { grid-column: 2; }
  .page-head { display: block; }
  .admin-row { grid-template-columns: 60px minmax(0, 1fr); }
  .admin-row img { width: 60px; height: 60px; }
  .admin-row label, .admin-row input, .admin-row button { grid-column: 2; }
  .image-upload,
  .image-edit-row,
  .image-edit-row form:first-of-type {
    grid-template-columns: 1fr;
  }
  .image-edit-row img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 460px) {
  .brand-mark { width: 36px; height: 36px; }
  .cart-link { gap: 6px; }
  .product-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2.3rem; }
}
