:root {
  /* Base */
  --ink: #0a0a0b;
  --surface: #151517;
  --surface-2: #1c1c1f;
  --surface-3: #232326;
  --line: #2a2a2e;
  --line-soft: rgba(255, 255, 255, 0.06);

  /* Brand accent — spent only on primary actions, focus and the mark */
  --lime: #c5f82d;
  --lime-strong: #aadf00;
  --lime-dim: #5f8f00;
  --lime-tint: rgba(197, 248, 45, 0.1);
  --lime-glow: rgba(197, 248, 45, 0.22);

  /* Text */
  --paper: #f3f3ef;
  --mute: #96968d;
  --faint: #5c5c57;

  /* Semantic — distinct from the brand lime on purpose */
  --good: #4ade80;
  --good-bg: rgba(74, 222, 128, 0.12);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.1);
  --info: #60a5fa;

  --font-ui: 'Geist', 'Geist Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 999px;
  --transition: all 0.18s ease;
}

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

body {
  background-color: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Single, quiet ambient glow — static, not scattered motion */
.background-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.mesh-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
}

.mesh-1 {
  width: 560px;
  height: 420px;
  background: radial-gradient(circle, var(--lime-glow), transparent 70%);
  opacity: 0.35;
  top: -220px;
  left: 10%;
}

.mesh-2 {
  display: none;
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-ui);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--paper);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--mute);
  margin-top: 2px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: 12.5px;
  flex-shrink: 0;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--bad);
}

.status-indicator.online {
  background-color: var(--good);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

/* URL Param Banner */
.url-param-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--lime-tint);
  border: 1px solid rgba(197, 248, 45, 0.3);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 24px;
  animation: slideDown 0.3s ease;
}

.url-param-banner.hidden {
  display: none;
}

.banner-icon {
  font-size: 18px;
}

.banner-content {
  flex: 1;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--mute);
}

.banner-content strong {
  color: var(--paper);
}

.banner-close {
  background: transparent;
  border: none;
  color: var(--mute);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.banner-close:hover {
  color: var(--paper);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Nav Tabs — underline indicator, not a boxed button grid */
.nav-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--mute);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--paper);
}

.tab-btn.active {
  color: var(--lime);
  border-bottom-color: var(--lime);
}

.tab-icon {
  font-size: 15px;
}

/* Card General */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
}

.format-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: var(--r-sm);
  color: var(--mute);
  border: 1px solid var(--line);
}

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

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--mute);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--paper);
  border-color: #3a3a3e;
}

/* Textarea Input */
.textarea-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.cookie-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 14px;
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
  transition: var(--transition);
}

.cookie-textarea::placeholder {
  color: var(--faint);
}

.cookie-textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-tint);
}

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--faint);
  flex-wrap: wrap;
  gap: 8px;
}

.detection-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detection-badge {
  background: var(--surface-2);
  color: var(--mute);
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-size: 11px;
}

.detection-badge.valid {
  background: var(--good-bg);
  color: var(--good);
}

/* Action Button */
.action-bar {
  margin-bottom: 24px;
}

.btn-primary {
  width: 100%;
  background: var(--lime);
  color: var(--ink);
  border: none;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary:hover {
  background: var(--lime-strong);
}

.btn-primary:active {
  transform: scale(0.99);
}

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

/* Spinner */
.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(10, 10, 11, 0.25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.hidden {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Result Cards */
.result-card.hidden {
  display: none;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 10px;
}

.result-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: var(--r-full);
}

.result-badge.success {
  background: var(--good-bg);
  color: var(--good);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.expiry-label {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--mute);
}

/* 1-Click Launch Links */
.launch-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 12px;
}

/* Note Banner — informational, uses warn (not danger) */
.note-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--warn-bg);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--mute);
  line-height: 1.5;
}

.note-banner strong {
  color: var(--warn);
}

.note-icon {
  font-size: 15px;
  flex-shrink: 0;
}

/* Link List (Mobile / Web / TV) */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
}

.link-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.link-box-icon {
  font-size: 15px;
}

.link-box-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--paper);
}

.link-url-box {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--mute);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  word-break: break-all;
  max-height: 76px;
  overflow-y: auto;
  user-select: all;
  margin-bottom: 12px;
}

.link-box-actions {
  display: flex;
  gap: 8px;
}

.btn-link-copy,
.btn-link-open {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--r-full);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--line);
}

.btn-link-copy {
  background: var(--surface-3);
  color: var(--paper);
}

.btn-link-copy:hover {
  background: #2a2a2e;
  border-color: #3a3a3e;
}

.btn-link-open {
  background: var(--lime);
  color: var(--ink);
  border-color: transparent;
}

.btn-link-open:hover {
  background: var(--lime-strong);
}

/* QR Code Section */
.qr-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 20px;
  gap: 20px;
}

.qr-info h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.qr-info p {
  font-size: 12px;
  color: var(--mute);
}

.qr-box {
  width: 104px;
  height: 104px;
  background: #ffffff;
  border-radius: var(--r-sm);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-img.hidden {
  display: none;
}

.qr-placeholder {
  font-size: 11px;
  color: #333;
  text-align: center;
}

/* Account Checker Details */
.account-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.account-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: var(--good-bg);
  color: var(--good);
}

