/* Test vibrații (js/test-vibratii.js). Theme tokens on :root, redefined under body.dark-theme.
   Violet = the page accent; green = it vibrated; amber = the step to try first. */
:root {
    --tv-bg: #f5f3fb;
    --tv-surface: #ffffff;
    --tv-surface-2: #f7f5fc;
    --tv-ink: #1c1530;
    --tv-muted: #5f5876;
    --tv-line: #e1dcef;
    --tv-accent: #6d28d9;
    --tv-accent-2: #a855f7;
    --tv-accent-ink: #ffffff;
    --tv-accent-soft: rgba(109, 40, 217, .10);
    --tv-good: #15803d;
    --tv-good-soft: rgba(22, 163, 74, .12);
    --tv-bad: #b91c1c;
    --tv-bad-soft: rgba(220, 38, 38, .10);
    --tv-warn: #b45309;
    --tv-warn-soft: rgba(245, 158, 11, .14);
    --tv-warn-line: #f59e0b;
    --tv-shadow: 0 10px 30px rgba(28, 21, 48, .09);
}

body.dark-theme {
    --tv-bg: #0f0b1a;
    --tv-surface: #181226;
    --tv-surface-2: #1f182f;
    --tv-ink: #ece8f7;
    --tv-muted: #a8a0bf;
    --tv-line: #2e2543;
    --tv-accent: #a78bfa;
    --tv-accent-2: #c084fc;
    --tv-accent-ink: #1c1033;
    --tv-accent-soft: rgba(167, 139, 250, .14);
    --tv-good: #4ade80;
    --tv-good-soft: rgba(74, 222, 128, .13);
    --tv-bad: #f87171;
    --tv-bad-soft: rgba(248, 113, 113, .13);
    --tv-warn: #fbbf24;
    --tv-warn-soft: rgba(251, 191, 36, .12);
    --tv-warn-line: #f59e0b;
    --tv-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

/* clip, not hidden: the site-wide `body { overflow-x: hidden }` would kill position: sticky */
.tv-body, body.tv-body#page-top {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--tv-bg);
    color: var(--tv-ink);
    min-height: 100vh;
    overflow-x: clip;
}
.tv-main { padding-top: 40px; padding-bottom: 40px; }
.tv-main .container { max-width: 880px; }
.tv-main a { color: var(--tv-accent); }
.tv-main [hidden] { display: none !important; }

