:root {
  --bg: #050505;
  --panel: #1d1d1f;
  --panel-2: #242426;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f3f3f4;
  --muted: #999a9f;
  --soft: #c9c9ce;
  --blue: #2f86ff;
  --blue-2: #1d4f91;
  --gold: #d5b034;
  --green: #39b66d;
  --danger: #ef6f7f;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 12px max(18px, calc((100vw - 1180px) / 2));
  background: rgba(19, 19, 20, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
}

.brand.pill {
  padding: 8px 13px;
  border: 1px solid rgba(47, 134, 255, 0.55);
  border-radius: 8px;
  background: rgba(47, 134, 255, 0.12);
}

.mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 7px;
  font-weight: 900;
}

.brand strong {
  font-size: 15px;
}

.nav,
.userbar,
.formActions,
.tabs,
.detailActions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.compactNav {
  justify-content: center;
}

.nav a,
.nav button,
.navIconBtn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
}

.nav button {
  cursor: pointer;
}

.nav a.active,
.nav a:hover,
.nav button:hover,
.navIconBtn:hover,
.navIconBtn.accent {
  color: #fff;
  background: rgba(47, 134, 255, 0.16);
  border-color: rgba(47, 134, 255, 0.42);
}

.userbar {
  justify-content: end;
}

.hello {
  color: var(--soft);
  font-size: 14px;
}

.catalogShell,
.detailShell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.catalogHero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.eyebrow.dark {
  color: var(--gold);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(24px, 3vw, 34px);
}

.catalogHero p:not(.eyebrow),
.muted {
  color: var(--muted);
  line-height: 1.7;
}

.btn,
.tab,
.iconBtn,
.linkBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 900;
}

.btn.primary,
.tab.active {
  background: var(--blue);
  border-color: var(--blue);
}

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

.btn.subtle {
  background: rgba(255, 255, 255, 0.06);
}

.btn.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 14px;
}

.btn.full {
  width: 100%;
}

.linkBtn {
  color: var(--soft);
  background: transparent;
  border: 0;
}

