/* ═══════════════════════════════════════════
   INSTA SCRAPER — Instagram Numerology Brand
   Ancient mathematics, printed today
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Eczar:wght@400;600;800&family=Mukta:wght@400;500;700&display=swap');

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

:root {
  /* ── Brand 4-color system ── */
  --canvas:  #E7EAE0;   /* chalk celadon — base */
  --ink:     #14241E;   /* green-black   — text  */
  --saffron: #C5551A;   /* kesariya      — accent */
  --forest:  #1D3A2F;   /* deep forest   — trust  */

  /* ── Mapped to UI tokens ── */
  --bg:      var(--canvas);
  --surface: #F0F1EB;
  --surface2: #E2E4DC;
  --border:  rgba(20,36,30,.13);
  --border2: rgba(20,36,30,.25);

  --text:  var(--ink);
  --text2: rgba(20,36,30,.62);
  --text3: rgba(20,36,30,.38);

  --accent:        var(--saffron);
  --accent-hover:  #A4440F;
  --accent-light:  rgba(197,85,26,.08);
  --accent-border: rgba(197,85,26,.3);

  /* Status — stay within brand palette */
  --green:    var(--forest);
  --green-bg: rgba(29,58,47,.08);
  --green-bd: rgba(29,58,47,.28);
  --yellow:   #7A5200;
  --yellow-bg: rgba(197,85,26,.08);
  --yellow-bd: rgba(197,85,26,.32);
  --red:    #7A1A1A;
  --red-bg: rgba(122,26,26,.06);
  --red-bd: rgba(122,26,26,.22);
  --purple:    var(--forest);
  --purple-bg: rgba(29,58,47,.08);
  --purple-bd: rgba(29,58,47,.28);

  --font-display: 'Eczar', Georgia, serif;
  --font-ui:      'Mukta', system-ui, sans-serif;

  --radius:    8px;
  --radius-sm: 4px;
  --shadow:    0 1px 3px rgba(20,36,30,.07), 0 4px 16px rgba(20,36,30,.06);
  --shadow-md: 0 2px 8px rgba(20,36,30,.10), 0 12px 32px rgba(20,36,30,.09);
  --gap: 20px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   PAGE LAYOUT
══════════════════════════════════════ */

.bg-wrap { display: none; }

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 28px 100px;
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */

.header {
  text-align: center;
  margin-bottom: 48px;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

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

/* ── Gridmark (brand device) ── */
.logo-icon { display: none; } /* replaced by gridmark */

.gridmark {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5px;
  width: 34px;
  flex-shrink: 0;
}
.gridmark span {
  aspect-ratio: 1;
  border: 1.5px solid var(--ink);
  transition: background .3s;
}
.gridmark span.lit {
  background: var(--saffron);
  border-color: var(--saffron);
}

.logo-ring, .logo-ring--2 { display: none; }

.logo-text {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: 0;
  color: var(--ink);
}

.logo-text::before, .logo-text::after { display: none; }

.logo-version {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--saffron);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: 3px;
  padding: 2px 6px;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: .06em;
}

.tagline {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.tagline-prefix { color: var(--saffron); font-weight: 600; margin-right: 4px; }
.cursor-blink   { display: none; }

.header-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.divider-line {
  flex: 1;
  max-width: 160px;
  height: 1px;
  background: var(--border2);
}

.divider-diamond { color: var(--saffron); font-size: 9px; }

/* ══════════════════════════════════════
   NOTION STATUS + NAV
══════════════════════════════════════ */

.notion-history-link {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  color: var(--forest);
  text-decoration: none;
  padding: .35rem .75rem;
  border: 1.5px solid var(--forest);
  border-radius: 4px;
  margin-bottom: .5rem;
  transition: background .15s;
}
.notion-history-link:hover {
  background: rgba(29,58,47,.08);
}

.notion-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 500;
}

.notion-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.notion-dot--on  { background: var(--forest); animation: pulse 2s ease-in-out infinite; }
.notion-dot--err { background: var(--red); }
.notion-dot--off { background: var(--text3); }

.notion-label     { color: var(--text3); }
.notion-label--on { color: var(--forest); }
.notion-label--err { color: var(--red); }
.notion-label--off { color: var(--text3); }

