:root {
  --page: #0b1433;
  --surface: #ffffff;
  --ink: #17233f;
  --muted: #65728c;
  --blue: #5672ff;
  --cyan: #24d2f4;
  --mint: #9b7cff;
  --pale: #eef4ff;
  --line: rgba(126, 154, 236, 0.24);
  --shadow: 0 18px 38px rgba(4, 12, 34, 0.30);
  --radius: 20px;
  --card-gap: 12px;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, #172a63 0, #101d47 255px, #0b1433 100%),
    radial-gradient(circle at 88% 8%, rgba(36, 210, 244, 0.36), transparent 30%),
    radial-gradient(circle at 12% 44%, rgba(155, 124, 255, 0.34), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(86, 114, 255, 0.22), transparent 40%),
    var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
  overscroll-behavior-y: contain;
}
body::before {
  position: fixed;
  z-index: -1;
  top: -120px;
  right: -130px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 210, 244, 0.28), rgba(36, 210, 244, 0) 70%);
  content: "";
  pointer-events: none;
}
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }

.pull-hint {
  position: fixed;
  z-index: 5;
  top: -44px;
  left: 0;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  transition: transform 160ms ease;
}
.pull-icon { font-size: 17px; }
.is-refreshing .pull-icon { animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-hero {
  position: relative;
  overflow: hidden;
  padding: calc(max(12px, env(safe-area-inset-top)) + 10px) 18px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 255, 255, 0.24), transparent 24%),
    radial-gradient(circle at 6% 100%, rgba(36, 210, 244, 0.32), transparent 34%),
    linear-gradient(135deg, #0b1433 0%, #253f99 50%, #24d2f4 100%);
  border-radius: 0 0 32px 32px;
  box-shadow: 0 24px 48px rgba(2, 9, 28, 0.38), inset 0 -24px 42px rgba(3, 12, 39, 0.22), inset 0 1px rgba(255, 255, 255, 0.28);
}
.app-hero::after {
  position: absolute;
  right: 15%;
  bottom: -20px;
  width: 132px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  filter: blur(24px);
  content: "";
}
.status-bar,
.hero-nav,
.hero-panel { position: relative; z-index: 1; }
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
}
.hero-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.70);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
h1 { margin-bottom: 5px; color: #fff; font-size: 31px; font-weight: 850; line-height: 1.08; text-shadow: 0 2px 8px rgba(7, 75, 147, 0.18); }
.meta { margin-bottom: 0; color: rgba(255, 255, 255, 0.82); font-size: 13px; }
.header-actions { display: flex; flex: none; gap: 9px; padding-top: 1px; }
.icon-button {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  color: var(--blue);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(237, 244, 255, 0.88));
  box-shadow: 0 9px 20px rgba(10, 26, 64, 0.20), inset 0 1px rgba(255, 255, 255, 0.98);
  font-size: 19px;
  line-height: 1;
  text-decoration: none;
}
.icon-button::after { content: ""; position: absolute; inset: -8px; }
button.icon-button { cursor: pointer; }
button.icon-button:active { transform: scale(0.92); }
.is-refreshing #refreshButton { animation: spin 700ms linear infinite; pointer-events: none; }

.hero-panel {
  display: grid;
  grid-template-columns: minmax(112px, 1.18fr) minmax(0, 0.91fr) minmax(0, 0.91fr);
  gap: 8px;
  margin-top: 20px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(10px);
}
.hero-panel div {
  min-width: 0;
  padding: 5px 4px;
  text-align: center;
}
.hero-panel span,
.hero-panel small {
  display: block;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
}
.hero-panel strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: #fff;
  font-size: 18px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.issue-select-wrap { display: block; margin-top: 5px; }
#issueSelect {
  width: 100%;
  min-width: 112px;
  height: 32px;
  padding: 0 30px 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  color: #fff;
  background: rgba(13, 31, 78, 0.36);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  text-align-last: center;
  outline: none;
}
#issueSelect:disabled { opacity: 0.78; }
#issueSelect option { color: #17233f; background: #fff; }
.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;
}
.hero-panel small {
  grid-column: 1 / -1;
  padding-top: 4px;
  text-align: center;
}

