:root {
  --ink: #172034;
  --muted: #697386;
  --surface: #ffffff;
  --canvas: #f4f6f9;
  --line: #dfe4ec;
  --navy: #0b2348;
  --violet: #6a11cb;
  --green: #00a84f;
  --green-dark: #007b3a;
  --amber: #ffb224;
  --red: #d53c3c;
  --shadow: 0 12px 35px rgba(23, 32, 52, 0.10);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(106, 17, 203, 0.08), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(0, 168, 79, 0.10), transparent 30rem),
    var(--canvas);
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 82px;
  padding: 10px clamp(18px, 4vw, 64px);
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  gap: 24px;
  color: white;
  background: linear-gradient(92deg, #6415b7 0%, #3753a5 48%, #00a84f 100%);
  box-shadow: 0 4px 18px rgba(23, 32, 52, 0.18);
}

.brand { min-width: 0; display: flex; align-items: center; gap: 12px; font-size: 1.35rem; font-weight: 800; }
.brand img { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 4px 5px rgba(0,0,0,.18)); }
.main-nav { display: flex; gap: 8px; }
.main-nav a { padding: 10px 14px; border-radius: 999px; font-weight: 700; }
.main-nav a:hover { background: rgba(255,255,255,.14); }
.header-actions { min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.text-link { font-weight: 700; }
.icon-button { border: 0; background: rgba(255,255,255,.13); color: white; padding: 10px 14px; border-radius: 999px; cursor: pointer; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; border-radius: 50%; background: white; color: var(--violet); font-weight: 900; }

.page {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 90px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  min-height: 330px;
  padding: clamp(34px, 6vw, 76px);
  border-radius: 28px;
  background: linear-gradient(120deg, #0b2348, #203f74 62%, #117747);
  color: white;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -100px;
  top: -120px;
  border: 75px solid rgba(255,255,255,.07);
  border-radius: 50%;
}

.hero-copy { position: relative; z-index: 1; min-width: 0; align-self: center; max-width: 720px; }
.eyebrow { margin: 0 0 12px; color: #a7efc9; font-size: .82rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 750px; font-size: clamp(2.2rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.04em; }
.hero p { max-width: 630px; margin: 22px 0 28px; color: #dce7f6; font-size: 1.08rem; line-height: 1.7; }
.hero-art { position: relative; z-index: 1; display: grid; place-items: center; }
.hero-art img { width: min(330px, 100%); max-height: 170px; object-fit: contain; filter: drop-shadow(0 18px 20px rgba(0,0,0,.25)); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }

.button {
  border: 0;
  border-radius: 10px;
  padding: 13px 20px;
  background: var(--green);
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(0, 168, 79, .23);
}
.button:hover { background: var(--green-dark); transform: translateY(-1px); }
.button-secondary { background: white; color: var(--navy); box-shadow: none; }
.button-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); box-shadow: none; }
.button-small { padding: 9px 14px; }
.button-danger { background: var(--red); }

.section { margin-top: 54px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; color: var(--navy); font-size: clamp(1.55rem, 3vw, 2.1rem); }
.section-heading p { margin: 6px 0 0; color: var(--muted); }

.tcg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.tcg-card, .panel, .product-card, .stat-card {
  background: var(--surface);
  border: 1px solid rgba(223, 228, 236, .85);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px rgba(23,32,52,.06);
}
.tcg-card { min-height: 205px; padding: 24px; display: grid; place-items: center; text-align: center; transition: .2s ease; cursor: pointer; }
.tcg-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: rgba(106,17,203,.3); }
.tcg-card img { width: 150px; height: 78px; object-fit: contain; margin-bottom: 15px; }
.tcg-card h3 { margin: 0 0 6px; color: var(--navy); }
.tcg-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.search-bar { display: grid; grid-template-columns: 1fr auto; gap: 10px; width: min(750px, 100%); margin: 26px auto 0; }
.input, .select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #cfd6e2;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  outline: none;
}
.input:focus, .select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(106,17,203,.1); }