/* ══════════════════════════════════════
   SEARCH SECTION
══════════════════════════════════════ */

.search-section {
  max-width: 720px;
  margin: 0 auto 32px;
}

.search-hud {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.search-hud:focus-within {
  border-color: var(--accent-border);
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-light);
}

.hud-corner { display: none; }

.search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  transition: border-color .15s;
}

.search-inner:focus-within { border-color: var(--accent-border); }

.input-prefix {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--saffron);
  white-space: nowrap;
  flex-shrink: 0;
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  min-width: 0;
}

.url-input::placeholder { color: var(--text3); }

.scrape-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--saffron);
  border: none;
  color: var(--canvas);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: .04em;
  transition: background .15s;
  clip-path: none;
}

.scrape-btn:hover:not(:disabled)  { background: var(--accent-hover); }
.scrape-btn:active:not(:disabled) { transform: scale(.98); }
.scrape-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  background: var(--text3);
}

.btn-shimmer { display: none; }

.search-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text3);
}

.meta-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.meta-dot--green  { background: var(--forest); }
.meta-dot--cyan   { background: var(--saffron); }
.meta-dot--yellow { background: var(--yellow); }

/* ══════════════════════════════════════
   ALERTS
══════════════════════════════════════ */

.hud-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid;
}

.hud-alert--error {
  background: var(--red-bg);
  border-color: var(--red-bd);
  color: var(--red);
}

.alert-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--red);
  color: var(--canvas);
}

.hud-alert code {
  background: rgba(122,26,26,.1);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

/* ══════════════════════════════════════
   LOADING
══════════════════════════════════════ */

.loading {
  text-align: center;
  padding: 80px 0 60px;
}

.loading-ring {
  position: relative;
  width: 72px; height: 72px;
  margin: 0 auto 28px;
}

.ring-segment {
  position: absolute;
  inset: 0;
  border: 2.5px solid transparent;
  border-radius: 50%;
}

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

.ring-segment:nth-child(1) {
  border-top-color: var(--saffron);
  animation: spin 1.2s linear infinite;
}
.ring-segment:nth-child(2) {
  inset: 10px;
  border-right-color: var(--text3);
  animation: spin .9s linear infinite reverse;
}
.ring-segment:nth-child(3) {
  inset: 20px;
  border-bottom-color: var(--forest);
  animation: spin 1.6s linear infinite;
}

.ring-core {
  position: absolute;
  inset: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--saffron);
  font-family: var(--font-display);
  font-weight: 800;
}

.loading-lines {
  margin: 0 auto 16px;
  max-width: 340px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Brand motion: stepped ticks, not smooth slides */
@keyframes lineAppear {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

.load-line {
  font-size: 13px;
  color: var(--text2);
  opacity: 0;
  animation: lineAppear .4s steps(4, end) forwards;
  animation-delay: var(--d, 0s);
}

.load-line:first-child { color: var(--saffron); font-weight: 600; }

.loading-eta {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  font-family: var(--font-display);
}

/* ══════════════════════════════════════
   USAGE BAR
══════════════════════════════════════ */

.usage-hud {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--forest);
  border-radius: var(--radius-sm);
  padding: 12px 16px 14px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.usage-hud-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
}

.usage-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text3);
  text-transform: uppercase;
  font-family: var(--font-display);
}

.usage-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.usage-small { font-size: 12px; color: var(--text3); }
.usage-sep   { color: var(--border2); }
.usage-plan  {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--forest);
  letter-spacing: .04em;
}

.neon-green { color: var(--forest) !important; }

.usage-track {
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s steps(8, end);
}

.usage-track-glow { display: none; }

/* ══════════════════════════════════════
   RESULTS HEADER
══════════════════════════════════════ */

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border2);
}

.results-header::after { display: none; }

.results-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.results-bracket { color: var(--text3); }
.results-profile  { color: var(--saffron); margin-left: 8px; }

.results-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

/* ══════════════════════════════════════
   RESULTS ACTIONS ROW
══════════════════════════════════════ */

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

.pdf-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
  clip-path: none;
}

.pdf-btn:hover { background: var(--surface2); color: var(--ink); }