.cartBtn span {
  display: grid;
  min-width: 23px;
  height: 23px;
  place-items: center;
  margin-left: 8px;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.productGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.productCard,
.adminCard,
.adminItem,
.orderCard,
.modalCard,
.detailPanel,
.detailDescription {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.cleanCard {
  display: grid;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.cleanCard:hover {
  transform: translateY(-2px);
  background: #222225;
  border-color: rgba(47, 134, 255, 0.55);
}

.productCard img {
  width: 100%;
  aspect-ratio: 16 / 10.8;
  object-fit: cover;
  background: #111;
}

.productBody {
  display: grid;
  gap: 11px;
  padding: 16px;
}

.categoryText {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.productBody h3 {
  min-height: 52px;
  margin: 0;
  font-size: 20px;
  line-height: 1.28;
}

.descLine {
  min-height: 46px;
  margin: 0;
  color: var(--soft);
  line-height: 1.6;
}

.tagRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tagRow span {
  padding: 5px 8px;
  color: #f7df75;
  background: rgba(213, 176, 52, 0.16);
  border: 1px solid rgba(213, 176, 52, 0.35);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.productStats,
.detailStats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.productStats span,
.detailStats span {
  padding: 5px 8px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.productStats .stockOk,
.detailStats .stockOk {
  color: #8ff0b2;
  background: rgba(57, 182, 109, 0.12);
  border-color: rgba(57, 182, 109, 0.38);
}

.productStats .stockOut,
.detailStats .stockOut {
  color: #ff9aaa;
  background: rgba(239, 111, 127, 0.14);
  border-color: rgba(239, 111, 127, 0.42);
}

.cardFooter {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cardFooter span {
  color: var(--muted);
  font-size: 12px;
}

.cardFooter strong {
  font-size: 18px;
}

.cardFooter em {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-style: normal;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb strong {
  color: var(--text);
}

.detailPanel {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 1fr);
  overflow: hidden;
}

.detailImageBox {
  padding: 28px;
  background: linear-gradient(180deg, #2a2a2d, #202023);
  border-right: 1px solid var(--line);
}

.detailImageBox img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
  border-radius: 8px;
}

.detailInfo {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 34px;
}

.detailInfo h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.detailPrice {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.detailPrice span,
.detailMeta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detailPrice strong {
  font-size: 36px;
}

.divider {
  height: 1px;
  background: var(--line);
}

.detailMeta {
  display: grid;
  gap: 10px;
}

.detailQty {
  width: fit-content;
}

.detailActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.detailDescription {
  display: grid;
  gap: 22px;
  margin-top: 26px;
  padding: 28px;
}

.detailDescription h2 {
  padding-left: 12px;
  border-left: 4px solid var(--blue);
}

.detailDescription article {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detailDescription h3 {
  margin-bottom: 10px;
  font-size: 20px;
}

.detailDescription p {
  color: var(--soft);
  line-height: 1.9;
  white-space: pre-wrap;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  justify-items: end;
  pointer-events: none;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease;
}

.drawer.open {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.56);
}

.drawerPanel {
  width: min(500px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  color: var(--text);
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.drawer.open .drawerPanel {
  transform: translateX(0);
}

.drawerHead {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.iconBtn {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 26px;
}

.cartLines,
.orderList,
.adminList {
  display: grid;
  gap: 12px;
}

.cartLine {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cartLine img {
  width: 72px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
}

.cartLine strong,
.cartLine span {
  display: block;
}

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

.qty {
  display: inline-grid;
  grid-template-columns: 32px 36px 32px;
  align-items: center;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.qty button {
  min-height: 32px;
  color: var(--text);
  background: transparent;
  border: 0;
}

.qty b {
  text-align: center;
}

.formStack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.formStack.narrow {
  max-width: 420px;
}

.formStack label {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: #111113;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 134, 255, 0.22);
}

.payMethods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.payMethods legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: var(--soft);
  font-weight: 900;
}

.payChoice {
  display: grid;
  min-height: 48px;
  place-items: center;
  color: var(--soft);
  background: #111113;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 900;
}

.payChoice.active {
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 134, 255, 0.18);
}

.payChoice input {
  position: absolute;
  width: 1px;
  opacity: 0;
}

.totalBox {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #111113;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.totalBox div {
  display: flex;
  justify-content: space-between;
}

.totalBox .grand {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 20px;
}

.modal {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow-y: auto;
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.modalCard {
  position: relative;
  padding: 30px;
  color: var(--text);
  background: var(--panel);
}

.modalCard.wide {
  width: min(760px, 100%);
}

.modalCard .closeDialog {
  position: absolute;
  top: 14px;
  right: 14px;
}

.authRegister #accountLabel,
.authRegister input[name="account"] {
  display: none;
}

body:not(.authRegister) .registerOnly {
  display: none;
}

.paymentLayout {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(220px, 1fr);
  gap: 18px;
  margin: 18px 0;
}

.qrImage {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #111113;
  border: 12px solid #111113;
  border-radius: 8px;
}

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

.payInfo > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.payInfo > strong {
  font-size: 21px;
  word-break: break-all;
}

.payInfo .amount {
  color: var(--gold);
  font-size: 38px;
}

.copyBox,
.orderCard pre {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px;
  color: var(--soft);
  background: #111113;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.status {
  color: var(--green);
  font-weight: 900;
}

.section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.sectionHead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.adminPage {
  background: #0b0b0c;
}

.adminShell {
  padding-top: 42px;
}

.adminGrid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.adminCard {
  padding: 24px;
}

.adminItem {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 14px;
}

.adminItem.orderAdmin {
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 0.9fr);
}

.adminItem.disabled {
  opacity: 0.55;
}

.adminItem img {
  width: 120px;
  height: 94px;
  object-fit: cover;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .productGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .compactNav,
  .userbar {
    justify-content: start;
  }

  .productGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detailPanel,
  .adminGrid,
  .adminItem.orderAdmin {
    grid-template-columns: 1fr;
  }

  .detailImageBox {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .catalogShell,
  .detailShell,
  .section {
    width: calc(100% - 24px);
    padding: 34px 0 64px;
  }

  .catalogHero {
    align-items: start;
    flex-direction: column;
  }

  .productGrid {
    grid-template-columns: 1fr;
  }

  .productBody h3 {
    min-height: auto;
  }

  .detailInfo,
  .detailImageBox,
  .detailDescription,
  .modalCard {
    padding: 20px;
  }

  .detailActions,
  .paymentLayout,
  .payMethods {
    grid-template-columns: 1fr;
  }

  .adminItem {
    grid-template-columns: 84px 1fr;
  }

  .adminItem img {
    width: 84px;
    height: 72px;
  }
}
