: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;
}
a { color: inherit; text-decoration: none; }
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; }
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; }
.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 { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--panel-2); }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; }
.thumbs img { 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; }
.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-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 90px minmax(96px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px;
}
.cart-row img { width: 82px; height: 82px; object-fit: cover; border-radius: 6px; }
.cart-row p { margin-top: 4px; font-size: .92rem; }
.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; }

.admin-list { display: grid; gap: 10px; }
.admin-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 90px 100px minmax(160px, 240px) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.admin-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.checkline { display: flex; align-items: center; gap: 8px; color: var(--text); }
.checkline input { width: auto; }
.notice-inline { color: var(--gold); margin: 6px 0 0; }

.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; }

@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; }
  .hero, .product-detail, .checkout-grid { grid-template-columns: 1fr; }
  .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-row { grid-template-columns: 64px minmax(0, 1fr); }
  .cart-row img { width: 64px; height: 64px; }
  .cart-row input, .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; }
}

@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; }
}
