body {
  margin: 0;
  font-family: sans-serif;
}

/* ── Top bar ────────────────────────────────────────────── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid #ccc;
  gap: 16px;
  flex-wrap: wrap;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.top-left button,
.top-right button {
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
}


/* Collection top bar (progress + code, inline with left nav) */
#collTopBar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-left: 1px solid #ddd;
  padding-left: 16px;
  margin-left: 4px;
}

.collection-tab {
  margin-left: 12px;
  background: #1a1a2e;
  color: #e0e0ff;
  border: none !important;
}

.collection-tab.active,
.collection-tab:hover {
  background: #3a3a6e !important;
  color: #fff !important;
}

.buy-btn {
  display: inline-block;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 8px;
  background: #b71c1c;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.buy-btn:hover {
  background: #d32f2f;
}

/* ── Banner shared styles ────────────────────────────────── */
.shared-label {
  font-weight: bold;
  letter-spacing: 0.02em;
}

.shared-actions {
  display: flex;
  gap: 8px;
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
  display: flex;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  padding: 15px;
  border-right: 1px dashed #aaa;
}

.sidebar button {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #999;
  background: #f8f8f8;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.sidebar.disabled {
  pointer-events: none;
  opacity: 0.45;
}

/* ── Buttons ─────────────────────────────────────────────── */
button {
  cursor: pointer;
}

button.active {
  background-color: #333 !important;
  color: white !important;
}

/* ── Overview ────────────────────────────────────────────── */
#overview {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.overview-image {
  max-width: 80%;
  height: auto;
}

/* ── Card grid ───────────────────────────────────────────── */
.card-grid {
  display: none;
  padding: 20px;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 20px;
}

/* ── Card wrap ───────────────────────────────────────────── */
.card-wrap {
  position: relative;
  width: 160px;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.15s;
}

.card-wrap:hover {
  transform: scale(1.04);
}

.card-wrap img {
  width: 160px;
  display: block;
}

/* Unowned: greyed out in browse AND collection */
.card-wrap.unowned img {
  filter: grayscale(100%) opacity(0.35);
}

/* In browse mode, hovering unowned shows it clearly */
.card-grid .card-wrap.unowned:hover img {
  filter: grayscale(60%) opacity(0.6);
}

/* ── Owned checkmark badge (shared/read-only view) ───────── */
.owned-mark {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  background: #2e7d32;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.card-wrap.owned .owned-mark { display: block; }

/* ── Count stepper badge (editable collection) ───────────── */
.count-badge {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  background: #2e7d32;
  color: #fff;
  border-radius: 12px;
  height: 24px;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.card-wrap.owned .count-badge { display: flex; }

.cnt-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  padding: 0 5px;
  cursor: pointer;
  font-weight: bold;
}
.cnt-btn:hover { opacity: 0.75; }

.cnt-num {
  min-width: 14px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  pointer-events: none;
}

/* In collection view, unowned card shows a + hint on hover */
.card-grid .card-wrap.unowned:hover::after {
  content: '+';
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 18px;
  line-height: 22px;
  text-align: center;
  font-weight: bold;
}

/* ── Collection season picker (sidebar) ─────────────────── */
.coll-season-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #999;
  background: #f8f8f8;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

/* ── Collection progress (top bar, compact) ─────────────── */
.collection-progress {
  display: flex;
  gap: 16px;
  align-items: center;
}

.prog-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 72px;
}

.prog-label {
  font-size: 11px;
  font-weight: bold;
  color: #555;
}

.prog-bar {
  height: 5px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  background: #2e7d32;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.prog-count {
  font-size: 11px;
  color: #888;
}


/* ── Save code bar ───────────────────────────────────────── */
.save-code-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.import-wrap {
  position: relative;
}

#importArea {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.code-btn {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #999;
  background: #f8f8f8;
  cursor: pointer;
  white-space: nowrap;
}

.code-btn:hover {
  background: #e8e8e8;
}

.apply-btn {
  background: #1a1a2e;
  color: #e0e0ff;
  border-color: #1a1a2e;
}

.apply-btn:hover {
  background: #3a3a6e !important;
}

.clear-btn {
  background: #fff;
  border-color: #c62828;
  color: #c62828;
}
.clear-btn:hover {
  background: #c62828 !important;
  color: #fff !important;
}

.print-btn {
  background: #fff;
  border-color: #999;
}

.print-btn:hover {
  background: #f0f0f0;
}

#codeInput {
  font-family: monospace;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid #bbb;
  border-radius: 6px;
  width: 320px;
  max-width: 100%;
}

#codeInput:focus {
  outline: none;
  border-color: #1a1a2e;
}

.feedback-ok {
  font-size: 13px;
  color: #2e7d32;
  font-weight: bold;
}

.feedback-err {
  font-size: 13px;
  color: #c62828;
}

.collection-season-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
}

.collection-season-tabs button {
  padding: 7px 16px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #999;
  background: #f8f8f8;
  cursor: pointer;
}