/* ---- hero ---- */
.tv-hero { text-align: center; padding: 4px 0 14px; }
.tv-hero-icon { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; color: #fff; background: linear-gradient(135deg, #a855f7, #6d28d9); box-shadow: var(--tv-shadow); }
.tv-hero h1 { font-weight: 800; font-size: clamp(1.7rem, 6vw, 2.4rem); letter-spacing: -.02em; margin: 0 0 8px; }
.tv-lead { max-width: 640px; margin: 0 auto; color: var(--tv-muted); font-size: 1rem; line-height: 1.55; }
.tv-last { display: inline-block; margin: 12px auto 0; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; border: 1px solid var(--tv-line); background: var(--tv-surface); }
.tv-last.is-ok { color: var(--tv-good); border-color: var(--tv-good); background: var(--tv-good-soft); }
.tv-last.is-bad { color: var(--tv-bad); border-color: var(--tv-bad); background: var(--tv-bad-soft); }

/* ---- cards ---- */
.tv-wrap { display: grid; gap: 18px; }
.tv-card { background: var(--tv-surface); border: 1px solid var(--tv-line); border-radius: 20px; box-shadow: var(--tv-shadow); padding: 18px; min-width: 0; }
.tv-card:focus { outline: none; }
.tv-card h2 { font-size: 1.2rem; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.tv-card h2 svg { color: var(--tv-accent); flex: none; }
.tv-card h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 6px; }
.tv-card p { line-height: 1.55; }
.tv-card p:last-child { margin-bottom: 0; }
.tv-small { font-size: .88rem; color: var(--tv-muted); line-height: 1.5; }

/* ---- notes (computer / iPhone / no API) ---- */
.tv-note { border-width: 2px; }
.tv-note-desktop { border-color: var(--tv-accent); }
.tv-note-ios { border-color: var(--tv-accent); }
.tv-note-noapi { border-color: var(--tv-warn-line); background: var(--tv-warn-soft); }
.tv-note-noapi h2 svg { color: var(--tv-warn); }
.tv-desktop-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.tv-url { font-size: 1.25rem; font-weight: 800; word-break: break-all; margin-bottom: 6px; }
.tv-url a { text-decoration: none; }
.tv-url-inline { font-weight: 700; word-break: break-all; }
.tv-qr { box-sizing: content-box; width: 222px; height: 222px; border-radius: 12px; border: 1px solid var(--tv-line); background: #fff; image-rendering: pixelated; }
.tv-ios-demo { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--tv-surface-2); border: 1px dashed var(--tv-line); }
.tv-switch-row { display: flex; align-items: center; gap: 12px; font-weight: 700; cursor: pointer; margin: 0 0 8px; min-height: 44px; }
.tv-switch-row input { width: 52px; height: 30px; flex: none; accent-color: var(--tv-accent); }

/* ---- the big test ---- */
.tv-test { text-align: center; padding-top: 26px; padding-bottom: 22px; }
.tv-stage { display: grid; justify-items: center; gap: 14px; }
.tv-big {
    position: relative; width: 188px; height: 188px; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; align-content: center; gap: 4px;
    color: #fff; background: radial-gradient(circle at 30% 25%, #c084fc, #7c3aed 55%, #5b21b6);
    box-shadow: 0 14px 34px rgba(109, 40, 217, .35), inset 0 -6px 0 rgba(0, 0, 0, .12);
    -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform .12s;
}
.tv-big:active { transform: scale(.96); }
.tv-big:focus-visible { outline: 4px solid var(--tv-accent-2); outline-offset: 5px; }
.tv-phone { font-size: 58px; line-height: 1; display: block; position: relative; z-index: 1; }
.tv-big-label { font-size: 1.3rem; font-weight: 800; letter-spacing: .01em; position: relative; z-index: 1; }
.tv-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--tv-accent-2); opacity: 0; pointer-events: none; }
.tv-big.is-on .tv-ring { animation: tv-ring .7s ease-out infinite; }
.tv-big.is-on .tv-ring-2 { animation-delay: .35s; }
.tv-big.is-on .tv-phone, .tv-test-btn.is-on .tv-test-ic, .tv-step.is-on h3 svg, .tv-brand-card.is-on h3 svg { animation: tv-shake .09s linear infinite; }
.tv-big.is-playing { box-shadow: 0 0 0 6px var(--tv-accent-soft), 0 14px 34px rgba(109, 40, 217, .45); }
@keyframes tv-ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.45); opacity: 0; } }
@keyframes tv-shake { 0% { transform: translateX(-3px) rotate(-4deg); } 50% { transform: translateX(3px) rotate(4deg); } 100% { transform: translateX(-3px) rotate(-4deg); } }

.tv-desktop-after { margin-top: 12px; color: var(--tv-muted); }
.tv-desktop-after svg { color: var(--tv-accent); margin-right: 4px; }
.tv-status { margin: 0; font-weight: 600; color: var(--tv-muted); max-width: 460px; min-height: 1.5em; }
.tv-refused { text-align: left; max-width: 520px; padding: 12px 14px; border-radius: 14px; background: var(--tv-bad-soft); border: 1px solid var(--tv-bad); }
.tv-refused p { margin: 0 0 4px; }
.tv-refused ul { margin: 0; padding-left: 20px; }

.tv-ask { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--tv-line); }
.tv-step .tv-ask, .tv-brand-card .tv-ask { text-align: center; }
.tv-ask-q { font-size: 1.25rem; font-weight: 800; margin: 0 0 10px; }
.tv-ask-btns { display: flex; justify-content: center; gap: 12px; }

