:root {
  --kick-green: #46c800;
  --kick-green-soft: rgba(70, 200, 0, 0.08);
  --bg-main: #020203;
  --bg-elevated: #070708;
  --bg-elevated-soft: #0a0a0b;
  --text-main: #e6e7e8;
  --text-muted: #9aa0a6;
  --text-soft: #6b6d72;
  --border-subtle: #0c0c0d;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.85);

  /* Smaller radii for compactness */
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  --transition-fast: 200ms ease-out;
  --transition-med: 300ms ease-out;
  --scroll-ease: cubic-bezier(.16,.84,.26,1);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;

  /* Reduced header/footer heights for a compact layout */
  --header-height: 48px;
  --reveal-slow: 500ms cubic-bezier(.16,.84,.26,1);
  --scroll-progress: 0;

  /* Smaller footer to save vertical space */
  --footer-height: 56px;

  /* category pills inside the stat card */
  --category-pill-gap: 8px;
  --category-pill-padding: 6px 8px;
  --category-pill-radius: 999px;
  --category-pill-background: rgba(255,255,255,0.02);
  --category-pill-border: 1px solid rgba(255,255,255,0.02);
  --category-pill-font-size: 0.78rem;
  --category-pill-color: var(--text-main);
  --category-pill-min-height: 34px;

  /* small rank badge on the left */
  --cat-rank-width: 26px;
  --cat-rank-height: 26px;
  --cat-rank-border-radius: 7px;
  --cat-rank-font-weight: 700;
  --cat-rank-font-size: 0.78rem;
  --cat-rank-color: var(--kick-green); /* NUMEROS EN VERDE (cambio solicitado) */
  --cat-rank-background: rgba(255,255,255,0.06); /* ligero fondo para contraste con el verde */

  /* name and optional count */
  --cat-name-font-weight: 600;
  --cat-name-color: var(--text-main);

  --cat-count-font-size: 0.72rem;
  --cat-count-color: var(--text-soft);
  --cat-count-margin-left: 4px;

  /* Emphasize top categories with color accents */
  --top-category-1-rank-background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)); /* aclarado para permitir números verdes */
  --top-category-1-rank-color: var(--kick-green);
  --top-category-1-rank-box-shadow: 0 6px 12px rgba(70,200,0,0.06), inset 0 -6px 10px rgba(0,0,0,0.06);
  --top-category-2-rank-background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); /* aclarado para permitir números verdes */
  --top-category-2-rank-color: var(--kick-green);
  --top-category-2-rank-box-shadow: 0 6px 12px rgba(80,160,220,0.06);

  /* smaller pills for lower ranks */
  --category-pill-top-n-background: rgba(255,255,255,0.01);
  --category-pill-top-n-border: 1px solid rgba(255,255,255,0.02);

  /* Make pills wrap nicely on narrow screens */
  --category-pill-wrap-max-width: 420px;

  /* --- New marquee/carrusel styling for top categories --- */

  /* container that holds the marquee */
  --stat-categories-marquee-width: 100%;
  --stat-categories-marquee-overflow: hidden;
  --stat-categories-marquee-position: relative;
  --stat-categories-marquee-display: block;
  --stat-categories-marquee-padding: 6px 0;

  /* track that moves horizontally; duplicated for seamless loop */
  --marquee-track-display: inline-flex;
  --marquee-track-gap: 10px;
  --marquee-track-align-items: center;
  --marquee-track-white-space: nowrap;
  --marquee-track-will-change: transform;

  /* speed control: lower value => faster (seconds for a full loop of one copy width) */
  --marquee-speed: 18s;

  /* keyframes for a smooth leftward loop */
  @keyframes marquee-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
  }

  /* apply animation to track wrapper; we duplicate items so -50% shift reveals the second copy */
  --marquee-track-marquee-animate: marquee-left linear infinite;
  --marquee-track-marquee-animate-duration: var(--marquee-speed);

  /* ensure duplicated content sits inline and visually identical */
  --marquee-inner-copy-display: inline-flex;
  --marquee-inner-copy-gap: 10px;
  --marquee-inner-copy-align-items: center;

  /* make the pills slightly separated from edges for breathing room */
  --stat-card-5-value-width: 100%;
  --stat-card-5-value-display: block;

  /* reduce pointer events on moving track (improves perceived smoothness on touch) */
  --marquee-track-pointer-events: none;
  --marquee-inner-copy-pointer-events: none;

  /* pause animation when user hovers (or focuses) the stat card to allow reading */
  --stat-card-5-hover-marquee-track-marquee-animate: paused;
  --stat-card-5-focus-within-marquee-track-marquee-animate: paused;

  /* ensure accessible static view on reduced-motion preference */
  @media (prefers-reduced-motion: reduce) {
    --marquee-track-marquee-animate: none;
    --marquee-track-transform: none;
  }
}

