:root {
  --bg: #f4f8ff;
  --bg2: #eef7f1;
  --card: #ffffff;
  --text: #1a2433;
  --muted: #5f6b7b;
  --line: #dbe4ef;
  --accent: #2f6df6;
  --accent-2: #14a36f;
  --danger: #cf3f56;
  --radius: 18px;
  --radius-lg: 24px;
  --rarity-common-text: #1f6b5a;
  --rarity-common-border: #9fd8c8;
  --rarity-common-bg: #eefaf5;
  --rarity-uncommon-text: #2f6c9e;
  --rarity-uncommon-border: #a9cceb;
  --rarity-uncommon-bg: #eff6fd;
  --rarity-rare-text: #7753b3;
  --rarity-rare-border: #c8b4eb;
  --rarity-rare-bg: #f6f0ff;
  --rarity-epic-text: #a34e7e;
  --rarity-epic-border: #e4b3cb;
  --rarity-epic-bg: #fff0f8;
  --rarity-legendary-text: #9f5d05;
  --rarity-legendary-border: #f0c487;
  --rarity-legendary-bg: #fff5e8;
  --rarity-default-text: #365c93;
  --rarity-default-border: #a0bae2;
  --rarity-default-bg: #f0f7ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: linear-gradient(120deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

.page-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(47, 109, 246, 0.20), transparent 34%),
    radial-gradient(circle at 80% 10%, rgba(20, 163, 111, 0.18), transparent 30%),
    radial-gradient(circle at 50% 90%, rgba(129, 88, 255, 0.08), transparent 26%);
  pointer-events: none;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 18px;
}

.layout-single {
  grid-template-columns: 1fr;
  max-width: 980px;
}

.test-topbar {
  margin-bottom: 6px;
}

.home-wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 36px;
  display: grid;
  gap: 16px;
}

.home-nav {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-nav-brand {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #1f2a3a;
}

.home-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.home-nav-links a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.home-nav-links a:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: #fff;
}

.home-nav-cta {
  color: #fff !important;
  border-color: var(--accent) !important;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)) !important;
}

.home-hero {
  padding: 30px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88)),
    linear-gradient(120deg, rgba(47, 109, 246, 0.10), rgba(20, 163, 111, 0.08));
}

.home-kicker {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.home-hero h1 {
  margin: 8px 0 0;
  font-size: 42px;
  line-height: 1.2;
  letter-spacing: .2px;
}

.home-hero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.home-lead {
  max-width: 760px;
  line-height: 1.85;
  letter-spacing: 0.1px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.home-card {
  text-decoration: none;
  color: var(--text);
  padding: 20px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(249, 252, 255, 0.96));
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.home-card:hover {
  transform: translateY(-5px) scale(1.01);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: 0 22px 48px rgba(15, 35, 60, 0.14);
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-card-id {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.home-card-arrow {
  font-size: 18px;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 72%, #334155);
  transform: translateX(0);
  transition: transform .2s ease;
}

.home-card:hover .home-card-arrow {
  transform: translateX(4px);
}

.home-card h2 {
  margin: 12px 0 0;
  font-size: 25px;
  letter-spacing: .2px;
  line-height: 1.25;
}

.home-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
  min-height: 48px;
}

.home-card strong {
  margin-top: 14px;
  display: inline-block;
  color: color-mix(in srgb, var(--accent) 78%, #1e293b);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .2px;
}

.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.97), rgba(255,255,255,0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 42px rgba(20, 40, 60, 0.09);
  backdrop-filter: blur(4px);
}

.sidebar { padding: 18px; height: fit-content; position: sticky; top: 16px; }
.logo { margin: 0; font-size: 28px; letter-spacing: 0.4px; }
.muted { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.back-home {
  margin-top: 10px;
  display: inline-block;
  text-decoration: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.78);
}

.bank-switch { margin-top: 18px; display: grid; gap: 8px; }
.bank-switch label { font-size: 13px; color: var(--muted); }
.bank-switch select,
.bank-switch button,
.hero-actions button,
.test-footer button {
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-size: 14px;
}
.bank-switch button,
.hero-actions button,
.test-footer button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
}

.hero-actions .ghost {
  background: #fff;
  color: var(--accent);
}

button.ghost {
  background: #fff !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.meta-list {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}
.meta-list > div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.meta-list span { color: var(--muted); }

.content { display: grid; gap: 14px; }
.hero { padding: 20px; }
.kicker { margin: 0 0 8px; color: var(--accent); font-weight: 600; }
.hero h2 { margin: 0; font-size: 46px; letter-spacing: .3px; }
.hero p { margin: 10px 0 0; line-height: 1.7; }
.hero-actions { margin-top: 16px; display: flex; gap: 10px; }

.test, .result { padding: 18px; }
.progress-wrap { display: grid; gap: 8px; margin-bottom: 14px; }
.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #edf2f8;
  overflow: hidden;
}
.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}

.question-list { display: grid; gap: 12px; }
.q-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.q-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.q-title {
  margin: 0;
  line-height: 1.65;
  flex: 1 1 auto;
  min-width: 0;
}
.q-dim {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  background: #f5f8fc;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  line-height: 1.25;
}
.opts { display: grid; gap: 8px; margin-top: 10px; }
.opt {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  transition: border-color .18s ease, background .18s ease, transform .12s ease;
}

.opt:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: #f9fcff;
  transform: translateY(-1px);
}

.opt input {
  accent-color: var(--accent);
  transform: scale(1.05);
}

.opt:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, #fff) inset;
}

.opt input { margin: 0; }
.test-footer { margin-top: 14px; }

.result-head h3 {
  margin: 0;
  font-size: 52px;
  color: var(--accent);
  letter-spacing: .4px;
}
.result-head p { margin: 8px 0 0; line-height: 1.7; }

