:root {
  --pn-cream: #f3ead4;
  --pn-coral: #e94e3a;
  --pn-orange: #f08a2c;
  --pn-yellow: #f4c324;
  --pn-lime: #b9d136;
  --pn-green: #2ea757;
  --pn-cyan: #2bb3c7;
  --pn-blue: #2160c4;
  --pn-magenta: #c43a7e;
  --pn-purple: #7b3ba0;
  --ink: #1a1a1a;
  --ink-2: #4b4b4b;
  --paper: #f7f3e7;
  --country-primary: #fcd116;
  --country-secondary: #003893;
  --country-accent: #ce1126;
  --hero-ink: #1a1a1a;
  --hero-muted: rgba(26, 26, 26, .72);
  --sticker-number-ink: #1a1a1a;
  --sticker-accent-ink: #1a1a1a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #e8e4d6;
  color: var(--ink);
  font-family: "Kalam", system-ui, sans-serif;
  padding: 22px;
}

button, input, select {
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font: inherit;
}

button {
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2, .brand, .display {
  font-family: "Archivo Black", sans-serif;
  letter-spacing: 0;
}

.mono {
  font-family: ui-monospace, "JetBrains Mono", monospace;
}

.artboard {
  background: linear-gradient(135deg, color-mix(in srgb, var(--country-primary) 14%, transparent) 0%, var(--pn-cream) 40%);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  margin: 0 auto;
  max-width: 1200px;
  min-height: calc(100vh - 44px);
  overflow: hidden;
  position: relative;
}

.artboard::before {
  background: repeating-linear-gradient(-25deg, transparent 0 18px, rgba(26, 26, 26, .05) 18px 19px);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.appbar {
  align-items: center;
  background: #fff;
  border-bottom: 4px solid var(--country-primary);
  display: flex;
  justify-content: space-between;
  padding: 12px 22px;
  position: relative;
  z-index: 1;
}

.brand-row {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand {
  font-size: 18px;
  white-space: nowrap;
}

.brand span, .mono {
  color: var(--ink-2);
}

#albumCounter {
  font-size: 10px;
}

.mini-progress, .overall-progress {
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 220px;
}

.mini-progress span, .overall-progress span {
  background: var(--pn-coral);
  border-right: 1.5px solid var(--ink);
  display: block;
  height: 100%;
}

.app-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.auth-status {
  border: 1.5px dashed var(--ink);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12px;
  padding: 4px 10px;
}

.auth-panel {
  align-items: stretch;
  background:
    repeating-linear-gradient(-25deg, transparent 0 18px, rgba(26, 26, 26, .04) 18px 19px),
    var(--pn-cream);
  border-bottom: 0;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  min-height: calc(100vh - 98px);
  padding: 34px;
  position: relative;
  z-index: 1;
}

.auth-panel h2 {
  font-size: 34px;
  margin-bottom: 6px;
}

.auth-panel p {
  color: var(--ink-2);
  margin-bottom: 0;
}

.login-art,
.login-card {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--ink);
}

.login-art {
  background:
    repeating-linear-gradient(-22deg, transparent 0 32px, rgba(0, 56, 147, .14) 32px 34px),
    linear-gradient(135deg, rgba(252, 209, 22, .75), rgba(206, 17, 38, .16)),
    var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
}

.login-art h1 {
  font-size: clamp(42px, 7vw, 86px);
  line-height: .92;
  max-width: 780px;
  text-transform: uppercase;
}

.login-art p {
  font-size: 22px;
  max-width: 620px;
}

.login-stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-stickers span {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, .72);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  display: inline-flex;
  font-family: "Archivo Black", sans-serif;
  min-width: 88px;
  padding: 10px;
}

.login-card {
  align-self: center;
  display: grid;
  gap: 14px;
  padding: 24px;
}

.auth-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.auth-form input {
  min-width: 0;
  padding: 12px 14px;
}

.auth-form button,
.google-btn {
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
  padding: 12px 14px;
}

.google-btn {
  background: #fff;
  width: 100%;
}

.login-divider {
  align-items: center;
  color: var(--ink-2);
  display: grid;
  font-size: 13px;
  gap: 8px;
  grid-template-columns: 1fr auto 1fr;
}

.login-divider::before,
.login-divider::after {
  background: var(--ink);
  content: "";
  height: 1px;
}

body.auth-required .country-tabs,
body.auth-required .body-grid {
  display: none;
}

.pill-btn {
  border-radius: 999px;
  font-size: 13px;
  padding: 4px 10px;
}

.pill-btn.solid {
  background: var(--country-primary);
}

.country-tabs {
  background: #fff;
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 10px 18px 0;
  position: relative;
  z-index: 1;
}

.country-tab {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px 10px 0 0;
  border-top: 4px solid transparent;
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  margin-bottom: -2px;
  padding: 8px 14px 12px;
}

.country-tab.active {
  background: #fff;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-top: 4px solid var(--country-primary);
}