/* ══════════════════════════════════════
   CARDS GRID
══════════════════════════════════════ */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--gap);
}

/* ══════════════════════════════════════
   CARD
══════════════════════════════════════ */

/* Brand motion: stepped tick */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.card {
  animation: cardIn 400ms steps(4, end) both;
  cursor: default;
}

.card-3d-inner {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, border-color .2s, transform .15s;
}

.card:hover .card-3d-inner {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.card-corner { display: none; }

/* Thumbnail */
.card-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
}

.card-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.card:hover .card-thumb { transform: scale(1.04); }

.thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20,36,30,.55) 0%, transparent 55%);
}

.card-scanlines { display: none; }

.card-rank-badge {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--canvas);
  background: rgba(20,36,30,.7);
  backdrop-filter: blur(4px);
  padding: 3px 9px;
  border-radius: 3px;
}

.card-duration-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--canvas);
  background: rgba(20,36,30,.6);
  backdrop-filter: blur(4px);
  padding: 2px 7px;
  border-radius: 3px;
}

.thumb-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  background: rgba(20,36,30,.3);
  transition: opacity .2s;
  text-decoration: none;
}

.card:hover .thumb-play-btn { opacity: 1; }

.play-tri {
  font-size: 24px;
  color: var(--canvas);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}

/* Card body */
.card-body { padding: 16px; }

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Engagement badge — brand equation style */
.eng-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid;
  clip-path: none;
}

.eng-val  {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
}
.eng-unit {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  opacity: .7;
}

.eng-green  { border-color: var(--green-bd); color: var(--forest);  background: var(--green-bg); }
.eng-yellow { border-color: var(--yellow-bd); color: var(--yellow); background: var(--yellow-bg); }
.eng-red    { border-color: var(--red-bd);    color: var(--red);    background: var(--red-bg); }

.card-author {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

/* Stats row */
.card-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.stat-chip {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  text-align: center;
}

.stat-label {
  display: block;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 3px;
}

.stat-val {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

/* Neon → brand color remaps */
.neon-cyan   { color: var(--saffron) !important; }
.neon-pink   { color: var(--red) !important; }
.neon-yellow { color: var(--yellow) !important; }

/* Music */
.card-music {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--forest);
  background: var(--green-bg);
  border: 1px solid var(--green-bd);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 10px;
}

.music-ico   { flex-shrink: 0; }
.music-name  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* Caption */
.card-caption {
  margin-bottom: 10px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-left: 3px solid var(--saffron);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
}

.caption-hook-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.hook-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--saffron);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}

.hook-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}

.caption-toggle-btn {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--saffron);
  cursor: pointer;
  padding: 2px 0;
}

.caption-toggle-btn:hover { opacity: .75; }

.caption-full {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.7;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* Hashtags */
.card-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.htag {
  font-size: 11px;
  font-weight: 500;
  color: var(--saffron);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: default;
  transition: background .15s;
}

.htag:hover { background: rgba(197,85,26,.14); }

/* Actions */
.card-actions {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.btn-watch,
.btn-copy {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: .15s;
  text-decoration: none;
  clip-path: none;
  letter-spacing: .03em;
}

.btn-watch {
  background: var(--saffron);
  border: 1px solid var(--saffron);
  color: var(--canvas);
}

.btn-watch:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-copy {
  background: var(--canvas);
  border: 1px solid var(--border2);
  color: var(--text2);
}

.btn-copy:hover { background: var(--surface2); color: var(--ink); }

/* ══════════════════════════════════════
   HISTORY PANEL
══════════════════════════════════════ */

.history-panel {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--forest);
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.history-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .04em;
}

.history-count {
  font-size: 12px;
  color: var(--text3);
  font-weight: 400;
  margin-left: 8px;
}

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

.hist-toggle-btn,
.hist-clear-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  transition: .15s;
}

.hist-toggle-btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.hist-toggle-btn:hover { background: var(--border2); color: var(--ink); }

.hist-clear-btn {
  background: var(--red-bg);
  border: 1px solid var(--red-bd);
  color: var(--red);
}
.hist-clear-btn:hover { background: rgba(122,26,26,.1); }

