:root {
  --bg: #f2ede2;
  --bg-accent: #e7ded1;
  --surface: rgba(255, 251, 245, 0.78);
  --surface-strong: #fffaf2;
  --surface-dark: #193227;
  --text: #18211c;
  --muted: #5a655d;
  --line: rgba(24, 33, 28, 0.1);
  --primary: #c94f24;
  --primary-dark: #8f3213;
  --accent: #1f7a5a;
  --accent-soft: rgba(31, 122, 90, 0.12);
  --wanted: #cc5a1f;
  --duplicate: #177451;
  --owned: #6c746e;
  --shadow: 0 24px 60px rgba(36, 42, 35, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-display: "Archivo Expanded", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 79, 36, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 122, 90, 0.22), transparent 26%),
    linear-gradient(180deg, #f7f1e7 0%, #eee4d5 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(24, 33, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 28, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 90%);
}

body.is-gated {
  overflow: hidden;
}

body.is-gated .app-shell {
  display: none;
}

body.app-booting .app-shell {
  display: none;
}

body.app-booting .pin-gate {
  display: flex;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 8px 10px 92px;
}

.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(242, 237, 226, 0.94);
  backdrop-filter: blur(14px);
  overflow-y: auto;
}

.pin-gate.is-visible {
  display: flex;
}

.pin-gate__card {
  width: min(100%, 420px);
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 251, 245, 0.96);
  box-shadow: var(--shadow);
}

.pin-gate__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pin-gate__title {
  margin-bottom: 8px;
  font-size: 1.1rem;
  line-height: 1.05;
}

.hero {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.eyebrow,
.panel__eyebrow,
.team-card__eyebrow {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.72;
}

.hero__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

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

h2 {
  font-size: 1.45rem;
  line-height: 1.05;
}

h3 {
  font-size: 1.2rem;
}

.sync-status {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat-card,
.panel,
.team-card,
.share-box {
  border: 1px solid var(--line);
}

.stat-card {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 251, 245, 0.84);
  box-shadow: 0 8px 20px rgba(36, 42, 35, 0.07);
}

.stat-card__label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
}

.stat-card__value {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  line-height: 1;
}

.badge,
.version-badge,
.team-count,
.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge {
  min-height: 30px;
  padding: 5px 10px;
  background: rgba(24, 33, 28, 0.08);
  color: var(--text);
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.version-badge {
  min-height: 26px;
  padding: 4px 9px;
  background: rgba(24, 33, 28, 0.06);
  color: var(--muted);
  border: 1px solid rgba(24, 33, 28, 0.1);
  font-size: 0.72rem;
}

.content {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.top-views {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 8px 0 10px;
  background: linear-gradient(180deg, rgba(247, 241, 231, 0.96), rgba(247, 241, 231, 0.84));
  backdrop-filter: blur(12px);
}

.top-views__item {
  min-height: 38px;
  border: none;
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(24, 33, 28, 0.06);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.top-views__item.is-active {
  background: var(--surface-dark);
  color: #fff8ef;
}

[data-section-panel] {
  display: none;
}

[data-section-panel].is-active {
  display: block;
}

.panel--facts {
  background: linear-gradient(180deg, rgba(255, 248, 239, 0.92), rgba(247, 239, 227, 0.82));
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.fact-tile {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 245, 0.72);
}

.fact-tile__value {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.8vw, 1.85rem);
  line-height: 0.95;
}

.fact-tile__label,
.album-notes {
  color: var(--muted);
}

.album-notes {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  line-height: 1.5;
}

.panel {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 251, 245, 0.8);
  box-shadow: var(--shadow);
}

.panel--glass {
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.87), rgba(252, 245, 236, 0.78));
  backdrop-filter: blur(16px);
}

.panel__header,
.list-meta,
.share-box__actions,
.filters,
.hero__topline,
.team-card__header,
.team-card__counts,
.stepper {
  display: flex;
}

