:root {
  --paper: #fffaf0;
  --paper-deep: #f4ecdc;
  --ink: #191817;
  --ink-soft: #59554e;
  --line: #211f1b;
  --pink: #e8477a;
  --blue: #2165d3;
  --orange: #f68b1f;
  --green: #289650;
  --danger: #c42e38;
  font-family: "Microsoft YaHei UI", "Noto Sans SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.purchase-link { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0.85rem 0 1.1rem; color: var(--pink); font-weight: 700; text-decoration: none; }
.purchase-link:hover { text-decoration: underline; }

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(25, 24, 23, 0.09) 0.65px, transparent 0.8px);
  background-size: 5px 5px;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; letter-spacing: 0; }
a { color: inherit; }
h1, h2, p, figure { margin-top: 0; }
.is-hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { position: relative; height: 72px; border-bottom: 2px solid var(--line); background: rgba(255, 250, 240, 0.94); }
.site-header::after { position: absolute; right: 8%; bottom: -5px; width: 90px; height: 7px; background: var(--pink); content: ""; }
.brand { display: flex; width: min(100% - 32px, 1120px); height: 100%; align-items: center; gap: 12px; margin: 0 auto; color: var(--ink); font-family: Georgia, "Songti SC", serif; font-size: 20px; font-weight: 700; text-decoration: none; }
.theme-toggle { position: absolute; top: 50%; right: max(16px, calc((100% - 1120px) / 2)); display: grid; width: 38px; height: 38px; place-items: center; padding: 0; transform: translateY(-50%); border: 2px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); cursor: pointer; box-shadow: 3px 3px 0 var(--blue); transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.theme-toggle i { grid-area: 1 / 1; font-size: 16px; }
.theme-toggle .fa-moon { display: none; }
.theme-toggle:hover { transform: translate(-2px, calc(-50% - 2px)); box-shadow: 5px 5px 0 var(--pink); }
.theme-toggle:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.key-mark { position: relative; flex: 0 0 auto; width: 64px; height: 64px; border: 2px solid var(--line); border-radius: 0; background: var(--orange); }
.key-mark::after { position: absolute; z-index: -1; top: 4px; left: 4px; width: 100%; height: 100%; background: var(--blue); content: ""; }
.key-mark-small { width: 34px; height: 34px; }
.key-mark i { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; color: var(--ink); font-size: 34px; }
.key-mark-small i { font-size: 19px; }

