:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e2e8f0;
  --border-focus: #7c5cfc;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #7c5cfc;
  --accent2: #6d4ae8;
  --accent-soft: rgba(124, 92, 252, 0.12);
  --accent-glow: rgba(124, 92, 252, 0.25);
  --done-bg: #ecfdf5;
  --done-border: #a7f3d0;
  --done-text: #059669;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --radius: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 28px 20px 64px;
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 92, 252, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(167, 139, 250, 0.06), transparent);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #7c5cfc, #a78bfa);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.header-icon svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.header-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-text p {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Download extension button */
.dl-ext {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--accent2);
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.dl-ext:hover {
  background: var(--accent-soft);
  border-color: rgba(124, 92, 252, 0.35);
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.dl-ext:active {
  transform: translateY(0);
}

.dl-ext svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Input card */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

textarea {
  flex: 1;
  min-height: 100px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  direction: ltr;
  text-align: left;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  line-height: 1.7;
}

textarea::placeholder {
  color: #94a3b8;
  font-style: italic;
}

textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}

.btn-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 140px;
}

.genBtn {
  flex: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #7c5cfc, #a78bfa);
  color: #fff;
  font-family: inherit;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.genBtn:hover {
  opacity: 0.92;
  box-shadow: 0 6px 22px var(--accent-glow);
}

.genBtn:active {
  transform: scale(0.97);
}

.genBtn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.openAllBtn {
  display: none;
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--accent2);
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.openAllBtn.visible {
  display: flex;
}

.openAllBtn:hover {
  background: var(--accent-soft);
  border-color: rgba(124, 92, 252, 0.4);
}

.openAllBtn:active {
  transform: scale(0.97);
}

.openAllBtn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Stats */
.stats {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 8px;
}

.stats.visible {
  display: flex;
}

.stats-count {
  font-weight: 700;
  color: var(--accent2);
}

.stats-hint {
  color: var(--muted);
}

/* Section */
.section-sep {
  display: none;
  align-items: center;
  gap: 12px;
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-sep.visible {
  display: flex;
}

.section-sep::before,
.section-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s, opacity 0.35s;
  user-select: none;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  animation: cardIn 0.35s ease backwards;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card:hover {
  transform: translateY(-4px);
  background: #faf8ff;
  border-color: rgba(124, 92, 252, 0.45);
  box-shadow: 0 10px 28px var(--accent-glow);
}

.card:active {
  transform: translateY(-1px);
}

.card-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.12), rgba(167, 139, 250, 0.1));
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(124, 92, 252, 0.18);
  transition: background 0.2s, border-color 0.2s;
}

.card-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent2);
}

.card .num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  direction: ltr;
  unicode-bidi: isolate;
  word-break: break-all;
}

.card .lbl {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* Done */
.card.done {
  opacity: 0.55;
  pointer-events: none;
  background: var(--done-bg);
  border-color: var(--done-border);
  box-shadow: none;
}

.card.done .num {
  color: var(--done-text);
}

.card.done .card-icon {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}

.card.done .card-icon svg {
  color: var(--done-text);
}

/* Empty state */
.empty {
  display: none;
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty.visible {
  display: block;
}

.empty svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.35;
}

.empty p {
  font-size: 0.9rem;
}

/* Footer note */
.footer-note {
  margin-top: 36px;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
}

.footer-note a {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 600;
}

.footer-note a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .input-row {
    flex-direction: column;
  }

  .btn-col {
    flex-direction: row;
    min-width: 0;
  }

  .genBtn,
  .openAllBtn {
    flex: 1;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }
}