*, 
*::before, 
*::after {
  box-sizing: border-box;
}

html, 
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top, #14171f 0, #050607 52%);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Mobile-first: full-height shell, no scroll if posible */
body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app-shell {
  width: 100%;
  max-width: 360px; /* much smaller overall shell */
  height: 100vh;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  position: relative;
}

/* Header */

.app-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--reveal-slow), opacity var(--reveal-slow);
  will-change: transform, opacity;

  /* take header out of document flow so hiding it doesn't leave a gap */
  position: absolute;
  top: 16px;
  left: 14px;
  right: 14px;
  z-index: 12;
  pointer-events: auto;
  /* ensure it visually sits above the main content */
  background: transparent;

  /* use CSS variable to drive smooth transform & opacity with scroll
     reduced travel distance (70% instead of 110%) for subtler motion */
  transform: translateY(calc(-1 * var(--scroll-progress) * 70%));
  opacity: calc(1 - var(--scroll-progress));
}

/* reserve space at top of scrollable area equal to header height so content isn't overlapped */

/* Hidden header state (slides up and fades) */
.app-header.hidden {
  transform: translateY(-70%);
  opacity: 0;
  pointer-events: none;
}

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

.brand-mark {
  width: 24px; /* smaller brand mark */
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(70,200,0,0.95), rgba(120,200,60,0.14));
  box-shadow: 0 0 6px rgba(70, 200, 0, 0.14);
  position: relative;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
}

/* Logo image sits on top of the green mark, centered and contained.
   Keeps the green gradient visible behind the image. */
.brand-logo {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: brightness(0.88) saturate(0.9);
  -webkit-user-drag: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-kick {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
}

.brand-analyzer {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-soft);
}

.subheading {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* smaller subtitle used under the main page H1 */
.sub-h1 {
  margin: 6px 0 10px;
  font-size: 0.95rem; /* slightly larger but lighter for better readability */
  color: var(--text-muted);
  line-height: 1.22;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Main layout */

.app-main {
  /* Main becomes the single scrollable region; start non-scrollable so the initial screen doesn't scroll */
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden; /* start locked — will be restored to 'auto' when results are shown */
  -webkit-overflow-scrolling: touch;
  padding-right: 6px; /* give space for scrollbar on some devices */
  /* prevent content from being covered by the absolute header */
  padding-top: calc(var(--header-height) + 6px);

  /* reserve space at bottom so the absolute footer doesn't overlap actionable items when fully revealed */
  padding-bottom: calc(var(--footer-height) + 6px);
}

/* Custom scrollbar styling for the central scroll area (.app-main) */
/* Firefox */
.app-main {
  scrollbar-width: thin;
  scrollbar-color: rgba(82,255,0,0.25) rgba(11,12,15,0.6);
}

/* WebKit browsers (Chrome, Safari, Edge) */
.app-main::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.app-main::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(5,6,7,0.6), rgba(11,12,15,0.6));
  border-radius: 999px;
  margin: 8px 0;
}

.app-main::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(82,255,0,0.28), rgba(82,255,0,0.12));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 6px 18px rgba(82,255,0,0.12), inset 0 0 8px rgba(0,0,0,0.45);
}

.app-main::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(82,255,0,0.42), rgba(82,255,0,0.18));
  box-shadow: 0 8px 22px rgba(82,255,0,0.18), inset 0 0 10px rgba(0,0,0,0.5);
}