.history-list { padding: 4px 0; }

.hist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.hist-row:last-child { border-bottom: none; }
.hist-row:hover { background: var(--canvas); }

.hist-row-left  { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hist-row-right { display: flex; align-items: center; gap: 8px; }

.hist-user  {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--saffron);
}
.hist-reels { font-size: 12px; color: var(--text3); }
.hist-eng   { font-size: 12px; font-weight: 600; }
.hist-date  { font-size: 11px; color: var(--text3); }

.hist-load-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  color: var(--saffron);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: .15s;
}
.hist-load-btn:hover { background: rgba(197,85,26,.14); }

.hist-del-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--red-bd);
  color: var(--red);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: .15s;
}
.hist-del-btn:hover { background: var(--red-bg); }
.hist-del-btn:disabled { opacity: .4; cursor: not-allowed; }

.hist-notion-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--forest);
  background: var(--green-bg);
  border: 1px solid var(--green-bd);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  text-decoration: none;
  transition: .15s;
}
.hist-notion-badge:hover { background: rgba(29,58,47,.14); }
.hist-notion-badge--pending { opacity: .45; cursor: default; color: var(--text3); border-color: var(--border); background: transparent; }

.hist-notion-save-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  background: transparent;
  color: var(--forest);
  border: 1.5px solid var(--forest);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: .04em;
  transition: .15s;
  white-space: nowrap;
}
.hist-notion-save-btn:hover { background: rgba(29,58,47,.08); }
.hist-notion-save-btn:disabled { opacity: .5; cursor: not-allowed; }

.hist-notion-save-all-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  background: rgba(29,58,47,.08);
  color: var(--forest);
  border: 1.5px solid var(--forest);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: .04em;
  transition: .15s;
}
.hist-notion-save-all-btn:hover { background: rgba(29,58,47,.14); }
.hist-notion-save-all-btn:disabled { opacity: .5; cursor: not-allowed; }

.hist-notion-clear-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  background: rgba(29,58,47,.08);
  border: 1px solid var(--green-bd);
  color: var(--forest);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: .15s;
}
.hist-notion-clear-btn:hover    { background: rgba(29,58,47,.15); }
.hist-notion-clear-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 100px 0;
}

.empty-icon {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--text3);
  margin-bottom: 16px;
  display: block;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text2);
  margin-bottom: 8px;
}

.empty-sub {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text3);
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--canvas);
  background: var(--forest);
  border: 1px solid rgba(231,234,224,.2);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  clip-path: none;
  animation: toastIn .2s steps(4, end);
}

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 80px;
  padding-top: 20px;
  border-top: 1px solid var(--border2);
}

.footer-line {
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: var(--border2);
}

.footer-text {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  letter-spacing: .08em;
}

/* ══════════════════════════════════════
   UTILITY
══════════════════════════════════════ */

.hidden { display: none !important; }
.dots   { display: inline-block; width: 20px; }

/* ══════════════════════════════════════
   PRINT / PDF
══════════════════════════════════════ */

