:root {
  --ink: #1c1c1e;
  --ink-soft: #3a3a3c;
  --muted: #6c6c70;
  --accent: #ff2d55;
  --accent-ink: #d70015;
  --accent-soft: rgba(255, 45, 85, 0.14);
  --ok: #34c759;
  --ok-ink: #248a3d;
  --warn-bg: rgba(255, 149, 0, 0.14);
  --warn-ink: #c93400;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.68);
  --glass-edge-soft: rgba(255, 255, 255, 0.35);
  --hairline: rgba(60, 60, 67, 0.12);
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  --shadow-card: 0 4px 18px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --blur: saturate(180%) blur(22px);
  --font: "Noto Sans SC", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --max: 960px;
  --radius: 18px;
  --radius-sm: 14px;
  --head-h: 76px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + 12px);
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: #f7e8ef;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(255, 248, 252, 0.28) 0%,
      rgba(255, 255, 255, 0.18) 28%,
      rgba(255, 255, 255, 0.34) 62%,
      rgba(247, 232, 239, 0.48) 100%
    ),
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(255, 255, 255, 0.08), transparent 70%),
    url("bg.png") center 22% / cover no-repeat;
}

button, input, select, a.btn { font: inherit; }
[hidden] { display: none !important; }

.glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-card);
}

.head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: saturate(190%) blur(28px);
  -webkit-backdrop-filter: saturate(190%) blur(28px);
  border-bottom: 1px solid var(--glass-edge-soft);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.head-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  min-height: var(--head-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand-mark {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.head h1 {
  margin: 0;
  font-size: clamp(1.08rem, 2.4vw, 1.3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.25;
  color: var(--ink);
}

.sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(60, 60, 67, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: rgba(255, 45, 85, 0.35);
  background: linear-gradient(180deg, #ff5a7a 0%, var(--accent) 100%);
  color: #fff;
  box-shadow:
    0 8px 20px rgba(255, 45, 85, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ff6b88 0%, var(--accent-ink) 100%);
  color: #fff;
}

.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin: 22px auto 36px;
}

.panel {
  border-radius: var(--radius);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 210px) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin-bottom: 18px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
}

.field {
  position: relative;
  display: block;
  margin: 0;
}

.field.search .field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(60, 60, 67, 0.45);
  font-size: 0.95rem;
  pointer-events: none;
}

.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field.search input { padding-left: 34px; }

.toolbar input:focus,
.toolbar select:focus {
  border-color: rgba(255, 45, 85, 0.45);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.count {
  margin: 0;
  min-width: 52px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.list-head {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 0 18px 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.device-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px 16px;
  width: 100%;
  padding: 15px 17px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: saturate(170%) blur(18px);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
  animation: cardIn 0.3s ease both;
}

.device-card:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transform: translateY(-2px);
}

.device-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.card-main { min-width: 0; }

.card-series {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--ink);
}

.card-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex-shrink: 0;
}

