:root {
  --bg: #0b0b12; --card: #151520; --card2: #1d1d2b; --line: #2a2a3c;
  --text: #f3f3f8; --muted: #9a9ab0; --pink: #ff5f8f; --violet: #7c5cff;
  --green: #2bd98b; --red: #ff5c6c; --amber: #ffbe3d;
  --grad: linear-gradient(135deg, var(--pink), var(--violet));
  --r: 18px; --tab: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; }
body { min-height: 100vh; padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 16px); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 12px) 18px 12px; background: rgba(11,11,18,.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand img { width: 30px; height: 30px; }
.mode-pill { display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.mode-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.mode-pill.live::before { background: var(--green); box-shadow: 0 0 10px var(--green); }
.view { max-width: 560px; margin: 0 auto; padding: 4px 16px 0; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h1 { font-size: 28px; letter-spacing: -.03em; margin: 8px 0 4px; }
h2 { font-size: 17px; margin: 22px 0 10px; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.hero { background: radial-gradient(120% 120% at 0% 0%, rgba(255,95,143,.25), transparent 55%), radial-gradient(120% 120% at 100% 100%, rgba(124,92,255,.3), transparent 55%), var(--card); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: rgba(255,255,255,.04); border-radius: 14px; padding: 12px 10px; }
.kpi b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi.accent b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lastrun { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot.bad { background: var(--red); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); font-weight: 700; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--grad); border: 0; box-shadow: 0 8px 24px rgba(124,92,255,.35); }
.btn.block { width: 100%; }
.btn.big { padding: 17px; font-size: 17px; border-radius: 16px; }
.btn.danger { color: var(--red); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.action { flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 14px; }
.action small { color: var(--muted); font-weight: 500; font-size: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chip.ok { color: var(--green); border-color: rgba(43,217,139,.35); }
.chip.no { color: var(--muted); }
.chip.hot { color: #fff; background: var(--grad); border: 0; }
.chip button { color: var(--muted); font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.setting { padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting label { font-weight: 600; }
.setting small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.input, select.input { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; width: 100%; }
.input:focus { border-color: var(--violet); }
.num { width: 90px; text-align: center; }
.seg { display: flex; background: var(--card2); border: 1px solid var(--line); border-radius: 13px; padding: 3px; }
.seg button { flex: 1; padding: 9px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--grad); color: #fff; }
.stack { position: relative; height: min(64vh, 580px); margin-top: 6px; }
.rcard { position: absolute; inset: 0; background: var(--card); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; touch-action: pan-y; transition: transform .3s ease, opacity .3s; box-shadow: 0 20px 40px rgba(0,0,0,.4); }
.rcard.behind { transform: scale(.95) translateY(14px); opacity: .6; pointer-events: none; }
.rcard .img { position: relative; flex: 1 1 auto; min-height: 0; background: #222 center/cover no-repeat; }
.rcard .img .chip { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.55); color: #fff; border: 0; }
.rcard .body { padding: 14px 16px 16px; flex: none; }
.rcard h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard .chips { max-height: 62px; overflow: hidden; }
.stamp { position: absolute; top: 24px; padding: 6px 14px; border: 3px solid; border-radius: 10px; font-weight: 900; font-size: 22px; letter-spacing: .05em; opacity: 0; }
.stamp.yes { left: 20px; color: var(--green); transform: rotate(-12deg); }
.stamp.no { right: 20px; color: var(--red); transform: rotate(12deg); }
.ractions { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 18px 0 6px; }
.round { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 20px rgba(0,0,0,.35); transition: transform .1s; }
.round:active { transform: scale(.9); }
.round svg { width: 28px; height: 28px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.round.no svg { stroke: var(--red); }
.round.yes svg { stroke: var(--green); }
.round.re { width: 48px; height: 48px; }
.round.re svg { width: 22px; height: 22px; stroke: var(--amber); }
.details { margin-top: 8px; font-size: 13px; color: var(--muted); }
.details summary { cursor: pointer; color: var(--text); font-weight: 600; }
.niche { padding: 14px 0; border-bottom: 1px solid var(--line); }
.niche:last-child { border-bottom: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--card2); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.rank { width: 28px; height: 28px; border-radius: 9px; background: var(--card2); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.rank.top { background: var(--grad); }
.addrow { display: flex; gap: 8px; margin-top: 12px; }
.prod { display: flex; gap: 12px; padding: 12px; margin-bottom: 10px; }
.thumb { width: 76px; height: 76px; border-radius: 14px; background: #222 center/cover; flex: none; }
.prod .info { flex: 1; min-width: 0; }
.prod h4 { margin: 0 0 4px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin: 6px 0 8px; }
.stats b { color: var(--text); }
.prod .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pin.on { color: var(--amber); border-color: rgba(255,190,61,.4); }
.killed { opacity: .55; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 8px; }
.login-view { display: grid; place-items: center; min-height: 100vh; max-width: none; padding: 24px; }
.login-card { width: min(100%, 380px); text-align: center; padding: 30px; }
.login-logo { width: 56px; height: 56px; margin-bottom: 8px; }
.login-card h1 { margin: 0 0 22px; }
.login-card form { text-align: left; }
.login-label { display: block; margin-bottom: 7px; font-weight: 600; }
.login-error { min-height: 20px; margin: 6px 0 10px; color: var(--red); font-size: 13px; }
.login-card .btn { margin-top: 2px; }
body.login-mode { padding-bottom: 0; }
body.login-mode .topbar, body.login-mode .tabbar { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; padding: 8px 6px calc(env(safe-area-inset-bottom) + 8px); background: rgba(15,15,24,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 10px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: #fff; }
.tabbar a.on svg { stroke: var(--pink); }
.badge { position: absolute; top: 0; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--pink); color: #fff; font-size: 11px; display: grid; place-items: center; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 18px); z-index: 20; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #24243a; border: 1px solid var(--line); border-left: 4px solid var(--green); padding: 12px 14px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; animation: fade .2s; }
.toast.err { border-left-color: var(--red); }
.muted { color: var(--muted); }
.mt { margin-top: 12px; }
.mt-s { margin-top: 8px; }
.mb { margin-bottom: 12px; }
.chip.up { color: var(--green); border-color: rgba(43,217,139,.35); }
.chip.down { color: var(--red); border-color: rgba(255,92,108,.35); }
.chip.season { color: var(--amber); border-color: rgba(255,190,61,.35); }
.chip.disc { color: #b9a8ff; border-color: rgba(124,92,255,.45); }
.chip.comp-low { color: var(--green); }
.chip.comp-high { color: var(--red); }
.chip.addseed { color: var(--text); border-style: dashed; cursor: pointer; }
.factors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.factors div { background: var(--card2); border-radius: 10px; padding: 8px 4px; text-align: center; }
.factors span { display: block; font-size: 10px; color: var(--muted); }
.factors b { font-size: 13px; color: var(--text); }
#trendSeg button { font-size: 12px; padding: 8px 4px; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.money { margin-top: 12px; }
.money-net { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.money-net b { font-size: 28px; }
.money-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.money-grid div { display: flex; flex-direction: column; }
.money-grid b { font-size: 15px; }
.money-grid span, .pmoney { font-size: 12px; color: var(--muted); }
.pmoney { display: flex; gap: 12px; margin: 4px 0; }
.connect-cta { border: 1px solid var(--amber); }
[hidden] { display: none !important; }

.autopilot-line { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 14px; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 650; }
.autopilot-line span { color: var(--muted); }
.schedule-hour { width: 128px; }
.pun-chip { color: #d4c9ff; border-color: rgba(124,92,255,.5); }
.view.puns { padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 100px); }
.pun-form { margin-top: 18px; }
.pun-form > label { font-size: 13px; font-weight: 700; }
select.input.pun-count { width: 120px; flex: none; }
.pun-form .row { align-items: stretch; }
.pun-form .row .btn { flex: 1; min-width: 0; }
.pun-results { margin-top: 24px; }
.pun-result-heading { margin-bottom: 8px; }
.pun-result-heading h2 { margin: 0; }
.pun-card { position: relative; display: flex; width: 100%; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 46px 18px 16px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); text-align: left; transition: border-color .15s, background .15s, transform .1s; }
.pun-card:active { transform: scale(.99); }
.pun-card.selected { border-color: var(--violet); background: linear-gradient(120deg, rgba(124,92,255,.16), rgba(255,95,143,.08)), var(--card); }
.pun-text { font-size: 19px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; }
.pun-idea { font-size: 13px; color: var(--muted); }
.pun-check { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); }
.pun-card.selected .pun-check { background: var(--grad); border-color: transparent; color: white; }
.pun-empty { padding-top: 36px; }
.pun-actions { position: fixed; left: 50%; bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 8px); z-index: 9; width: min(calc(100% - 24px), 528px); padding: 10px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 18px; background: rgba(15,15,24,.94); box-shadow: 0 10px 32px rgba(0,0,0,.35); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
