:root {
  --un-blue: #4b92db;
  --un-blue-deep: #0d3f78;
  --un-blue-ink: #062b55;
  --sky: #d9ecff;
  --paper: #f7fbff;
  --panel: rgba(245, 250, 255, .92);
  --line: rgba(59, 123, 184, .22);
  --muted: #6d7f96;
  --gold: #d9b15f;
  --gold-deep: #b8923f;
  --danger: #c84a5f;
  --shadow: 0 20px 56px rgba(5, 34, 73, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--un-blue-ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(137, 199, 255, .24), transparent 28rem),
    linear-gradient(135deg, #082447 0%, #15558f 42%, #d8ecff 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

.mobile-tabbar {
  display: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.65), transparent 72%);
}

/* ---- Error bar ---- */
.error-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 14px 24px;
  background: linear-gradient(135deg, #c84a5f, #9e3548);
  color: white;
  font-weight: 800;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(200, 74, 95, .35);
  animation: errorSlide .3s ease;
}

@keyframes errorSlide {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 60px;
  position: relative;
}

.compact { width: min(900px, calc(100% - 32px)); }

.hero {
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 30px;
  padding: 34px;
  color: white;
  background: linear-gradient(120deg, rgba(9, 58, 111, .94), rgba(62, 142, 216, .78));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "UN";
  position: absolute;
  right: 24px;
  top: -30px;
  font-size: 160px;
  color: rgba(255,255,255,.10);
  font-weight: 900;
  letter-spacing: -12px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #bfe1ff;
  font: 800 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .22em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(36px, 7vw, 78px); line-height: .95; margin-bottom: 16px; letter-spacing: -.05em; }
h2 { font-size: 28px; margin-bottom: 8px; }
.intro { color: rgba(255,255,255,.84); line-height: 1.8; max-width: 720px; }
.panel p { color: var(--muted); line-height: 1.7; }

.user-switch, .trade-form, .album-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.album-controls {
  margin: 18px 0 20px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(229, 242, 255, .78);
  border: 1px solid #cfe0f4;
}

.album-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #315c8b;
  font-weight: 800;
}

.filter-count {
  color: #8ba0b9;
  font-size: 12px;
  font-weight: 700;
  min-width: 28px;
}

select, button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  background: rgba(255,255,255,.96);
  color: var(--un-blue-ink);
  font: 700 14px/1.2 "Microsoft YaHei", sans-serif;
}

input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255,255,255,.96);
  color: var(--un-blue-ink);
  font: 700 14px/1.2 "Microsoft YaHei", sans-serif;
}

button {
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

button:disabled { cursor: not-allowed; opacity: .5; }
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(5, 47, 95, .18); }

.primary {
  background: linear-gradient(135deg, #1675cf, #0c4e95);
  color: white;
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 12px 28px rgba(22, 117, 207, .24);
}

.user-session {
  position: relative;
  z-index: 2;
}

.user-session span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: rgba(255,255,255,.92);
  font-weight: 800;
}

.user-session strong {
  color: white;
}

.user-session button {
  color: white;
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.14);
}

.panel {
  margin-top: 22px;
  padding: 26px;
  border: 1px solid rgba(255,255,255,.46);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(5, 34, 73, .13);
  backdrop-filter: blur(16px);
}

/* ---- Progress bar ---- */
.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 4px;
}

.progress-bar {
  flex: 1;
  height: 10px;
  background: #e1eaf4;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #d0dfee;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4b92db, #0d3f78);
  border-radius: 6px;
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}

.progress-text {
  color: var(--un-blue-deep);
  font: 900 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

/* ---- Draw panel ---- */
.draw-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}

.draw-panel .eyebrow,
.trade-maker .eyebrow,
.section-head .eyebrow { color: var(--un-blue); }

.draw-stage {
  grid-column: 1 / -1;
  height: 620px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(5, 39, 78, .92), rgba(7, 83, 148, .72));
  border: 1px solid rgba(255,255,255,.22);
  overflow: hidden;
  position: relative;
}