.result-media {
  margin-top: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-visual {
  width: 100%;
  max-width: 640px;
  border: 1px solid color-mix(in srgb, var(--line) 85%, #ffffff);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  padding: 16px 16px 14px;
  box-shadow: 0 10px 24px rgba(20, 37, 58, 0.08);
}

.result-visual-kicker {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.result-visual-name {
  margin: 8px 0 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: 0.8px;
  color: #1f2937;
}

.result-visual-code {
  margin: 4px 0 0;
  font-size: clamp(22px, 3.5vw, 36px);
  line-height: 1.15;
  letter-spacing: 0.6px;
  color: color-mix(in srgb, var(--accent) 85%, #18405f);
  font-weight: 800;
}

.result-visual-image-wrap {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.result-visual-image-wrap img {
  width: auto;
  max-width: 100%;
  max-height: 560px;
  height: auto;
  object-fit: contain;
  object-position: center center;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, #ffffff);
  box-shadow: 0 10px 24px rgba(20, 37, 58, 0.10);
  display: block;
}

.result.is-snapshot,
.result.match-snapshot {
  padding: 16px;
  border-radius: 18px;
  display: block;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,252,255,.95)),
    radial-gradient(circle at 18% 16%, rgba(82, 130, 215, .08), transparent 32%),
    radial-gradient(circle at 85% 20%, rgba(30, 150, 110, .07), transparent 28%);
}

.result.is-snapshot::before {
  content: "SBTI 快照";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
  color: color-mix(in srgb, var(--accent) 64%, #64748b);
  opacity: .55;
  pointer-events: none;
}

.result.match-snapshot::before {
  content: none;
}

.result.is-snapshot .result-head,
.result.match-snapshot .result-head {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  margin-top: 0;
}

.result.is-snapshot .result-head p,
.result.match-snapshot .result-head p {
  margin-top: 6px;
}

.result.is-snapshot .result-head p:first-child,
.result.match-snapshot .result-head p:first-child {
  margin-top: 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: .2px;
}

.result.is-snapshot .result-head h3,
.result.match-snapshot .result-head h3 {
  margin-top: 8px;
  font-size: clamp(44px, 5vw, 58px);
  display: inline-block;
  vertical-align: baseline;
  margin-right: 12px;
}

.result.is-snapshot .result-head p:nth-of-type(2),
.result.match-snapshot .result-head p:nth-of-type(2) {
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
  color: #1f2a3a;
  display: inline-block;
  vertical-align: baseline;
  margin-top: 0;
}

.result-rarity {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  padding: 5px 12px;
  width: fit-content;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: color-mix(in srgb, var(--accent) 74%, #1f2a3a);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, #e3e8f2);
  background: color-mix(in srgb, #ffffff 82%, var(--accent) 18%);
}

.result-rarity[hidden] {
  display: none !important;
}

.result-rarity[data-tier="common"] {
  color: var(--rarity-common-text);
  border-color: var(--rarity-common-border);
  background: var(--rarity-common-bg);
}

.result-rarity[data-tier="uncommon"] {
  color: var(--rarity-uncommon-text);
  border-color: var(--rarity-uncommon-border);
  background: var(--rarity-uncommon-bg);
}

.result-rarity[data-tier="rare"] {
  color: var(--rarity-rare-text);
  border-color: var(--rarity-rare-border);
  background: var(--rarity-rare-bg);
}

.result-rarity[data-tier="epic"] {
  color: var(--rarity-epic-text);
  border-color: var(--rarity-epic-border);
  background: var(--rarity-epic-bg);
}

.result-rarity[data-tier="legendary"] {
  color: var(--rarity-legendary-text);
  border-color: var(--rarity-legendary-border);
  background: var(--rarity-legendary-bg);
}

.result.is-snapshot .result-head p:nth-of-type(4) {
  font-size: 15px;
  line-height: 1.75;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  display: block;
  margin-top: 12px;
}

.result.is-snapshot .result-media,
.result.match-snapshot .result-media {
  margin-top: 0;
  width: 100%;
  max-width: 240px;
  float: left;
  margin-right: 14px;
  margin-bottom: 10px;
  align-items: stretch;
}

.result.is-snapshot .result-visual,
.result.match-snapshot .result-visual {
  max-width: 100%;
  border-radius: 14px;
  padding: 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.result.is-snapshot .result-visual-kicker,
.result.is-snapshot .result-visual-name,
.result.is-snapshot .result-visual-code,
.result.match-snapshot .result-visual-kicker,
.result.match-snapshot .result-visual-name,
.result.match-snapshot .result-visual-code {
  display: none;
}

.result.is-snapshot .result-visual-image-wrap,
.result.match-snapshot .result-visual-image-wrap {
  margin-top: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid color-mix(in srgb, var(--line) 88%, #ffffff);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #fcfaf2, #f8f5e8);
  overflow: hidden;
}

.result.is-snapshot .result-visual-image-wrap img,
.result.match-snapshot .result-visual-image-wrap img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

.result.is-snapshot .result-actions,
.result.match-snapshot .result-actions {
  margin-top: 16px;
  clear: both;
}

.result.is-snapshot .result-grid,
.result.match-snapshot .result-grid {
  margin-top: 12px;
  clear: both;
}

@media (max-width: 980px) {
  .result.is-snapshot::before {
    position: static;
    display: block;
    text-align: right;
    margin-bottom: 8px;
  }

  .result.is-snapshot .result-media,
  .result.match-snapshot .result-media {
    float: none;
    margin-right: 0;
    margin-bottom: 10px;
    max-width: 100%;
  }

  .result.is-snapshot .result-visual,
  .result.match-snapshot .result-visual {
    min-height: 0;
  }

  .result.is-snapshot .result-visual-image-wrap img,
  .result.match-snapshot .result-visual-image-wrap img {
    height: 100%;
    max-height: none;
  }
}

.result-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.result-actions button {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.history-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.history-modal[hidden] {
  display: none !important;
}

.history-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 18%, rgba(47, 109, 246, 0.10), transparent 34%),
    radial-gradient(circle at 84% 12%, rgba(20, 163, 111, 0.08), transparent 31%),
    rgba(228, 236, 246, 0.62);
  backdrop-filter: blur(4px) saturate(108%);
}

.history-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border-radius: 24px;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
  box-shadow: 0 20px 44px rgba(23, 42, 66, 0.12);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.history-head h3 {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.18;
  letter-spacing: 0.3px;
}

.history-head .ghost,
.history-foot .ghost {
  height: 42px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, #fff 92%, var(--accent) 8%) !important;
  color: color-mix(in srgb, var(--accent) 82%, #1f2937) !important;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.history-head .ghost:hover,
.history-foot .ghost:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
  box-shadow: 0 7px 16px rgba(37, 57, 84, 0.10);
}

.history-list {
  display: grid;
  gap: 11px;
}

.history-empty {
  border: 1px dashed color-mix(in srgb, var(--line) 82%, #ffffff);
  border-radius: 16px;
  padding: 18px 16px;
  color: var(--muted);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  font-size: 18px;
  line-height: 1.75;
}

.history-item {
  border: 1px solid color-mix(in srgb, var(--line) 88%, #ffffff);
  border-radius: 16px;
  padding: 14px 14px 13px;
  background:
    linear-gradient(180deg, #ffffff, #fafdff);
  box-shadow: 0 5px 12px rgba(18, 33, 52, 0.05);
}

.history-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.history-view-btn {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 999px;
  height: 34px;
  padding: 0 12px;
  background: color-mix(in srgb, #fff 90%, var(--accent) 10%);
  color: color-mix(in srgb, var(--accent) 86%, #243447);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.history-view-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  box-shadow: 0 7px 16px rgba(37, 57, 84, 0.10);
}

.history-item-code {
  font-size: 19px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.4;
  letter-spacing: 0.2px;
}

.history-item-time {
  font-size: 13px;
  color: color-mix(in srgb, var(--muted) 84%, #475569);
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--line) 88%, #ffffff);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(247, 251, 255, 0.95);
}

.history-item-meta {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

.history-foot {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.leaderboard-shell {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: 28px;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 250, 255, 0.95) 42%, rgba(240, 255, 249, 0.94) 100%);
}

.leaderboard-shell::before,
.leaderboard-shell::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.leaderboard-shell::before {
  width: 260px;
  height: 260px;
  top: -140px;
  right: -80px;
  background: radial-gradient(circle, rgba(47, 109, 246, 0.18), transparent 70%);
}

.leaderboard-shell::after {
  width: 220px;
  height: 220px;
  bottom: -130px;
  left: -80px;
  background: radial-gradient(circle, rgba(20, 163, 111, 0.14), transparent 72%);
}

.leaderboard-summary {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, #263f65 12%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(135deg, #1f3554 0%, #294a73 52%, #20626f 100%);
  color: #e9f2ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  box-shadow: 0 16px 28px rgba(30, 49, 76, 0.24);
}

.leaderboard-summary-main {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.leaderboard-summary-main strong {
  font-size: 34px;
  line-height: 1;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.leaderboard-summary-main span {
  color: rgba(231, 244, 255, 0.88);
  font-size: 14px;
}

.leaderboard-summary-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.leaderboard-chip {
  border: 1px solid rgba(223, 241, 255, 0.35);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: #e4f2ff;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(2px);
}

.leaderboard-list {
  position: relative;
  z-index: 1;
  gap: 14px;
}

.leaderboard-item {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 18px;
  cursor: pointer;
  border-color: color-mix(in srgb, #243f65 18%, var(--line));
  background:
    linear-gradient(172deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 251, 255, 0.96) 100%);
  box-shadow: 0 14px 24px rgba(20, 36, 59, 0.10);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.leaderboard-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(20, 36, 59, 0.16);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.leaderboard-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, #ffffff);
  outline-offset: 2px;
}

.leaderboard-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a7cff, #3dd09f);
}

.leaderboard-item.is-top1 {
  border-color: color-mix(in srgb, #f2c94c 46%, var(--line));
  background:
    linear-gradient(172deg, #fffef8 0%, #fff8eb 100%);
}

.leaderboard-item.is-top2 {
  border-color: color-mix(in srgb, #95a4c0 48%, var(--line));
  background:
    linear-gradient(172deg, #fafdff 0%, #f2f7ff 100%);
}

.leaderboard-item.is-top3 {
  border-color: color-mix(in srgb, #d18b5e 45%, var(--line));
  background:
    linear-gradient(172deg, #fffaf7 0%, #fff2ea 100%);
}

.leaderboard-item.is-top1::before {
  background: linear-gradient(180deg, #f8c449, #f15d2e);
}

.leaderboard-item.is-top2::before {
  background: linear-gradient(180deg, #91a3bf, #7689a8);
}

.leaderboard-item.is-top3::before {
  background: linear-gradient(180deg, #d68f60, #bc6f3f);
}

.leaderboard-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.leaderboard-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.leaderboard-rank {
  min-width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background:
    radial-gradient(circle at 30% 30%, #ffffff, color-mix(in srgb, #ffffff 72%, var(--accent) 28%));
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  color: color-mix(in srgb, var(--accent) 76%, #1f2a3a);
  line-height: 0.95;
  box-shadow: inset 0 4px 10px rgba(255, 255, 255, 0.8), 0 8px 18px rgba(35, 56, 84, 0.14);
}

.leaderboard-rank span {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  color: color-mix(in srgb, var(--muted) 85%, #3b4c63);
  letter-spacing: 0.25px;
}

.leaderboard-item.is-top1 .leaderboard-rank {
  color: #b86210;
  border-color: color-mix(in srgb, #f0b639 50%, #f6e4a4);
  background: radial-gradient(circle at 30% 30%, #fffef4, #ffe7bb);
}

.leaderboard-item.is-top2 .leaderboard-rank {
  color: #526683;
  border-color: color-mix(in srgb, #96a8c2 52%, #d7e1f2);
  background: radial-gradient(circle at 30% 30%, #ffffff, #dde7f7);
}

.leaderboard-item.is-top3 .leaderboard-rank {
  color: #93562f;
  border-color: color-mix(in srgb, #cd885d 52%, #eed2bd);
  background: radial-gradient(circle at 30% 30%, #fff8f2, #f7d8c1);
}

.leaderboard-title-wrap {
  min-width: 0;
}

.leaderboard-title {
  margin: 0;
  font-size: clamp(30px, 4.3vw, 42px);
  line-height: 1.1;
  letter-spacing: 0.2px;
  color: #1f2a3a;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.leaderboard-subtitle {
  margin: 5px 0 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.leaderboard-count {
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, #fff 88%, var(--accent) 12%));
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 800;
  color: color-mix(in srgb, var(--accent) 82%, #26384c);
  box-shadow: 0 7px 16px rgba(29, 46, 69, 0.12);
}

.leaderboard-progress {
  margin-top: 12px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, #d9e3ef 78%, #eef3f9);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #c5d2e3 72%, #f6f9fd);
}

.leaderboard-progress span {
  display: block;
  height: 100%;
  width: var(--bar-width, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6df6 0%, #2494d3 45%, #14a36f 100%);
  box-shadow: 0 4px 12px rgba(47, 109, 246, 0.26);
  transform-origin: left center;
  animation: leaderboard-fill 0.85s cubic-bezier(.2,.7,.18,1) both;
}

.leaderboard-item.is-top1 .leaderboard-progress span {
  background: linear-gradient(90deg, #f7b733 0%, #fc4a1a 100%);
}

.leaderboard-item.is-top2 .leaderboard-progress span {
  background: linear-gradient(90deg, #7f8ea3 0%, #a8b8cd 100%);
}

.leaderboard-item.is-top3 .leaderboard-progress span {
  background: linear-gradient(90deg, #c2703f 0%, #e29f6b 100%);
}

.leaderboard-meta {
  margin-top: 9px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

@keyframes leaderboard-fill {
  from {
    width: 0%;
    filter: saturate(0.8);
  }
  to {
    width: var(--bar-width, 0%);
    filter: saturate(1);
  }
}

.atlas-shell {
  padding: 22px;
  display: grid;
  gap: 14px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(243, 250, 255, 0.94));
}

.atlas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.atlas-stats span {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  background: color-mix(in srgb, #fff 92%, var(--accent) 8%);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  color: color-mix(in srgb, #2b3f59 90%, var(--accent) 10%);
}

.atlas-stats strong {
  font-size: 17px;
  color: color-mix(in srgb, var(--accent) 80%, #20334a);
}

.atlas-search {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #ffffff);
  border-radius: 12px;
  height: 50px;
  padding: 0 14px;
  background: #fff;
}

.atlas-search span {
  display: inline-block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 50px;
  transform: translateY(-1px);
  white-space: nowrap;
}

.atlas-search input {
  flex: 1 1 auto;
  width: auto;
  height: 50px;
  border: 0;
  outline: none;
  font-size: 14px;
  line-height: 50px;
  color: var(--text);
  background: transparent;
  min-width: 0;
  padding: 0;
}

.atlas-search input::placeholder {
  line-height: 50px;
}

.atlas-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
}

.atlas-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 86%, #ffffff);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 10px 20px rgba(20, 36, 59, 0.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.atlas-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 33%, var(--line));
  box-shadow: 0 16px 28px rgba(20, 36, 59, 0.14);
}

.atlas-card-hit {
  position: absolute;
  top: auto;
  bottom: 8px;
  left: 8px;
  right: auto;
  z-index: 2;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(29, 47, 76, 0.52);
  backdrop-filter: blur(6px) saturate(108%);
  box-shadow: 0 6px 12px rgba(19, 34, 54, 0.18);
  font-size: 8px;
  font-weight: 600;
  color: rgba(247, 251, 255, 0.96);
  padding: 2px 7px;
}

.atlas-card-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  position: relative;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
  background:
    radial-gradient(circle at 15% 10%, rgba(47, 109, 246, 0.14), transparent 44%),
    radial-gradient(circle at 90% 0%, rgba(20, 163, 111, 0.12), transparent 40%),
    linear-gradient(180deg, #f7fbff, #eef6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.atlas-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  filter: drop-shadow(0 10px 12px rgba(26, 43, 67, 0.18));
}

.atlas-card-content {
  padding: 13px 14px 14px;
}

.atlas-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.atlas-card-code {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--accent) 72%, #30445e);
}

.atlas-card-tier {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--rarity-default-border);
  background: var(--rarity-default-bg);
  color: var(--rarity-default-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.atlas-card-tier[data-tier="common"] {
  color: var(--rarity-common-text);
  border-color: var(--rarity-common-border);
  background: var(--rarity-common-bg);
}

.atlas-card-tier[data-tier="uncommon"] {
  color: var(--rarity-uncommon-text);
  border-color: var(--rarity-uncommon-border);
  background: var(--rarity-uncommon-bg);
}

.atlas-card-tier[data-tier="rare"] {
  color: var(--rarity-rare-text);
  border-color: var(--rarity-rare-border);
  background: var(--rarity-rare-bg);
}

.atlas-card-tier[data-tier="epic"] {
  color: var(--rarity-epic-text);
  border-color: var(--rarity-epic-border);
  background: var(--rarity-epic-bg);
}

.atlas-card-tier[data-tier="legendary"] {
  color: var(--rarity-legendary-text);
  border-color: var(--rarity-legendary-border);
  background: var(--rarity-legendary-bg);
}

.atlas-card-content h3 {
  margin: 5px 0 0;
  font-size: 25px;
  line-height: 1.2;
}

.atlas-card-content p {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.62;
  color: var(--muted);
}

.atlas-card-cta {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: color-mix(in srgb, var(--accent) 80%, #20334a);
}

.atlas-card-cta::after {
  content: "↗";
  font-size: 12px;
}

.atlas-detail-wrap {
  display: grid;
  gap: 14px;
}

.atlas-detail-loading {
  padding: 24px;
  font-size: 18px;
}

.atlas-detail-hero {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 20px;
  align-items: center;
  background:
    radial-gradient(circle at 10% 8%, rgba(47, 109, 246, 0.11), transparent 36%),
    radial-gradient(circle at 88% 14%, rgba(20, 163, 111, 0.10), transparent 34%),
    linear-gradient(180deg, #ffffff, #f6fbff);
}

.atlas-detail-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  border-radius: 14px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--line) 86%, #ffffff);
  padding: 0;
  display: block;
}

.atlas-detail-kicker {
  margin: 0;
  color: color-mix(in srgb, var(--muted) 88%, #2f4661);
  font-size: 16px;
  font-weight: 700;
}

.atlas-detail-title {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  line-height: 1.05;
}

.atlas-detail-code-inline {
  font-size: clamp(42px, 6.2vw, 72px);
  font-weight: 900;
  letter-spacing: 0.4px;
  color: color-mix(in srgb, var(--accent-2) 68%, #1f7c73);
}

.atlas-detail-name-inline {
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #17253a;
}

.atlas-detail-rarity {
  margin: 12px 0 0;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--rarity-default-border);
  background: var(--rarity-default-bg);
  color: var(--rarity-default-text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  padding: 9px 15px;
}

.atlas-detail-rarity[data-tier="common"] {
  color: var(--rarity-common-text);
  border-color: var(--rarity-common-border);
  background: var(--rarity-common-bg);
}

.atlas-detail-rarity[data-tier="uncommon"] {
  color: var(--rarity-uncommon-text);
  border-color: var(--rarity-uncommon-border);
  background: var(--rarity-uncommon-bg);
}

.atlas-detail-rarity[data-tier="rare"] {
  color: var(--rarity-rare-text);
  border-color: var(--rarity-rare-border);
  background: var(--rarity-rare-bg);
}

.atlas-detail-rarity[data-tier="epic"] {
  color: var(--rarity-epic-text);
  border-color: var(--rarity-epic-border);
  background: var(--rarity-epic-bg);
}

.atlas-detail-rarity[data-tier="legendary"] {
  color: var(--rarity-legendary-text);
  border-color: var(--rarity-legendary-border);
  background: var(--rarity-legendary-bg);
}

.atlas-detail-history {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.atlas-detail-introline {
  margin: 12px 0 0;
  color: #2a3950;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.atlas-detail-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.atlas-back-link,
.atlas-test-link {
  text-decoration: none;
  height: 40px;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.atlas-back-link {
  color: var(--accent);
  background: #fff;
}

.atlas-test-link {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.atlas-detail-section {
  padding: 18px;
}

.atlas-detail-section h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.atlas-detail-full {
  margin: 10px 0 0;
  line-height: 1.85;
  color: #2a3648;
  font-size: 15px;
}

.atlas-highlight-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.atlas-highlight-list li {
  line-height: 1.72;
  color: #2f3f54;
}

.atlas-metric-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.atlas-metric-grid article {
  border: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.atlas-metric-grid h3 {
  margin: 0;
  font-size: 16px;
  color: #2f3f54;
}

.atlas-metric-grid p {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 800;
  color: color-mix(in srgb, var(--accent) 80%, #23384e);
}

.atlas-pattern {
  margin: 12px 0 0;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 14px;
  color: var(--muted);
}

.atlas-entry-links {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.atlas-entry-links a {
  border: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
  border-radius: 12px;
  text-decoration: none;
  color: color-mix(in srgb, var(--accent) 76%, #23384e);
  font-weight: 700;
  background: #fff;
  padding: 10px 12px;
}

.tarot-shell {
  padding: 0;
  margin-top: -18px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.tarot-stage {
  display: grid;
  gap: 0;
}

.tarot-stage-only {
  justify-items: center;
}

.tarot-orbit-panel {
  width: min(1360px, calc(100vw - 40px));
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.tarot-orbit-scene {
  position: relative;
  width: 100%;
  min-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1040px;
  perspective-origin: 50% 36%;
}

.tarot-orbit-scene::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 108px;
  width: min(700px, 78vw);
  height: 170px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(24, 41, 72, 0.22), rgba(24, 41, 72, 0.06) 48%, transparent 72%);
  filter: blur(16px);
  pointer-events: none;
}

.tarot-orbit-scene::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(720px, 84vw);
  height: min(720px, 84vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.34) 0%, rgba(170, 191, 245, 0.12) 40%, rgba(120, 143, 203, 0.02) 62%, transparent 72%);
  filter: blur(8px);
  pointer-events: none;
}

.tarot-card-view {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform .4s ease;
}

.tarot-card-center {
  position: relative;
  z-index: 8;
  width: min(430px, 58%);
  box-shadow: 0 24px 52px rgba(20, 40, 72, 0.2);
  cursor: pointer;
}

.tarot-card-view.is-reversed {
  transform: rotateY(180deg);
}

.tarot-orbit {
  --count: 12;
  --orbit-radius: clamp(420px, 43vw, 580px);
  --orbit-duration: 18s;
  position: absolute;
  top: 35%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%) rotateX(-14deg);
  animation: tarot-cylinder-spin var(--orbit-duration) linear infinite, tarot-orbit-hover 4.8s ease-in-out infinite;
}

.tarot-orbit.is-accelerating {
  --orbit-duration: 3.2s;
}

.tarot-orbit-card {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(96px, 8.8vw, 128px);
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 10px 22px rgba(12, 30, 52, 0.2),
    0 0 0 1px rgba(145, 168, 222, 0.18) inset;
  background: linear-gradient(175deg, rgba(255, 255, 255, 0.96), rgba(241, 246, 255, 0.82));
  backface-visibility: visible;
  will-change: transform;
  transform-origin: center center;
  transform:
    translate(-50%, -50%)
    rotateY(var(--angle))
    translateZ(var(--orbit-radius))
    rotateY(calc(var(--angle) * -1))
    rotateX(1.5deg)
    translateY(var(--lift));
  transition: transform .3s ease, box-shadow .3s ease, filter .3s ease, opacity .3s ease;
  opacity: 1;
  filter: saturate(.95) brightness(.98);}

.tarot-scene-tip {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  color: #4b5a72;
  font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #ffffff);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  padding: 6px 14px;
}

.tarot-orbit-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.26), transparent 46%, rgba(123, 143, 189, 0.12));
  pointer-events: none;
}

.tarot-orbit-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.28), rgba(167, 185, 226, 0.12), rgba(255, 255, 255, 0.18));
  mix-blend-mode: screen;
  pointer-events: none;
}

.tarot-orbit-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tarot-orbit-code {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  pointer-events: none;
  animation: tarot-code-counter-spin var(--orbit-duration) linear infinite;
}

.tarot-orbit-code .face {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(44, 63, 98, 0.86), rgba(74, 95, 138, 0.86));
  letter-spacing: .2px;
  box-shadow: 0 4px 10px rgba(10, 25, 48, 0.25);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tarot-orbit-code .face.back {
  transform: rotateY(180deg);
}

.tarot-orbit-card.is-active {
  transform:
    translate(-50%, -50%)
    rotateY(var(--angle))
    translateZ(calc(var(--orbit-radius) + 40px))
    rotateY(calc(var(--angle) * -1))
    rotateX(1.5deg)
    translateY(var(--lift))
    scale(1.08);
  box-shadow:
    0 22px 42px rgba(43, 99, 214, 0.4),
    0 0 0 1px rgba(130, 172, 255, 0.44) inset;
  filter: saturate(1.16) brightness(1.02);
  opacity: 1;
}

.tarot-reveal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(220px, 20vw, 290px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 255, 0.94));
  box-shadow:
    0 24px 52px rgba(18, 37, 68, 0.32),
    0 0 0 1px rgba(149, 177, 232, 0.24) inset;
  transform: translate(-50%, -50%) scale(.62);
  opacity: 0;
  pointer-events: none;
  z-index: 25;
}

.tarot-reveal-card.is-visible {
  opacity: 1;
}

.tarot-reveal-card.is-spinning {
  animation: tarot-reveal-spin 1.7s cubic-bezier(.14,.75,.21,1.03) forwards;
}

.tarot-reveal-card.is-stopped {
  transform: translate(-50%, -50%) rotateY(0deg) scale(1);
  transition: transform .4s ease;
}

.tarot-reveal-badge {
  position: absolute;
  top: auto;
  bottom: 10px;
  left: 10px;
  right: auto;
  z-index: 2;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(130deg, rgba(47, 86, 153, 0.9), rgba(99, 128, 186, 0.88));
}

.tarot-reveal-badge[data-tier="common"] {
  color: var(--rarity-common-text);
  background: var(--rarity-common-bg);
  border: 1px solid var(--rarity-common-border);
}

.tarot-reveal-badge[data-tier="uncommon"] {
  color: var(--rarity-uncommon-text);
  background: var(--rarity-uncommon-bg);
  border: 1px solid var(--rarity-uncommon-border);
}

.tarot-reveal-badge[data-tier="rare"] {
  color: var(--rarity-rare-text);
  background: var(--rarity-rare-bg);
  border: 1px solid var(--rarity-rare-border);
}

.tarot-reveal-badge[data-tier="epic"] {
  color: var(--rarity-epic-text);
  background: var(--rarity-epic-bg);
  border: 1px solid var(--rarity-epic-border);
}

.tarot-reveal-badge[data-tier="legendary"] {
  color: var(--rarity-legendary-text);
  background: var(--rarity-legendary-bg);
  border: 1px solid var(--rarity-legendary-border);
}

.tarot-reveal-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
}

.tarot-reveal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tarot-reveal-meta {
  padding: 12px 14px 14px;
}

.tarot-reveal-meta p {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  font-weight: 700;
}

.tarot-reveal-meta h2 {
  margin: 6px 0 0;
  font-size: clamp(32px, 2.5vw, 42px);
  line-height: 1.05;
}

.tarot-action-row {
  margin-top: 8px;
  display: grid;
  justify-items: center;
  gap: 10px;
  position: relative;
  z-index: 40;
}

.tarot-draw-btn {
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(76, 120, 201, 0.72);
  padding: 0 22px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, #2f6df6, #16a374);
  box-shadow: 0 10px 24px rgba(41, 93, 188, 0.28);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.tarot-draw-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(41, 93, 188, 0.34);
}

.tarot-draw-btn:disabled {
  opacity: .78;
  cursor: wait;
}

.tarot-hint {
  margin: 0;
  color: #4a5972;
  font-size: 14px;
  font-weight: 600;
}

.tarot-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(28, 49, 77, 0.66);
}

.tarot-image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, #ffffff);
}

.tarot-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.tarot-meta {
  padding: 12px 14px 14px;
}

.tarot-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.tarot-meta h2 {
  margin: 6px 0 0;
  font-size: 34px;
  line-height: 1.1;
}

.tarot-result {
  padding: 16px;
}

.tarot-result h3 {
  margin: 0;
  font-size: 26px;
}

.tarot-result p {
  margin: 10px 0 0;
  line-height: 1.8;
  color: #334155;
}

.tarot-result a {
  margin-top: 12px;
  display: inline-flex;
  text-decoration: none;
  color: var(--accent);
  font-weight: 700;
}

@keyframes tarot-cylinder-spin {
  from { transform: translate(-50%, -50%) rotateX(-14deg) rotateY(0deg); }
  to { transform: translate(-50%, -50%) rotateX(-14deg) rotateY(360deg); }
}

@keyframes tarot-orbit-hover {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -6px; }
}

@keyframes tarot-card-bob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -5px; }
}

@keyframes tarot-code-counter-spin {
  from { transform: translateX(-50%) rotateY(0deg); }
  to { transform: translateX(-50%) rotateY(-360deg); }
}

@keyframes tarot-reveal-spin {
  0% {
    transform: translate(-50%, -50%) rotateY(0deg) scale(.66);
  }
  100% {
    transform: translate(-50%, -50%) rotateY(1440deg) scale(1);
  }
}

@media (min-width: 1025px) {
  html, body {
    height: 100%;
  }

  body.tarot-page {
    overflow-y: hidden;
  }

  .tarot-page .home-wrap {
    height: 100vh;
    max-width: 1120px;
    padding: 14px 24px 12px;
    gap: 8px;
    grid-template-rows: auto auto 1fr;
    align-content: start;
  }

  .tarot-page .home-nav {
    padding: 10px 16px;
  }

  .tarot-page .home-hero {
    padding: 16px 28px;
  }

  .tarot-page .home-kicker {
    font-size: 28px;
  }

  .tarot-page .home-hero h1 {
    margin-top: 4px;
    font-size: 52px;
    line-height: 1.04;
  }

  .tarot-page .home-lead {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.55;
  }

  .tarot-page .tarot-shell {
    margin-top: -2px;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    overflow-x: visible;
    overflow-y: hidden;
  }

  .tarot-page .tarot-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .tarot-page .tarot-orbit-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
  }

  .tarot-page .tarot-orbit-scene {
    min-height: 0;
    height: 100%;
  }

  .tarot-page .tarot-orbit {
    --orbit-radius: clamp(460px, 46vw, 640px);
  }

  .tarot-page .tarot-orbit-card {
    width: clamp(94px, 7.8vw, 118px);
  }

  .tarot-page .tarot-action-row {
    margin-top: 0;
    padding-top: 4px;
    padding-bottom: 28px;
    gap: 6px;
    transform: translateY(-32px);
  }
}

.snapshot-modal {
  z-index: 10020;
}

.snapshot-panel {
  width: min(980px, 100%);
  max-height: min(90vh, 980px);
}

.snapshot-content {
  display: grid;
  gap: 12px;
}

.snapshot-top {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.snapshot-meta {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.snapshot-meta + .snapshot-meta {
  margin-top: 4px;
}

.snapshot-question-list {
  display: grid;
  gap: 10px;
  max-height: 46vh;
  overflow: auto;
  padding-right: 4px;
}

.snapshot-card {
  padding: 14px;
}

.snapshot-opt {
  cursor: default;
}

.snapshot-opt input {
  pointer-events: none;
}

.snapshot-card .opt,
.snapshot-card .opt *,
.snapshot-card .opt:hover,
.snapshot-card .opt:has(input:checked) {
  transition: none !important;
  animation: none !important;
}

.snapshot-card .opt:hover {
  transform: none !important;
  border-color: var(--line) !important;
  background: #fff !important;
  box-shadow: none !important;
}

.snapshot-card .opt:has(input:checked) {
  transform: none !important;
}

.snapshot-card .opt:has(input:checked):hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
  background: color-mix(in srgb, var(--accent) 8%, #fff) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, #fff) inset !important;
}

.snapshot-result {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.snapshot-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px;
  color: var(--muted);
}

.result-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.dim {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.dim b { display: block; margin-bottom: 4px; }
.dim span { color: var(--muted); font-size: 13px; }

.dim-meter {
  margin-top: 8px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eaf0f8;
  overflow: hidden;
}

.dim-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
}

.quality-box span {
  display: block;
  margin-top: 6px;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .home-wrap { padding: 20px 14px 30px; }
  .home-nav { padding: 12px; }
  .home-nav-brand { font-size: 24px; }
  .home-hero { padding: 22px; }
  .home-hero h1 { font-size: 34px; line-height: 1.28; }
  .hero h2 { font-size: 34px; }
  .result-head h3 { font-size: 42px; }
  .home-card h2 { font-size: 28px; }
  .home-card p { font-size: 16px; }
  .home-card strong { font-size: 16px; }

  .q-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .q-title {
    width: 100%;
    font-size: 18px;
    line-height: 1.55;
  }

  .q-dim {
    align-self: flex-start;
    font-size: 13px;
    padding: 5px 10px;
  }

  .home-nav-links a {
    font-size: 13px;
    padding: 7px 10px;
  }

  .result-visual {
    padding: 14px;
  }

  .result-visual-image-wrap {
    margin-top: 12px;
  }

  .result-visual-image-wrap img {
    max-height: 420px;
  }

  .atlas-shell {
    padding: 16px;
  }

  .atlas-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }

  .atlas-card-cover {
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .atlas-detail-hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .atlas-detail-image {
    max-height: none;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .atlas-detail-section h2 {
    font-size: 24px;
  }

  .tarot-shell {
    padding: 0;
    margin-top: -10px;
  }

  .tarot-stage {
    grid-template-columns: 1fr;
  }

  .tarot-orbit-scene {
    min-height: 650px;
  }

  .tarot-orbit {
    --orbit-radius: clamp(300px, 46vw, 390px);
  }

  .tarot-reveal-card {
    width: clamp(205px, 28vw, 258px);
  }

  .tarot-card-center {
    width: min(390px, 66%);
  }
}

@media (max-width: 760px) {
  .tarot-orbit-panel {
    padding: 0;
  }

  .tarot-orbit-scene {
    min-height: 460px;
  }

  .tarot-orbit {
    --orbit-radius: clamp(140px, 40vw, 195px);
  }

  .tarot-orbit-card {
    width: clamp(58px, 13vw, 80px);
    border-radius: 8px;
  }

  .tarot-action-row {
    margin-top: 2px;
  }

  .tarot-draw-btn {
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
  }

  .tarot-card-center {
    width: min(300px, 76%);
  }

  .tarot-scene-tip {
    font-size: 13px;
    padding: 5px 12px;
  }

  .history-modal {
    align-items: flex-end;
    justify-content: stretch;
    padding: 0;
  }

  .history-panel {
    width: 100%;
    max-height: min(86vh, 760px);
    border-radius: 24px 24px 0 0;
    padding: 14px 14px 18px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .history-head {
    margin-bottom: 10px;
  }

  .history-head h3 {
    font-size: 30px;
  }

  .history-head .ghost,
  .history-foot .ghost {
    height: 40px;
    padding: 0 13px;
    font-size: 14px;
    border-radius: 11px;
  }

  .history-empty {
    font-size: 15px;
    border-radius: 14px;
    padding: 15px 14px;
  }

  .history-item {
    border-radius: 14px;
    padding: 11px;
  }

  .history-item-top {
    gap: 8px;
  }

  .history-item-code {
    font-size: 16px;
    line-height: 1.35;
  }

  .history-item-time {
    font-size: 11px;
    padding: 4px 8px;
  }

  .history-item-meta {
    font-size: 13px;
    line-height: 1.52;
  }

  .history-item-right {
    gap: 6px;
  }

  .leaderboard-shell {
    padding: 15px;
    border-radius: 20px;
  }

  .leaderboard-summary {
    margin-bottom: 10px;
    padding: 12px;
    display: grid;
    gap: 8px;
    justify-content: flex-start;
  }

  .leaderboard-summary-main strong {
    font-size: 28px;
  }

  .leaderboard-summary-main span {
    font-size: 13px;
  }

  .leaderboard-summary-chips {
    justify-content: flex-start;
  }

  .leaderboard-item {
    padding: 12px;
    border-radius: 14px;
  }

  .leaderboard-item-top {
    align-items: flex-start;
  }

  .leaderboard-main {
    gap: 9px;
  }

  .leaderboard-rank {
    min-width: 56px;
    height: 56px;
    font-size: 20px;
  }

  .leaderboard-rank span {
    font-size: 10px;
  }

  .leaderboard-title {
    font-size: clamp(24px, 7.5vw, 32px);
  }

  .leaderboard-subtitle {
    margin-top: 4px;
    font-size: 13px;
  }

  .leaderboard-count {
    font-size: 13px;
    padding: 6px 10px;
  }

  .leaderboard-meta {
    margin-top: 8px;
    font-size: 12px;
  }

  .atlas-toolbar {
    align-items: stretch;
  }

  .atlas-search {
    width: 100%;
    height: 46px;
  }

  .atlas-search span {
    line-height: 46px;
  }

  .atlas-search input,
  .atlas-search input::placeholder {
    height: 46px;
    line-height: 46px;
  }

  .atlas-search input {
    width: 100%;
  }

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

  .atlas-card-cover {
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .atlas-card-content h3 {
    font-size: 23px;
  }

  .atlas-detail-loading {
    padding: 16px;
    font-size: 16px;
  }

  .atlas-detail-hero,
  .atlas-detail-section {
    padding: 13px;
  }

  .atlas-detail-title {
    gap: 8px 12px;
  }

  .atlas-detail-code-inline {
    font-size: clamp(30px, 9.5vw, 42px);
  }

  .atlas-detail-name-inline {
    font-size: clamp(28px, 8.8vw, 38px);
  }

  .atlas-detail-rarity {
    font-size: 13px;
    padding: 8px 13px;
  }

  .atlas-detail-introline {
    font-size: 16px;
    font-weight: 700;
  }

  .atlas-detail-history {
    font-size: 14px;
  }

  .atlas-detail-actions {
    margin-top: 12px;
  }

  .atlas-back-link,
  .atlas-test-link {
    width: 100%;
    justify-content: center;
  }

  .atlas-highlight-list {
    margin-top: 8px;
    gap: 5px;
  }

  .atlas-metric-grid {
    grid-template-columns: 1fr;
  }

  .atlas-metric-grid p {
    font-size: 20px;
  }

  .atlas-entry-links {
    grid-template-columns: 1fr;
  }

  .tarot-control select,
  .tarot-control button {
    width: 100%;
  }

  .tarot-meta h2 {
    font-size: 30px;
  }

  .history-view-btn {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .snapshot-panel {
    max-height: 88vh;
  }

  .snapshot-question-list {
    max-height: 42vh;
  }
}