.category-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 15px; }
.category-card { padding: 25px 16px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 14px; }
.category-icon { width: 58px; height: 58px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg, rgba(106,17,203,.12), rgba(0,168,79,.15)); font-size: 1.7rem; }
.category-card h3 { margin: 0 0 8px; color: var(--navy); }
.category-card span { color: var(--muted); font-size: .86rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.product-card { overflow: hidden; transition: .2s ease; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-image { height: 260px; padding: 18px; display: grid; place-items: center; background: linear-gradient(145deg, #f8fafc, #edf1f6); }
.product-image img { width: 100%; height: 100%; object-fit: contain; }
.product-body { padding: 18px; }
.product-body h3 { margin: 0 0 7px; color: var(--navy); }
.product-meta { color: var(--muted); font-size: .86rem; }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.price { color: var(--green-dark); font-size: 1.2rem; font-weight: 900; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #245637; background: #dff6e9; font-size: .76rem; font-weight: 800; }
.badge-warning { color: #7d4d00; background: #fff0cc; }
.badge-red { color: #7e2020; background: #fde3e3; }

.two-column { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 24px; }
.panel { padding: 24px; }
.panel h2, .panel h3 { margin-top: 0; color: var(--navy); }
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { display: block; margin-bottom: 7px; color: #3d485c; font-size: .85rem; font-weight: 800; }

.auth-shell { min-height: calc(100vh - 210px); display: grid; place-items: center; }
.auth-card { width: min(460px, 100%); padding: 36px; background: white; border-radius: 20px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; color: var(--navy); }
.auth-card > p { margin: 0 0 26px; color: var(--muted); }
.account-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.account-type-option { display: block; cursor: pointer; }
.account-type-option input { position: absolute; opacity: 0; pointer-events: none; }
.account-type-option span {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.account-type-option small { color: var(--muted); line-height: 1.35; }
.account-type-option input:checked + span {
  border-color: var(--green);
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, .12);
  transform: translateY(-1px);
}
.check-row { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 14px; }
.check-row input { margin-top: 3px; }
.verification-note { display: grid; gap: 5px; padding: 14px; border-radius: 14px; background: #eff6ff; color: #334155; font-size: 14px; }
.verification-note strong { color: var(--navy); }
.form-error { min-height: 20px; color: #b91c1c; font-size: 14px; }
.account-banner { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 24px; padding: 18px 22px; border: 1px solid #bbf7d0; border-radius: 16px; background: #f0fdf4; }
.account-banner div { display: grid; gap: 3px; min-width: 150px; }
.account-banner span { color: var(--muted); font-size: 13px; }
.account-banner strong { color: var(--navy); }
.auth-link { margin-top: 18px; text-align: center; color: var(--muted); }
.auth-link a { color: var(--violet); font-weight: 800; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.stat-card { padding: 20px; }
.stat-card strong { display: block; margin-top: 6px; color: var(--navy); font-size: 1.7rem; }
.stat-card span { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: white; background: var(--navy); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }

.scanner-shell { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr); gap: 24px; }
.scanner-view {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 3px solid var(--navy);
  border-radius: 20px;
  background:
    linear-gradient(rgba(10,20,36,.72), rgba(10,20,36,.72)),
    radial-gradient(circle at center, #31445e, #101722);
  color: white;
}
.scan-frame { width: min(330px, 60%); aspect-ratio: 2.5 / 3.5; border: 4px solid var(--green); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.18), 0 0 24px rgba(0,168,79,.6); }
.scanner-label { position: absolute; bottom: 26px; padding: 10px 16px; border-radius: 999px; background: rgba(0,0,0,.55); }
.scanner-status { display: grid; gap: 12px; }
.status-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }

.admin-layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; }
.admin-menu { padding: 14px; }
.admin-menu button { width: 100%; padding: 12px; text-align: left; border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer; }
.admin-menu button.active, .admin-menu button:hover { background: #eef1f7; color: var(--violet); font-weight: 800; }

.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.site-footer { min-height: 90px; padding: 22px clamp(18px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: #161d2b; color: #c8cfda; }
.site-footer strong { display: block; color: white; }
.site-footer nav { display: flex; gap: 20px; }
.site-footer a:hover { color: #5ce89d; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 360px; padding: 14px 18px; border-radius: 10px; background: #172034; color: white; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; box-shadow: var(--shadow); }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { order: 3; grid-column: 1 / -1; justify-content: center; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .scanner-shell, .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .account-type-grid { grid-template-columns: 1fr; }
  .site-header { position: static; display: flex; flex-wrap: wrap; padding-inline: 16px; }
  .brand { flex: 1 1 100%; justify-content: center; }
  .brand span { font-size: 1rem; }
  .header-actions { width: 100%; justify-content: center; flex-wrap: wrap; gap: 9px; }
  .main-nav { width: 100%; overflow-x: auto; justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; padding: 34px 24px; }
  .hero-art { display: none; }
  .hero h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .search-bar { grid-template-columns: 1fr; }
  .category-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; align-items: flex-start; }
  .site-footer nav { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .page { width: min(100% - 20px, 1440px); padding-top: 24px; }
  .category-grid, .stats-grid { grid-template-columns: 1fr; }
  .header-actions .icon-button { order: 3; width: 100%; }
  .main-nav { justify-content: center; }
}