.flag, .hero-flag, .flag-sm {
  background: #fff;
  border-radius: 4px;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .15);
  display: grid;
  overflow: hidden;
}

.flag { height: 18px; width: 28px; }
.flag-sm { height: 26px; width: 40px; }
.hero-flag { height: 60px; width: 90px; }

.flag svg,
.flag-sm svg,
.hero-flag svg {
  display: block;
  height: 100%;
  width: 100%;
}

.tab-name {
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.tab-count {
  color: var(--country-primary);
  font-size: 9px;
  font-weight: 700;
}

.body-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 320px;
  height: calc(100vh - 190px);
  min-height: 600px;
  padding: 16px;
  position: relative;
  z-index: 1;
}

.country-panel {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
}

.country-hero {
  background: var(--country-primary);
  height: 150px;
  overflow: hidden;
  position: relative;
}

.country-hero::before {
  background: repeating-linear-gradient(-22deg, transparent 0 32px, color-mix(in srgb, var(--country-secondary) 22%, transparent) 32px 34px);
  content: "";
  inset: 0;
  position: absolute;
}

.hero-copy {
  left: 22px;
  position: absolute;
  top: 22px;
}

.kicker {
  color: var(--hero-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
}

.country-hero h1 {
  color: var(--hero-ink);
  font-size: 56px;
  line-height: .95;
  margin: 0;
  text-transform: uppercase;
}

.hero-flag {
  box-shadow: 5px 5px 0 var(--ink), 0 1px 2px rgba(0, 0, 0, .2);
  position: absolute;
  right: 22px;
  top: 22px;
  transform: rotate(3deg);
}

.hero-stat {
  background: var(--ink);
  border-radius: 8px;
  bottom: 14px;
  color: var(--paper);
  padding: 6px 12px;
  position: absolute;
  right: 22px;
  text-align: right;
}

.hero-stat strong {
  color: var(--pn-yellow);
  display: block;
  font-family: "Archivo Black", sans-serif;
  font-size: 22px;
  line-height: 1;
}

.hero-stat span {
  font-size: 12px;
  opacity: .85;
}

.filter-strip {
  align-items: center;
  border-bottom: 1.5px dashed var(--ink);
  display: flex;
  gap: 6px;
  padding: 12px 16px;
}

.chip {
  border-radius: 999px;
  font-family: "Archivo Black", sans-serif;
  font-size: 10px;
  padding: 5px 12px;
}

.chip.active {
  background: var(--ink);
  color: var(--paper);
}

.chip:nth-child(2) { background: color-mix(in srgb, var(--pn-green) 14%, white); }
.chip:nth-child(3) { background: color-mix(in srgb, var(--pn-coral) 14%, white); }
.chip:nth-child(4) { background: color-mix(in srgb, var(--pn-orange) 18%, white); }

.filter-strip input {
  border: 0;
  color: var(--ink-2);
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
}

.filter-strip select {
  padding: 6px 8px;
}

.stickers-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  max-height: calc(100% - 212px);
  overflow: auto;
  padding: 16px 16px 28px;
}

.sticker {
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 6px;
  position: relative;
  text-align: left;
}

.sticker.missing {
  background:
    linear-gradient(color-mix(in srgb, var(--team-band-color, transparent) 20%, transparent), color-mix(in srgb, var(--team-band-color, transparent) 20%, transparent)),
    repeating-linear-gradient(45deg, rgba(26, 26, 26, .06) 0 1px, transparent 1px 6px),
    var(--paper);
}

.sticker.duplicate {
  background:
    linear-gradient(color-mix(in srgb, var(--team-band-color, var(--pn-yellow)) 20%, transparent), color-mix(in srgb, var(--team-band-color, var(--pn-yellow)) 20%, transparent)),
    repeating-linear-gradient(45deg, rgba(26, 26, 26, .05) 0 1px, transparent 1px 6px),
    color-mix(in srgb, var(--pn-yellow) 20%, white);
}

.sticker.owned {
  background:
    linear-gradient(color-mix(in srgb, var(--team-band-color, var(--pn-green)) 18%, transparent), color-mix(in srgb, var(--team-band-color, var(--pn-green)) 18%, transparent)),
    #fff;
}

.sticker-number {
  color: var(--sticker-number-ink);
  font-family: "Archivo Black", sans-serif;
  font-size: 18px;
  line-height: 1;
  max-width: calc(100% - 18px);
  overflow-wrap: anywhere;
  text-shadow: 0 1px 0 #fff;
}

.sticker.long-code .sticker-number {
  font-size: clamp(14px, 1.6vw, 22px);
  line-height: .95;
}

.sticker.missing .sticker-number {
  background: rgba(247, 243, 231, .82);
  border-radius: 4px;
  display: inline-block;
  padding: 1px 4px;
}

.sticker.owned .sticker-number,
.sticker.duplicate .sticker-number,
.sticker.extra .sticker-number {
  color: var(--sticker-accent-ink);
}

