:root {
  --bg: #07111f;
  --panel: #0f172a;
  --panel-soft: #111c31;
  --card: #121f35;
  --border: rgba(255,255,255,.1);
  --text: #f8fafc;
  --muted: #9ca3af;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --gold: #facc15;
  --danger: #ef4444;
  --blue: #38bdf8;
  --shadow: 0 18px 50px rgba(0,0,0,.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.18), transparent 32rem),
    radial-gradient(circle at top right, rgba(34,197,94,.14), transparent 34rem),
    var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
  border: 0;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--border);
  background: rgba(7,17,31,.84);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: .95;
  letter-spacing: -.05em;
}

.subtitle {
  max-width: 720px;
  color: var(--muted);
  margin-bottom: 0;
}

.header-actions,
.auth-controls,
.quick-form,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #052e16;
  font-weight: 800;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

button:hover,
.file-label:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: var(--blue);
  color: #082f49;
}

button.ghost,
.file-label.ghost {
  color: var(--text);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
}

button.danger {
  color: #fecaca;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 4vw, 44px) 56px;
}

.auth-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}

.auth-copy {
  color: var(--muted);
  font-size: .92rem;
}

.auth-copy strong {
  color: var(--text);
}

.auth-controls input {
  min-height: 44px;
  min-width: 240px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

.auth-controls[hidden] {
  display: none;
}

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

.stat-card,
.progress-panel,
.quick-add,
.filters-panel,
.summary-card {
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 24px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.progress-panel,
.quick-add,
.filters-panel {
  margin-top: 16px;
  padding: 18px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted);
}

.progress-info strong {
  color: var(--text);
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width .25s ease;
}

.quick-add {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.4fr);
  gap: 18px;
  align-items: center;
}

.quick-add p {
  color: var(--muted);
  margin-bottom: 0;
}

.quick-form input,
.filter-row input,
.filter-row select {
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

.quick-form input {
  flex: 1 1 240px;
}

.filter-row input {
  flex: 1 1 260px;
}

.filter-row select {
  flex: 0 1 200px;
}

.quick-feedback {
  grid-column: 1 / -1;
  min-height: 22px;
  font-size: .92rem;
}

.tabs,
.team-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tab,
.team-pill {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255,255,255,.055);
  border: 1px solid var(--border);
}

.tab.active,
.team-pill.active {
  background: var(--text);
  color: #0f172a;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.stickers-area {
  min-width: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 8px 0 14px;
}

.section-title h2 {
  margin: 0;
}

.section-title span {
  color: var(--muted);
}

.stickers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 12px;
}

.sticker-card {
  min-height: 170px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.sticker-card:hover {
  transform: translateY(-2px);
}

.sticker-card.owned {
  border-color: rgba(34,197,94,.7);
  background: linear-gradient(180deg, rgba(34,197,94,.22), rgba(18,31,53,1));
}

.sticker-card.duplicate {
  border-color: rgba(250,204,21,.75);
}

.sticker-card.special::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.12) 45%, transparent 70%);
  transform: translateX(-100%);
  animation: shine 4s infinite;
}

@keyframes shine {
  0%, 60% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.sticker-main {
  width: 100%;
  min-height: 126px;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.sticker-code {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-weight: 900;
  letter-spacing: .02em;
}

.sticker-title {
  font-weight: 800;
  line-height: 1.2;
}

.sticker-meta {
  color: var(--muted);
  font-size: .82rem;
}

.sticker-actions {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.sticker-actions button {
  min-height: 36px;
  border-radius: 14px;
  padding: 0;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid var(--border);
}

.duplicate-badge {
  text-align: center;
  font-weight: 900;
  color: var(--gold);
}

.summary-panel {
  position: sticky;
  top: 150px;
  display: grid;
  gap: 14px;
}

.summary-card {
  padding: 16px;
}

.summary-card p {
  color: var(--muted);
  font-size: .9rem;
}

.summary-card textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.2);
  color: var(--text);
  padding: 12px;
  outline: none;
}

.copy-btn {
  width: 100%;
  margin-top: 10px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid var(--border);
}

@media (max-width: 980px) {
  .app-header,
  .auth-panel,
  .quick-add,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .app-header,
  .auth-panel {
    display: grid;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding-top: 20px;
  }

  .header-actions,
  .auth-controls,
  .quick-form,
  .filter-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  button,
  .file-label,
  .auth-controls input,
  .filter-row input,
  .filter-row select,
  .quick-form input {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .sticker-card {
    min-height: 160px;
  }
}
