:root {
  --bg-0: #050f08;
  --bg-1: #0a1c0f;
  --panel: #0e2413;
  --panel-soft: #0b1e10;
  --panel-2: #123018;
  --line: rgba(178, 214, 91, 0.16);
  --line-strong: rgba(178, 214, 91, 0.32);
  --text: #f3f9ec;
  --muted: #9cb497;
  --muted-2: #708a6c;
  --accent: #8dc63f;
  --accent-strong: #b4d65b;
  --accent-2: #f0b429;
  --success: #6fcf3e;
  --warning: #f0b429;
  --danger: #ff6b6b;

  --rarity-base: #93a68c;
  --rarity-shiny: #5fd0e8;
  --rarity-legend: #f0b429;
  --rarity-limited: #b47cff;
  --rarity-special: #ff6b6b;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-soft: 0 18px 50px rgba(1, 6, 2, 0.55);
  --shadow-lift: 0 26px 70px rgba(1, 6, 2, 0.7);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(141, 198, 63, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(240, 180, 41, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- header ---------- */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 1.6rem 3.5rem;
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--accent-2);
  background: rgba(5, 15, 8, 0.82);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.hero nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.hero nav a:not(.button) {
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  transition: color .15s ease;
}
.hero nav a:not(.button):hover { color: var(--text); }

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent-2);
  font-size: .72rem;
  font-weight: 800;
  margin: 0 0 .5rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  background: rgba(5, 15, 8, 0.9);
  border: 1px solid rgba(240, 180, 41, 0.4);
}

.hero h1 {
  margin: 0 0 .4rem;
  font-size: 1.7rem;
  letter-spacing: -.01em;
}

.hero > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  max-width: 46ch;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 2.2rem 2rem 4rem;
}

/* ---------- buttons ---------- */
.button, button {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #0a1f0c;
  border: none;
  border-radius: 999px;
  padding: .75rem 1.3rem;
  font-weight: 700;
  font-size: .92rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  box-shadow: 0 8px 22px rgba(141, 198, 63, 0.28);
}
.button:hover, button:hover { transform: translateY(-1px); filter: brightness(1.05); text-decoration: none; }
.button:active, button:active { transform: translateY(0); }

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 107, 129, 0.5);
  box-shadow: none;
}
button.danger:hover { background: rgba(255, 107, 129, 0.1); }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.panel h2 {
  margin-top: 0;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}

/* ---------- stats / dashboard ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: linear-gradient(160deg, var(--panel-2), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.stat-card span { color: var(--muted); font-size: .82rem; font-weight: 600; }

.stat-card strong {
  display: block;
  font-size: 2.1rem;
  margin-top: .4rem;
  letter-spacing: -.02em;
}

.stat-card.accent { border-color: rgba(255, 202, 79, 0.45); }
.stat-card.accent strong { color: var(--warning); }

.progress-card {
  grid-column: 1 / -1;
  background: linear-gradient(160deg, var(--panel-2), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
}
.progress-card .progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .7rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.progress-card .progress-head strong { font-size: 1.35rem; }
.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s ease;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 1.5rem;
}

/* ---------- forms ---------- */
.filters, .card-form, .bulk-form {
  display: grid;
  gap: 1rem;
}

.filters { grid-template-columns: 2fr 1fr 1fr auto; }
.filters-actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.secondary-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
}

input, select, textarea {
  width: 100%;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  font-size: .95rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(141, 198, 63, 0.22);
}

.card-form { grid-template-columns: repeat(2, 1fr); }
.card-form label span { display: block; margin-bottom: .45rem; color: var(--muted); font-size: .88rem; font-weight: 600; }
.full { grid-column: 1 / -1; }
.actions-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.checkbox { display: flex; align-items: center; gap: .6rem; }
.checkbox input { width: auto; }

.hint { color: var(--muted-2); font-size: .88rem; line-height: 1.55; margin-top: -.3rem; margin-bottom: 1rem; }
.hint code { background: rgba(255,255,255,0.06); border-radius: 6px; padding: .1rem .4rem; color: var(--accent-strong); }

.bulk-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }

