:root {
  --bg-dark: #1a2533;
  --bg-header: #141d28;
  --bg-card: #243044;
  --accent: #e07a5f;
  --accent-hover: #c96a52;
  --accent-light: #e68a2e;
  --text-on-dark: #ffffff;
  --text-muted: #9aa8b8;
  --text-body: #3c5a78;
  --bg-light: #ffffff;
  --bg-section: #f4f6f9;
  --border: #dce3ec;
  --shadow: 0 4px 24px rgba(26, 37, 51, 0.12);
  --radius: 10px;
  --radius-lg: 16px;
  --font: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --header-h: 56px;
  --max-w: 1100px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-on-dark);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-on-dark);
  transition: background 0.15s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: var(--text-on-dark);
  font-size: 0.9rem;
  transition: background 0.15s;
}

.account-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Mobile nav */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
}

.nav-drawer.open {
  pointer-events: auto;
  visibility: visible;
}

.nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
}

.nav-drawer.open .nav-backdrop {
  opacity: 1;
}

.nav-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--bg-header);
  padding: 1rem 0;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.nav-drawer.open .nav-panel {
  transform: translateX(0);
}

.nav-panel a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: var(--text-on-dark);
  font-weight: 500;
  transition: background 0.15s;
}

.nav-panel a:hover,
.nav-panel a.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.5rem 1.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(224, 122, 95, 0.35);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--bg-dark);
}

.btn-secondary:hover {
  background: #f0f2f5;
}

.btn-outline {
  border: 2px solid var(--border);
  color: var(--text-body);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--text-body);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Hero */
.hero {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  text-align: center;
  padding: 3rem 1.5rem 2rem;
}

.hero-inner {
  max-width: 640px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.hero-lead {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.hero-illustration {
  max-width: 520px;
  margin: 0 auto;
}

/* Feature sections */
.feature-section {
  padding: 4rem 1.5rem;
  text-align: center;
}

.feature-section.alt {
  background: var(--bg-section);
}

.feature-visual {
  max-width: 380px;
  margin: 0 auto 2rem;
}

.feature-section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  color: var(--text-body);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.feature-section p {
  margin: 0 auto;
  max-width: 520px;
  font-size: 1.05rem;
  line-height: 1.65;
}

/* CTA band */
.cta-band {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  text-align: center;
  padding: 4rem 1.5rem;
}

.cta-band h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  font-weight: 700;
}

/* Footer */
.site-footer {
  background: var(--bg-header);
  color: var(--text-muted);
  padding: 2.5rem 1.5rem 2rem;
  font-size: 0.9rem;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.footer-links a {
  color: var(--text-on-dark);
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.footer-social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-on-dark);
  transition: background 0.15s, color 0.15s;
}

.footer-social a:hover {
  background: var(--accent);
  color: #fff;
}

.footer-social svg {
  width: 18px;
  height: 18px;
}

.footer-legal {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
}

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

/* Page shell (inner pages) */
.page-hero {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 2rem 1.5rem;
}

.page-hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.page-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
}

.page-hero p {
  margin: 0;
  color: var(--text-muted);
}

.page-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem;
}

/* Sets toolbar */
.sets-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-section);
  border-radius: var(--radius-lg);
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  color: var(--text-body);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.15);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-pill {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-body);
  transition: all 0.15s;
}

.filter-pill:hover,
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Sets grid */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.set-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.set-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.set-card-thumb {
  aspect-ratio: 1.4;
  background: linear-gradient(145deg, #d2c1a8 0%, #b8a68c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
}

.set-card-thumb span {
  font-weight: 800;
  font-size: 0.75rem;
  text-align: center;
  color: #4a3f32;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.set-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
}

.set-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.set-card-body {
  padding: 0.75rem;
}

.set-card-body h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-body);
  line-height: 1.3;
}

.set-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.card-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-tile-img {
  aspect-ratio: 0.72;
  background: linear-gradient(160deg, #e8dfd0, #c9b89a);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
}

.card-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-tile-img svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.card-tile-body {
  padding: 0.6rem 0.75rem;
}

.card-tile-body h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.card-tile-body p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  opacity: 0.6;
}

.card-detail {
  display: grid;
  grid-template-columns: minmax(200px, 360px) 1fr;
  gap: 2rem;
  align-items: start;
  max-width: 900px;
}

.card-detail-image {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.card-detail-image img {
  display: block;
  width: 100%;
  height: auto;
}

.card-detail-placeholder {
  aspect-ratio: 0.72;
  background: linear-gradient(160deg, #e8dfd0, #c9b89a);
  border-radius: var(--radius);
}

.card-detail-label {
  margin: 1.25rem 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.card-detail-label:first-child {
  margin-top: 0;
}

.card-detail-meta p:not(.card-detail-label):not(.card-detail-actions) {
  margin: 0;
  font-size: 1rem;
}

.card-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

@media (max-width: 640px) {
  .card-detail {
    grid-template-columns: 1fr;
  }
}

/* Dashboard */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-section);
  border-radius: var(--radius-lg);
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  color: var(--text-body);
}

.empty-state p {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
}

/* Auth pages */
.auth-page {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--bg-section);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  color: var(--text-body);
}

.auth-card .subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-body);
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.15);
}

.auth-card .btn {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Scroll to top */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  color: var(--text-body);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  background: var(--bg-section);
}

/* Desktop nav in header center */
.header-nav {
  display: none;
  gap: 0.25rem;
}

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

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-on-dark);
  background: rgba(255, 255, 255, 0.06);
}

@media (min-width: 900px) {
  .header-nav {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }
}

@media (max-width: 899px) {
  .header-nav-desktop {
    display: none;
  }
}