.draw-stage::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.08);
  opacity: .34;
}

.draw-result {
  width: 390px;
  height: 560px;
  position: relative;
  z-index: 1;
  perspective: 1200px;
}

.draw-result.shuffling { animation: cardPulse .42s ease-in-out 1 alternate; }
.draw-result.revealed { animation: cardReveal .62s cubic-bezier(.2,.8,.2,1) both; }

.card-back {
  width: 390px;
  height: 560px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  text-align: center;
  color: rgba(255,255,255,.88);
  background:
    linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.03)),
    linear-gradient(160deg, #0d4f95, #083569);
  border: 1px solid rgba(255,255,255,.36);
  box-shadow: 0 20px 44px rgba(20, 85, 150, .20);
}

.card-back span {
  font-size: 96px;
  font-weight: 900;
  letter-spacing: -.1em;
  opacity: .76;
}

.card-back small {
  display: block;
  margin-top: -90px;
  font-weight: 800;
  letter-spacing: .16em;
}

.card-back .draw-prompt {
  margin-top: 12px;
  color: var(--gold);
  font-size: 15px;
  letter-spacing: .2em;
  animation: drawPulse 1.6s ease-in-out infinite;
}

@keyframes drawPulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}

/* ---- Archive card ---- */
.archive-card {
  width: 100%;
  height: 560px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 24px;
  padding: 18px;
  color: #22334a;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,255,.99));
  border: 2px solid rgba(188, 212, 238, .95);
  box-shadow: 0 18px 40px rgba(20, 85, 150, .18);
  overflow: hidden;
  position: relative;
}

.archive-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.8);
}

.archive-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  border-bottom: 3px solid #d8e4f2;
  padding-bottom: 12px;
}

