:root {
  --bg: #0b141a;
  --surface: #111b21;
  --surface-2: #202c33;
  --border: #2a3942;
  --text: #e9edef;
  --muted: #8696a0;
  --accent: #00a884;
  --accent-hover: #06cf9c;
  --danger: #ea4335;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

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

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

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

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search-bar {
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.search-bar input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b141a;
  font-weight: 600;
}

.select-group {
  display: flex;
  gap: 8px;
}

select {
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

.provider-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.provider-pill {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.provider-pill.active {
  border-color: rgba(0, 168, 132, 0.5);
  color: var(--accent-hover);
}

.btn {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #0b141a;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.status-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.sticker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, transform 0.15s;
}

.sticker-card.in-pack {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.sticker-thumb-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: repeating-conic-gradient(#18242b 0% 25%, #111b21 0% 50%) 50% / 16px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

.sticker-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.badge-row {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(11, 20, 26, 0.85);
  color: var(--text);
}

.badge.animated {
  color: #ffd166;
}

.sticker-title {
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticker-actions {
  display: flex;
  gap: 6px;
}

.sticker-actions .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.78rem;
}

/* Drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.drawer-panel {
  position: relative;
  width: min(420px, 100vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.pack-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pack-meta label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.pack-meta input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.pack-rules-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg);
}

.pack-items-list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-content: start;
}

.pack-item {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pack-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pack-item-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(234, 67, 53, 0.9);
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  line-height: 1;
}

.drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.drawer-buttons {
  display: flex;
  gap: 8px;
}

.drawer-buttons .btn-primary {
  flex: 1;
}

.export-progress {
  font-size: 0.8rem;
  color: var(--accent-hover);
}

.import-help {
  font-size: 0.78rem;
  color: var(--muted);
}

.import-help summary {
  cursor: pointer;
  color: var(--text);
}

.import-help ol {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.45;
}