.app-content {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
}
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 12px;
}
.section-title .section-kicker { color: rgba(36, 210, 244, 0.92); }
.section-title h2 { margin: 0; color: #f8fbff; font-size: 21px; line-height: 1.1; }
.section-title span { flex: none; color: rgba(220, 231, 255, 0.72); font-size: 12px; }
.section-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}
.mode-switch { display: inline-flex; gap: 4px; margin: 0 0 16px; padding: 4px; background: #eef5f7; border-radius: 12px; }
.mode-tab { border: 0; border-radius: 9px; padding: 8px 14px; background: transparent; color: #5d7078; font: inherit; cursor: pointer; }
.mode-tab.is-active { background: #fff; color: #087f99; box-shadow: 0 2px 8px rgba(15, 90, 110, .12); font-weight: 700; }

.draw-summary {
  display: grid;
  grid-template-columns: minmax(132px, 0.9fr) minmax(0, 2.5fr);
  gap: 10px;
  align-items: stretch;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(126, 154, 236, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.9));
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.98);
}
.draw-summary > * { min-width: 0; }
.draw-result,
.category-summary-item {
  min-width: 0;
  text-align: center;
}
.draw-result {
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
}
.draw-result-values {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 7px;
}
.draw-attributes {
  margin-top: 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}
.draw-number,
.draw-zodiac {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}
.draw-number.wave-red { color: #e23d4b; }
.draw-number.wave-blue { color: #3973dc; }
.draw-number.wave-green { color: #2b9d62; }
.draw-zodiac { color: var(--blue); }
.draw-result-label,
.category-summary-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.category-summary-label span {
  display: block;
  text-align: center;
}
.category-summary {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}
.category-summary-item {
  display: flex;
  min-height: 60px;
  flex-direction: column;
  justify-content: center;
  padding: 5px 3px;
}
.category-summary-item strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}
.draw-empty {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.collect-status {
  overflow: hidden;
  max-width: 160px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collect-button {
  position: relative;
  display: inline-flex;
  min-width: 92px;
  height: 36px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #5672ff, #24aee8);
  box-shadow: 0 8px 18px rgba(3, 13, 42, 0.24), inset 0 1px rgba(255, 255, 255, 0.28);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.collect-button:active:not(:disabled) { transform: translateY(1px); }
.collect-button:disabled { cursor: wait; }
.collect-spinner {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.48);
  border-top-color: #fff;
  border-radius: 50%;
}
.collect-button:not(.is-collecting) .collect-spinner { border-color: rgba(255, 255, 255, 0.88); }
.collect-button.is-collecting .collect-spinner { animation: spin 700ms linear infinite; }
.collect-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 38%;
  height: 3px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.82);
  opacity: 0;
  transform: translateX(-120%);
}
.collect-button.is-collecting .collect-progress {
  opacity: 1;
  animation: collect-progress 1.15s ease-in-out infinite;
}
.collect-button.is-complete { background: linear-gradient(135deg, #25a56a, #20c997); }
.collect-button.is-error { background: linear-gradient(135deg, #d84b58, #ee6b62); }
@keyframes collect-progress {
  from { transform: translateX(-120%); }
  to { transform: translateX(365%); }
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--card-gap);
}
.data-card,
.zodiac-card,
.loading-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(238, 244, 255, 0.88) 100%);
  box-shadow: var(--shadow), 0 1px 2px rgba(6, 15, 42, 0.14), inset 0 1px rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
}
.data-card {
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
}
.card-head h3 { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.2; }
.special-card-head h3 { font-weight: 800; }
.matched-card-title {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
}
.card-count {
  flex: none;
  min-width: 42px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--pale);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 14px;
}
.card-metrics div {
  min-width: 0;
  padding: 11px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f3f7ff, #eef6ff);
  text-align: center;
}
.card-metrics span,
.card-foot span { display: block; color: var(--muted); font-size: 11px; }
.card-metrics strong { display: block; margin-top: 4px; color: var(--ink); font-size: 18px; }
.card-foot {
  padding: 11px 16px 15px;
  border-top: 1px solid var(--line);
  background: rgba(239, 246, 255, 0.80);
}
.card-foot strong { display: block; margin-top: 3px; color: var(--ink); font-size: 13px; }

.zodiac-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
  grid-column: 1 / -1;
}
.zodiac-card {
  display: flex;
  min-width: 0;
  min-height: 138px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px 9px;
  flex-direction: column;
}
.zodiac-icon-frame {
  display: grid;
  width: 62px;
  height: 62px;
  flex: none;
  place-items: center;
}
.zodiac-icon {
  display: block;
  width: 56px;
  height: 56px;
  background-image: url('/assets/zodiac/zodiac-sprite.png?v=20260826-4');
  background-repeat: no-repeat;
  background-size: 600% 200%;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 2px 7px rgba(15, 31, 69, 0.2);
}
.zodiac-icon-rat { background-position: 0 0; }
.zodiac-icon-ox { background-position: 20% 0; }
.zodiac-icon-tiger { background-position: 40% 0; }
.zodiac-icon-rabbit { background-position: 60% 0; }
.zodiac-icon-dragon { background-position: 80% 0; }
.zodiac-icon-snake { background-position: 100% 0; }
.zodiac-icon-horse { background-position: 0 100%; }
.zodiac-icon-goat { background-position: 20% 100%; }
.zodiac-icon-monkey { background-position: 40% 100%; }
.zodiac-icon-rooster { background-position: 60% 100%; }
.zodiac-icon-dog { background-position: 80% 100%; }
.zodiac-icon-pig { background-position: 100% 100%; }
.zodiac-card h3 { display: grid; width: 100%; min-height: 20px; margin: 0; align-items: center; color: var(--ink); font-size: 13px; text-align: center; }
.zodiac-card p { display: flex; min-height: 24px; margin: 0; align-items: baseline; justify-content: center; gap: 2px; color: var(--muted); }
.zodiac-card strong { color: var(--blue); font-size: 18px; }
.zodiac-card span { font-size: 11px; }
.zodiac-match-numbers {
  display: block;
  min-height: 16px;
  color: rgba(30, 35, 45, 0.58);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.number-frequency-grid,
.tail-grid,
.selection-frequency-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
}
.number-frequency-card,
.tail-card,
.selection-frequency-card {
  display: grid;
  min-height: 68px;
  place-items: center;
  padding: 9px 6px;
  border: 1px solid rgba(126, 154, 236, 0.20);
  border-radius: 16px;
  background: linear-gradient(180deg, #f8faff, #eef5ff);
  text-align: center;
}
.number-frequency-card.wave-red { background: #fff0f1; border-color: #f1b8bd; }
.number-frequency-card.wave-blue { background: #eef5ff; border-color: #b8cdef; }
.number-frequency-card.wave-green { background: #eff9f1; border-color: #b8d9bd; }
.number-frequency-value,
.tail-value,
.selection-frequency-value { color: var(--blue); font-size: 16px; }
.number-frequency-zodiac,
.number-frequency-count,
.tail-count,
.selection-frequency-count { color: var(--muted); font-size: 11px; }
.number-frequency-zodiac { white-space: nowrap; }
.number-frequency-card.is-collapsed-item { display: none; }
.number-frequency-data-card.is-expanded .number-frequency-card.is-collapsed-item { display: grid; }
.twenty-code-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin: 0 12px 12px;
}
.twenty-code-cell {
  display: grid;
  min-width: 0;
  min-height: 40px;
  place-items: center;
  padding: 5px 2px 4px;
  border: 1px solid rgba(126, 154, 236, 0.18);
  border-radius: 9px;
  background: #f8faff;
  text-align: center;
}
.twenty-code-cell span,
.twenty-code-cell strong {
  min-width: 0;
  line-height: 1.2;
}
.twenty-code-cell strong {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}
.twenty-code-cell.wave-red strong { color: #e23d4b; }
.twenty-code-cell.wave-blue strong { color: #3973dc; }
.twenty-code-cell.wave-green strong { color: #2b9d62; }
.twenty-code-cell span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.expand-button {
  display: flex;
  width: calc(100% - 24px);
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 12px 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--mint) 52%, var(--cyan));
  box-shadow: 0 9px 18px rgba(35, 70, 178, 0.22);
  font-weight: 800;
  cursor: pointer;
}
.loading-card { height: 126px; background: linear-gradient(110deg, #dbe5ff 20%, #ffffff 42%, #d7f8ff 68%); background-size: 220% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position-x: -220%; } }
.empty-state { padding: 28px 16px; color: var(--muted); text-align: center; }

:where(button, a, input, .collapsible-card-head):focus-visible {
  outline: 3px solid rgba(32, 199, 232, 0.42);
  outline-offset: 2px;
}

@media (max-width: 430px) {
  .app-content { padding-right: 10px; padding-left: 10px; }
  .section-title { align-items: center; gap: 8px; }
  .section-actions { gap: 7px; }
  .collect-status { display: none; }
  .collect-button { min-width: 86px; height: 34px; padding-right: 10px; padding-left: 10px; }
  #categoryHint { display: none; }
  .card-grid { gap: 10px; }
  .draw-summary { grid-template-columns: minmax(112px, 0.86fr) minmax(0, 2.14fr); gap: 6px; padding: 8px; }
  .draw-result { padding-right: 5px; padding-left: 5px; }
  .draw-number, .draw-zodiac { font-size: 15px; }
  .draw-attributes { margin-top: 5px; font-size: 10px; }
  .category-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; }
  .category-summary-item strong { font-size: 16px; }
  .category-summary-label { margin-top: 6px; font-size: 10px; }
  .zodiac-grid,
  .number-frequency-grid,
  .tail-grid,
  .selection-frequency-grid { gap: 8px; padding-right: 10px; padding-left: 10px; }
  .twenty-code-grid { gap: 4px; margin-right: 10px; margin-left: 10px; }
  .twenty-code-cell { min-height: 38px; }
  .zodiac-card { min-height: 118px; padding-right: 4px; padding-left: 4px; }
  .zodiac-icon-frame { width: 44px; height: 44px; }
  .zodiac-icon { width: 40px; height: 40px; }
}

@media (max-width: 374px) {
  .app-hero { padding-right: 14px; padding-left: 14px; }
  .hero-panel { gap: 6px; padding: 10px; }
  .hero-panel strong { font-size: 16px; }
  #issueSelect { font-size: 14px; }
  .draw-summary { grid-template-columns: minmax(78px, 0.78fr) minmax(0, 2.22fr); gap: 4px; padding: 7px; }
  .draw-result { min-height: 62px; padding-right: 3px; padding-left: 3px; border-right: 1px solid var(--line); }
  .draw-number { font-size: 15px; }
  .draw-attributes { font-size: 9px; white-space: nowrap; }
  .category-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-top: 2px; }
  .category-summary-item { padding-right: 1px; padding-left: 1px; }
  .category-summary-item strong { font-size: 14px; }
  .category-summary-label { margin-top: 5px; font-size: 9px; }
  .card-metrics { gap: 6px; padding-right: 12px; padding-left: 12px; }
  .card-metrics div { padding-right: 4px; padding-left: 4px; }
  .twenty-code-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .twenty-code-cell strong { font-size: 12px; }
  .twenty-code-cell span { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Settings page */
.settings-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #172a63 0, #101d47 260px, #0b1433 100%),
    var(--page);
}
.app-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 184px;
  padding: calc(max(12px, env(safe-area-inset-top)) + 18px) 18px 42px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 84% 12%, rgba(255, 255, 255, 0.24), transparent 25%),
    linear-gradient(135deg, #0b1433 0%, #253f99 52%, #24d2f4 100%);
  border-radius: 0 0 32px 32px;
  box-shadow: 0 24px 48px rgba(2, 9, 28, 0.34), inset 0 -24px 42px rgba(3, 12, 39, 0.2);
}
.app-header::after {
  position: absolute;
  right: 15%;
  bottom: -20px;
  width: 132px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(24px);
  content: "";
  pointer-events: none;
}
.settings-header .brand-block,
.settings-header .icon-button { position: relative; z-index: 1; }
.settings-header .eyebrow { color: rgba(255, 255, 255, 0.74); }
.settings-header h1 { margin-bottom: 5px; }
.settings-header .meta { color: rgba(255, 255, 255, 0.80); }
.settings-header .icon-button { color: var(--blue); }
.settings-content {
  position: relative;
  z-index: 2;
  width: min(100%, 680px);
  margin: -20px auto 0;
  padding: 0 14px calc(36px + env(safe-area-inset-bottom));
}
.settings-form { display: grid; gap: 14px; }
.settings-card {
  padding: 18px;
  border: 1px solid rgba(126, 154, 236, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #fafdff 100%);
  box-shadow: 0 14px 30px rgba(4, 12, 34, 0.18), inset 0 1px rgba(255, 255, 255, 0.98);
}
.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.settings-card h2 { margin: 0; color: var(--ink); font-size: 21px; line-height: 1.2; }
.settings-card .section-kicker { margin: 0 0 4px; color: var(--blue); font-size: 10px; }
.settings-note { margin: 8px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.selection-badge {
  flex: none;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--pale);
  font-size: 11px;
  font-weight: 800;
}
.mode-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; width: 100%; }
.mode-option {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 78px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(126, 154, 236, 0.22);
  border-radius: 12px;
  background: #f7faff;
  cursor: pointer;
}
.mode-option:has(input:checked) {
  border-color: rgba(86, 114, 255, 0.58);
  background: linear-gradient(180deg, #eef3ff, #f8fbff);
  box-shadow: inset 0 0 0 1px rgba(86, 114, 255, 0.12);
}
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option strong,
.mode-option small { display: block; min-width: 0; overflow-wrap: anywhere; }
.mode-option strong { color: var(--ink); font-size: 14px; line-height: 1.2; }
.mode-option small { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.switch-control { display: inline-flex; flex: none; align-items: center; cursor: pointer; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; display: block; width: 46px; height: 26px; border-radius: 999px; background: #dbe3f4; transition: background 120ms ease; }
.switch-track::after { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(20, 35, 70, .22); content: ""; transition: transform 120ms ease; }
.switch-control input:checked + .switch-track { background: var(--blue); }
.switch-control input:checked + .switch-track::after { transform: translateX(20px); }
.toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toggle {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 7px 8px;
  min-width: 0;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid rgba(126, 154, 236, 0.22);
  border-radius: 12px;
  background: #f7faff;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.toggle:has(input:checked) { border-color: rgba(86, 114, 255, 0.48); background: #eef3ff; }
.toggle:active { transform: scale(0.985); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-check {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(23, 35, 63, 0.22);
  border-radius: 6px;
  color: transparent;
  font-size: 13px;
  font-weight: 900;
}
.toggle input:checked + .toggle-check { border-color: var(--blue); color: #fff; background: var(--blue); }
.toggle-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.toggle code { grid-column: 2; color: var(--muted); font-size: 10px; }
.number-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--ink); font-size: 14px; font-weight: 800; }
.stepper { display: inline-grid; grid-template-columns: 34px 62px 34px; gap: 5px; flex: none; }
.stepper button,
.stepper input {
  height: 34px;
  border: 1px solid rgba(126, 154, 236, 0.26);
  border-radius: 9px;
  color: var(--ink);
  background: #f3f7ff;
  text-align: center;
  font: inherit;
}
.stepper button { padding: 0; color: var(--blue); background: #eaf0ff; font-size: 18px; cursor: pointer; }
.stepper input { width: 62px; padding: 0 4px; }
.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 44px; }
.status { min-width: 0; color: rgba(220, 231, 255, 0.82); font-size: 12px; text-align: right; }
.status.ok { color: #9be7ca; }
.status.err { color: #ffadb5; }
.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--mint) 52%, var(--cyan));
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 9px 18px rgba(35, 70, 178, 0.24);
}
.save-button span { font-size: 18px; line-height: 1; }
.save-button:disabled { cursor: wait; opacity: 0.65; }

.collection-result-card { padding: 0; overflow: hidden; }
.collection-result-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  list-style: none;
  cursor: pointer;
}
.collection-result-summary::-webkit-details-marker { display: none; }
.collection-result-card[open] .accordion-chip {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--mint));
}
.accordion-chip {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--pale);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.collection-result-body { padding: 0 18px 18px; }
.issue-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}
.issue-picker span { flex: none; }
.issue-picker select {
  flex: 1;
  min-width: 0;
  max-width: 176px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(126, 154, 236, 0.26);
  border-radius: 9px;
  color: var(--ink);
  background: #f3f7ff;
  font: inherit;
  text-align: center;
  text-align-last: center;
}
.result-card-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.result-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(126, 154, 236, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f6faff);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.98);
}
.result-card-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(126, 154, 236, 0.14);
}
.result-card-head > div { min-width: 0; text-align: center; }
.result-card-label,
.result-card-field span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.result-card-head strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.result-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 11px 12px 12px;
}
.result-card-field {
  min-width: 0;
  padding: 9px 8px;
  border-radius: 12px;
  background: #f3f7ff;
  text-align: center;
}
.result-card-field strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.result-item-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid rgba(126, 154, 236, 0.10);
}
.result-item.empty {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.result-item-meta {
  min-width: 0;
}
.result-item-author {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-item-time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.result-item-value {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.result-item-rank {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 430px) {
  .app-header { min-height: 174px; padding-right: 16px; padding-left: 16px; }
  .settings-content { padding-right: 10px; padding-left: 10px; }
  .settings-card { padding: 15px; }
  .mode-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
}
@media (max-width: 360px) {
  .toggles { grid-template-columns: 1fr; }
  .number-setting { align-items: flex-start; flex-direction: column; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .status { text-align: left; }
  .save-button { width: 100%; }
}
