:root,
[data-theme="light"] {
  --bg: #FFFDF5;
  --ink: #000000;
  --card-bg: #FFFFFF;
  --shadow-c: #000000;
  --accent: #FF6B6B;
  --secondary: #FFD93D;
  --muted: #C4B5FD;
  --success: #00C853;
  --tile-ink: #000000;
}

[data-theme="dark"] {
  --bg: #000000;
  --ink: #FFFDF5;
  --card-bg: #000000;
  --shadow-c: #FFFDF5;
  --accent: #FF6B6B;
  --secondary: #FFD93D;
  --muted: #C4B5FD;
  --success: #00E676;
  --tile-ink: #000000;
}

:root, [data-theme="light"] {
  --code-method: #dc2626;
  --code-key: #7c3aed;
  --code-string: #15803d;
  --code-value: #b45309;
  --code-comment: #6b7280;
}

[data-theme="dark"] {
  --code-method: #ff6b6b;
  --code-key: #c4b5fd;
  --code-string: #86efac;
  --code-value: #fbbf24;
  --code-comment: #9ca3af;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cairo', 'Space Grotesk', sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(var(--ink) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  background-position: -10px -10px;
  color: var(--ink);
  min-height: 100vh;
  font-weight: 700;
}

.hidden { display: none !important; }

.icon svg { width: 100%; height: 100%; display: block; }
.icon { display: inline-flex; }

h1, h2, h3 { font-weight: 900; margin: 0; }
p { margin: 0; }

/* ---------- Navbar ---------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(16px, 5vw, 56px);
  background: var(--bg);
  border-bottom: 6px solid var(--ink);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-logo { height: 40px; width: auto; display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--secondary);
  color: #000;
  border: 4px solid var(--ink);
  box-shadow: 4px 4px 0 0 var(--shadow-c);
  font-size: 20px;
  font-weight: 900;
}

.brand-name {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: var(--accent);
  color: #000;
  border: 3px solid var(--ink);
  padding: 3px 8px;
  transform: rotate(-4deg);
}

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

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--card-bg);
  border: 4px solid var(--ink);
  box-shadow: 4px 4px 0 0 var(--shadow-c);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.status-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--ink);
}

.status-pill.connected .dot { background: var(--success); }
.status-pill.connecting .dot { background: var(--secondary); }

.theme-toggle-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 4px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
  box-shadow: 4px 4px 0 0 var(--shadow-c);
  cursor: pointer;
  font-size: 18px;
  text-decoration: none;
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}

.theme-toggle-btn .icon { width: 20px; height: 20px; }

.theme-toggle-btn:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 4px solid var(--ink);
  cursor: pointer;
  padding: 18px 34px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  color: #000;
  background: var(--accent);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
  text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 0 var(--shadow-c);
}

.btn-primary:active:not(:disabled) {
  transform: translate(6px, 6px);
  box-shadow: 2px 2px 0 0 var(--shadow-c);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.hint {
  display: inline-block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Landing nav ---------- */
.nav-links { display: flex; gap: 4px; align-items: center; margin-inline-end: auto; margin-inline-start: 24px; }
.nav-link { padding: 10px 14px; font-weight: 800; font-size: 14px; color: var(--ink); text-decoration: none; }
.nav-link:hover { background: var(--secondary); border-radius: 2px; box-shadow: 3px 3px 0 0 var(--shadow-c); }

.btn-outline {
  border: 4px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
  padding: 10px 20px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}
.btn-outline:hover { box-shadow: 4px 4px 0 0 var(--shadow-c); transform: translate(-2px, -2px); }

.btn-primary.small, .btn-outline.small, .btn-secondary.small { padding: 9px 18px; font-size: 13px; }

@media (max-width: 900px) {
  .nav-links { display: none; }
}