.sticker-name {
  font-family: "Archivo Black", sans-serif;
  font-size: 10px;
  line-height: 1.12;
  margin-top: auto;
  max-width: 100%;
  min-height: 22px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.sticker-meta {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-name::before {
  display: none;
}

.sticker-meta::before {
  background: var(--ink);
  border-radius: 2px;
  content: "";
  display: block;
  height: 3px;
  margin-bottom: 4px;
  width: 80%;
}

.sticker-meta {
  color: var(--ink-2);
  font-size: 10px;
}

.sticker-meta::before { width: 55%; }

.status-dot {
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  height: 10px;
  position: absolute;
  right: 6px;
  top: 6px;
  width: 10px;
}

.status-owned { background: var(--pn-green); }
.status-duplicate { background: var(--pn-yellow); }
.status-missing { background: var(--paper); }

.side-panel {
  display: grid;
  gap: 12px;
  grid-auto-rows: min-content;
  max-height: 100%;
  overflow-y: auto;
  padding-bottom: 18px;
}

.side-card {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px;
}

.side-kicker {
  color: var(--country-accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.side-kicker.purple { color: var(--pn-purple); }

.side-card h2 {
  font-size: 14px;
  margin: 2px 0 8px;
}

.mini-stickers {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, 1fr);
}

.mini-sticker {
  aspect-ratio: 3 / 4;
  background: color-mix(in srgb, var(--country-primary) 8%, white);
  border: 1.5px dashed var(--ink);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 4px;
}

.swap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.swap-item {
  background: color-mix(in srgb, var(--pn-orange) 14%, white);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
}

.swap-item strong {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 10px;
}

.swap-item span {
  color: var(--ink-2);
  font-size: 11px;
}

.quick-form {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.quick-form input {
  flex: 1;
  padding: 6px 10px;
}

.quick-form button {
  background: var(--country-primary);
  font-family: "Archivo Black", sans-serif;
  font-size: 10px;
  padding: 6px 12px;
}

.messages {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-height: 86px;
  overflow: auto;
}

.message {
  border: 1.5px dashed var(--ink);
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 12px;
  padding: 6px 8px;
}

.overall-card {
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  color: var(--paper);
  padding: 12px;
}

.overall-card .mono {
  color: rgba(247, 243, 231, .7);
  font-size: 9px;
  letter-spacing: 1px;
}

.overall-line {
  align-items: baseline;
  display: flex;
  gap: 8px;
  margin: 4px 0 6px;
}

.overall-line strong {
  color: var(--pn-yellow);
  font-family: "Archivo Black", sans-serif;
  font-size: 28px;
}

.overall-line span {
  font-size: 12px;
  opacity: .8;
}

.overall-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 8px;
}

.overall-grid span {
  font-size: 12px;
}

.reset-btn {
  background: var(--ink);
  color: var(--paper);
  padding: 10px;
}

.empty-state {
  border: 1.5px dashed var(--ink);
  border-radius: 10px;
  padding: 16px;
}

.sheet[hidden] { display: none; }

.sheet {
  inset: 0;
  position: fixed;
  z-index: 20;
}

.sheet-backdrop {
  background: rgba(26, 26, 26, .48);
  border: 0;
  border-radius: 0;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

.sheet-card {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  bottom: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  left: 50%;
  max-width: 560px;
  padding: 22px;
  position: absolute;
  transform: translateX(-50%) rotate(-.4deg);
  width: min(94vw, 560px);
}

.sheet-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
}

.icon-btn {
  background: var(--ink);
  color: var(--paper);
  height: 38px;
  width: 38px;
}

.sheet-code {
  color: var(--country-accent);
  font-family: "Archivo Black", sans-serif;
  font-size: 54px;
  line-height: 1;
  margin: 18px 0 8px;
}

.sheet-status {
  color: var(--ink-2);
  margin-bottom: 18px;
}

.counter-actions {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto 1fr;
}

.counter-actions strong {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-family: "Archivo Black", sans-serif;
  font-size: 28px;
  min-width: 70px;
  padding: 10px 16px;
  text-align: center;
}

.counter-actions button:last-child {
  background: var(--country-primary);
}

.secondary {
  background: var(--ink);
  color: var(--paper);
}

@media (max-width: 980px) {
  body { padding: 0; }
  .artboard {
    border: 0;
    border-radius: 0;
    min-height: 100vh;
  }
  .appbar {
    align-items: flex-start;
    display: grid;
    gap: 10px;
  }
  .auth-panel,
  .auth-form {
    grid-template-columns: 1fr;
  }
  .brand-row {
    align-items: flex-start;
    display: grid;
    gap: 6px;
  }
  .body-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .stickers-grid {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-actions {
    overflow-x: auto;
  }
  .country-hero {
    height: 168px;
  }
  .country-hero h1 {
    font-size: 38px;
  }
  .hero-flag {
    height: 38px;
    width: 56px;
  }
  .hero-stat {
    left: 22px;
    right: auto;
  }
  .filter-strip {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .filter-strip input {
    flex-basis: 100%;
  }
  .stickers-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
