/* ===========================
   Cards EV Lab - Dark Gaming Theme
   =========================== */

:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface-raised: #22222e;
  --border: #2a2a3a;
  --accent: #c9a227;
  --accent-dim: #a0811c;
  --green: #2ecc71;
  --red: #e74c3c;
  --text: #e8e8ee;
  --text-muted: #8888a0;
  --text-dim: #555566;

  /* Rarity colors */
  --rarity-c: #888;
  --rarity-uc: #4a9eff;
  --rarity-r: #a259f7;
  --rarity-sr: #c0c0c0;
  --rarity-sec: #ffd700;
  --rarity-sp: #ff6b35;
  --rarity-tr: #00d4aa;
  --rarity-mr: #ff2d55;
  --rarity-l: #66cc66;
  --rarity-don: #c9a227;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

a:hover {
  color: #e0b92f;
}

/* ===========================
   Header
   =========================== */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.logo:hover {
  color: var(--accent);
}

.logo-icon {
  color: var(--accent);
  font-size: 1.4rem;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
}

.main-nav a {
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

.main-nav a:hover {
  background: var(--surface-raised);
  color: var(--text);
}

/* ===========================
   Footer
   =========================== */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 0;
}

.footer-inner {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-sub {
  margin-top: 0.5rem;
  color: var(--text-dim);
}

.footer-sub a {
  color: var(--text-muted);
}

/* ===========================
   Buttons
   =========================== */

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #111;
}

.btn-primary:hover {
  background: #e0b92f;
  color: #111;
}

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

.btn-glow {
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.3);
}

.btn-glow:hover {
  box-shadow: 0 0 30px rgba(201, 162, 39, 0.5);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===========================
   Hero
   =========================== */

.hero {
  text-align: center;
  padding: 3.5rem 1rem 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #e0b92f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.15rem;
}

/* ===========================
   Featured Set Card
   =========================== */

.featured-set {
  padding: 1rem 0 2.5rem;
}

.set-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.set-card-header {
  margin-bottom: 1.5rem;
}

.set-badge {
  display: inline-block;
  background: var(--accent);
  color: #111;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  margin-bottom: 0.75rem;
}

.set-card-header h2 {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.set-card-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
}

.set-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.set-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===========================
   Profit / Loss Colors
   =========================== */

.profit {
  color: var(--green);
}

.loss {
  color: var(--red);
}

.ev-highlight {
  color: var(--accent);
}

/* ===========================
   Info Section
   =========================== */

.info-section {
  padding: 2rem 0 3rem;
}

.info-section h2 {
  text-align: center;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.info-card h3 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.info-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ===========================
   Page Header
   =========================== */

.page-header {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

.page-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ===========================
   EV Banner
   =========================== */

.ev-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.ev-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.ev-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.ev-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ev-value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ===========================
   Card Table
   =========================== */

.card-list-section {
  margin-bottom: 3rem;
}

.card-list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-list-controls h2 {
  font-size: 1.1rem;
}

.sort-controls {
  display: flex;
  gap: 0.35rem;
}

.sort-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.sort-btn.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

.card-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.card-table thead {
  background: var(--surface-raised);
}

.card-table th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.card-table td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.card-table tr:hover {
  background: rgba(201, 162, 39, 0.04);
}

.card-number {
  font-family: monospace;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.card-price {
  font-weight: 600;
  font-family: monospace;
}

/* Rarity row left borders */
.rarity-row {
  border-left: 3px solid transparent;
}

.rarity-c { border-left-color: var(--rarity-c); }
.rarity-uc { border-left-color: var(--rarity-uc); }
.rarity-r { border-left-color: var(--rarity-r); }
.rarity-sr { border-left-color: var(--rarity-sr); }
.rarity-sec { border-left-color: var(--rarity-sec); }
.rarity-sp { border-left-color: var(--rarity-sp); }
.rarity-tr { border-left-color: var(--rarity-tr); }
.rarity-mr { border-left-color: var(--rarity-mr); }
.rarity-manga-event { border-left-color: var(--rarity-mr); }
.rarity-anniversary-silver { border-left-color: var(--rarity-sr); }
.rarity-anniversary-gold { border-left-color: var(--rarity-sec); }
.rarity-l { border-left-color: var(--rarity-l); }
.rarity-don { border-left-color: var(--rarity-don); }

/* ===========================
   Rarity Badges
   =========================== */

.rarity-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #111;
}

.rarity-badge.rarity-c { background: var(--rarity-c); color: #fff; }
.rarity-badge.rarity-uc { background: var(--rarity-uc); }
.rarity-badge.rarity-r { background: var(--rarity-r); }
.rarity-badge.rarity-sr { background: var(--rarity-sr); }
.rarity-badge.rarity-sec { background: var(--rarity-sec); }
.rarity-badge.rarity-sp { background: var(--rarity-sp); }
.rarity-badge.rarity-tr { background: var(--rarity-tr); }
.rarity-badge.rarity-mr { background: var(--rarity-mr); color: #fff; }
.rarity-badge.rarity-manga-event { background: var(--rarity-mr); color: #fff; }
.rarity-badge.rarity-anniversary-silver { background: var(--rarity-sr); }
.rarity-badge.rarity-anniversary-gold { background: var(--rarity-sec); }
.rarity-badge.rarity-l { background: var(--rarity-l); }
.rarity-badge.rarity-don { background: var(--rarity-don); }

/* ===========================
   Simulator
   =========================== */

.sim-pre {
  padding: 1rem 0 3rem;
}

.sim-pre-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
}

.sim-pre-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.price-prefix {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.price-input {
  width: 100px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  text-align: center;
  font-family: inherit;
}

.price-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Loading */
.sim-loading {
  text-align: center;
  padding: 4rem 0;
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sim-loading p {
  color: var(--text-muted);
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

/* ===========================
   Results
   =========================== */

.results-summary {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.summary-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.results-section {
  margin-bottom: 2rem;
}

.results-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.muted {
  color: var(--text-muted);
  font-style: italic;
}

/* Hit badges */
.hit-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hit-badge {
  padding: 0.35rem 0.75rem;
  border: 2px solid;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Highlight cards */
.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.highlight-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  position: relative;
  overflow: hidden;
}

.highlight-card-color {
  width: 4px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 8px 0 0 8px;
}

.highlight-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.5rem;
}

.highlight-card-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.highlight-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.sim-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 0;
}

.sim-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 1rem 0;
}

/* ===========================
   Admin
   =========================== */

.admin-panel {
  max-width: 700px;
  margin: 0 auto 3rem;
}

.admin-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.admin-status strong {
  color: var(--text);
}

.admin-log {
  margin-top: 1.5rem;
}

.admin-log h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.admin-log pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* Error page */
.error-actions {
  text-align: center;
  padding: 2rem 0;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .set-stats, .sim-pre-stats {
    gap: 1.25rem;
  }

  .stat-value, .summary-value {
    font-size: 1.2rem;
  }

  .ev-banner-inner {
    gap: 1rem;
  }

  .card-list-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-summary {
    gap: 1rem;
  }

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

  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 0.75rem 0;
    gap: 0.5rem;
  }
}