/* ---------- Marquee ---------- */
.marquee-wrap {
  overflow: hidden;
  border-top: 6px solid var(--ink);
  border-bottom: 6px solid var(--ink);
  background: var(--secondary);
  padding: 14px 0;
}
.marquee-track {
  display: flex;
  gap: 44px;
  white-space: nowrap;
  width: max-content;
  animation: marquee-scroll 26s linear infinite;
}
.marquee-track span {
  font-weight: 900;
  font-size: 17px;
  color: #000;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ---------- Stat bar ---------- */
.stat-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
  background: var(--card-bg);
  margin: 0 clamp(16px, 5vw, 56px);
}
.stat-bar .stat {
  padding: 24px 16px;
  text-align: center;
  border-inline-end: 4px solid var(--ink);
}
.stat-bar .stat:last-child { border-inline-end: none; }
.stat-bar .num {
  font-size: 30px;
  font-weight: 900;
  font-family: 'Space Grotesk', 'Cairo', sans-serif;
  display: block;
}
.stat-bar .label { font-size: 12px; font-weight: 800; }

/* ---------- About / detail section ---------- */
.about-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  align-items: center;
  padding: 70px clamp(16px, 5vw, 56px);
}
.about-section p { font-size: 15px; font-weight: 700; line-height: 1.9; margin: 0 0 16px; }
.about-visual {
  border: 4px solid var(--ink);
  box-shadow: 10px 10px 0 0 var(--shadow-c);
  background: var(--muted);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: rotate(-1deg);
}
.about-visual .about-row { display: flex; align-items: center; gap: 14px; background: var(--card-bg); border: 3px solid var(--ink); padding: 14px 16px; }
.about-visual .about-row .icon { width: 24px; height: 24px; color: var(--ink); flex-shrink: 0; }
.about-visual .about-row span { font-weight: 800; font-size: 14px; }

@media (max-width: 900px) {
  .about-section { grid-template-columns: 1fr; }
}

.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  max-width: 1100px;
  margin: 0 auto;
}
.cap-grid .step-card { transform: none; }
.cap-grid .step-card:hover { transform: translateY(-5px); box-shadow: 11px 11px 0 0 var(--shadow-c); }

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  max-width: 900px;
  margin: 0 auto;
}
.price-card {
  border: 4px solid var(--ink);
  box-shadow: 10px 10px 0 0 var(--shadow-c);
  padding: 34px 30px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}
.price-card.featured { background: var(--accent); color: #000; transform: rotate(-1deg); }
.price-card.featured h3, .price-card.featured .plan-desc, .price-card.featured .amount, .price-card.featured li { color: #000; }
.price-card h3 { font-size: 20px; margin-bottom: 6px; }
.price-card .plan-desc { font-size: 13px; font-weight: 700; margin-bottom: 18px; }
.price-card .amount { font-size: 42px; font-weight: 900; font-family: 'Space Grotesk', 'Cairo', sans-serif; margin: 0 0 20px; }
.price-card .amount span { font-size: 14px; font-weight: 800; }
.price-card ul { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.price-card li { font-size: 14px; font-weight: 700; display: flex; gap: 8px; align-items: flex-start; }
.price-card li .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 6px solid var(--ink);
  padding: 50px clamp(16px, 5vw, 56px) 26px;
  background: var(--card-bg);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 40px;
}
.footer-col h4 { font-size: 12px; margin-bottom: 14px; letter-spacing: 0.06em; }
.footer-col a { display: block; font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: none; margin-bottom: 10px; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom { border-top: 3px solid var(--ink); padding-top: 20px; font-size: 12px; font-weight: 700; text-align: center; }

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

/* ---------- Home page ---------- */
.home-hero {
  position: relative;
  text-align: center;
  padding: 70px clamp(16px, 5vw, 56px) 60px;
  border-bottom: 6px solid var(--ink);
  overflow: hidden;
}

.home-hero .eyebrow { }

.home-hero h1 {
  font-size: clamp(36px, 6vw, 62px);
  line-height: 1.15;
  margin: 0 0 20px;
}

.home-lead {
  max-width: 620px;
  margin: 0 auto;
}

.home-star {
  position: absolute;
  top: 18px;
  left: 8%;
}

.tools-section {
  padding: 56px clamp(16px, 5vw, 56px) 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
  max-width: 1100px;
  margin: 0 auto;
}

.feature-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: var(--tile-ink);
  border: 4px solid var(--ink);
  box-shadow: 10px 10px 0 0 var(--shadow-c);
  padding: 30px 28px;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
  transform: rotate(-1deg);
}

.feature-card:nth-child(2n) { transform: rotate(1deg); }

.feature-card:hover {
  transform: translateY(-6px) rotate(0deg);
  box-shadow: 14px 14px 0 0 var(--shadow-c);
}

.feature-card h2 {
  font-size: 24px;
  line-height: 1.3;
  color: var(--tile-ink);
}

.feature-card p {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--tile-ink);
  margin: 0;
}

.feature-icon {
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  background: var(--muted);
  border: 4px solid var(--ink);
  color: #000;
}

.feature-icon .icon { width: 28px; height: 28px; }

.feature-card--soon {
  cursor: default;
}

.feature-card.plain,
.feature-card.plain h2,
.feature-card.plain p { color: var(--ink); }

.feature-card--soon .feature-icon { background: var(--muted); }

.soon-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--secondary);
  color: #000;
  border: 3px solid var(--ink);
  padding: 4px 10px;
  transform: rotate(-3deg);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 40px clamp(16px, 5vw, 56px) 0;
  border-bottom: 6px solid var(--ink);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  padding-bottom: 60px;
}