.card-price {
  margin: 0;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.card-price.is-free { color: var(--ok-ink); }
.card-price.is-na { color: #8e8e93; font-weight: 600; font-size: 0.88rem; }

.card-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.empty {
  margin: 48px 0;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-edge-soft);
}

.author {
  margin-top: 28px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
}

.author-top {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
}

.author h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.author-bio {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.author-contacts {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.author-contacts li {
  padding: 13px 18px;
}

.author-contacts li + li {
  border-top: 1px solid var(--hairline);
}

.author-contacts a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.author-contacts .label {
  color: var(--muted);
  font-size: 0.86rem;
}

.author-contacts .value {
  font-weight: 600;
  font-size: 0.9rem;
  text-align: right;
  word-break: break-all;
}

.author-contacts a:hover .value { color: var(--accent); }

.foot {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto 40px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.foot p { margin: 0 0 6px; }
.foot .meta { color: #8e8e93; }

/* 搜索时只保留型号列表，隐藏系列筛选与页脚联系区 */
body.is-searching .toolbar .field:not(.search),
body.is-searching .author,
body.is-searching .foot {
  display: none;
}

body.is-searching .device-card--search .card-name {
  margin: 0;
}

/* Modal — 居中玻璃弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top, 0px));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(88vh, 680px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(190%) blur(30px);
  -webkit-backdrop-filter: saturate(190%) blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  padding: 22px 20px 24px;
  box-shadow:
    0 18px 48px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  animation: dialogIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dialogIn {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(120, 120, 128, 0.16);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background 0.15s ease;
}

.modal-close:hover { background: rgba(120, 120, 128, 0.28); }

.modal-body { padding-right: 28px; }

.modal-series {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.modal-body h2 {
  margin: 0 0 12px;
  font-size: 1.28rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.modal-note {
  margin: 0 0 14px;
  color: var(--warn-ink);
  background: var(--warn-bg);
  border: 1px solid rgba(255, 149, 0, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.price-dl {
  margin: 0;
  display: grid;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.price-dl div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--hairline);
}

.price-dl div:first-child {
  border-top: 0;
  background: rgba(255, 255, 255, 0.28);
}

.price-dl dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.price-dl dd {
  margin: 0;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}

.price-dl dd.is-free { color: var(--ok-ink); }
.price-dl dd.is-na { color: #8e8e93; font-weight: 600; font-size: 0.92rem; }

@media (min-width: 720px) {
  .list-head { display: grid; }

  .device-card { padding: 16px 18px; }

  .modal { place-items: center; }

  .modal-panel {
    border-radius: 22px;
    padding: 24px;
    max-height: min(88vh, 680px);
  }
}

/* —— 手机端 —— */
@media (max-width: 720px) {
  :root {
    --head-h: auto;
  }

  html {
    scroll-padding-top: 88px;
  }

  html, body {
    font-size: 14px;
  }

  .ambient {
    background-position: center 12%;
    background-size: cover;
  }

  .head {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .head-inner {
    width: min(var(--max), calc(100% - 20px));
    min-height: 0;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 0 12px;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand-mark {
    font-size: 0.68rem;
  }

  .head h1 {
    font-size: 1.02rem;
    letter-spacing: -0.02em;
  }

  .sub {
    gap: 6px;
    margin-top: 4px;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .sub .dot { display: none; }

  .btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.8rem;
  }

  .wrap {
    width: min(var(--max), calc(100% - 20px));
    margin: 14px auto 28px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 16px;
  }

  .toolbar input,
  .toolbar select {
    min-height: 44px;
    font-size: 16px; /* 防止 iOS 聚焦放大 */
    border-radius: 12px;
  }

  .count {
    text-align: left;
    padding: 2px 4px 0;
    font-size: 0.78rem;
  }

  .card-grid { gap: 8px; }

  .device-card {
    gap: 10px 12px;
    padding: 13px 14px;
    border-radius: 14px;
    min-height: 64px;
    -webkit-tap-highlight-color: transparent;
  }

  .device-card:hover {
    transform: none;
  }

  .device-card:active {
    background: rgba(255, 255, 255, 0.78);
    transform: scale(0.99);
  }

  .card-series {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-name {
    font-size: 0.92rem;
    word-break: break-word;
  }

  .card-price {
    font-size: 0.98rem;
  }

  .card-hint {
    font-size: 0.68rem;
  }

  .author {
    margin-top: 20px;
    border-radius: 16px;
  }

  .author-top { padding: 14px 14px 12px; }

  .author-contacts li {
    padding: 12px 14px;
  }

  .author-contacts .value {
    font-size: 0.86rem;
    max-width: 62%;
  }

  .foot {
    width: min(var(--max), calc(100% - 20px));
    margin: 0 auto calc(28px + env(safe-area-inset-bottom, 0px));
    font-size: 0.75rem;
  }

  .modal {
    place-items: center;
    padding: 20px 16px;
    padding-top: max(20px, env(safe-area-inset-top, 0px));
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  }

  .modal-panel {
    width: min(420px, 100%);
    max-height: min(86vh, 100%);
    max-height: min(86dvh, 100%);
    border-radius: 18px;
    padding: 18px 16px 20px;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }

  .modal-body {
    padding-right: 36px;
  }

  .modal-body h2 {
    font-size: 1.12rem;
  }

  .price-dl div {
    padding: 13px 14px;
  }

  .gate {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    align-items: center;
  }

  .gate-card {
    width: min(400px, 100%);
    padding: 22px 18px 18px;
    border-radius: 20px;
  }

  .gate-title {
    font-size: 1.28rem;
  }

  .gate-desc {
    font-size: 0.84rem;
    margin-bottom: 14px;
  }

  .gate-field input {
    min-height: 48px;
    font-size: 16px; /* 防止 iOS 聚焦放大 */
    letter-spacing: 0.08em;
  }

  .gate-submit {
    min-height: 48px;
    font-size: 1rem;
  }
}

@media (max-width: 380px) {
  .head-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .head .btn {
    width: 100%;
  }

  .card-side {
    justify-items: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .device-card,
  .modal-panel { animation: none; }
  .device-card:hover,
  .device-card:active,
  .btn:hover { transform: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .head,
  .toolbar,
  .device-card,
  .author,
  .modal-panel,
  .empty,
  .gate-card {
    background: rgba(255, 255, 255, 0.92);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.is-locked #site { display: none !important; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(40, 24, 34, 0.28);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.gate-card {
  width: min(380px, 100%);
  padding: 28px 24px 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(190%) blur(28px);
  -webkit-backdrop-filter: saturate(190%) blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  text-align: center;
}

.gate-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.gate-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.gate-desc {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.gate-field { display: block; margin: 0 0 12px; }

.gate-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.12em;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.gate-field input:focus {
  border-color: rgba(255, 45, 85, 0.45);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.gate-error {
  margin: 0 0 12px;
  color: var(--accent-ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.gate-submit {
  width: 100%;
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

body.is-unlocked .gate { display: none !important; }
