:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --ink: #14213d;
  --muted: #64748b;
  --line: #dbe4df;
  --primary: #0f766e;
  --primary-dark: #134e4a;
  --accent: #f59e0b;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 20px 55px rgba(15, 23, 42, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(20, 184, 166, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 0%, rgba(245, 158, 11, 0.16), transparent 26rem),
    var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 14px clamp(18px, 4vw, 56px) 58px;
  background: linear-gradient(135deg, #101827 0%, #0f3f46 58%, #0f766e 100%);
  color: white;
}

.hero::after {
  content: "FOOTBALL CARDS 26";
  position: absolute;
  inset: 4px -28px auto auto;
  width: min(520px, 72vw);
  height: 180px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 36px;
  color: rgba(255,255,255,.10);
  font-weight: 900;
  font-size: clamp(2.4rem, 8vw, 5.6rem);
  line-height: .82;
  letter-spacing: -.08em;
  text-align: center;
  transform: rotate(-8deg);
  opacity: .9;
}

.topbar, .hero-content, .shell, .footer { width: min(1180px, 100%); margin-inline: auto; }
.topbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: flex-end; gap: 18px; min-height: 42px; }
.topbar-minimal:has(.ghost-button[hidden]) { min-height: 0; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.locale-control { display: flex; grid-template-columns: auto auto; align-items: center; gap: 8px; color: rgba(255,255,255,.82); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; }
.locale-control select { width: auto; min-width: 74px; padding: 9px 12px; border-color: rgba(255,255,255,.35); color: white; background: rgba(255,255,255,.12); }
.locale-control option { color: var(--ink); background: white; }

.ghost-button, .primary-button, .edit-list {
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 10px 16px;
  color: white;
  background: rgba(255,255,255,.12);
  transition: .2s ease;
}
.ghost-button:hover, .primary-button:hover, .edit-list:hover { transform: translateY(-1px); }
.primary-button { border-color: rgba(15,118,110,.35); background: var(--primary); box-shadow: 0 12px 28px rgba(15,118,110,.22); }
.dark-button { color: var(--ink); border-color: var(--line); background: white; }
.danger-button { color: var(--danger); border-color: rgba(220,38,38,.28); background: #fff5f5; }
.danger-button:hover { background: #fee2e2; }

.hero-content { position: relative; z-index: 1; padding-top: 42px; }
.compact-hero { padding-top: 24px; }
.eyebrow { margin: 0 0 12px; text-transform: uppercase; letter-spacing: .16em; font-weight: 800; font-size: .78rem; color: #d1fae5; }
.eyebrow.dark { color: var(--primary); }
h1 { max-width: 780px; margin: 0; font-size: clamp(1.9rem, 5vw, 3.8rem); line-height: .95; letter-spacing: -.06em; }

.shell { margin-top: -38px; padding: 0 clamp(14px, 3vw, 24px) 40px; position: relative; z-index: 2; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.stat-card, .panel, .country-card { border: 1px solid rgba(219, 228, 223, .9); background: var(--panel); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.stat-card { border-radius: 22px; padding: 20px; }
.stat-card span { color: var(--muted); font-size: .9rem; font-weight: 600; }
.stat-card strong { display: block; margin-top: 8px; font-size: clamp(1.7rem, 4vw, 2.55rem); letter-spacing: -.05em; }
.stat-card em { display: block; margin-top: 4px; color: var(--muted); font-style: normal; font-size: .82rem; }
.global-progress-card { border-color: rgba(15,118,110,.24); background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%); }
.global-progress-bar { overflow: hidden; height: 9px; margin-top: 12px; border-radius: 999px; background: #dbe4df; }
.global-progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); }

.panel { border-radius: var(--radius); }
.app-nav { position: sticky; top: 10px; z-index: 10; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; padding: 8px; border: 1px solid rgba(219, 228, 223, .92); border-radius: 999px; background: rgba(255,255,255,.9); box-shadow: 0 16px 38px rgba(15,23,42,.10); backdrop-filter: blur(14px); }
.app-nav-button { border: 0; border-radius: 999px; padding: 12px 14px; color: var(--muted); background: transparent; font-weight: 900; letter-spacing: .01em; transition: .2s ease; }
.app-nav-button:hover { color: var(--primary-dark); background: #f0fdfa; }
.app-nav-button.active { color: white; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); box-shadow: 0 10px 24px rgba(15,118,110,.22); }
.app-page { animation: page-in .18s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
#friendsPanel { scroll-margin-top: 18px; }
.settings-panel { margin: 0; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%); }
.settings-panel h2 { margin: 0; letter-spacing: -.04em; }
.settings-actions { display: grid; gap: 10px; justify-items: end; max-width: 620px; }
.settings-actions p { margin: 0; color: var(--muted); font-weight: 700; text-align: right; }
.settings-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.settings-message { min-height: 1.2em; font-size: .88rem; }
.auth-panel { padding: clamp(20px, 4vw, 34px); display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; align-items: center; background: var(--panel-solid); }
.auth-panel h2 { margin: 0 0 8px; font-size: clamp(1.5rem, 3vw, 2.4rem); letter-spacing: -.05em; }
.auth-panel p { color: var(--muted); margin: 0; }
.login-form { display: grid; gap: 12px; }
.auth-mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.auth-mode label { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; color: var(--ink); font-weight: 800; }
.auth-mode input { width: auto; accent-color: var(--primary); }
.register-only[hidden] { display: none !important; }
.form-error { min-height: 1.2em; color: var(--danger) !important; font-weight: 800; }

.controls { margin-top: 18px; padding: 16px; display: grid; grid-template-columns: 1fr 210px 220px; gap: 14px; }
.friends-panel { margin-top: 18px; padding: 18px; background: var(--panel-solid); }
.friends-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.friends-head h2 { margin: 0; letter-spacing: -.04em; }
.friend-search-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; }
.invite-tools { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; margin-top: 12px; }
.invite-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.created-invites { margin-top: 14px; }
.created-invites h3 { margin: 0 0 8px; font-size: 1rem; }
.created-invites .friend-item { align-items: flex-start; flex-direction: column; }
.created-invites small { max-width: 100%; overflow-wrap: anywhere; color: var(--muted); font-weight: 700; }
.friends-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.friends-columns h3 { margin: 0 0 8px; font-size: 1rem; }
.friends-list { display: grid; gap: 8px; }
.friend-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fbfdfc; }
.friend-item p { margin: 0; font-weight: 800; }
.friend-item small { color: var(--muted); font-weight: 700; }
.friend-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.friend-actions button { border: 1px solid rgba(15,118,110,.24); border-radius: 999px; padding: 7px 10px; color: var(--primary-dark); background: #ecfdf5; font-weight: 800; }
.friend-actions button:hover { background: #ccfbf1; }
.friend-actions span, .friends-empty { color: var(--muted); font-size: .84rem; font-weight: 800; }
.friends-empty { margin: 0; padding: 10px; border: 1px dashed var(--line); border-radius: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: .84rem; font-weight: 700; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15,118,110,.12); }

.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 30px 2px 14px; }
.toolbar h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.04em; }
.toolbar p { margin: 0; color: var(--muted); }
.countries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.country-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--panel-solid);
  --kit-primary: #e5e7eb;
  --kit-secondary: #111827;
  --kit-accent: #94a3b8;
}
.country-card > * { position: relative; z-index: 1; }
.country-card.has-kit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% 18%, color-mix(in srgb, var(--kit-accent) 54%, transparent), transparent 15rem),
    repeating-linear-gradient(115deg, rgba(255,255,255,.28) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(25deg, rgba(0,0,0,.035) 0 1px, transparent 1px 7px),
    linear-gradient(135deg, color-mix(in srgb, var(--kit-primary) 34%, white), color-mix(in srgb, var(--kit-secondary) 24%, white));
  opacity: .34;
}
.country-card.has-kit::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  inset: 8px -28px auto auto;
  width: 265px;
  height: 265px;
  border-radius: 36px;
  background:
    linear-gradient(165deg, transparent 0 16%, rgba(255,255,255,.52) 16% 19%, transparent 19% 100%),
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.55) 0 18px, transparent 19px),
    linear-gradient(90deg, var(--kit-secondary), var(--kit-primary) 38% 62%, var(--kit-secondary));
  clip-path: polygon(24% 10%, 39% 2%, 50% 12%, 61% 2%, 76% 10%, 94% 34%, 80% 47%, 74% 30%, 74% 94%, 26% 94%, 26% 30%, 20% 47%, 6% 34%);
  opacity: .105;
  transform: rotate(-9deg);
  filter: saturate(1.15) contrast(1.05);
}
.country-card.has-kit-image::after {
  clip-path: none;
  background-image: var(--kit-body-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  width: 248px;
  height: 338px;
  inset: -8px -38px auto auto;
  border-radius: 0;
  opacity: .18;
  transform: rotate(-7deg);
  filter: saturate(1.08) contrast(1.03) drop-shadow(0 18px 18px rgba(15,23,42,.11));
  mix-blend-mode: multiply;
}
.country-card.special-card-section {
  border-color: rgba(245,158,11,.42);
  background: linear-gradient(145deg, #fffaf0 0%, #ffffff 64%);
}
.country-card.special-card-section::before {
  content: "★";
  position: absolute;
  inset: -34px -18px auto auto;
  z-index: 0;
  color: rgba(245,158,11,.13);
  font-size: 12rem;
  line-height: 1;
  transform: rotate(10deg);
}
.country-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.country-code { margin: 0 0 4px; color: var(--primary); font-weight: 800; letter-spacing: .13em; font-size: .75rem; }
h3 { margin: 0; font-size: 1.35rem; letter-spacing: -.04em; display: flex; align-items: center; gap: 10px; }
.flag-img { width: 30px; height: 22px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 7px rgba(15,23,42,.18); background: #e2e8f0; flex: none; }
.flag-img.fallback { display: inline-grid; place-items: center; font-size: 1.3rem; }
.badge { flex: none; border-radius: 999px; padding: 7px 10px; background: #ecfdf5; color: var(--primary-dark); font-weight: 800; font-size: .78rem; }
.progress-wrap { margin-top: 18px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .86rem; }
.progress-label strong { color: var(--ink); }
.progress { overflow: hidden; height: 10px; margin-top: 8px; border-radius: 999px; background: #e2e8f0; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .25s ease; }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.list-block { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fbfdfc; }
.list-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: .86rem; font-weight: 800; }
.list-title strong { color: var(--ink); }
.duplicates-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.edit-list { display: inline-grid; place-items: center; width: 26px; height: 26px; border-color: rgba(15, 118, 110, .22); padding: 0; color: var(--primary-dark); background: #ecfdf5; font-size: .92rem; line-height: 1; font-weight: 900; white-space: nowrap; }
.edit-list:hover { background: #ccfbf1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 36px; }
.chip { display: inline-flex; align-items: center; justify-content: flex-start; gap: 7px; min-width: 82px; min-height: 34px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: white; color: var(--ink); cursor: pointer; user-select: none; font-weight: 800; font-size: .86rem; transition: .18s ease; }
.chip-number { display: inline-block; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.chip:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15,23,42,.08); }
.chip input { width: 14px; height: 14px; accent-color: var(--primary); }
.chip.done { color: var(--muted); background: #f1f5f9; text-decoration: line-through; }
.chip.reserved { color: #7c2d12; background: #fff7ed; border-color: rgba(249,115,22,.45); box-shadow: inset 0 0 0 1px rgba(249,115,22,.10); }
.chip.pending-validation { color: #1e3a8a; background: #eff6ff; border-color: rgba(37,99,235,.45); box-shadow: inset 0 0 0 1px rgba(37,99,235,.12), 0 0 0 3px rgba(37,99,235,.08); }
.chip.reserved-by-other { color: #7c2d12; background: #fff7ed; border-color: rgba(249,115,22,.55); }
.chip-status { margin-left: auto; padding: 2px 6px; border-radius: 999px; background: rgba(249,115,22,.16); color: #9a3412; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.chip-status.availability { background: rgba(15,118,110,.14); color: var(--primary-dark); }
.chip-status.pending { background: rgba(37,99,235,.14); color: #1d4ed8; }
.chip.missing { border-color: rgba(220, 38, 38, .18); }
.chip.duplicate { border-color: rgba(15, 118, 110, .22); }
.empty { color: var(--muted); font-size: .88rem; }
.no-results { grid-column: 1 / -1; padding: 32px; text-align: center; color: var(--muted); }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(15,23,42,.52); backdrop-filter: blur(6px); }
.modal-card { width: min(640px, 100%); max-height: min(760px, calc(100vh - 36px)); overflow: auto; border-radius: 26px; background: white; padding: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.04em; }
.modal-hint { margin: 8px 0 18px; color: var(--muted); }
.edit-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.edit-check { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #f8fafc; font-weight: 900; }
.edit-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.edit-check.selected { border-color: rgba(15,118,110,.35); background: #ecfdf5; color: var(--primary-dark); }

.footer { padding: 0 clamp(14px, 3vw, 24px) 34px; color: var(--muted); font-size: .9rem; text-align: center; }
.footer p { margin: 0; }
.footer .disclaimer { margin-bottom: 8px; font-size: .82rem; }
.footer a { color: var(--primary-dark); font-weight: 900; text-decoration: none; }
.footer a:hover { color: var(--primary); text-decoration: underline; }
code { padding: 2px 6px; border-radius: 7px; background: #e2e8f0; color: var(--ink); }
.credits-hero { padding-bottom: 86px; }
.credits-shell { display: grid; gap: 18px; }
.credits-panel { padding: clamp(20px, 4vw, 34px); background: var(--panel-solid); }
.credits-panel h2 { margin: 0 0 10px; letter-spacing: -.04em; }
.credits-panel p, .credits-panel li { color: var(--muted); line-height: 1.65; }
.credits-panel a, .credits-back a { color: var(--primary-dark); font-weight: 900; text-decoration: none; }
.credits-panel a:hover, .credits-back a:hover { color: var(--primary); text-decoration: underline; }
.credits-back { margin: 0 0 8px; text-align: center; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-panel { grid-template-columns: 1fr; align-items: stretch; }
  .settings-panel { flex-direction: column; }
  .settings-actions { justify-items: stretch; max-width: none; width: 100%; }
  .settings-actions p { text-align: left; }
  .settings-buttons { flex-direction: column; }
  .invite-tools, .invite-form { grid-template-columns: 1fr; }
  .app-nav { position: static; border-radius: 24px; }
  .controls, .auth-panel, .friend-search-form { grid-template-columns: 1fr; }
  .friends-columns { grid-template-columns: 1fr; }
  .countries { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .hero { padding-inline: 16px; padding-bottom: 78px; }
  .topbar { align-items: flex-end; flex-direction: column; }
  .top-actions, .ghost-button { width: 100%; }
  .hero-content { padding-top: 44px; }
  .shell { margin-top: -44px; }
  .stats-grid { grid-template-columns: 1fr; }
  .settings-panel { text-align: left; }
  .profile-link, #createInviteButton, .settings-buttons .ghost-button { width: 100%; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .lists { grid-template-columns: 1fr; }
  .country-card { padding: 16px; }
  .edit-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}