.eyebrow {
  display: inline-block;
  color: #000;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  margin: 0 0 18px;
  padding: 8px 16px;
  background: var(--secondary);
  border: 3px solid var(--ink);
  transform: rotate(-2deg);
}

.hero-text h1 {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.15;
  margin: 0 0 20px;
}

.accent-tag {
  display: inline-block;
  background: var(--accent);
  color: #000;
  border: 4px solid var(--ink);
  padding: 2px 14px;
  box-shadow: 6px 6px 0 0 var(--shadow-c);
  transform: rotate(-1.5deg);
  margin-top: 8px;
}

.lead {
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.8;
  max-width: 540px;
  margin: 0 0 30px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

/* ---------- Hero visual ---------- */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}

.deco-star {
  position: absolute;
  width: 46px;
  height: 46px;
  color: var(--secondary);
  filter: drop-shadow(3px 3px 0 var(--ink));
  animation: spin-slow 9s linear infinite;
}

.star-1 { top: -6px; left: 10px; }

.deco-shape {
  position: absolute;
  border: 4px solid var(--ink);
}

.shape-square {
  width: 34px; height: 34px;
  background: var(--muted);
  top: 40px; right: -6px;
  transform: rotate(12deg);
}

.shape-circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  bottom: 30px; left: -10px;
}

.hero-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  background: var(--card-bg);
  border: 4px solid var(--ink);
  box-shadow: 12px 12px 0 0 var(--shadow-c);
  transform: rotate(1deg);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.panel-empty, .panel-qr, .panel-connected {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.panel-icon-box {
  width: 64px; height: 64px;
  display: grid;
  place-items: center;
  background: var(--muted);
  border: 4px solid var(--ink);
  color: #000;
}

.panel-icon-box .icon { width: 30px; height: 30px; }
.panel-icon-box.success { background: var(--success); }

.panel-empty p, .panel-connected p { font-weight: 900; font-size: 18px; margin: 0; }
.panel-empty span, .panel-note { color: var(--ink); font-weight: 700; font-size: 13px; }

.panel-title { font-size: 13px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }

.qr-frame {
  background: #fff;
  padding: 12px;
  border: 4px solid var(--ink);
}

#qrImage { width: 220px; height: 220px; display: block; image-rendering: pixelated; }

#trackingSince { color: var(--ink); font-weight: 700; font-size: 13px; }

.floating-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 3px solid var(--ink);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 4px 4px 0 0 var(--shadow-c);
  z-index: 2;
}

.floating-badge .icon { width: 16px; height: 16px; color: var(--accent); }

