:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9f9;
  --ink: #0f1419;
  --muted: #536471;
  --faint: #8b98a5;
  --line: #eff3f4;
  --brand: #1d9bf0;
  --brand-ink: #ffffff;
  --brand-soft: #e8f5fd;
  --danger: #f4212e;
  --ok: #00ba7c;
  --ok-soft: #e0f7ef;
  --warn: #b26b00;
  --warn-soft: #fff4dc;
  --mark: #fff0a8;
  --shadow: 0 1px 2px rgba(15, 20, 25, .04), 0 8px 24px rgba(15, 20, 25, .07);
  --radius: 16px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #16181c;
    --surface-2: #202327;
    --ink: #e7e9ea;
    --muted: #8b98a5;
    --faint: #5f6b75;
    --line: #2f3336;
    --brand: #1d9bf0;
    --brand-soft: #0b2a3f;
    --danger: #f4212e;
    --ok: #00ba7c;
    --ok-soft: #062d20;
    --warn: #ffad1f;
    --warn-soft: #33260a;
    --mark: #6b5a10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* --- shared bits ------------------------------------------------------- */

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 19px; letter-spacing: -.02em; text-decoration: none;
}
.logo-mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand);
  display: grid; place-items: center;
}
.logo-mark::after { content: ''; width: 12px; height: 2.5px; border-radius: 2px; background: var(--brand-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink); opacity: .88; }
.btn-brand { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-brand:hover { background: var(--brand); opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); opacity: .9; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.banner {
  background: var(--warn-soft); color: var(--warn); text-align: center;
  padding: 8px 16px; font-size: 13.5px; font-weight: 550;
}
.error-box { background: var(--brand-soft); color: var(--danger); padding: 12px 14px; border-radius: 10px; font-size: 14px; }

/* --- landing ----------------------------------------------------------- */

.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.nav-links { display: flex; gap: 6px; align-items: center; }

.hero { padding: 72px 0 56px; text-align: center; }
.hero h1 {
  font-size: clamp(38px, 7vw, 72px); line-height: 1.02; letter-spacing: -.045em; margin: 0 auto 20px; max-width: 13ch;
}
.hero h1 s { text-decoration-color: var(--brand); text-decoration-thickness: .09em; color: var(--faint); }
.hero p { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 560px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 16px; font-size: 13.5px; color: var(--faint); }

.demo-feed { max-width: 560px; margin: 56px auto 0; text-align: left; padding: 8px; }
.feed-row { display: flex; gap: 12px; padding: 14px; border-radius: 10px; align-items: flex-start; }
.feed-row + .feed-row { border-top: 1px solid var(--line); border-radius: 0; }
.feed-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); flex: none; }
.feed-text { flex: 1; font-size: 15px; }
.feed-meta { font-size: 12.5px; color: var(--faint); margin-bottom: 2px; }
.feed-row.gone .feed-text { text-decoration: line-through; text-decoration-color: var(--brand); color: var(--faint); }
.feed-row.gone .feed-avatar { opacity: .4; }