.collection-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #999;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 20px;
  display: flex;
  gap: 24px;
  border-radius: 12px;
}

.modal-content img {
  width: 300px;
  height: 420px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.modal-info {
  max-height: 420px;
  overflow-y: auto;
}

.card-table {
  border-collapse: collapse;
  min-width: 260px;
  font-size: 14px;
}

.card-table th {
  text-align: left;
  padding: 6px 10px;
  background: #f2f2f2;
  width: 80px;
  white-space: pre-line;
  vertical-align: top;
}

.card-table td {
  padding: 6px 10px;
  background: #fff;
  white-space: pre-line;
  vertical-align: top;
  border-bottom: 1px dashed #ddd;
}

#info-effect {
  line-height: 1.8;
}

/* ── Summary tab button ─────────────────────────────────── */
.summary-tab {
  background: #263238;
  color: #cfd8dc;
  border: none !important;
}
.summary-tab.active,
.summary-tab:hover {
  background: #37474f !important;
  color: #fff !important;
}

/* ── Summary view wrapper ───────────────────────────────── */
.sv-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  font-family: 'Hiragino Sans', 'Noto Sans KR', sans-serif;
}

/* ── Hero stats ─────────────────────────────────────────── */
.sv-header {
  margin-bottom: 36px;
  padding: 24px 28px;
  background: #1a1a2e;
  border-radius: 14px;
  color: #e0e0ff;
}

.sv-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.sv-hero-num {
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
}
.sv-hero-den {
  font-size: 26px;
  font-weight: 400;
  color: rgba(255,255,255,0.4);
}
.sv-hero-label {
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  margin-left: 4px;
}