.badge-views { top: 4px; right: -14px; transform: rotate(-3deg); }
.badge-love { bottom: 24px; left: -20px; transform: rotate(3deg); }
.badge-love .icon { color: var(--accent); }

/* ---------- Steps row ---------- */
.steps-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  transform: translateY(40px);
  margin-bottom: 40px;
}

.step-card {
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
  padding: 26px 24px;
  color: var(--tile-ink);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.step-card:nth-child(1) { transform: rotate(-1.5deg); }
.step-card:nth-child(2) { transform: rotate(1deg); }
.step-card:nth-child(3) { transform: rotate(-1deg); }

.step-card:hover {
  transform: translateY(-6px) rotate(0deg);
  box-shadow: 12px 12px 0 0 var(--shadow-c);
}

.step-num {
  display: block;
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 10px;
  font-family: 'Space Grotesk', 'Cairo', sans-serif;
}

.step-card h3 { margin: 0 0 6px; font-size: 18px; color: var(--tile-ink); }
.step-card p { margin: 0; font-size: 13px; line-height: 1.6; font-weight: 700; color: var(--tile-ink); }

.tone-a { background: var(--accent); }
.tone-b { background: var(--secondary); }
.tone-c { background: var(--muted); }
.plain { background: var(--card-bg); color: var(--ink); }
.plain .kpi-label { color: var(--ink); }

/* ---------- Sections ---------- */
main { padding-bottom: 40px; }

.section-head { padding: 0 clamp(16px, 5vw, 56px); margin-bottom: 22px; }
.section-head h2 { font-size: 27px; margin: 0 0 6px; }
.section-head p { color: var(--ink); margin: 0; font-size: 14px; font-weight: 700; }

.kpis { padding-top: 90px; }
.stories-section, .leaderboards {
  padding-top: 56px;
  padding-left: clamp(16px, 5vw, 56px);
  padding-right: clamp(16px, 5vw, 56px);
}

/* ---------- Panel (bordered card wrapping a section's content) ---------- */
.board {
  border: 4px solid var(--ink);
  background: var(--card-bg);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
}

.board .section-head {
  padding: 20px 22px;
  margin: 0;
  background: var(--secondary);
  border-bottom: 4px solid var(--ink);
}

.leaderboards .board:nth-child(2) .section-head { background: var(--muted); }

.board .section-head h2 { font-size: 20px; }
.board .section-head p { font-size: 13px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  padding: 0 clamp(16px, 5vw, 56px);
}

.kpi-card {
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
  justify-content: center;
  color: var(--tile-ink);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 11px 11px 0 0 var(--shadow-c);
}

.kpi-icon { width: 30px; height: 30px; }
.kpi-value { font-size: 36px; font-weight: 900; font-family: 'Space Grotesk', 'Cairo', sans-serif; }
.kpi-label { font-size: 13px; font-weight: 800; }

.kpi-card.plain { color: var(--ink); }
.kpi-card.plain .kpi-value,
.kpi-card.plain .kpi-label,
.kpi-card.plain .kpi-icon { color: var(--ink); }

/* ---------- Stories ---------- */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  padding: 22px;
}

.story-card {
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
  overflow: hidden;
  cursor: pointer;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
}

.story-card:hover {
  transform: translateY(-6px);
  box-shadow: 12px 12px 0 0 var(--shadow-c);
}

.story-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--muted);
  border-bottom: 4px solid var(--ink);
  color: #000;
}

.story-thumb .icon { width: 34px; height: 34px; }
.story-thumb img { width: 100%; height: 100%; object-fit: cover; }