.field-label {
  display: block;
  color: #8ba0b9;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}

.card-number,
.archive-head strong {
  display: block;
  font-size: 31px;
  letter-spacing: -.04em;
  color: var(--un-blue-deep);
}

.archive-visual {
  height: 178px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #8197b3;
  background: linear-gradient(135deg, rgba(213, 230, 248, .9), rgba(240, 247, 255, .92));
  border: 2px dashed #c8d6e8;
  position: relative;
  overflow: hidden;
}

.archive-visual.quiet { opacity: .82; }

.archive-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.archive-visual::after {
  content: "";
  position: absolute;
  inset: auto auto -56px -56px;
  width: 150px;
  height: 150px;
  border-radius: 24px;
  background: rgba(255,255,255,.35);
  transform: rotate(45deg);
}

.archive-visual img ~ ::after { display: none; }

.un-emblem {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #6f86a3;
  border: 2px solid rgba(111, 134, 163, .42);
  font-weight: 900;
  letter-spacing: -.08em;
}

.archive-body {
  height: 116px;
  overflow: hidden;
}

.archive-body p {
  color: #26364a;
  font-size: 15px;
  line-height: 1.58;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.archive-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: #6d7f96;
  font-size: 13px;
  font-weight: 800;
  border-top: 1px solid #e1eaf4;
  padding-top: 10px;
}

.result-tag {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.result-pass { color: #0b5f9f; background: #e4f2ff; }
.result-veto { color: #a62f46; background: #ffe8ed; }
.result-fail { color: #5f6673; background: #eceff5; }
.result-neutral { color: #6b7890; background: #eef3f8; }

.vote-grid {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: center;
}

.vote-grid div {
  padding: 10px 6px;
  border-radius: 14px;
  background: #eef5ff;
  border: 1px solid #dbe8f7;
}

.vote-grid div.zero-vote {
  background: #f0f1f4;
  border-color: #e0e2e8;
}

.vote-grid div.zero-vote b {
  color: #b0b8c4;
}

.vote-grid b {
  display: block;
  color: #0c64b6;
  font-size: 24px;
}

.vote-grid span {
  color: #8295ad;
  font-size: 12px;
  font-weight: 900;
}

.card-extra {
  border-radius: 14px;
  padding: 9px 12px;
  color: #0b4f94;
  background: rgba(75,146,219,.12);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.detail-button {
  width: 100%;
  border-radius: 14px;
  padding: 10px;
  color: #0b4f94;
  background: #e7f2ff;
}

/* ---- Album grid ---- */
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.card-tile {
  position: relative;
  transition: transform .18s ease, filter .18s ease;
  cursor: pointer;
}

.card-tile:hover { transform: translateY(-4px); }
.card-tile.locked { opacity: .68; cursor: default; }

.compact-card {
  height: 375px;
  min-height: unset;
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 14px 30px rgba(5, 34, 73, .11);
}

.compact-card .archive-head strong { font-size: 22px; }
.compact-card .archive-visual { height: 110px; }
.compact-card .archive-body { height: 82px; }
.compact-card .archive-body p { font-size: 12px; -webkit-line-clamp: 4; }
.compact-card .vote-grid b { font-size: 16px; }
.compact-card .vote-grid div { padding: 7px 4px; }
.compact-card .archive-meta { font-size: 11px; }

.locked-face {
  filter: grayscale(.45);
  background: linear-gradient(180deg, rgba(237,244,252,.96), rgba(218,231,246,.98));
}

.quantity {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: linear-gradient(135deg, var(--un-blue), var(--un-blue-deep));
  color: white;
  border-radius: 999px;
  padding: 5px 10px;
  font: 900 12px/1 ui-sans-serif, system-ui, sans-serif;
  border: 1px solid rgba(255,255,255,.7);
}

/* ---- Trade section ---- */
.share-box, .trade-detail {
  margin-top: 16px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(231, 242, 255, .92);
  border: 1px solid #cfe0f4;
  word-break: break-all;
  line-height: 1.7;
}

.trade-preview {
  margin-top: 16px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(231, 242, 255, .92);
  border: 1px solid #cfe0f4;
}

.trade-preview-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.trade-preview-arrow {
  font-size: 28px;
  color: var(--un-blue);
  font-weight: 900;
  text-align: center;
}

.trade-preview-card {
  text-align: center;
  padding: 14px;
  border-radius: 14px;
  background: white;
  border: 1px solid #d8e4f2;
}

.trade-preview-card .preview-label {
  font-size: 11px;
  font-weight: 800;
  color: #8ba0b9;
  margin-bottom: 6px;
}

.trade-preview-card .preview-code {
  font: 900 20px/1 ui-monospace, monospace;
  color: var(--un-blue-deep);
}

.trade-preview-card .preview-card-id {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #5a6a7e;
  background: #eef3f8;
  font: 900 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.trade-preview-card .preview-name {
  font-size: 13px;
  color: #4a6d92;
  margin-top: 4px;
}

.trade-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.trade-link-row a {
  flex: 1;
  color: var(--un-blue-deep);
  font-weight: 700;
}

.copy-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--un-blue);
  color: white;
  border: none;
  cursor: pointer;
}

.copy-btn:hover { background: var(--un-blue-deep); }

/* ---- Auth ---- */
.auth-panel {
  display: grid;
  gap: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(229,242,255,.74);
}

.auth-tabs button {
  box-shadow: none;
}

.auth-tabs button.active {
  color: white;
  background: linear-gradient(135deg, var(--un-blue), var(--un-blue-deep));
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: #315c8b;
  font-weight: 900;
}

.auth-form button {
  margin-top: 8px;
}

.trade-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
}

.trade-status-pending { background: #fff4e0; color: #b8801f; }
.trade-status-completed { background: #e0f5e9; color: #1a8a4e; }
.trade-status-expired { background: #f0f1f4; color: #6b7890; }

.trade-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.trade-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: #f7fbff;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--un-blue-deep);
  font-weight: 900;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}

.modal.open { display: block; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 18, 38, .62);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: 24px auto;
  border-radius: 26px;
  padding: 24px;
  background: #f7fbff;
  box-shadow: 0 30px 100px rgba(0,0,0,.34);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
}

.modal-card-layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 24px;
  align-items: start;
}

.modal-fields h2 { margin-top: 48px; }
.modal-fields dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px 16px;
}

.modal-fields dt {
  color: #6d7f96;
  font-weight: 900;
}

.modal-fields dd {
  margin: 0;
  color: #1d314d;
  line-height: 1.7;
}

.unlock-summary {
  margin: 10px 0 22px;
  padding: 16px;
  border: 1px solid #d8e7f6;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(232, 244, 255, .94), rgba(255, 255, 255, .9));
}

.unlock-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #315c8b;
  font-size: 13px;
  margin-bottom: 18px;
}

.unlock-summary-head strong {
  color: var(--un-blue-deep);
}

.unlock-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #dce8f4;
}

.unlock-track-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--un-blue), var(--gold));
}