/* Small tweak so scrollbar doesn't overlap content on narrow viewports */
@media (max-width: 420px) {
  .app-main {
    padding-right: 14px;
  }

  /* Hide the left prefix on very narrow viewports so the input placeholder has full space */
  .input-prefix {
    display: none;
  }

  /* Slightly reduce the primary button sizing on narrow screens to free width for the input */
  .primary-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  /* Reduce placeholder font slightly to help fit without changing visual balance */
  #handle-input {
    font-size: 0.84rem;
  }
}

/* Cards */

.input-card,
.results-card {
  background: linear-gradient(
      135deg,
      rgba(82, 255, 0, 0.08),
      rgba(82, 255, 0, 0)
    ),
    var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-soft);
}

/* Input */

.input-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated-soft);
  border-radius: var(--radius-pill);
  padding: 3px 3px 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(82, 255, 0, 0);
  transition: box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.input-row:focus-within {
  border-color: rgba(82, 255, 0, 0.7);
  box-shadow: 0 0 0 1px rgba(82, 255, 0, 0.6);
  background: radial-gradient(circle at top left, #141a12 0, #050608 55%);
  transform: translateY(-0.5px);
}

.input-prefix {
  font-size: 0.75rem;
  color: var(--text-soft); /* softened from bright white to match muted text */
  padding-right: 6px;
  border-right: 1px solid rgba(255,255,255,0.06); /* subtle divider instead of pure white */
}

#handle-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.86rem;
  padding: 6px 2px;
  min-width: 0;
}

#handle-input::placeholder {
  /* Subtler, darker-toned placeholder with reduced prominence */
  color: rgba(255, 255, 255, 0.18);
}

/* Buttons */

.primary-btn {
  border: none;
  outline: none;
  padding: 6px 10px; /* reduced padding for compact layout */
  border-radius: calc(var(--radius-pill) - 4px);
  font-size: 0.74rem; /* slightly smaller text */
  font-weight: 600;
  background: var(--kick-green);
  color: #020302;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(82, 255, 0, 0.5);
  transform: translateY(0);
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
  white-space: nowrap;
}

.primary-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 6px rgba(82, 255, 0, 0.5);
  filter: brightness(0.96);
}

.intent-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.intent-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: #050607;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.intent-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: transparent;
  transition: transform var(--transition-fast), opacity var(--transition-fast),
    background var(--transition-fast);
}

.intent-toggle input[type="checkbox"]:checked {
  border-color: rgba(82, 255, 0, 0.9);
  background: var(--kick-green-soft);
  box-shadow: 0 0 0 1px rgba(82, 255, 0, 0.7);
}

.intent-toggle input[type="checkbox"]:checked::after {
  background: var(--kick-green);
  opacity: 1;
}

.intent-toggle label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.input-helper {
  margin: 6px 0 0;
  font-size: 0.7rem;
  color: var(--text-soft);
}

/* error state for helper text */
.input-helper.error {
  color: #ff6b6b;
  font-weight: 600;
}

/* subtle shake animation for invalid input attention */
@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.input-row.shake {
  animation: shake 640ms ease-in-out;
  border-color: rgba(255,107,107,0.9) !important;
  box-shadow: 0 0 0 1px rgba(255,107,107,0.12);
}

/* Results */

.results-card {
  /* Let the results-card size naturally inside the scrollable main area */
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.results-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  padding: 6px 2px;
}

.results-empty p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.results-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  /* disable internal scroll so the whole page scrolls */
  overflow: visible;
  -webkit-overflow-scrolling: auto;
  animation: fadeInUp 220ms ease-out;
}

.results-content[hidden] { display: none; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.channel-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: conic-gradient(
    from 160deg,
    #111 0deg,
    #141a10 120deg,
    #52ff00 180deg,
    #141a10 220deg,
    #111 320deg
  );
  position: relative;
  overflow: hidden;
}

.channel-avatar::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 0, #252b2d 0, #070809 64%);
}

.channel-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.channel-username {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-soft);
}