.story-thumb.tone-a, .story-thumb.tone-b, .story-thumb.tone-c { color: #000; }

.story-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.story-caption { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-meta { color: var(--ink); font-size: 12px; font-weight: 700; }
.story-stats { display: flex; gap: 14px; }
.story-stat { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; }
.story-stat .icon { width: 15px; height: 15px; }
.story-stat.views { color: #000; }
.story-stat.reactions { color: var(--accent); }

.pill-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--secondary);
  color: #000;
  font-size: 12px;
  font-weight: 800;
}

.pill-link .icon { width: 13px; height: 13px; transform: scaleX(-1); }

/* ---------- Leaderboards ---------- */
.leaderboards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 4px solid var(--ink);
  box-shadow: 5px 5px 0 0 var(--shadow-c);
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.rank-item:hover {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 0 var(--shadow-c);
}

.rank-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  background: var(--muted);
  color: #000;
  flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-avatar { background: var(--secondary); }
.rank-item:nth-child(2) .rank-avatar { background: #E4E4E4; }
.rank-item:nth-child(3) .rank-avatar { background: #F0B27A; }

.rank-crown { width: 20px; height: 20px; }

.rank-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rank-name { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { color: var(--ink); font-size: 12px; font-weight: 700; }
.rank-value { font-weight: 900; color: #000; background: var(--accent); border: 2px solid var(--ink); padding: 3px 10px; font-size: 13px; white-space: nowrap; }

.empty-state { color: var(--ink); font-size: 14px; font-weight: 700; padding: 20px 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-weight: 800; font-size: 14px; }
.field .field-hint { font-size: 12px; font-weight: 700; color: var(--ink); opacity: 0.85; }

.field input[type="text"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 14px;
  border: 4px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
  width: 100%;
}

.field textarea { min-height: 90px; resize: vertical; }

.field input:focus, .field textarea:focus {
  outline: none;
  background: var(--secondary);
  color: #000;
  box-shadow: 4px 4px 0 0 var(--shadow-c);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.checkbox-field input[type="checkbox"] {
  width: 22px; height: 22px;
  accent-color: var(--accent);
  border: 3px solid var(--ink);
  flex-shrink: 0;
  margin-top: 2px;
}

.checkbox-field label { font-size: 13px; font-weight: 700; line-height: 1.6; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 4px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
  padding: 14px 26px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 6px 6px 0 0 var(--shadow-c);
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}

.btn-secondary:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 0 var(--shadow-c); }
.btn-secondary:active:not(:disabled) { transform: translate(4px, 4px); box-shadow: none; }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Switch ---------- */
.switch-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

.switch {
  position: relative;
  width: 70px; height: 38px;
  border: 4px solid var(--ink);
  background: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.switch.on { background: var(--success); }

.switch-thumb {
  position: absolute;
  top: 2px; right: 2px;
  width: 26px; height: 26px;
  background: #000;
  border: 2px solid var(--ink);
  transition: transform 150ms ease-out;
}

.switch.on .switch-thumb { transform: translateX(-32px); }
.switch-label { font-weight: 800; font-size: 14px; }

/* ---------- Result banner ---------- */
.result-banner {
  border: 4px solid var(--ink);
  padding: 14px 18px;
  font-weight: 800;
  font-size: 14px;
  margin-top: 14px;
}

.result-banner.ok { background: var(--success); color: #000; }
.result-banner.error { background: var(--accent); color: #000; }
.result-banner.info { background: var(--secondary); color: #000; }

/* ---------- Code block ---------- */
.code-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: var(--muted);
  color: #000;
  border: 3px solid var(--ink);
  padding: 3px 10px;
  margin-bottom: 8px;
}

/* ---------- Editor window (syntax-highlighted code) ---------- */
.editor-window {
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 0 var(--shadow-c);
  margin: 0 0 22px;
  overflow: hidden;
}

.editor-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--muted);
  border-bottom: 4px solid var(--ink);
  direction: ltr;
}

.editor-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.editor-dot.red { background: var(--accent); }
.editor-dot.yellow { background: var(--secondary); }
.editor-dot.green { background: var(--success); }

.editor-filename {
  margin-inline-start: 8px;
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  font-weight: 800;
  color: #000;
}

.editor-body {
  background: var(--card-bg);
  color: var(--ink);
  padding: 18px 20px;
  margin: 0;
  font-family: 'Space Grotesk', 'Cairo', monospace;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
}

.tok-method { color: var(--code-method); font-weight: 800; }
.tok-key { color: var(--code-key); font-weight: 700; }
.tok-string { color: var(--code-string); }
.tok-bool, .tok-num { color: var(--code-value); font-weight: 700; }
.tok-comment { color: var(--code-comment); font-style: italic; }

/* ---------- Log rows ---------- */
.log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 3px solid var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.log-row:last-child { border-bottom: none; }

.log-status {
  padding: 2px 10px;
  border: 2px solid var(--ink);
  font-weight: 800;
  font-size: 11px;
  white-space: nowrap;
}

.log-status.sent { background: var(--success); color: #000; }
.log-status.failed { background: var(--accent); color: #000; }

/* ---------- Accordion boards (broadcast page) ---------- */
.board.accordion .section-head {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  -webkit-user-select: none;
  user-select: none;
}

.board.accordion .section-head-text { flex: 1; min-width: 0; }

.collapse-chevron {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transform: rotate(-90deg);
  transition: transform 150ms ease-out;
}

.board.accordion.open .collapse-chevron { transform: rotate(90deg); }

.board.accordion .config-body { display: none; }
.board.accordion.open .config-body { display: block; }

.consent-banner {
  border: 4px solid var(--ink);
  background: var(--secondary);
  color: #000;
  padding: 16px 20px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.8;
  margin: 0 clamp(16px, 5vw, 56px) 30px;
}

.consent-banner.notif-warning { background: var(--accent); }

#notifWrap { display: block; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--card-bg);
  border: 4px solid var(--ink);
  box-shadow: 16px 16px 0 0 var(--shadow-c);
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  color: var(--ink);
}

.modal h2 { font-size: 22px; margin-bottom: 10px; }
.modal h3 { font-size: 16px; margin: 18px 0 8px; }

.modal-close {
  position: absolute;
  top: 16px; left: 16px;
  width: 36px; height: 36px;
  border: 3px solid var(--ink);
  background: var(--accent);
  color: #000;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 3px 3px 0 0 var(--shadow-c);
}

.modal-close:active { transform: translate(3px, 3px); box-shadow: none; }

.viewer-row, .timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 3px solid var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.viewer-row:last-child, .timeline-row:last-child { border-bottom: none; }
.timeline-row .icon, .timeline-row span .icon { width: 15px; height: 15px; display: inline-flex; vertical-align: -3px; }

/* ---------- Motion ---------- */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .deco-star { animation: none; }
}

/* ---------- Compass (تحليل تواصل شخصي) ---------- */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 4px dashed var(--ink);
  background: var(--card-bg);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.upload-zone:hover, .upload-zone.drag-over {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 0 var(--shadow-c);
  background: var(--secondary);
}
.upload-zone .icon { width: 34px; height: 34px; margin-bottom: 10px; }
.upload-zone p { font-weight: 800; font-size: 15px; }
.upload-zone span { display: block; font-size: 12px; font-weight: 700; margin-top: 6px; opacity: 0.8; }

.file-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.file-chip {
  display: flex; align-items: center; gap: 8px;
  border: 3px solid var(--ink);
  background: var(--muted);
  color: #000;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
}
.file-chip button {
  border: none; background: none; cursor: pointer;
  font-weight: 900; color: #000; font-size: 14px; line-height: 1;
}

.table-scroll { overflow-x: auto; padding: 22px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th, .data-table td {
  border: 3px solid var(--ink);
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
.data-table th { background: var(--secondary); font-weight: 900; }
.data-table td:first-child, .data-table th:first-child { text-align: right; }

.formula-note {
  margin: 0 22px 22px;
  padding: 14px 16px;
  border: 3px dashed var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.8;
  opacity: 0.9;
}

.conv-meta-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 18px; }
.conv-meta-tag {
  border: 3px solid var(--ink);
  background: var(--card-bg);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}

.split-bar { display: flex; height: 28px; border: 3px solid var(--ink); margin: 0 22px 18px; overflow: hidden; }
.split-bar span { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; color: #000; }
.split-bar .theirs { background: var(--accent); }
.split-bar .yours { background: var(--muted); }

.quote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 0 22px 18px; }
.quote-card {
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 0 var(--shadow-c);
  padding: 16px;
  background: var(--card-bg);
}
.quote-card p.quote-text { font-size: 14px; font-weight: 800; line-height: 1.7; margin-bottom: 10px; }
.quote-card p.quote-text::before { content: '“'; }
.quote-card p.quote-text::after { content: '”'; }
.quote-card .quote-meta { font-size: 11px; font-weight: 700; opacity: 0.85; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.quote-card .quote-tag { background: var(--secondary); border: 2px solid var(--ink); padding: 2px 8px; }

.insight-text { padding: 0 22px 22px; font-size: 14px; font-weight: 700; line-height: 1.9; }

.style-list { list-style: none; margin: 0; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.style-item { border: 4px solid var(--ink); box-shadow: 5px 5px 0 0 var(--shadow-c); padding: 14px 18px; background: var(--card-bg); }
.style-item .style-title { font-weight: 900; font-size: 14px; margin-bottom: 6px; }
.style-item .style-evidence { font-size: 12px; font-weight: 700; opacity: 0.85; }

.history-list { list-style: none; margin: 0; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 3px solid var(--ink);
  padding: 12px 16px;
  cursor: pointer;
  background: var(--card-bg);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.history-item:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 0 var(--shadow-c); }
.history-item .hist-title { font-size: 13px; font-weight: 800; }
.history-item .hist-date { font-size: 11px; font-weight: 700; opacity: 0.7; }
.history-item .hist-del { border: 2px solid var(--ink); background: var(--accent); color: #000; font-weight: 900; cursor: pointer; padding: 4px 9px; }

.owner-pick-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.owner-pick-btn {
  flex: 1; min-width: 140px;
  border: 4px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
  font-family: inherit;
  padding: 14px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.owner-pick-btn.selected { background: var(--success); color: #000; }

.result-banner { margin-top: 14px; padding: 12px 16px; border: 3px solid var(--ink); font-size: 13px; font-weight: 800; }
.result-banner.error { background: var(--accent); color: #000; }
.result-banner.ok { background: var(--success); color: #000; }

/* ---------- Auto-reply tree builder (الرد التلقائي) ---------- */
.tree-node {
  border: 3px solid var(--ink);
  background: var(--card-bg);
  padding: 14px;
  margin-bottom: 14px;
}
.tree-action-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tree-action-row label { font-size: 12px; font-weight: 800; }
.tree-action-select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border: 3px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
}
.tree-hint {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  background: var(--muted);
  color: #000;
  border: 2px solid var(--ink);
  padding: 8px 10px;
  margin: -4px 0 10px;
}
.tree-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
  min-height: 60px;
  resize: vertical;
  margin-bottom: 10px;
}
.tree-textarea:focus { outline: none; background: var(--secondary); color: #000; }
.tree-options { display: flex; flex-direction: column; gap: 8px; }
.tree-option-row { display: flex; align-items: center; gap: 8px; }
.tree-option-key {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 2px solid var(--ink);
  background: var(--secondary);
  color: #000;
  font-weight: 900;
  font-size: 12px;
}
.tree-option-row input[type="text"] {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  background: var(--card-bg);
  color: var(--ink);
}
.tree-option-row input[type="text"]:focus { outline: none; background: var(--secondary); color: #000; }
.tree-del-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border: 2px solid var(--ink);
  background: var(--accent);
  color: #000;
  font-weight: 900;
  cursor: pointer;
}
.tree-nested { margin: 6px 22px 6px 0; border-left: 3px dashed var(--ink); padding-left: 16px; }
.tree-add-btn { margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; margin-bottom: 20px; }
  .steps-row { grid-template-columns: 1fr; transform: none; }
  .step-card:nth-child(n) { transform: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .leaderboards { grid-template-columns: 1fr; }
  .kpis { padding-top: 40px; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
}