.sv-hero-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  margin-bottom: 12px;
  overflow: hidden;
}
.sv-hero-bar {
  height: 100%;
  background: #69f0ae;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.sv-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}
.sv-meta-sep { opacity: 0.4; }
.sv-meta-item strong { color: #e0e0ff; }
.sv-meta-dup strong  { color: #ffab40; }

/* ── Sections ───────────────────────────────────────────── */
.sv-section {
  margin-bottom: 32px;
}
.sv-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sv-badge {
  background: #1a1a2e;
  color: #e0e0ff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.sv-badge-miss {
  background: #b71c1c;
}

/* ── Season breakdown grid ──────────────────────────────── */
.sv-season-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.sv-season-block {
  background: #f9f9fb;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 14px 16px;
}

.sv-season-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.sv-season-label {
  font-size: 13px;
  font-weight: 800;
  color: #1a1a2e;
}
.sv-season-frac {
  font-size: 12px;
  color: #666;
  flex: 1;
}
.sv-season-pct {
  font-size: 12px;
  font-weight: 700;
  color: #888;
}

.sv-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
.sv-table td {
  padding: 3px 0;
  vertical-align: middle;
}
.sv-table td:last-child { text-align: right; }

.sv-rarity {
  font-size: 11px;
  font-weight: 900;
  display: inline-block;
  width: 24px;
}
.sv-frac {
  font-weight: 700;
  color: #1a1a2e;
  padding: 0 8px;
}
.sv-total { color: #bbb; font-weight: 400; }

.sv-bar {
  display: inline-block;
  width: 70px;
  height: 5px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.sv-bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.sv-pct { color: #888; font-size: 11px; }
.sv-complete { color: #2e7d32 !important; font-weight: 800 !important; }

/* ── Chip-based card list ───────────────────────────────── */
.sv-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sv-chip-group {
  margin-bottom: 12px;
}
.sv-chip-season {
  font-size: 11px;
  font-weight: 700;
  color: #aaa;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sv-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1.5px solid #ddd;
  color: #444;
  background: #fff;
  white-space: nowrap;
  cursor: default;
}
.sv-chip-dup {
  background: #fff8f3;
  color: #e65100;
  border-color: #e65100;
}
.sv-chip-miss {
  background: #f5f5f5;
  color: #bbb;
  border-color: #ddd;
}

.sv-empty {
  color: #bbb;
  font-size: 13px;
}

/* ── Duplicates list ────────────────────────────────────── */
.sv-dup-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sv-dup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  background: #fff8f3;
  border-left: 3px solid #e65100;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
}
.sv-dup-id {
  font-family: monospace;
  font-weight: 700;
  color: #1a1a2e;
  min-width: 70px;
}
.sv-dup-name {
  color: #555;
  flex: 1;
}
.sv-dup-cnt {
  font-weight: 800;
  color: #e65100;
}

/* ── Missing cards ──────────────────────────────────────── */
.sv-miss-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sv-miss-rarity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.sv-miss-r {
  min-width: 52px;
  margin-top: 3px;
}

.sv-complete-msg {
  color: #2e7d32;
  font-weight: 700;
  font-size: 14px;
}

/* ── Compare banner ─────────────────────────────────────── */
#compareBanner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 24px;
  background: #1a1a2e;
  color: #e0e0ff;
  font-size: 14px;
}

.compare-stats {
  display: flex;
  gap: 12px;
}

.cstat {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.cstat-need  { background: #1565c0; color: #fff; }
.cstat-offer { background: #e65100; color: #fff; }
.cstat-both  { background: #2e7d32; color: #fff; }

/* ── Account bar ─────────────────────────────────────────── */
.acct-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cloud-btn {
  background: #0f4c75;
  color: #e0f0ff;
  border-color: #0f4c75;
}
.cloud-btn:hover {
  background: #1a6fa0 !important;
  color: #fff !important;
}

.acct-id-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #e8f4fd;
  border: 1px solid #90caf9;
  border-radius: 6px;
  white-space: nowrap;
}
.acct-id-label {
  font-size: 10px;
  font-weight: 800;
  color: #0f4c75;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#acctIdText, #settingsId {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  color: #0f4c75;
  letter-spacing: 0.1em;
}
.acct-small-btn {
  padding: 3px 8px !important;
  font-size: 11px !important;
}

/* Sync status indicator */
.sync-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
}
.sync-ok      { color: #2e7d32; background: #e8f5e9; }
.sync-pending { color: #e65100; background: #fff3e0; }
.sync-err     { color: #c62828; background: #ffebee; }

/* ── Account panels (create / login / settings) ──────────── */
.acct-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  min-width: 300px;
}

.acct-panel-inner h4 {
  font-size: 15px;
  margin: 0 0 6px;
  color: #1a1a2e;
}
.acct-hint {
  font-size: 12px;
  color: #888;
  margin: 0 0 12px;
}

.acct-panel-inner label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
  margin-bottom: 10px;
}
.acct-panel-inner input {
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: monospace;
}
.acct-panel-inner input:focus {
  outline: none;
  border-color: #0f4c75;
}

.acct-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.acct-error {
  font-size: 12px;
  color: #c62828;
  margin-top: 6px;
  min-height: 16px;
}

.acct-setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: #555;
}
.acct-setting-row code {
  font-size: 15px;
  font-weight: 700;
  color: #0f4c75;
  letter-spacing: 0.1em;
}

/* ── Profile banner ─────────────────────────────────────── */
#profileBanner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 24px;
  background: #0f4c75;
  color: #e0f0ff;
  font-size: 14px;
}

.compare-btn {
  background: #1565c0 !important;
  color: #fff !important;
  border-color: #1565c0 !important;
}
.compare-btn:hover {
  background: #1976d2 !important;
}

/* ── Compare card badges ────────────────────────────────── */
.cmp-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0,0,0,0.55);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.cmp-badge.cmp-need  { background: #1565c0; }
.cmp-badge.cmp-offer { background: #e65100; }
.cmp-badge.cmp-both  { background: #2e7d32; }

.cmp-me   { opacity: 1; }
.cmp-sep  { opacity: 0.5; margin: 0 2px; }
.cmp-them { opacity: 0.8; }

.cmp-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 0;
  color: #fff;
}
.cmp-tag-need  { background: rgba(21,101,192,0.85); }
.cmp-tag-offer { background: rgba(230,81,0,0.85); }

/* In compare mode, "need" cards get a blue glow, "offer" get orange */
.card-wrap:has(.cmp-need) {
  box-shadow: 0 0 0 2px #1565c0;
}
.card-wrap:has(.cmp-offer) {
  box-shadow: 0 0 0 2px #e65100;
}

/* ── Trade summary panel ────────────────────────────────── */
#tradeSummary {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 24px 24px;
  background: #f9f9fb;
  border-bottom: 1px solid #e0e0e0;
}

.trade-section { }

.trade-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
}
.trade-need  { background: #e3f2fd; color: #1565c0; }
.trade-offer { background: #fff3e0; color: #e65100; }
.trade-match { background: #e8f5e9; color: #2e7d32; }

.trade-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trade-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s;
  max-width: 220px;
}
.trade-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.trade-card-need  { border-left: 3px solid #1565c0; }
.trade-card-offer { border-left: 3px solid #e65100; }

.trade-card img {
  width: 36px;
  border-radius: 3px;
  flex-shrink: 0;
}

.trade-card-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.trade-rarity {
  font-size: 10px;
  font-weight: 900;
  color: #888;
}
.trade-name {
  font-size: 11px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trade-extra {
  font-size: 10px;
  color: #999;
  font-weight: 700;
}
.trade-empty {
  font-size: 13px;
  color: #999;
  margin: 0;
  padding: 8px 0;
}

/* ── Trade match suggestions ────────────────────────────── */
.trade-matches {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trade-match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #c8e6c9;
  border-radius: 10px;
}

.trade-match-card {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
}
.trade-match-card img {
  width: 32px;
  border-radius: 3px;
  flex-shrink: 0;
}
.trade-match-card .trade-rarity {
  flex-shrink: 0;
}
.trade-match-card .trade-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trade-match-card.give { opacity: 0.85; }

.trade-arrow {
  font-size: 20px;
  color: #2e7d32;
  font-weight: bold;
  flex-shrink: 0;
}