.account-status-badge.expired {
  background: var(--bad-bg);
  color: var(--bad);
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.account-plan-badge {
  background: var(--lime-tint);
  border: 1px solid rgba(197, 248, 45, 0.3);
  color: var(--lime);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.info-tile {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-tile.full-width {
  grid-column: span 2;
}

.tile-label {
  font-size: 11px;
  color: var(--faint);
}

.tile-value {
  font-size: 14px;
  color: var(--paper);
  font-family: var(--font-mono);
  word-break: break-word;
}

.profiles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.profile-chip {
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
}

/* TV Tab */
.tv-card {
  text-align: center;
  padding: 32px 24px;
}

.tv-instructions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.tv-icon-big {
  font-size: 44px;
}

.tv-instructions h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tv-instructions p {
  font-size: 13px;
  color: var(--mute);
}

.tv-code-input-group {
  max-width: 360px;
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--mute);
}

.tv-code-field {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 7px;
  text-align: center;
  padding: 12px;
  transition: var(--transition);
}

.tv-code-field::placeholder {
  color: var(--faint);
  letter-spacing: 7px;
}

.tv-code-field:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-tint);
}

.input-hint {
  font-size: 11px;
  color: var(--faint);
}

.tv-result {
  max-width: 400px;
  margin: 20px auto 0;
  padding: 20px;
}

.tv-result-icon {
  font-size: 34px;
  margin-bottom: 8px;
}

.tv-result h4 {
  font-size: 15px;
  margin-bottom: 4px;
}

.tv-result p {
  font-size: 13px;
  color: var(--mute);
}

/* Cookie Cleaner Tab */
.cleaner-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.cleaner-tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--mute);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: var(--transition);
}

.cleaner-tab-btn.active {
  background: var(--lime-tint);
  color: var(--lime);
  border-color: rgba(197, 248, 45, 0.3);
}

.cleaner-output-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}

.output-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--mute);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

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

.btn-copy-sm {
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-sm:hover {
  background: #2a2a2e;
  border-color: #3a3a3e;
}

.cleaned-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

.cleaned-textarea:focus {
  outline: none;
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--faint);
  font-size: 12px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--surface-2);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease;
  min-width: 260px;
}

.toast.success {
  border-left: 3px solid var(--good);
}

.toast.error {
  border-left: 3px solid var(--bad);
}

.toast.info {
  border-left: 3px solid var(--info);
}

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

/* Focus visibility (accessibility) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-tile.full-width {
    grid-column: span 1;
  }

  .qr-section {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 20px 14px 48px;
  }

  /* Header: brand on top, status below, no cramped side-by-side */
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

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

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 12px;
    line-height: 1.45;
  }

  /* Tabs: equal-width, no horizontal scroll needed for 4 short labels */
  .nav-tabs {
    margin-bottom: 18px;
  }

  .tab-btn {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px 10px;
    font-size: 12px;
  }

  .tab-icon {
    font-size: 17px;
  }

  /* Cards */
  .card {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: var(--r-md);
  }

  .card-header {
    margin-bottom: 12px;
  }

  .card-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }

  .format-pill {
    white-space: normal;
    line-height: 1.4;
  }

  .card-actions {
    width: 100%;
  }

  .card-actions .btn-ghost {
    flex: 1;
    padding: 9px 12px;
  }

  .cookie-textarea {
    font-size: 12px;
    min-height: 96px;
  }

  .detection-info {
    flex-wrap: wrap;
  }

  .action-bar {
    margin-bottom: 16px;
  }

  .btn-primary {
    padding: 14px 18px;
    font-size: 14px;
  }

  /* Result header stacks cleanly */
  .result-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 16px;
  }

  /* Links: keep Copy / Open side by side, bigger tap targets */
  .link-box {
    padding: 14px;
  }

  .link-url-box {
    font-size: 11px;
    max-height: 88px;
  }

  .btn-link-copy,
  .btn-link-open {
    padding: 11px 10px;
  }

  .note-banner {
    font-size: 12px;
    padding: 10px 12px;
  }

  .qr-box {
    width: 140px;
    height: 140px;
  }

  /* Banner & checker */
  .url-param-banner {
    padding: 10px 12px;
    align-items: flex-start;
  }

  .banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

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

  .tile-value {
    font-size: 13px;
  }

  /* TV */
  .tv-card {
    padding: 24px 16px;
  }

  .tv-code-field {
    font-size: 22px;
    letter-spacing: 5px;
  }

  .tv-code-field::placeholder {
    letter-spacing: 5px;
  }

  /* Cleaner */
  .cleaner-tab-btn {
    flex: 1 1 auto;
    text-align: center;
  }

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

  .output-btn-group {
    width: 100%;
  }

  .output-btn-group .btn-copy-sm {
    flex: 1;
    padding: 8px 10px;
  }

  .app-footer {
    font-size: 11px;
  }

  /* Toast spans the screen width instead of overflowing */
  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