/* ---------- flash ---------- */
.flash-stack { margin-bottom: 1.2rem; display: grid; gap: .6rem; }
.flash { border-radius: var(--radius-sm); padding: .9rem 1.1rem; font-size: .92rem; }
.flash-success { background: rgba(73, 209, 125, .12); border: 1px solid rgba(73, 209, 125, .35); color: #b7f4cd; }
.flash-error { background: rgba(255, 107, 129, .12); border: 1px solid rgba(255, 107, 129, .35); color: #ffc2cb; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: .32rem .75rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: .01em;
}
.badge-missing { background: rgba(255, 107, 129, .16); color: #ffb0bb; }
.badge-owned { background: rgba(73, 209, 125, .16); color: #96f0b4; }
.badge-duplicate { background: rgba(255, 202, 79, .16); color: #ffd980; }
.badge-trade { background: rgba(79, 195, 247, .16); color: #95e0ff; }

.rarity-tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid currentColor;
}
.rarity-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.rarity-Base { color: var(--rarity-base); }
.rarity-Shiny { color: var(--rarity-shiny); }
.rarity-Legend { color: var(--rarity-legend); }
.rarity-Limited { color: var(--rarity-limited); }
.rarity-Special { color: var(--rarity-special); }

.card-list { list-style: none; padding: 0; margin: 0; }
.card-list li {
  display: flex;
  gap: .7rem;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}
.card-list li:last-child { border-bottom: 0; }

/* ---------- trading card grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.trading-card {
  position: relative;
  background: linear-gradient(165deg, var(--panel-2) 0%, var(--panel-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  border-top: 3px solid var(--rarity-color, var(--line));
}
.trading-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
}
.trading-card.rarity-Base { --rarity-color: var(--rarity-base); }
.trading-card.rarity-Shiny { --rarity-color: var(--rarity-shiny); }
.trading-card.rarity-Legend { --rarity-color: var(--rarity-legend); }
.trading-card.rarity-Limited { --rarity-color: var(--rarity-limited); }
.trading-card.rarity-Special { --rarity-color: var(--rarity-special); }

.tc-image-link {
  display: block;
  margin: -.2rem -.2rem .95rem;
  border-radius: calc(var(--radius-md) - 2px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.tc-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.trading-card .tc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .8rem;
  gap: .5rem;
}
.tc-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
}
.tc-player {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 0 0 .15rem;
  line-height: 1.25;
}
.tc-team { color: var(--muted); font-size: .88rem; margin: 0 0 .9rem; }
.tc-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .9rem;
}
.tc-note {
  font-size: .84rem;
  color: var(--muted-2);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  margin-bottom: .9rem;
  min-height: 1.2rem;
}
.tc-source {
  margin: -.3rem 0 .9rem;
  font-size: .82rem;
}
.tc-source a {
  color: var(--accent);
}
.tc-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding-top: .8rem;
  border-top: 1px solid var(--line);
}
.tc-actions a {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
}
.tc-actions form { margin: 0; }
.tc-actions button.danger {
  padding: .4rem .8rem;
  font-size: .8rem;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .25rem .35rem;
}
.qty-stepper form { margin: 0; }
.qty-btn {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  border-radius: 999px;
  box-shadow: none;
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.qty-btn:hover { background: rgba(255,255,255,0.16); }
.qty-value { min-width: 1.1rem; text-align: center; font-weight: 800; font-size: .92rem; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  grid-column: 1 / -1;
}

/* ---------- classic table (reference page) ---------- */
.table-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: .8rem .7rem;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
td { text-align: left; padding: .85rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.actions { display: flex; gap: .7rem; align-items: center; }
.actions form { margin: 0; }
.actions button { padding: .5rem .9rem; font-size: .82rem; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

@media (max-width: 880px) {
  .hero { flex-direction: column; align-items: flex-start; padding: 1.4rem; }
  .split, .filters, .card-form { grid-template-columns: 1fr; }
  .container { padding: 1.3rem; }
  .cards-grid { grid-template-columns: 1fr; }
}

/* ---------- login ---------- */
.login-body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 15% 0%, rgba(141, 198, 63, 0.22), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(240, 180, 41, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
  -webkit-font-smoothing: antialiased;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-panel {
  width: 100%;
  max-width: 380px;
  text-align: center;
  border-top: 3px solid var(--accent-2);
}

.login-title {
  margin: 0 0 .5rem;
  font-size: 1.5rem;
  letter-spacing: -.01em;
}

.login-sub {
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-size: .92rem;
}

.login-panel form { text-align: left; }
.login-panel .actions-row { justify-content: center; margin-top: .3rem; }
.login-panel button[type="submit"] { width: 100%; }

.logout-form { margin: 0; }
.logout-form button { padding: .55rem 1.1rem; font-size: .85rem; }
