:root {
  color-scheme: dark;
  --paper: #191a18;
  --panel: #21231f;
  --ink: #f1eee6;
  --muted: #b5b3a7;
  --gold: #dfbc7f;
  --line: #3e4037;
  --green: #a8c99f;
  --width: 1120px;
  font: 16px/1.65 system-ui, "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0 0 .5em; font-family: Georgia, "Songti SC", "SimSun", serif; line-height: 1.25; }
button, input, textarea, select { font: inherit; }
button { padding: 8px 15px; min-height: 40px; border: 1px solid #56574b; color: var(--ink); background: #24261f; cursor: pointer; }
button:hover:not(:disabled) { background: #313429; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--gold); border-color: var(--gold); color: #211c13; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #efd2a4; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(var(--width), calc(100% - 64px)); margin-inline: auto; }
.skip { position: absolute; left: 8px; top: -100px; padding: 8px; background: var(--paper); }
.skip:focus { top: 8px; z-index: 1; }

.site-header { background: #1b1d19; border-bottom: 1px solid #525044; }
.top { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; font-weight: 700; letter-spacing: .06em; }
.brand span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #8b7653; color: var(--gold); transform: rotate(45deg); }
.brand b { transform: rotate(-45deg); font: 14px Georgia, serif; }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 35px); white-space: nowrap; }
.site-nav a { padding-block: 8px; color: var(--muted); font-size: 14px; }
.site-nav a:first-child, .site-nav a:hover, .site-nav a[aria-current=page] { color: var(--gold); }

.hero { border-bottom: 1px solid #514738; background: radial-gradient(ellipse at 85% 5%, #403724, transparent 65%), #1d2019; }
.hero-inner { display: flex; justify-content: space-between; align-items: center; gap: 32px; min-height: 228px; padding-block: 34px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .17em; color: var(--gold); margin: 0 0 14px; }
.hero h1 { font-size: clamp(38px, 6vw, 66px); margin-bottom: 10px; letter-spacing: .025em; }
.hero-copy { color: #e0dacd; margin: 0; }
.account-summary { min-width: 210px; padding-left: 24px; border-left: 1px solid #65573e; overflow-wrap: anywhere; }
.account-summary strong { font-size: 18px; }
.account-summary p { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
#session { border-color: #947951; color: var(--gold); }

.shop-body { min-height: 55vh; padding-bottom: 68px; }
.shop-nav { display: flex; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); padding-block: 12px; }
.shop-nav button { flex-shrink: 0; white-space: nowrap; border-color: transparent; background: transparent; }
.shop-nav button[aria-current=page] { color: var(--gold); border-color: #856f48; background: #2c2920; }
#cart-count { display: inline-block; min-width: 1.5em; color: var(--gold); }
.license-guide { margin: 16px 0; padding: 14px 18px; border: 1px solid #806944; background: #2a281d; overflow-wrap: anywhere; }
.license-guide strong { color: var(--gold); }
.license-guide p { margin: 4px 0 0; }
.license-guide a { color: var(--gold); text-decoration: underline; text-underline-offset: .2em; }
.license-guide[data-complete] { border-color: #596e51; background: #20291f; }
.license-guide[data-complete] strong { color: var(--green); }
#notice { color: var(--gold); white-space: pre-wrap; overflow-wrap: anywhere; }
#notice:not(:empty) {
  position: sticky;
  top: 8px;
  z-index: 2;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
#notice[data-feedback="success"] { color: var(--green); }
#notice[data-feedback="error"] { color: #ffbaa9; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: clamp(25px, 4vw, 37px); }
.section-head input { margin-top: 0; width: min(260px, 43%); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filters button { font-size: 13px; }
.filters .active { color: var(--gold); border-color: #856f48; }

.grid, .columns { display: grid; gap: 18px; }
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product, .panel, .cart-line { border: 1px solid var(--line); background: var(--panel); padding: 20px; }
.product { display: flex; flex-direction: column; }
.product.license-featured, .cart-line.license-featured { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.product.license-featured { animation: license-highlight 1.1s ease-out 2; scroll-margin-block: 24px; }
.license-label { align-self: flex-start; margin-bottom: 12px; padding: 3px 10px; background: var(--gold); color: #211c13; font-size: 13px; font-weight: 700; }
@keyframes license-highlight {
  50% { box-shadow: 0 0 0 4px #dfbc7f4d, 0 0 24px #dfbc7f60; }
}
@media (prefers-reduced-motion: reduce) {
  .product.license-featured { animation: none; }
}
.product-image { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; display: block; background: #171a15; border: 1px solid #3f4034; margin-bottom: 16px; }
.product small, .hint { color: var(--muted); font-size: 13px; }
.product h3 { margin: 8px 0 12px; font-size: 22px; overflow-wrap: anywhere; }
.product details { color: var(--muted); margin-bottom: 16px; font-size: 13px; }
.product summary { cursor: pointer; }
.product-description { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }
.product-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.product-bottom button { color: var(--gold); border-color: #806944; }
.product-bottom button.primary { color: #211c13; }
.price { color: var(--gold); font: 700 23px Georgia, serif; }
.price span { color: var(--muted); font: 12px system-ui, sans-serif; margin-left: 5px; }
label { display: block; margin: 14px 0; color: var(--muted); }
input, textarea, select { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #646558; background: #151711; color: var(--ink); }
textarea { min-height: 100px; resize: vertical; }
.quantity { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; font-size: 13px; }
.quantity input { width: 82px; margin: 0; }
.empty { padding: 36px 18px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.tablewrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th, .pill { color: var(--muted); }
.pill { font-size: 13px; }
.cart-list, .order-list { display: grid; gap: 12px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) 125px minmax(60px, auto) auto; align-items: center; gap: 14px; }
.cart-line .quantity, .cart-line p { margin: 0; }
.checkout-bar, .order-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.checkout-bar { padding: 18px 0; margin-top: 20px; border-top: 1px solid #806944; }
.checkout-bar strong { color: var(--gold); font-size: 22px; }
.order .hint { overflow-wrap: anywhere; }
.order ul { list-style: none; padding: 0; }
.order li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order-total { text-align: right; color: var(--gold); font-weight: 700; }

.actions { display: flex; gap: 10px; justify-content: flex-end; }
.footer { border-top: 1px solid var(--line); padding-block: 24px; color: var(--muted); font-size: 13px; }
.foot-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot-inner a { color: var(--gold); text-decoration: underline; text-underline-offset: .2em; }

@media (max-width: 850px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .wrap { width: calc(100% - 34px); }
  .top { flex-wrap: wrap; gap: 0; padding-top: 12px; }
  .site-nav { justify-content: space-between; width: 100%; padding-bottom: 5px; gap: 10px; }
  .hero-inner { align-items: stretch; flex-direction: column; gap: 18px; min-height: 0; padding-block: 22px; }
  .account-summary { border-left: 0; border-top: 1px solid #65573e; padding: 13px 0 0; }
  .grid, .columns { grid-template-columns: 1fr; }
  .shop-nav { gap: 0; }
  .shop-nav button { padding-inline: 9px; font-size: 13px; }
  .section-head input { width: min(175px, 53%); }
  .cart-line { grid-template-columns: 1fr 1fr; }
  .cart-line > div { grid-column: 1 / -1; }
  .order-heading { flex-wrap: wrap; gap: 4px; }
}