.panel__header,
.list-meta,
.team-card__header {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filters {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.field {
  display: grid;
  gap: 8px;
  flex: 1 1 180px;
}

.field--quantity {
  grid-column: span 2;
}

.field__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(24, 33, 28, 0.14);
  border-radius: 14px;
  padding: 11px 13px;
  background: var(--surface-strong);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(201, 79, 36, 0.22);
  outline-offset: 2px;
}

.capture-form,
.batch-form,
.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.auth-form--gate {
  grid-template-columns: 1fr;
}

.capture-form,
.auth-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented,
.chip-row,
.share-box__actions,
.bottom-nav,
.list-row__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented {
  margin-top: 12px;
}

.segmented__item,
.ghost-button,
.secondary-button,
.primary-button,
.bottom-nav__item,
.stepper__button {
  min-height: 38px;
  border: none;
  border-radius: 14px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.segmented__item,
.ghost-button,
.secondary-button,
.stepper__button {
  background: rgba(24, 33, 28, 0.06);
  color: var(--text);
}

.segmented__item.is-active {
  background: var(--surface-dark);
  color: #fff8ef;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff8ef;
  box-shadow: 0 14px 24px rgba(201, 79, 36, 0.28);
}

.secondary-button {
  background: rgba(31, 122, 90, 0.12);
  color: var(--accent);
}

.ghost-button {
  background: rgba(24, 33, 28, 0.05);
  color: var(--muted);
}

.segmented__item:hover,
.top-views__item:hover,
.ghost-button:hover,
.secondary-button:hover,
.primary-button:hover,
.bottom-nav__item:hover,
.stepper__button:hover {
  transform: translateY(-1px);
}

.stepper {
  align-items: center;
}

.stepper input {
  width: 68px;
  text-align: center;
  min-height: 38px;
}

.stepper__button {
  width: 40px;
  padding: 0;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.list-meta {
  margin-top: 18px;
}

.share-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.share-box.is-hidden {
  display: none;
}

.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip-row {
  margin-top: 14px;
}

.filter-chip,
.count-badge,
.sticker-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.filter-chip {
  padding: 8px 12px;
  background: rgba(24, 33, 28, 0.08);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.list-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.team-overview__hint {
  margin-top: 14px;
}

.team-search {
  margin-top: 8px;
}

.team-search-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.team-page.is-hidden {
  display: none;
}

.team-search-result,
.team-detail,
.team-sticker-card {
  border: 1px solid var(--line);
}

.team-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.92), rgba(247, 239, 227, 0.86));
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.team-search-result:hover,
.team-sticker-card:hover {
  transform: translateY(-2px);
}

.team-search-result__meta,
.team-detail__header,
.team-detail__stats,
.team-sticker-card__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.team-search-result__meta {
  justify-content: space-between;
  align-items: center;
}

.team-search-result__code,
.team-sticker-card__number {
  font-family: var(--font-display);
  font-size: 0.82rem;
}

.team-search-result__group,
.team-detail__eyebrow {
  color: var(--muted);
  font-size: 0.74rem;
}

.team-detail {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 250, 243, 0.94);
}

.team-detail.is-hidden {
  display: none;
}

.team-detail__header {
  justify-content: space-between;
  align-items: flex-start;
}

.team-detail__stats {
  gap: 10px;
}

.team-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.team-sticker-card {
  display: grid;
  gap: 5px;
  padding: 9px 8px;
  border-radius: 12px;
  background: rgba(255, 251, 245, 0.92);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.team-sticker-card--owned {
  background: rgba(24, 50, 39, 0.08);
}

.team-sticker-card--wanted,
.team-sticker-card--missing {
  background: rgba(204, 90, 31, 0.08);
}

.team-sticker-card--duplicate {
  background: rgba(23, 116, 81, 0.1);
}

.team-sticker-card__role {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
}

.mini-pill--have {
  background: rgba(24, 50, 39, 0.09);
  color: var(--surface-dark);
}

.mini-pill--need {
  background: rgba(204, 90, 31, 0.12);
  color: var(--wanted);
}

.mini-pill--duplicate {
  background: rgba(23, 116, 81, 0.12);
  color: var(--duplicate);
}

.mini-pill--complete {
  background: rgba(31, 122, 90, 0.16);
  color: var(--accent);
}

.empty-state {
  padding: 26px;
  border: 1px dashed rgba(24, 33, 28, 0.16);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
  background: rgba(255, 251, 245, 0.56);
}

.team-card {
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.96), rgba(249, 242, 232, 0.92)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent);
}

.team-card__counts {
  gap: 8px;
}

.count-badge {
  padding: 8px 12px;
  color: #fff8ef;
}

.count-badge--wanted {
  background: var(--wanted);
}

.count-badge--duplicate {
  background: var(--duplicate);
}

.team-card__lists {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.list-group {
  display: grid;
  gap: 10px;
}

.list-group__title {
  font-weight: 800;
  color: var(--muted);
}

.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sticker-pill {
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sticker-pill--wanted {
  background: rgba(204, 90, 31, 0.12);
  color: var(--wanted);
}

.sticker-pill--duplicate {
  background: rgba(23, 116, 81, 0.12);
  color: var(--duplicate);
}

.sticker-pill--owned {
  background: rgba(108, 116, 110, 0.12);
  color: var(--owned);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 640px);
  justify-content: space-between;
  padding: 8px;
  border: 1px solid rgba(24, 33, 28, 0.1);
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.app-version-note {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.74rem;
}

.bottom-nav__item {
  flex: 1 1 0;
  text-align: center;
  text-decoration: none;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
}

.bottom-nav__item.is-active {
  background: var(--surface-dark);
  color: #fff8ef;
}

.top-views__item.is-active {
  box-shadow: inset 0 0 0 1px rgba(255, 248, 239, 0.08);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 16px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(24, 33, 28, 0.92);
  color: #fff8ef;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 860px) {
  .content {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .pin-gate {
    align-items: flex-start;
    padding: 14px 10px;
  }

  .pin-gate__card {
    width: 100%;
    margin-top: 0;
    padding: 16px 14px;
    border-radius: 18px;
  }

  .pin-gate__title {
    font-size: 0.92rem;
    line-height: 1.15;
  }

  .facts-grid,
  .capture-form,
  .auth-form {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 6px 8px 88px;
  }

  .hero__topline {
    align-items: flex-start;
    gap: 6px;
  }

  .hero__meta {
    gap: 6px;
  }

  .hero__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .stat-card {
    padding: 7px 8px;
    border-radius: 12px;
  }

  .stat-card__label {
    font-size: 0.62rem;
  }

  .stat-card__value {
    font-size: 0.92rem;
  }

  .badge {
    min-height: 26px;
    padding: 4px 9px;
    font-size: 0.74rem;
  }

  .version-badge {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 0.68rem;
  }

  .sync-status {
    font-size: 0.72rem;
  }

  .top-views {
    gap: 6px;
    padding: 6px 0 8px;
  }

  .top-views__item {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .field--quantity {
    grid-column: auto;
  }

  .panel__header,
  .list-meta,
  .team-card__header,
  .team-detail__header,
  .team-search-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .team-sticker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