.channel-intent-tag {
  margin: 0;
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(82, 255, 0, 0.45);
  background: radial-gradient(circle at top, rgba(82, 255, 0, 0.14), #050607);
  color: var(--kick-green);
  white-space: nowrap;

  /* billiard / shiny effect */
  position: relative;
  overflow: hidden;
  /* subtle glassy base to receive the sheen */
  background-image: linear-gradient(180deg, rgba(82,255,0,0.12), rgba(82,255,0,0.06)), radial-gradient(circle at top, rgba(82,255,0,0.06), transparent 40%);
}

/* animated billiard sheen */
.channel-intent-tag::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -40%;
  width: 40%;
  height: 180%;
  transform: rotate(-22deg) translateX(-100%);
  background: linear-gradient(90deg, rgba(255,255,255,0.0) 0%, rgba(255,255,255,0.28) 50%, rgba(255,255,255,0.0) 100%);
  filter: blur(6px) saturate(1.1);
  opacity: 0.95;
  pointer-events: none;
  animation: billiard-sheen 2.2s linear infinite;
}

/* pause sheen on hover/focus for readability */
.channel-intent-tag:hover::after,
.channel-intent-tag:focus::after {
  animation-play-state: paused;
}

/* Sections */

.section-title {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}

/* Stats */

.stats-section {
  padding-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

/* On the categories stat, replace plain text with a horizontal list of pills */
.stat-card:nth-child(5) {
  grid-column: 1 / -1;
  padding-left: 12px;
  padding-right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* category pills inside the stat card */
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.02);
  font-size: 0.78rem;
  color: var(--text-main);
  min-height: 34px;
}

/* small rank badge on the left */
.cat-rank {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--kick-green); /* NUMEROS EN VERDE (cambio solicitado) */
  background: rgba(255,255,255,0.06); /* ligero fondo para contraste con el verde */
}

/* name and optional count */
.cat-name {
  font-weight: 600;
  color: var(--text-main);
}

.cat-count {
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-left: 4px;
}

/* Emphasize top categories with color accents */
.category-pill.top-1 .cat-rank {
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)); /* aclarado para permitir números verdes */
  color: var(--kick-green);
  box-shadow: 0 6px 12px rgba(70,200,0,0.06), inset 0 -6px 10px rgba(0,0,0,0.06);
}
.category-pill.top-2 .cat-rank {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); /* aclarado para permitir números verdes */
  color: var(--kick-green);
  box-shadow: 0 6px 12px rgba(80,160,220,0.06);
}

/* smaller pills for lower ranks */
.category-pill.top-n {
  padding: 6px 8px;
  background: rgba(255,255,255,0.01);
  border: 1px solid rgba(255,255,255,0.02);
}

/* Make pills wrap nicely on narrow screens */
@media (max-width: 420px) {
  .stat-card:nth-child(5) {
    padding-left: 8px;
    padding-right: 8px;
    gap: 6px;
  }
  .category-pill {
    font-size: 0.72rem;
    min-height: 30px;
    padding: 5px 8px;
  }
  .cat-rank {
    width: 22px;
    height: 22px;
    font-size: 0.72rem;
    border-radius: 6px;
  }
}

/* --- New marquee/carrusel styling for top categories --- */

/* container that holds the marquee */
.stat-categories-marquee {
  width: 100%;
  overflow: hidden;
  position: relative;
  display: block;
  padding: 6px 0;
}

/* track that moves horizontally; duplicated for seamless loop */
.marquee-track {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}

/* speed control: lower value => faster (seconds for a full loop of one copy width) */
:root {
  --marquee-speed: 18s;
}

/* keyframes for a smooth leftward loop */
@keyframes marquee-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* apply animation to track wrapper; we duplicate items so -50% shift reveals the second copy */
.marquee-track.marquee-animate {
  animation: marquee-left linear infinite;
  animation-duration: var(--marquee-speed);
}