.catalog-view { width: min(100% - 32px, 1120px); margin: 0 auto; padding: 72px 0 80px; }
.catalog-header { position: relative; margin-bottom: 32px; padding-bottom: 19px; border-bottom: 2px solid var(--line); }
.catalog-header::after { position: absolute; bottom: -5px; left: 0; width: 148px; height: 7px; background: var(--blue); content: ""; }
.catalog-header h1, .page-header h1 { margin-bottom: 8px; font-family: Georgia, "Songti SC", serif; font-weight: 700; }
.catalog-header h1 { font-size: 44px; line-height: 1.12; }
.catalog-header p { margin-bottom: 0; color: var(--ink-soft); font-size: 16px; }
.catalog-tools { display: flex; align-items: center; gap: 18px; margin-bottom: 32px; }
.search-field { flex: 1; }
.search-field input, .step-content input { width: 100%; height: 48px; padding: 0 15px; border: 2px solid var(--line); border-radius: 0; outline: none; background: rgba(255, 255, 255, 0.68); color: var(--ink); box-shadow: 3px 3px 0 var(--orange); transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.search-field input:focus, .step-content input:focus { transform: translate(-2px, -2px); background: #fff; box-shadow: 5px 5px 0 var(--blue); }
.search-field input::placeholder, .step-content input::placeholder { color: #817b71; }
.recovery-link, .back-link { color: var(--blue); font-size: 14px; font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.recovery-link:hover, .back-link:hover { color: var(--pink); }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.product-card { display: grid; position: relative; min-width: 0; min-height: 204px; grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: 1fr auto; gap: 0 18px; padding: 17px; border: 2px solid var(--line); border-radius: 0; background: #fffdf6; box-shadow: 5px 5px 0 var(--pink); text-decoration: none; transition: transform 160ms ease, box-shadow 160ms ease; }
.product-card:nth-child(3n + 2) { box-shadow: 5px 5px 0 var(--blue); }
.product-card:nth-child(3n) { box-shadow: 5px 5px 0 var(--orange); }
.product-card:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--green); }
.product-card:focus-visible, .button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.product-card-media { display: grid; grid-row: 1 / 3; min-height: 166px; place-items: center; overflow: hidden; border: 2px solid var(--line); border-radius: 0; background: #f6dda3; }
.product-card-media img { display: block; width: 100%; height: 100%; padding: 4px; object-fit: contain; mix-blend-mode: normal; }
.product-card-body { min-width: 0; }
.product-type { display: block; margin-bottom: 6px; color: var(--blue); font-family: Consolas, monospace; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.product-card h2 { margin-bottom: 5px; overflow: hidden; font-family: Georgia, "Songti SC", serif; font-size: 20px; line-height: 1.28; text-overflow: ellipsis; white-space: nowrap; }
.product-card code { display: block; margin-bottom: 13px; overflow: hidden; color: var(--ink-soft); font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.product-card p { display: -webkit-box; margin-bottom: 0; overflow: hidden; color: var(--ink-soft); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-card-action { display: flex; align-items: center; justify-content: space-between; align-self: end; padding-top: 12px; border-top: 2px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 800; }
.product-card-action b { color: var(--pink); font-size: 22px; font-weight: 700; line-height: 0.8; }
.catalog-state { padding: 72px 24px; border: 2px dashed var(--line); background: rgba(255, 253, 246, 0.72); text-align: center; }
.catalog-state h2 { margin-bottom: 8px; font-family: Georgia, "Songti SC", serif; font-size: 22px; }
.catalog-state p { margin-bottom: 0; color: var(--ink-soft); }

.activation-view { min-height: calc(100vh - 72px); padding: 28px 16px 48px; }
.activation-toolbar { width: min(100%, 672px); margin: 0 auto 20px; }
.activation-panel { position: relative; width: min(100%, 672px); min-height: 600px; margin: 0 auto; padding: 34px; border: 2px solid var(--line); border-radius: 0; background: #fffdf6; box-shadow: 8px 8px 0 var(--blue); }
.activation-panel::before { position: absolute; top: 14px; right: 14px; width: 68px; height: 68px; border-radius: 50%; background-color: rgba(232, 71, 122, 0.28); background-image: radial-gradient(var(--pink) 0.9px, transparent 1px); background-size: 5px 5px; content: ""; }
.page-header { position: relative; margin-bottom: 34px; text-align: center; }
.page-header h1 { font-size: 32px; line-height: 1.2; }
.page-header > p, .section-copy, .ready-hint, .product-result { color: var(--ink-soft); }
.page-header > p { margin-bottom: 0; font-size: 15px; }
.selected-product { display: grid; width: fit-content; max-width: 100%; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 13px; margin: 0 auto 22px; text-align: left; }
.selected-product img { display: block; width: 56px; height: 68px; object-fit: contain; border: 2px solid var(--line); border-radius: 0; background: #f6dda3; mix-blend-mode: multiply; }
.selected-product figcaption { min-width: 0; }
.selected-product span, .selected-product code { display: block; color: var(--ink-soft); font-size: 11px; }
.selected-product span { color: var(--blue); font-family: Consolas, monospace; font-weight: 700; }
.selected-product strong { display: block; max-width: 340px; margin: 3px 0; overflow: hidden; font-family: Georgia, "Songti SC", serif; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.selected-product code { font-family: Consolas, "SFMono-Regular", monospace; }

.steps { display: grid; grid-template-columns: 90px 1fr 90px 1fr 90px; align-items: start; margin-bottom: 40px; }
.step { display: flex; flex-direction: column; align-items: center; color: var(--ink-soft); text-align: center; }
.step span { display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid var(--line); border-radius: 0; background: var(--paper-deep); color: var(--ink); font-family: Georgia, serif; font-weight: 700; transition: transform 180ms ease, background 180ms ease; }
.step p { margin: 8px 0 0; font-size: 13px; line-height: 1.35; }
.step.is-active { color: var(--ink); font-weight: 700; }
.step.is-active span { transform: rotate(-4deg); background: var(--pink); color: #fff; }
.step-line { position: relative; height: 5px; margin-top: 15px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-deep); }
.step-line i { display: block; width: 0; height: 100%; background: var(--blue); transition: width 350ms ease; }
.step-line i.is-complete { width: 100%; }
.step-content { animation: fade-in 180ms ease-out; }
.step-content h2 { margin-bottom: 10px; font-family: Georgia, "Songti SC", serif; font-size: 23px; line-height: 1.4; }
.section-copy { margin-bottom: 24px; line-height: 1.65; }
label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 14px; font-weight: 800; }
.step-content input { margin-bottom: 18px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 2px solid var(--line); border-radius: 0; cursor: pointer; font-weight: 800; transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.button:hover:not(:disabled) { transform: translate(-2px, -2px); }
.button:disabled { cursor: wait; opacity: 0.65; }
.button-primary { width: 100%; background: var(--pink); color: #fff; box-shadow: 4px 4px 0 var(--line); }
.button-primary:hover:not(:disabled) { background: #d8386b; box-shadow: 6px 6px 0 var(--line); }
.button-secondary { width: 100%; background: var(--paper-deep); color: var(--ink); box-shadow: 3px 3px 0 var(--orange); }
.button-secondary:hover:not(:disabled) { background: var(--orange); box-shadow: 5px 5px 0 var(--line); }
.button-danger { width: 100%; background: var(--danger); color: #fff; box-shadow: 4px 4px 0 var(--line); }
.button-danger:hover:not(:disabled) { background: #a92330; box-shadow: 6px 6px 0 var(--line); }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.button-icon { margin-right: 9px; font-size: 16px; }
.message { min-height: 20px; margin: 16px 0 0; font-size: 14px; font-weight: 700; }
.message:empty { min-height: 0; margin: 0; }
.message.is-success { color: var(--green); }
.message.is-error { color: var(--danger); }
.ready-hint { margin: 5px 0 0; font-size: 12px; }
.code-frame { margin-bottom: 14px; padding: 7px; border: 2px solid var(--line); border-radius: 0; background: var(--orange); }
#unlock-code { display: grid; min-height: 72px; place-items: center; overflow: hidden; border: 2px solid var(--line); border-radius: 0; background-color: #fffdf6; background-image: radial-gradient(rgba(33, 101, 211, 0.2) 0.75px, transparent 0.85px); background-size: 5px 5px; font-family: Consolas, "SFMono-Regular", monospace; font-size: 34px; font-weight: 700; letter-spacing: 3px; line-height: 1; }
.product-result { min-height: 20px; margin-bottom: 18px; text-align: center; font-size: 13px; }
#copy-button { margin-bottom: 14px; }

.confirm-overlay { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(25, 24, 23, 0.68); }
.confirm-dialog { width: min(100%, 500px); padding: 30px; border: 2px solid var(--line); border-radius: 0; background: #fffdf6; box-shadow: 9px 9px 0 var(--pink); text-align: center; animation: confirm-in 160ms ease-out; }
.confirm-dialog h2 { margin-bottom: 20px; font-family: Georgia, "Songti SC", serif; font-size: 24px; line-height: 1.35; }
.confirm-label { margin-bottom: 8px; color: var(--ink-soft); font-size: 15px; }
.confirm-device-code { display: block; margin-bottom: 20px; color: var(--danger); font-family: Consolas, "SFMono-Regular", monospace; font-size: 42px; font-weight: 800; letter-spacing: 2px; line-height: 1.2; }
.confirm-warning { margin-bottom: 24px; color: var(--danger); font-size: 15px; font-weight: 700; line-height: 1.75; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@keyframes fade-in { from { transform: translateY(5px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes confirm-in { from { transform: translateY(10px) rotate(1deg); opacity: 0; } to { transform: translateY(0) rotate(0); opacity: 1; } }
@media (max-width: 900px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .site-header { height: 62px; }
  .brand { font-size: 18px; }
  .theme-toggle { right: 12px; width: 34px; height: 34px; }
  .catalog-view { width: min(100% - 24px, 1120px); padding: 46px 0 60px; }
  .catalog-header h1 { font-size: 34px; }
  .catalog-header p { font-size: 14px; }
  .catalog-tools { align-items: stretch; flex-direction: column; gap: 16px; }
  .recovery-link { align-self: flex-start; }
  .product-grid { grid-template-columns: 1fr; gap: 18px; }
  .product-card { min-height: 174px; grid-template-columns: 88px minmax(0, 1fr); padding: 14px; gap: 0 14px; }
  .product-card-media { min-height: 140px; }
  .product-card-media img { width: 100%; height: 100%; padding: 3px; }
  .activation-view { min-height: calc(100vh - 62px); padding: 18px 10px 34px; }
  .activation-toolbar { width: calc(100% - 16px); }
  .activation-panel { min-height: calc(100vh - 112px); padding: 28px 18px; box-shadow: 5px 5px 0 var(--blue); }
  .activation-panel::before { width: 52px; height: 52px; }
  .page-header { margin-bottom: 28px; }
  .page-header h1 { font-size: 27px; }
  .page-header > p { font-size: 13px; }
  .steps { grid-template-columns: 70px 1fr 70px 1fr 70px; margin-bottom: 34px; }
  .step p { font-size: 11px; }
  .step-line { margin-right: 4px; margin-left: 4px; }
  .section-copy { font-size: 14px; }
  .confirm-overlay { padding: 12px; }
  .confirm-dialog { padding: 26px 18px; }
  .confirm-dialog h2 { font-size: 21px; }
  .confirm-device-code { font-size: 36px; }
  .confirm-warning { font-size: 14px; }
}

/* Night Riso: dark ink and muted overprint colors retain the printed texture. */
html[data-theme="dark"] { --paper: #15121a; --paper-deep: #211a27; --ink: #f5eee4; --ink-soft: #d0c1cf; --line: #f1e5d8; --pink: #a33461; --blue: #6c8de3; --orange: #d99a46; --green: #64ad7e; --danger: #8f2637; }
html[data-theme="dark"] body { background-color: #15121a; background-image: radial-gradient(rgba(245, 238, 228, .14) .65px, transparent .8px); }
html[data-theme="dark"] .site-header { background: rgba(21, 18, 26, .94); }
html[data-theme="dark"] .theme-toggle { background: #211a27; color: #f5eee4; box-shadow: 3px 3px 0 #d99a46; }
html[data-theme="dark"] .theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .theme-toggle .fa-moon { display: block; }
html[data-theme="dark"] .catalog-header h1, html[data-theme="dark"] .page-header h1, html[data-theme="dark"] .step-content h2, html[data-theme="dark"] label { color: #f5eee4; }
html[data-theme="dark"] .search-field input, html[data-theme="dark"] .step-content input { background: #211a27; color: #f5eee4; border-color: #f1e5d8; }
html[data-theme="dark"] .search-field input:focus, html[data-theme="dark"] .step-content input:focus { background: #29202f; box-shadow: 5px 5px 0 #6c8de3; }
html[data-theme="dark"] .product-card { background: #211a27; border-color: #f1e5d8; }
html[data-theme="dark"] .product-card-media { border-color: #f1e5d8; background: #3a293f; }
html[data-theme="dark"] .product-card:nth-child(3n + 2) .product-card-media { background: #253148; }
html[data-theme="dark"] .product-card:nth-child(3n) .product-card-media { background: #473525; }
html[data-theme="dark"] .product-card h2, html[data-theme="dark"] .product-card-action { color: #f5eee4; }
html[data-theme="dark"] .product-card code, html[data-theme="dark"] .product-card p, html[data-theme="dark"] .selected-product code { color: #d0c1cf; }
html[data-theme="dark"] .product-card-action { border-color: #f1e5d8; }
html[data-theme="dark"] .catalog-state { border-color: #f1e5d8; background: rgba(33, 26, 39, .82); }
html[data-theme="dark"] .activation-panel { border-color: #f1e5d8; background: #211a27; box-shadow: 8px 8px 0 #6c8de3; }
html[data-theme="dark"] .selected-product img { border-color: #f1e5d8; background: #3a293f; }
html[data-theme="dark"] .step span { border-color: #f1e5d8; background: #33283a; color: #f5eee4; }
html[data-theme="dark"] .step-line { background: #49384c; }
html[data-theme="dark"] .button-primary { background: #a33461; color: #fffaf2; box-shadow: 4px 4px 0 #f1e5d8; }
html[data-theme="dark"] .button-primary:hover:not(:disabled) { background: #8f2c54; }
html[data-theme="dark"] .button-secondary { border-color: #f1e5d8; background: #33283a; color: #f5eee4; box-shadow: 3px 3px 0 #d99a46; }
html[data-theme="dark"] .button-secondary:hover:not(:disabled) { background: #493525; }
html[data-theme="dark"] .code-frame { border-color: #f1e5d8; background: #473525; }
html[data-theme="dark"] #unlock-code { border-color: #f1e5d8; background: #211a27; color: #f5eee4; }
html[data-theme="dark"] .confirm-overlay { background: rgba(4, 3, 6, .78); }
html[data-theme="dark"] .button-danger { background: #8f2637; color: #fffaf2; box-shadow: 4px 4px 0 #f1e5d8; }
html[data-theme="dark"] .confirm-dialog { border-color: #f1e5d8; background: #211a27; box-shadow: 9px 9px 0 #a33461; }
html[data-theme="dark"] .confirm-dialog h2, html[data-theme="dark"] .confirm-label { color: #f5eee4; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