.print-view { display: none; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  .bg-wrap, .header, .search-section, .history-panel,
  .hud-alert, .loading, .usage-hud, .results, .empty-state,
  .footer, .toast { display: none !important; }

  .print-view {
    display: block !important;
    font-family: 'Mukta', Arial, sans-serif;
    color: #14241E;
    background: #E7EAE0;
    padding: 20px;
  }

  .print-header { margin-bottom: 20px; border-bottom: 2px solid #14241E; padding-bottom: 12px; }
  .print-header h1 { font-size: 22px; font-weight: 900; margin-bottom: 8px; }
  .print-meta-row { display: flex; gap: 24px; font-size: 12px; color: #444; margin-bottom: 4px; }
  .print-usage    { font-size: 11px; color: #666; margin-top: 4px; }

  .print-table { width: 100%; border-collapse: collapse; font-size: 10px; margin-top: 16px; }
  .print-table th {
    background: #14241E; color: #E7EAE0; padding: 6px 8px;
    text-align: left; font-size: 9px; letter-spacing: 1px;
    text-transform: uppercase; border: 1px solid #333;
  }
  .print-table td { padding: 6px 8px; border: 1px solid #ccc; vertical-align: top; line-height: 1.4; }
  .print-table tr:nth-child(even) td { background: #f0f1eb; }
  .print-table td:nth-child(9) { max-width: 220px; word-break: break-word; }
  .print-footer { margin-top: 20px; font-size: 9px; color: #999; text-align: center; border-top: 1px solid #ccc; padding-top: 10px; }
  @page { margin: 15mm; size: A4 landscape; }
}

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════ */

@media (max-width: 640px) {

  /* ── Layout ── */
  .page    { padding: 16px 14px 80px; }
  .header  { margin-bottom: 24px; }

  /* ── Logo ── */
  .logo-inner  { gap: 10px; }
  .gridmark    { width: 26px; gap: 2px; }
  .logo-text   { font-size: 24px; }
  .logo-version { font-size: 10px; padding: 1px 5px; }
  .tagline     { font-size: 12px; }
  .notion-history-link { font-size: .67rem; padding: .3rem .6rem; }

  /* ── Search ── */
  .search-section { margin-bottom: 16px; }
  .search-hud     { padding: 14px; }
  .search-inner   {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .input-prefix { display: none; }
  .url-input    { font-size: 16px; } /* prevents iOS zoom */
  .scrape-btn   {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 15px;
    border-radius: 6px;
  }
  .search-meta { font-size: 11px; }

  /* ── History panel ── */
  .history-panel  { border-radius: 8px; border-left-width: 2px; margin-bottom: 14px; }
  .history-header { flex-direction: column; align-items: flex-start; padding: 10px 12px; }
  .history-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .hist-toggle-btn,
  .hist-clear-btn,
  .hist-notion-save-all-btn,
  .hist-notion-clear-btn { font-size: 11px; padding: 6px 8px; text-align: center; }

  /* History row — stacked */
  .hist-row       { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .hist-row-left  { width: 100%; gap: 6px; }
  .hist-row-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    align-items: center;
  }
  .hist-user  { font-size: 13px; }
  .hist-date  { font-size: 10px; grid-column: 1; }
  .hist-load-btn, .hist-del-btn, .hist-notion-save-btn {
    font-size: 11px; padding: 6px 10px; min-height: 34px;
  }
  .hist-notion-badge { font-size: 10px; padding: 2px 7px; }

  /* ── Usage bar ── */
  .usage-hud       { padding: 10px 12px 12px; }
  .usage-hud-inner { gap: 4px 10px; }
  .usage-sep       { display: none; }
  .usage-val       { font-size: 14px; }

  /* ── Results ── */
  .results-header      { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 12px; }
  .results-actions-row { flex-wrap: wrap; gap: 8px; }
  .results-title       { font-size: 18px; }
  .pdf-btn             { font-size: 12px; padding: 6px 12px; }

  /* ── Cards ── */
  .cards-grid      { grid-template-columns: 1fr; gap: 12px; }
  .card-3d-inner   { border-radius: 8px; }
  .card-thumb-wrap { aspect-ratio: 4/3; }
  .thumb-play-btn  { opacity: 1; background: rgba(20,36,30,.25); }
  .play-tri        { font-size: 30px; }

  /* Stats 2×2 */
  .card-stats-row { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .stat-chip      { padding: 8px 6px; }
  .stat-label     { font-size: 9px; }
  .stat-val       { font-size: 15px; }

  .card-body     { padding: 14px; }
  .card-head-row { margin-bottom: 10px; }
  .eng-val       { font-size: 18px; }
  .card-author   { font-size: 12px; }
  .hook-text     { font-size: 13px; }
  .htag          { font-size: 11px; }

  /* Large tap targets */
  .card-actions { gap: 8px; padding-top: 12px; }
  .btn-watch,
  .btn-copy {
    padding: 13px 10px;
    font-size: 13px;
    min-height: 46px;
    border-radius: 6px;
  }

  /* ── Toast ── */
  .toast {
    font-size: 12px;
    padding: 10px 18px;
    bottom: 20px;
    max-width: calc(100vw - 24px);
    white-space: nowrap;
  }

  /* ── Footer ── */
  .footer      { margin-top: 40px; }
  .footer-text { font-size: 10px; text-align: center; }
}