.unlock-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #c6d8eb;
  border-radius: 50%;
  background: white;
  color: #7b8fa7;
  font: 900 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.unlock-dot.unlocked {
  border-color: var(--gold);
  background: #fff5d8;
  color: #8a6518;
}

.card-tags-panel,
.event-chain-panel {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #d8e7f6;
  border-radius: 18px;
  background: rgba(255,255,255,.72);
}

.card-tags-panel h3,
.event-chain-panel h3 {
  margin: 0 0 12px;
  color: var(--un-blue-deep);
  font-size: 18px;
}

.card-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(75,146,219,.22);
  background: linear-gradient(135deg, #eef7ff, #fff);
  color: var(--un-blue-deep);
  font-size: 13px;
  font-weight: 800;
}

.event-chain-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.event-chain-summary div {
  padding: 10px;
  border-radius: 14px;
  background: #edf4fb;
}

.event-chain-summary span {
  display: block;
  margin-bottom: 4px;
  color: #6d7f96;
  font-size: 12px;
  font-weight: 800;
}

.event-chain-summary strong {
  color: #1d314d;
  font-size: 13px;
}

.event-chain-meta {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.event-chain-meta dt {
  color: #6d7f96;
  font-weight: 900;
}

.event-chain-meta dd {
  margin: 0;
  color: #1d314d;
}

.event-chain-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.event-chain-node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: #edf4fb;
  color: #6d7f96;
  border: 1px solid #d8e7f6;
}

.event-chain-node b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  color: var(--un-blue);
  font-size: 12px;
}

