:root {
  --bg: #070a11;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.13);
  --text: #f3f6fc;
  --muted: #98a3b8;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.18);
  --ok: #3fb950;
  --danger: #f85149;
  --radius: 20px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  padding: max(16px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

.orb-1 {
  width: 280px;
  height: 280px;
  top: -70px;
  left: -60px;
  background: radial-gradient(circle, #2b6cb0, transparent 70%);
}

.orb-2 {
  width: 320px;
  height: 320px;
  bottom: -90px;
  right: -80px;
  background: radial-gradient(circle, #1f6f5c, transparent 70%);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.36);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

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

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.35), rgba(63, 185, 80, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.2);
}

h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
}

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

.card {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

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

.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.locked { background: #d29922; }

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

@media (max-width: 500px) {
  .preset-grid {
    grid-template-columns: 1fr;
  }
}

.preset-btn {
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.15s, border-color 0.15s;
}

.preset-btn strong {
  font-size: 0.88rem;
}

.preset-btn span {
  font-size: 0.74rem;
  color: var(--muted);
}

.preset-btn.active {
  background: var(--accent-soft);
  border-color: rgba(88, 166, 255, 0.55);
}

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

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  font-size: 0.83rem;
  cursor: pointer;
}

.format-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}

.fmt-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.fmt-btn.active {
  background: var(--glass-bg-strong);
  color: var(--text);
}

.drop-card {
  border-style: dashed;
  border-color: rgba(88, 166, 255, 0.35);
  text-align: center;
  padding: 24px 16px;
  transition: background 0.15s, border-color 0.15s;
}

.drop-card.dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.drop-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
}

.drop-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.drop-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  font-family: inherit;
}

.primary-btn, .ghost-btn, .danger-btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.primary-btn {
  background: var(--accent);
  color: #06111f;
}

.ghost-btn {
  background: var(--glass-bg-strong);
  color: var(--text);
  border-color: var(--glass-border);
}

.danger-btn {
  background: rgba(248, 81, 73, 0.16);
  color: #ff948e;
  border-color: rgba(248, 81, 73, 0.35);
}

.small {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 10px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 11px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  align-items: center;
}

.thumb {
  width: 64px;
  height: 64px;
  border-radius: 11px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-title {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-stats {
  font-size: 0.77rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-ok {
  color: var(--ok);
  font-weight: 600;
}

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

.empty-state {
  padding: 10px 0 4px;
}

.hidden {
  display: none !important;
}

.modal {
  padding: 20px;
  width: min(92vw, 360px);
  color: var(--text);
  background: rgba(15, 21, 34, 0.92);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.modal h3 {
  margin: 0 0 6px;
}

.modal input {
  width: 100%;
  margin: 12px 0 8px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-align: center;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.error-text {
  color: #ff8a84;
  font-size: 0.8rem;
  margin: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(20, 27, 42, 0.94);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.83rem;
  z-index: 50;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.integrations-grid {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-strip {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.75rem;
}

.chip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(88, 166, 255, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(88, 166, 255, 0.28);
}

.chip-badge.green {
  background: rgba(63, 185, 80, 0.16);
  color: #7ee787;
  border-color: rgba(63, 185, 80, 0.3);
}

.match-box {
  font-size: 0.76rem;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-link {
  color: var(--accent);
  text-decoration: none;
}

.match-link:hover {
  text-decoration: underline;
}