/* ensure duplicated content sits inline and visually identical */
.marquee-inner-copy {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

/* make the pills slightly separated from edges for breathing room */
.stat-card:nth-child(5) .stat-value {
  width: 100%;
  display: block;
}

/* reduce pointer events on moving track (improves perceived smoothness on touch) */
.marquee-track, .marquee-inner-copy {
  pointer-events: none;
}

/* pause animation when user hovers (or focuses) the stat card to allow reading */
.stat-card:nth-child(5):hover .marquee-track.marquee-animate,
.stat-card:nth-child(5):focus-within .marquee-track.marquee-animate {
  animation-play-state: paused;
}

/* ensure accessible static view on reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .marquee-track.marquee-animate {
    animation: none;
    transform: none;
  }
}

/* stat card now includes a subtle progress visualization */
.stat-card {
  background: linear-gradient(180deg, rgba(5,6,7,0.6), rgba(11,12,15,0.45));
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(82,255,0,0.04);
  position: relative;
  overflow: hidden;
}

.stat-label {
  margin: 0 0 6px;
  font-size: 0.72rem;
  color: var(--text-soft);
}

/* Center the label for the categories (5th) stat card to visually align the "Categorías top" heading */
.stat-card:nth-child(5) .stat-label {
  text-align: center;
  width: 100%;
  margin-bottom: 8px; /* slight breathing room above the marquee */
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: transparent; /* use gradient text */
  background: linear-gradient(90deg, #aefc7b 0%, #46c800 40%, #c8ff9a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  position: relative;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(70,200,0,0.06), inset 0 -6px 14px rgba(0,0,0,0.14);
}

/* subtle decorative underline using pseudo element to keep label compact */
.stat-card:nth-child(5) .stat-label::after {
  content: "";
  display: block;
  height: 4px;
  width: 40%;
  margin: 8px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(70,200,0,0.85), rgba(120,200,50,0.45));
  box-shadow: 0 6px 14px rgba(70,200,0,0.06);
  opacity: 0.95;
}

/* reduce size a bit on very narrow screens to preserve layout */
@media (max-width: 420px) {
  .stat-card:nth-child(5) .stat-label {
    font-size: 0.8rem;
    padding: 5px 10px;
  }
  .stat-card:nth-child(5) .stat-label::after {
    width: 48%;
    height: 3px;
    margin-top: 6px;
  }
}

.stat-value {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

/* small helper for compact values */
.stat-value-small {
  font-size: 0.78rem;
}

/* progress track inside stat-card */
.stat-progress {
  height: 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.35);
}

.stat-progress .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(70,200,0,0.95), rgba(70,200,0,0.3));
  box-shadow: 0 6px 10px rgba(70,200,0,0.04), inset 0 -6px 10px rgba(0,0,0,0.45);
  transition: width 520ms cubic-bezier(.2,.9,.2,1);
}

/* make small numbers dimmer when used as secondary */
.stat-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--text-soft);
  margin-top: 6px;
}

/* Sparkline mini-graph for followers stat */
.spark-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.sparkline-canvas {
  width: 100px;
  height: 28px;
  display: block;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.00));
  box-shadow: inset 0 -6px 12px rgba(0,0,0,0.35);
  flex: 1 0 auto;
}

/* tiny numeric delta indicator to the right of the sparkline */
/* removed .spark-delta styles because numeric deltas were removed from DOM */
/* .spark-delta {
  font-size: 0.78rem;
  min-width: 46px;
  text-align: right;
  font-weight: 700;
  color: var(--kick-green);
} */

/* Streams list */

/* Streams list */

.streams-section {
  padding-top: 2px;
}

.streams-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stream-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #050607;
  border: 1px solid rgba(255, 255, 255, 0.02);

  /* Prevent overlap: allow main content to shrink, ensure pill stays fixed and visible */
  min-height: 44px;
  align-items: flex-start;
  gap: 10px;
}

/* Ensure the main column can shrink and text can be clipped instead of pushing over the pill */
.stream-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;      /* allow to grow and shrink */
  min-width: 0;        /* critical for ellipsis within flex items */
  overflow: hidden;
}

/* Title: clamp/ellipsis to avoid wrapping into the pill area */
.stream-title {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}