.event-chain-node em {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.event-chain-node.current {
  background: #fff5d8;
  border-color: rgba(217,177,95,.48);
  color: #8a6518;
}

.extra-archive {
  margin-top: 22px;
}

.extra-archive h3 {
  margin-bottom: 12px;
  color: var(--un-blue-deep);
}

.extra-empty,
.unlock-error {
  padding: 12px 14px;
  border-radius: 14px;
  background: #edf4fb;
  color: #6d7f96;
}

.extra-content {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #d8e7f6;
  border-radius: 16px;
  background: rgba(255,255,255,.82);
}

.extra-content.locked {
  background: repeating-linear-gradient(135deg, #f5f7fa 0, #f5f7fa 10px, #eef3f8 10px, #eef3f8 20px);
}

.extra-content-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #6d7f96;
  margin-bottom: 8px;
}

.extra-content-head strong {
  color: var(--un-blue);
}

.extra-content.locked .extra-content-head strong {
  color: #8b98a8;
}

.extra-content h4 {
  margin: 0 0 8px;
  color: #1d314d;
}

.extra-content p {
  margin: 0;
  white-space: pre-wrap;
}

@keyframes cardPulse {
  from { transform: translateY(0) rotateY(0); filter: drop-shadow(0 0 0 rgba(160,211,255,0)); }
  to { transform: translateY(-5px) rotateY(7deg); filter: drop-shadow(0 0 18px rgba(160,211,255,.38)); }
}

@keyframes cardReveal {
  0% { transform: rotateY(80deg) scale(.9); opacity: 0; filter: blur(6px); }
  65% { transform: rotateY(-5deg) scale(1.02); opacity: 1; filter: blur(0); }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

/* ---- Mobile-first responsive ---- */
@media (max-width: 820px) {
  body { padding-bottom: 76px; }
  .shell { width: calc(100% - 20px); padding: 20px 0 40px; }
  .hero { padding: 22px; border-radius: 22px; }
  .panel { padding: 18px; border-radius: 20px; }

  .draw-panel { grid-template-columns: 1fr; }
  .draw-panel .draw-copy { order: 1; }
  .draw-panel #drawBtn { order: 2; width: 100%; }
  .draw-stage { order: 3; height: 520px; }

  .draw-result, .archive-card, .card-back { width: min(340px, 100%); height: 500px; }
  .draw-result { height: 500px; }

  .section-head { flex-direction: column; }
  .section-head button { width: 100%; }

  .album-controls { flex-direction: column; align-items: stretch; }
  .album-controls label { flex-direction: row; justify-content: space-between; }
  .album-controls select { flex: 1; }

  .album-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .compact-card { height: 320px; padding: 10px; }
  .compact-card .archive-head strong { font-size: 18px; }
  .compact-card .archive-visual { height: 80px; }
  .compact-card .archive-body { height: 68px; }
  .compact-card .archive-body p { font-size: 11px; }
  .compact-card .vote-grid b { font-size: 14px; }

  .trade-form { flex-direction: column; align-items: stretch; }
  .trade-form label, .trade-form select, .trade-form button { width: 100%; }

  .trade-card-row, .modal-card-layout { grid-template-columns: 1fr; }
  .modal-fields h2 { margin-top: 10px; }
  .modal-fields dl { grid-template-columns: 1fr; gap: 6px; }
  .modal-fields dt { margin-top: 10px; }

  .trade-preview-row { grid-template-columns: 1fr; }
  .trade-preview-arrow { transform: rotate(90deg); }

  .mobile-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 22px;
    background: rgba(245,250,255,.9);
    box-shadow: 0 18px 50px rgba(5,34,73,.24);
    backdrop-filter: blur(16px);
  }

  .mobile-tabbar button {
    padding: 11px 8px;
    color: white;
    background: linear-gradient(135deg, var(--un-blue), var(--un-blue-deep));
    border: none;
    box-shadow: none;
  }

  h1 { font-size: clamp(32px, 10vw, 48px); }
  h2 { font-size: 22px; }
}

@media (max-width: 480px) {
  .album-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .album-grid .compact-card { height: 168px; padding: 10px; gap: 8px; }
  .compact-card .archive-head strong { font-size: 16px; }
  .album-grid .compact-card .archive-visual,
  .album-grid .compact-card .archive-meta,
  .album-grid .compact-card .vote-grid {
    display: none;
  }
  .album-grid .compact-card .archive-body { height: auto; flex: 1; }
  .album-grid .compact-card .archive-body h3 {
    font-size: 13px;
    line-height: 1.28;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .compact-card .archive-body p { font-size: 10px; -webkit-line-clamp: 2; }
  .compact-card .vote-grid b { font-size: 12px; }
  .compact-card .vote-grid span { font-size: 10px; }
  .compact-card .vote-grid div { padding: 5px 2px; }
  .compact-card .archive-meta { font-size: 10px; }
}

/* ---- 新版卡牌：活动 CSV 字段驱动 ---- */
.quick-entry,
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.quick-entry button {
  color: white;
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
}

.quick-filters button {
  color: #0b4f94;
  background: #e7f2ff;
}

.quick-filters button:hover {
  background: #d9ecff;
}

.album-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.album-stats div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.74);
  border: 1px solid #d5e5f5;
}

.album-stats b {
  display: block;
  color: var(--un-blue-deep);
  font-size: 24px;
  line-height: 1;
}

