/* AI Entry & Exit Counter (live tripwire people counter) — tool styles.
   Pairs with public/js/counters/ai-entry-exit-counter.js. Cyan/sky family. */

.tw-card {
    max-width: 560px;
    margin: 0 auto;
}

/* --- video stage + idle preview ---------------------------------------- */

.tw-stage {
    position: relative;
    width: 100%;
    background: #0b1220;
    border-radius: 14px;
    overflow: hidden;
    line-height: 0;
}
/* The <video> only needs to decode frames; the annotated canvas is what we show.
   Park it behind the canvas at full size (opacity 0) so it can't be interacted
   with and never steals the layout. */
.tw-stage video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}
/* Canvas is the flow element: its displayed size preserves the bitmap's aspect
   ratio (no object-fit crop), so drag coordinates map linearly to the frame. */
.tw-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none; /* let us drag the line without the page scrolling */
    cursor: crosshair;
}

.tw-idle {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #0b1220;
}
.tw-idle canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    cursor: crosshair;
}

.tw-hud {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}
.tw-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: #fff;
    background: rgba(2, 6, 23, .55);
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .9rem;
}
.tw-hud-btn {
    border: 0;
    background: rgba(2, 6, 23, .55);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    cursor: pointer;
}

/* --- live tallies ------------------------------------------------------- */

.tw-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0 6px;
}
.tw-stat {
    text-align: center;
    padding: 10px 6px;
    border-radius: 12px;
    background: var(--surface-2, rgba(148, 163, 184, .08));
    border: 1px solid var(--border-color, rgba(148, 163, 184, .2));
}
.tw-stat-num {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.tw-stat-label {
    display: block;
    margin-top: 4px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
}
.tw-stat-in .tw-stat-num { color: #22c55e; }
.tw-stat-out .tw-stat-num { color: #f97316; }
.tw-stat-inside .tw-stat-num { color: #0ea5e9; }

@keyframes tw-pop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.tw-pulse { animation: tw-pop .35s ease; }

.tw-cue {
    text-align: center;
    font-size: .9rem;
    color: var(--text-secondary, #94a3b8);
    min-height: 1.2em;
    margin: 4px 0 10px;
}
.tw-cue.is-error { color: #ef4444; }

/* --- line + direction controls ----------------------------------------- */

.tw-linectl {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}
.tw-linectl-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
}
.tw-chip {
    border: 1px solid var(--border-color, rgba(148, 163, 184, .35));
    background: transparent;
    color: var(--text-primary, inherit);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.tw-chip:hover { border-color: #0ea5e9; }
.tw-chip.is-active {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #04283a;
}
.tw-chip-swap { border-style: dashed; }

/* --- start / stop ------------------------------------------------------- */

.tw-controls {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}
.tw-btn {
    border: 0;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.tw-btn-start { background: #0ea5e9; color: #04283a; }
.tw-btn-start:hover { background: #0284c7; }
.tw-btn-stop { background: #ef4444; color: #fff; }
.tw-btn-ghost { background: transparent; color: var(--text-secondary, #94a3b8); border: 1px solid var(--border-color, rgba(148, 163, 184, .35)); }
.tw-btn:disabled { opacity: .55; cursor: default; }

.tw-loading {
    text-align: center;
    font-size: .85rem;
    color: var(--text-secondary, #94a3b8);
    margin-top: 8px;
}
.tw-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(148, 163, 184, .4);
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: tw-spin 0.8s linear infinite;
    vertical-align: -2px;
}
@keyframes tw-spin { to { transform: rotate(360deg); } }

.tw-quota {
    text-align: center;
    font-size: .8rem;
    color: var(--text-secondary, #94a3b8);
    margin: 8px 0 0;
}

/* --- upsell overlay ----------------------------------------------------- */

.tw-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.tw-overlay[hidden] { display: none; }
.tw-modal {
    background: var(--surface-1, #0f172a);
    color: var(--text-primary, #e2e8f0);
    border-radius: 16px;
    padding: 26px;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.tw-modal h3 { margin: 0 0 10px; }
.tw-modal p { font-size: .92rem; opacity: .9; margin: 0 0 16px; }
.tw-modal .tw-btn { width: 100%; justify-content: center; margin-bottom: 8px; }

/* session-end summary */
.tw-sum-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 4px 0 6px;
}
.tw-sum-stats > div {
    padding: 10px 4px;
    border-radius: 10px;
    background: rgba(148, 163, 184, .1);
}
.tw-sum-stats b { display: block; font-size: 1.8rem; line-height: 1; font-variant-numeric: tabular-nums; }
.tw-sum-stats span { display: block; margin-top: 4px; font-size: .72rem; color: var(--text-secondary, #94a3b8); }
.tw-sum-in { color: #22c55e; }
.tw-sum-out { color: #f97316; }
.tw-sum-peak { color: #0ea5e9; }
.tw-sum-meta { font-size: .85rem !important; color: var(--text-secondary, #94a3b8); margin: 0 0 14px !important; }
.tw-save-status { font-size: .88rem !important; min-height: 1.2em; margin-bottom: 10px !important; }
.tw-sum-pitch { font-size: .9rem !important; text-align: left; background: rgba(14, 165, 233, .08); border: 1px solid rgba(14, 165, 233, .25); border-radius: 10px; padding: 10px 12px; }
.tw-sum-pitch i { color: #f59e0b; }

/* --- landing page bits -------------------------------------------------- */

.tw-hero-art {
    margin: 0;
    width: 100%;
    max-width: 480px;
}
.tw-hero-art img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}
/* Desktop-only drop-shadow (follows the PNG alpha); skipped on mobile because
   iOS won't paint filter:drop-shadow on large transparent PNGs. Mobile gets a
   height cap instead — same guidance as the other AI-tool heroes. */
@media (min-width: 861px) {
    .tw-hero-art img { filter: drop-shadow(0 18px 40px rgba(2, 132, 199, .20)); }
}
@media (max-width: 860px) {
    .tw-hero-art img { max-height: 52vh; width: auto; }
}

/* Feature grid (watercolor cards) — 3-up on desktop, 2-up on tablet. */
.tw-features { display: grid; gap: 1.25rem; }
@media (min-width: 861px) { .tw-features { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 561px) and (max-width: 860px) { .tw-features { grid-template-columns: repeat(2, 1fr); } }

.tw-pro-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 14px 18px;
    border: 1px solid rgba(14, 165, 233, .35);
    border-radius: 14px;
    background: rgba(14, 165, 233, .07);
}
.tw-pro-strip i { color: #f59e0b; font-size: 1.2rem; }
.tw-pro-strip p { margin: 0; font-size: .9rem; flex: 1 1 320px; }
.tw-pro-strip a {
    font-weight: 700;
    color: #0284c7;
    white-space: nowrap;
    text-decoration: none;
}

.tw-cta-row {
    display: flex;
    justify-content: center;
    margin-top: 1.75rem;
}

/* --- fullscreen --------------------------------------------------------- */

.tw-card:fullscreen {
    background: #04283a;
    padding: 20px;
    overflow: auto;
    max-width: none;
}
.tw-card:fullscreen .tw-stage { max-width: 900px; margin: 0 auto; }