/* Meta line should wrap if needed but prefer a single line; don't let it push the pill */
.stream-meta {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pill stays fixed size and never overlaps main content */
.stream-pill {
  font-size: 0.7rem;
  padding: 6px 10px; /* slightly increased tappable area */
  border-radius: var(--radius-pill);
  background: rgba(82, 255, 0, 0.07);
  color: var(--kick-green);
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: 6px;
  align-self: center;
}

/* Diagnostics & tips */

.diagnostics-section,
.tips-section {
  padding-top: 4px;
}

.diagnostic-title {
  margin: 0 0 4px;
  font-size: 0.84rem;
  color: var(--kick-green);
  font-weight: 600;
}

.diagnostic-list,
.tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Diagnostic cards (left badge + text) */
.diagnostic-item {
  display: block;
}

.diagnostic-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: linear-gradient(180deg, rgba(82,255,0,0.03), rgba(0,0,0,0.24));
  border: 1px solid rgba(82,255,0,0.06);
  padding: 8px 10px;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.6);
}

.diag-badge {
  /* match tip icon sizing for symmetry */
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(82,255,0,0.95), rgba(82,255,0,0.6));
  color: #021202;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 6px 12px rgba(82,255,0,0.08), inset 0 -6px 12px rgba(0,0,0,0.25);
}

.diag-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.25;
}

/* Tip cards (icon + content) */
.tip-item {
  display: block;
}

.tip-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(5,6,7,0.6), rgba(11,12,15,0.5));
  border: 1px solid rgba(82,255,0,0.06);
}

/* Ensure icon block in tips matches diagnostic badges exactly */
.tip-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
  border-radius: 9px;
  background: rgba(82,255,0,0.08);
  color: var(--kick-green);
  flex: 0 0 36px;
}

/* Make diagnostic and tip text share the same sizing and color for symmetry */
.diag-text,
.tip-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.25;
}

/* Slightly stronger spacing on larger screens */
@media (min-width: 420px) {
  .diagnostic-card {
    padding: 10px 12px;
    gap: 12px;
  }
  .tip-card {
    padding: 10px 12px;
  }
}

/* Footer */
.app-footer.hidden-until-done {
  display: none;
}

.app-footer {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateY(calc((1 - var(--scroll-progress)) * 50%));
  opacity: calc(var(--scroll-progress));
  transition: transform var(--reveal-slow), opacity var(--reveal-slow),
    box-shadow var(--reveal-slow), background var(--reveal-slow);
  will-change: transform, opacity, box-shadow;

  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  pointer-events: auto;

  background: linear-gradient(180deg, rgba(6,6,6,0.96), rgba(4,4,4,0.92));
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.02);
  box-shadow: 0 12px 36px rgba(0,0,0,0.85), 0 6px 14px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px) saturate(0.95);
}

/* When fully visible */
.app-footer.visible {
  transform: translateY(0);
  opacity: 1;
  /* strengthen the contrast when visible */
  box-shadow: 0 28px 60px rgba(0,0,0,0.75), 0 10px 22px rgba(0,0,0,0.5);
  border-color: rgba(82,255,0,0.06);
}

.cta-btn {
  width: 100%;
  border-radius: calc(var(--radius-pill) - 4px);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(82, 255, 0, 0.6);
  background: linear-gradient(
    135deg,
    rgba(82, 255, 0, 0.14),
    rgba(82, 255, 0, 0.06)
  );
  color: var(--kick-green);
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 18px rgba(2,3,2,0.6), inset 0 -6px 12px rgba(0,0,0,0.35);
  transform: translateY(0);
  transition: transform var(--transition-med),
    box-shadow var(--transition-med),
    border-color var(--transition-med),
    background var(--transition-med);
}

.cta-btn:active {
  transform: translateY(1px) scale(0.995);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
  border-color: rgba(82, 255, 0, 0.8);
}

.footer-note {
  margin: 0;
  font-size: 0.66rem;
  color: rgba(255,255,255,0.85);
  text-align: center;
  opacity: 0.95;
}

/* Utilities */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  border: 0;
}

/* SVG icon sizing used for premium badges and tip icons */
.svg-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  color: #021202; /* matches diag-badge dark text */
}

/* Animations */

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

/* billiard sheen motion */
@keyframes billiard-sheen {
  0% {
    transform: rotate(-22deg) translateX(-100%);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  50% {
    transform: rotate(-22deg) translateX(40%);
    opacity: 0.95;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: rotate(-22deg) translateX(200%);
    opacity: 0;
  }
}

/* Simple inline loading spinner used during analysis */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  width: 100%;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.06);
  border-top-color: var(--kick-green);
  animation: spin 900ms linear infinite;
  box-shadow: 0 6px 14px rgba(82,255,0,0.06);
}

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