.album-stats span {
  display: block;
  margin-top: 6px;
  color: #6d7f96;
  font-size: 12px;
  font-weight: 900;
}

.country-name,
.archive-head strong {
  color: var(--un-blue-ink);
}

.archive-code {
  align-self: flex-start;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(13, 63, 120, .08);
  color: #0c64b6;
  font: 900 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.rarity-5 .archive-code {
  color: #7a5415;
  background: linear-gradient(135deg, #fff7cc, #d9b15f 48%, #fff1aa);
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}

.rarity-4 .archive-code {
  color: #5a6a7e;
  background: linear-gradient(135deg, #f0f2f5, #d4dae3 48%, #e8ecf1);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

.archive-body h3 {
  margin: 0 0 7px;
  color: #162c49;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.compact-card .archive-body h3 {
  font-size: 13px;
  line-height: 1.22;
  margin-bottom: 5px;
}

.archive-body p {
  -webkit-line-clamp: 3;
}

.compact-card .archive-body p {
  -webkit-line-clamp: 2;
}

.default-card-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.78), transparent 44%),
    linear-gradient(135deg, rgba(214,232,250,.96), rgba(245,249,255,.98));
  z-index: 1;
}

.default-orbit {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid rgba(13,63,120,.18);
  box-shadow:
    0 0 0 18px rgba(75,146,219,.055),
    0 0 0 36px rgba(75,146,219,.035);
}

.default-monogram {
  position: absolute;
  color: rgba(13,63,120,.22);
  font: 900 54px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -.08em;
}

.archive-visual.image-missing {
  border-style: solid;
}

.no-votes {
  grid-template-columns: 1fr;
}

.no-votes div {
  background: #f2f4f7;
}

.no-votes b {
  font-size: 17px;
  color: #5f6f83;
}

.no-votes span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}

.card-stack-count {
  position: absolute;
  right: -6px;
  bottom: -8px;
  z-index: 5;
  min-width: 42px;
  text-align: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #0d3f78, #4b92db);
  font: 900 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: 0 10px 22px rgba(5,34,73,.22);
}

.quantity {
  display: none;
}

.new-badge {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 4;
  padding: 7px 11px;
  border-radius: 999px;
  color: #7a5415;
  background: linear-gradient(135deg, #fff5c4, #d9b15f);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(184,146,63,.28);
  animation: newBadgePop .68s cubic-bezier(.2,.9,.2,1) both;
}

.draw-note {
  border-radius: 14px;
  padding: 9px 12px;
  color: #7a5415;
  background: #fff5d5;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.flip-reveal .archive-card {
  animation: softFlip .72s cubic-bezier(.2,.8,.2,1) both;
  transform-origin: center;
}

@keyframes softFlip {
  0% { transform: rotateY(76deg) scale(.96); opacity: 0; }
  62% { transform: rotateY(-6deg) scale(1.01); opacity: 1; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

@keyframes newBadgePop {
  from { transform: translateY(-8px) scale(.86); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.locked-face {
  filter: grayscale(.2);
  opacity: .78;
}

.locked-face .archive-body p {
  color: #6d7f96;
  font-style: normal;
}

.muted-code {
  opacity: .58;
}

.trade-preview-hint,
.share-note {
  text-align: center;
  color: #6d7f96;
  margin: 12px 0 0;
  font-size: 13px;
}

.trade-status-row {
  margin-bottom: 10px;
}

@media (max-width: 820px) {
  .album-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-entry button,
  .quick-filters button {
    flex: 1 1 150px;
  }
}

@media (max-width: 480px) {
  .album-stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .album-stats div {
    padding: 10px;
  }

  .archive-body h3 {
    font-size: 15px;
  }

  .compact-card .archive-body h3 {
    font-size: 12px;
  }

  .card-stack-count {
    right: 8px;
    bottom: 8px;
    min-width: 34px;
    padding: 6px 8px;
  }
}