.section { padding: 72px 0; }
.section h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.035em; line-height: 1.1; margin: 0 0 12px; }
.section-lead { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 0 40px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { padding: 24px; }
.step-num { font-family: var(--mono); font-size: 13px; color: var(--brand); font-weight: 600; }
.step h3 { margin: 10px 0 6px; font-size: 18px; letter-spacing: -.01em; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

.privacy { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.privacy ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.privacy li { display: flex; gap: 12px; }
.privacy li::before { content: ''; flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 6px; background: var(--ok-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%2300ba7c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }

.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; max-width: 720px; }
.plan { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.plan.featured { border-color: var(--brand); }
.plan-price { font-size: 40px; font-weight: 700; letter-spacing: -.04em; }
.plan-price span { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan ul { margin: 0; padding: 0 0 0 18px; color: var(--muted); display: grid; gap: 6px; flex: 1; }

.faq { max-width: 720px; }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::after { content: '+'; color: var(--faint); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq p { color: var(--muted); margin: 10px 0 0; }

.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--faint); font-size: 13.5px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* --- app --------------------------------------------------------------- */

.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.top-right { display: flex; align-items: center; gap: 14px; }

.meter { display: flex; align-items: center; gap: 12px; }
.balance { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.balance strong { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.linkish { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; font-weight: 600; }

.modal.modal-wide { max-width: 760px; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pack { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.pack.popular { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pack .pill { position: absolute; top: -12px; left: 16px; background: var(--brand); color: #fff; }
.pack.small-pack { opacity: .6; }
.pack-name { font-weight: 700; }
.pack-n { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.pack-n span { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.pack-price { font-size: 18px; font-weight: 600; }
.pack .btn { margin-top: 10px; }

.avatar-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 99px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); object-fit: cover; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.menu { position: absolute; right: 20px; top: 58px; width: 220px; padding: 6px; z-index: 30; }
.menu button { width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu .danger { color: var(--danger); }
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13.5px; }

.tabs { display: flex; gap: 4px; margin: 28px 0 20px; }
.tab { background: none; border: 0; padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 56px 24px; text-align: center;
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop h2 { margin: 14px 0 6px; font-size: 22px; letter-spacing: -.02em; }
.drop p { margin: 0 auto; color: var(--muted); max-width: 460px; }
.drop-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; }
.drop-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.help { margin-top: 16px; padding: 18px 20px; }
.help ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }

.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.workspace { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.rules { padding: 20px; position: sticky; top: 84px; display: grid; gap: 20px; }
.rules h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.archive-summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }

.chips-input {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; min-height: 48px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); cursor: text;
}
.chips-input:focus-within { border-color: var(--ink); }
.chips-input input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; padding: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px 0 11px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 550; }
.chip button { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 2px 4px; font-size: 16px; line-height: 1; }
.chip button:hover { opacity: 1; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.suggest button { border: 1px dashed var(--line); background: none; border-radius: 8px; padding: 4px 9px; font-size: 13px; color: var(--muted); cursor: pointer; }
.suggest button:hover { border-color: var(--ink); color: var(--ink); }

.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; cursor: pointer; font-size: 14.5px; }
.toggle small { display: block; color: var(--faint); font-size: 12.5px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--surface); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dates label { font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; }
.dates input { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--bg); min-width: 0; }

.results { min-height: 400px; overflow: hidden; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.results-head strong { font-size: 18px; letter-spacing: -.02em; }
.results-tools { display: flex; gap: 6px; }
.tweet { display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tweet:hover { background: var(--bg); }
.tweet.off { opacity: .45; }
.tweet input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); flex: none; cursor: pointer; }
.tweet-body { flex: 1; min-width: 0; }
.tweet-meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--faint); margin-bottom: 3px; flex-wrap: wrap; }
.tweet-meta a { color: var(--faint); }
.tweet-text { white-space: pre-wrap; overflow-wrap: anywhere; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.empty { padding: 72px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.more { padding: 16px; text-align: center; }

.actionbar {
  position: sticky; bottom: 16px; z-index: 10; margin-top: 16px; padding: 12px 12px 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--ink); color: var(--bg); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.actionbar .muted { color: color-mix(in srgb, var(--bg) 65%, transparent); }

/* choose source */
.choose-head { margin: 8px 0 24px; }
.choose-head h1 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.03em; }
.choose-head p { margin: 0; }
.choose { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice {
  text-align: left; padding: 26px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; position: relative;
  font: inherit; color: inherit; transition: transform .2s, border-color .2s, box-shadow .2s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--ink); }
.choice.featured { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.choice .pill { align-self: flex-start; }
.choice-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); margin-top: 4px; }
.choice.featured .choice-icon { background: var(--brand); color: #fff; }
.choice strong { font-size: 20px; letter-spacing: -.02em; }
.choice > span:not(.pill):not(.choice-icon):not(.choice-foot) { color: var(--muted); }
.choice-foot { font-size: 13px; color: var(--faint); margin-top: auto; padding-top: 6px; }
.back-btn { margin-bottom: 12px; padding-left: 6px; }

/* search box */
.search-box { margin-top: 14px; }
.search-btn { width: 100%; height: 44px; }
.search-status { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; background: var(--brand-soft); font-size: 14px; font-weight: 550; }
.search-status span:nth-child(2) { flex: 1; }
.search-msg { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; color: var(--muted); }
.search-msg.warn { background: var(--warn-soft); color: var(--warn); }
.search-msg.err { background: var(--brand-soft); color: var(--danger); }
.search-msg-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* job progress */
.job { padding: 28px; }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.job-head h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.03em; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.progress { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 24px 0 14px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .5s ease; }
.job-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.stat b { display: block; font-size: 24px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.job-note { margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.log { margin-top: 24px; border-top: 1px solid var(--line); }
.log-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.log-row .tweet-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.log-row.deleted .tweet-text, .log-row.gone .tweet-text { text-decoration: line-through; text-decoration-color: var(--brand); }

.history { overflow: hidden; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.history-row:last-child { border-bottom: 0; }
.kw { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-back { position: fixed; inset: 0; background: rgba(10,10,12,.5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { width: 100%; max-width: 460px; padding: 28px; animation: rise .2s cubic-bezier(.2,.8,.2,1); }
.modal h2 { margin: 0 0 8px; letter-spacing: -.02em; }
.modal p { color: var(--muted); margin: 0 0 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.confirm-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.confirm-check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--danger); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; z-index: 60; font-size: 14px; box-shadow: var(--shadow); animation: rise .2s; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .rules { position: static; }
  .steps, .privacy { grid-template-columns: 1fr; }
  .balance span { display: none; }
  .choose { grid-template-columns: 1fr; }
  .packs { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row .when { display: none; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .nav-links .hide-sm { display: none; }
  .tweet, .results-head { padding-left: 16px; padding-right: 16px; }
  .actionbar { padding: 12px; }
  .actionbar .btn { width: 100%; }
}