/* Progress bar used during analysis */
.loading-progress {
  width: 100%;
  max-width: 360px;
  margin-top: 12px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.02);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, rgba(70,200,0,0.9), rgba(120,200,50,0.6));
  box-shadow: 0 6px 12px rgba(70,200,0,0.04);
  transition: width 120ms linear;
}

/* Percentage label */
.progress-label {
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--text-soft);
  text-align: center;
  min-height: 18px;
}

/* Disabled primary button visual */
.primary-btn.disabled,
.primary-btn:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* Slightly larger screens */

@media (min-width: 480px) {
  .app-shell {
    padding: 20px 18px;
  }

  .input-card,
  .results-card {
    padding: 16px;
  }

  .primary-btn {
    padding-inline: 18px;
  }
}

/* Modern animated arrow used as the new "location" indicator */
.location-arrow {
  color: var(--kick-green);
  opacity: 0.98;
  transform-origin: center;
  /* subtle vertical motion and gentle pop on loop */
  /* smoothed: longer duration, gentler easing and smaller movement */
  animation: arrow-bob 2600ms cubic-bezier(.22,.9,.32,1) infinite;
  display: block;
}

/* Slight pulsing stroke sheen on the arrow */
.location-arrow .arrow-shaft,
.location-arrow .arrow-head {
  stroke: currentColor;
  transition: stroke 200ms ease;
}

/* Add a faint glow to the circle */
.location-arrow circle {
  filter: drop-shadow(0 6px 14px rgba(70,200,0,0.06));
}

/* Bobbing animation: small upward emphasis to point "up" */
@keyframes arrow-bob {
  0%   { transform: translateY(0) scale(1); opacity: 0.98; }
  30%  { transform: translateY(-3px) scale(1.01); opacity: 1; }
  60%  { transform: translateY(-1.5px) scale(1.005); opacity: 0.995; }
  100% { transform: translateY(0) scale(1); opacity: 0.98; }
}

/* On focus (if ever revealed/interactive), strengthen the color */
.location-arrow:focus,
.location-arrow:hover {
  color: #57e000;
  transform: translateY(-6px) scale(1.03);
}

/* Desktop (PC) - aprovechar espacio en pantallas amplias */
@media (min-width: 1024px) {
  /* Increase the base font size on desktop so most rem-based typography scales up */
  html {
    font-size: 18px; /* previously default ~16px — bumped for PC only */
  }

  .app-shell {
    max-width: 720px; /* reducir el ancho en PC para ocupar menos horizontalmente */
    padding: 20px 18px;
    gap: 12px;
  }

  .app-main {
    padding-top: calc(var(--header-height) + 12px);
    padding-bottom: calc(var(--footer-height) + 12px);
    padding-right: 12px;
    overflow: auto;
  }

  /* Header and footer slightly larger for desktop */
  :root {
    --header-height: 64px;
    --footer-height: 72px;
  }

  .brand-kick {
    font-size: 1.25rem;
  }

  .brand-analyzer {
    font-size: 0.84rem;
  }

  .input-card,
  .results-card {
    border-radius: 16px;
  }

  /* Make stats grid use three columns on wide screens */
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  /* Keep the categories stat full-width but with more breathing room */
  .stat-card:nth-child(5) {
    grid-column: 1 / -1;
    padding-left: 18px;
    padding-right: 18px;
    gap: 12px;
  }

  .stat-card {
    padding: 14px;
  }

  /* Larger sparklines & deltas */
  .sparkline-canvas {
    width: 140px;
    height: 36px;
  }

  .spark-delta {
    min-width: 56px;
    font-size: 0.9rem;
  }

  /* Streams items more spacious */
  .stream-item {
    padding: 10px 12px;
    border-radius: 12px;
    min-height: 52px;
  }

  .stream-title {
    font-size: 0.9rem;
  }

  .stream-meta {
    font-size: 0.78rem;
  }

  /* Footer CTA larger */
  .cta-btn {
    padding: 12px 16px;
    font-size: 0.96rem;
  }
}