/* ---- buttons ---- */
.tv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--tv-line); background: var(--tv-surface-2); color: var(--tv-ink); font-weight: 700; font-size: 1rem; cursor: pointer; touch-action: manipulation; }
.tv-btn:hover { border-color: var(--tv-accent); }
.tv-btn:focus-visible { outline: 3px solid var(--tv-accent-2); outline-offset: 2px; }
.tv-btn-yes, .tv-btn-no { min-width: 120px; font-size: 1.1rem; min-height: 54px; }
.tv-btn-yes { background: var(--tv-good); border-color: var(--tv-good); color: #fff; }
.tv-btn-no { background: var(--tv-bad); border-color: var(--tv-bad); color: #fff; }
body.dark-theme .tv-btn-yes { color: #052e16; }
body.dark-theme .tv-btn-no { color: #3b0a0a; }
.tv-btn-main { background: var(--tv-accent); border-color: var(--tv-accent); color: var(--tv-accent-ink); }
.tv-btn-main.is-playing { box-shadow: 0 0 0 4px var(--tv-accent-soft); }
.tv-btn-stop { width: 100%; margin-top: 10px; color: var(--tv-bad); border-color: var(--tv-bad); background: var(--tv-bad-soft); }
.tv-btn-retry { margin-top: 10px; background: var(--tv-accent); border-color: var(--tv-accent); color: var(--tv-accent-ink); font-size: .95rem; width: 100%; }

/* ---- success ---- */
.tv-success { text-align: center; border: 2px solid var(--tv-good); background: linear-gradient(180deg, var(--tv-good-soft), var(--tv-surface) 60%); }
.tv-success h2 { justify-content: center; color: var(--tv-good); font-size: 1.45rem; }
.tv-success-icon { font-size: 44px; color: var(--tv-good); line-height: 1; margin-bottom: 6px; }
.tv-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.tv-main a.tv-game { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--tv-line); background: var(--tv-surface); color: var(--tv-ink); font-weight: 700; text-decoration: none; text-align: left; }
.tv-main a.tv-game:hover { border-color: var(--tv-accent); }
.tv-game svg { color: var(--tv-accent); flex: none; }

/* ---- troubleshooting ---- */
.tv-steps { list-style: none; counter-reset: tv; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.tv-step { counter-increment: tv; position: relative; padding: 14px 14px 14px 52px; border-radius: 16px; border: 1px solid var(--tv-line); background: var(--tv-surface-2); }
.tv-step::before { content: counter(tv); position: absolute; left: 14px; top: 13px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; background: var(--tv-accent-soft); color: var(--tv-accent); }
.tv-step h3 { display: flex; align-items: flex-start; gap: 8px; }
.tv-step h3 svg { color: var(--tv-accent); margin-top: 3px; flex: none; }
.tv-step p { margin: 0 0 6px; }
.tv-step.is-top { border: 2px solid var(--tv-warn-line); background: var(--tv-warn-soft); }
.tv-step.is-top::before { background: var(--tv-warn-line); color: #1c1200; }
.tv-step.is-top h3 { font-size: 1.12rem; }
.tv-step.is-top h3 svg { color: var(--tv-warn); }
.tv-step.is-next { box-shadow: 0 0 0 3px var(--tv-accent); }
.tv-step.is-tried::after { content: "încercat"; position: absolute; top: 12px; right: 12px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tv-muted); }
.tv-step.is-tried h3 { padding-right: 64px; }
.tv-story { font-weight: 600; color: var(--tv-warn); }
.tv-story svg { margin-right: 4px; }
.tv-battery-hint { font-weight: 700; color: var(--tv-bad); }

.tv-brand-card { margin-top: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--tv-line); background: var(--tv-surface-2); }
.tv-brand-card.is-featured { border: 2px solid var(--tv-accent); background: var(--tv-accent-soft); }
.tv-brand-card h3 { display: flex; align-items: flex-start; gap: 8px; }
.tv-brand-card h3 svg { color: var(--tv-accent); margin-top: 3px; flex: none; }
.tv-brand-steps { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 10px; }
.tv-brand-steps .tv-small { margin: 2px 0 0; }
.tv-path { margin-top: 2px; }
.tv-path-text { font-weight: 600; font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.tv-crumb { color: var(--tv-ink); }
.tv-sep { color: var(--tv-accent); font-weight: 800; }
.tv-path-en { font-size: .8rem; color: var(--tv-muted); margin-top: 2px; overflow-wrap: anywhere; }
.tv-badge { display: inline-block; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.tv-badge.is-ok { background: var(--tv-good-soft); color: var(--tv-good); }
.tv-badge.is-maybe { background: var(--tv-warn-soft); color: var(--tv-warn); }

.tv-brands-more { margin-top: 14px; border: 1px solid var(--tv-line); border-radius: 16px; padding: 0 14px; }
.tv-brands-more summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; gap: 8px; }
.tv-brands-more summary svg { color: var(--tv-accent); }
.tv-brands-more[open] { padding-bottom: 14px; }
.tv-brand-pick { display: grid; gap: 6px; }
.tv-brand-pick label { font-weight: 600; font-size: .92rem; }
.tv-select { width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--tv-line); background: var(--tv-surface); color: var(--tv-ink); font-size: 1rem; }
.tv-motor { margin-top: 14px; }

/* ---- pattern grid ---- */
.tv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tv-test-btn { display: grid; justify-items: start; align-content: start; gap: 2px; min-height: 100px; padding: 12px; border-radius: 16px; border: 1px solid var(--tv-line); background: var(--tv-surface-2); color: var(--tv-ink); text-align: left; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: border-color .15s, background-color .15s; min-width: 0; }
.tv-test-btn:hover { border-color: var(--tv-accent); }
.tv-test-btn:focus-visible { outline: 3px solid var(--tv-accent-2); outline-offset: 2px; }
.tv-test-btn.is-playing { border-color: var(--tv-accent); background: var(--tv-accent-soft); }
.tv-test-ic { color: var(--tv-accent); font-size: 1.15rem; display: inline-block; margin-bottom: 2px; }
.tv-test-name { font-weight: 800; font-size: .98rem; line-height: 1.2; }
.tv-test-sub { font-size: .78rem; color: var(--tv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tv-bars { display: flex; align-items: stretch; width: 100%; height: 10px; margin-top: 8px; gap: 1px; }
.tv-bar { background: var(--tv-accent); border-radius: 3px; min-width: 2px; }
.tv-gap { min-width: 1px; }

.tv-builder { margin-top: 18px; padding: 14px; border-radius: 16px; border: 1px solid var(--tv-line); background: var(--tv-surface-2); }
.tv-sliders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; }
.tv-slider { display: grid; gap: 4px; margin: 0; font-weight: 600; font-size: .92rem; }
.tv-slider span { display: flex; justify-content: space-between; gap: 6px; }
.tv-slider output { font-variant-numeric: tabular-nums; color: var(--tv-accent); font-weight: 800; }
.tv-slider input { width: 100%; accent-color: var(--tv-accent); min-height: 32px; }
.tv-preview { margin: 12px 0 4px; padding: 10px; border-radius: 12px; background: var(--tv-surface); border: 1px solid var(--tv-line); }
.tv-preview .tv-bars { height: 22px; margin: 0; }
.tv-preview.is-playing { border-color: var(--tv-accent); }
.tv-preview.is-on .tv-bars { animation: tv-shake .09s linear infinite; }
.tv-strength { margin-top: 14px; }
.tv-strength svg { color: var(--tv-accent); margin-right: 4px; }

/* ---- detection ---- */
.tv-detect { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 10px; }
.tv-detect > div { padding: 10px 12px; border-radius: 12px; background: var(--tv-surface-2); border: 1px solid var(--tv-line); min-width: 0; }
.tv-detect dt { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tv-muted); }
.tv-detect dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.tv-detect dd.is-ok { color: var(--tv-good); }
.tv-detect dd.is-bad { color: var(--tv-bad); }

/* ---- explainer ---- */
.tv-help ul { padding-left: 20px; margin: 0 0 10px; }
.tv-help li { margin-bottom: 6px; line-height: 1.5; }
.tv-sources { border-top: 1px solid var(--tv-line); padding-top: 10px; margin-top: 12px; }

/* ---- phones ---- */
@media (max-width: 720px) {
    .tv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tv-sliders { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
    .tv-main { padding-top: 22px; }
    .tv-card { padding: 14px; border-radius: 18px; }
    .tv-desktop-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .tv-step { padding: 12px 12px 12px 46px; }
    .tv-step::before { left: 10px; top: 11px; }
    .tv-ask-btns .tv-btn { flex: 1 1 0; min-width: 0; }
    .tv-step .tv-btn-retry, .tv-step .tv-ask { margin-left: -34px; width: calc(100% + 34px); }
}
@media (max-width: 380px) {
    .tv-big { width: 168px; height: 168px; }
    .tv-phone { font-size: 50px; }
    .tv-test-btn { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .tv-big.is-on .tv-ring { animation-duration: 1.4s; }
    .tv-big.is-on .tv-phone, .tv-test-btn.is-on .tv-test-ic, .tv-preview.is-on .tv-bars, .tv-step.is-on h3 svg, .tv-brand-card.is-on h3 svg { animation: none; transform: scale(1.08); }
}
