/* Falcon Eye app — styles. Tokens come from assets/tokens.css */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
html[lang="ar"] .en, html[lang="en"] .ar { display: none !important; }
html[data-theme="dark"] .th-light, html[data-theme="light"] .th-dark { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.latin { font-family: var(--font-latin); }
.muted { color: var(--text-muted); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
html[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- device frame on desktop ---------- */
.stage { min-height: 100%; display: grid; place-items: center; }
.device { position: relative; width: 100%; height: 100dvh; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }
@media (min-width: 600px) {
  body { background: color-mix(in srgb, var(--bg) 70%, #000); }
  html[data-theme="light"] body { background: #E2E6E1; }
  .device { width: 400px; height: min(860px, 94dvh); border-radius: 46px; border: 10px solid #000; box-shadow: var(--shadow-3); }
  .stage-note { position: fixed; bottom: 16px; inset-inline-start: 16px; font-size: 12px; color: var(--text-subtle); max-width: 260px; }
}
@media (max-width: 599px) { .stage-note { display: none; } }

/* ---------- top bar ---------- */
.topbar { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; min-height: 60px; }
.topbar h1 { font-size: 20px; font-weight: 700; margin: 0; flex: 1; line-height: 1.2; }
.topbar .sub { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.topbar img.logo { height: 26px; }
.topbar .sp { flex: 1; }
.ibtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; position: relative; transition: background-color var(--dur-fast); }
.ibtn:active { background: var(--surface-hover); }
@media (hover: hover) { .ibtn:hover { background: var(--surface-hover); } }
.ibtn .dot { position: absolute; top: 8px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--live); border: 2px solid var(--bg); }

/* ---------- screens ---------- */
.view { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 4px 16px 24px; }
.view.enter { animation: viewIn var(--dur-base) var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 18px)); } }
html[dir="rtl"] .view.enter { --dir: -1; }
.view.back { animation-name: viewBack; }
@keyframes viewBack { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * -18px)); } }
.view.flush { padding: 0 0 24px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 10px; }
.section-title h2 { font-size: 15px; font-weight: 600; margin: 0; }
.section-title a, .section-title button { font-size: 13px; color: var(--text-muted); }

/* ---------- tab bar ---------- */
.tabbar { flex: none; display: flex; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 500; color: var(--text-subtle); position: relative; transition: color var(--dur-fast); }
.tabbar a svg.i { width: 24px; height: 24px; transition: transform var(--dur-base) var(--ease-snap); }
.tabbar a.on { color: var(--text); }
.tabbar a.on svg.i { transform: translateY(-1px); color: var(--accent-text); }
.tabbar a .badge-n { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; background: var(--live); color: #fff; font: 700 10px/16px var(--font-latin); text-align: center; }
html[dir="rtl"] .tabbar a .badge-n { left: auto; right: calc(50% + 6px); }

/* ---------- buttons / chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 20px; border-radius: 14px; font-weight: 600; font-size: 16px; transition: background-color var(--dur-fast), transform var(--dur-instant); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { border: 1px solid var(--border-strong); }
.btn-ghost { color: var(--text-muted); }
.btn-block { width: 100%; }
.btn svg.i { width: 19px; height: 19px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--text-muted); transition: all var(--dur-fast); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font: 600 11px var(--font); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.lime { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.badge.live i { background: var(--live); animation: pulse 1.6s infinite; }
.badge.warn { color: var(--warning); }
.badge.err { color: var(--danger); }
.badge.proc i { background: none; border: 1.5px solid currentColor; border-inline-end-color: transparent; animation: spin .8s linear infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.clip-row { display: grid; grid-template-columns: 104px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; transition: transform var(--dur-instant), border-color var(--dur-fast); }
.clip-row:active { transform: scale(.985); }
@media (hover: hover) { .clip-row:hover { border-color: var(--border-strong); } }
.thumb { aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; position: relative; background: #1C2327; }
.thumb svg { width: 100%; height: 100%; display: block; }
.thumb .d { position: absolute; bottom: 5px; inset-inline-end: 5px; font: 700 10px var(--font-latin); padding: 2px 6px; border-radius: 99px; background: rgb(10 13 15 / .78); color: #F3F5F2; direction: ltr; }
.clip-row b { display: block; font-size: 15px; font-weight: 600; }
.clip-row small { font-size: 12px; color: var(--text-muted); }
.clip-row .chev { color: var(--text-subtle); }
.night { font-size: 12px; font-weight: 600; color: var(--text-subtle); margin: 18px 4px 8px; }

/* ---------- player ---------- */
.player { position: relative; background: #000; user-select: none; }
.player .scene-wrap { position: relative; aspect-ratio: 16/10; background: #1C2327; overflow: hidden; }
.player svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform var(--dur-slow) var(--ease-out); }
.player.angle-b svg.scene { transform: scaleX(-1); }
.player .bracket { position: absolute; width: 20%; height: 30%; --c: var(--fe-lime); --l: 10px; background: linear-gradient(var(--c),var(--c)) top left / var(--l) 2px, linear-gradient(var(--c),var(--c)) top left / 2px var(--l), linear-gradient(var(--c),var(--c)) top right / var(--l) 2px, linear-gradient(var(--c),var(--c)) top right / 2px var(--l), linear-gradient(var(--c),var(--c)) bottom left / var(--l) 2px, linear-gradient(var(--c),var(--c)) bottom left / 2px var(--l), linear-gradient(var(--c),var(--c)) bottom right / var(--l) 2px, linear-gradient(var(--c),var(--c)) bottom right / 2px var(--l); background-repeat: no-repeat; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity var(--dur-base); }
.player.near-goal .bracket { opacity: 1; }
.player .ov-top { position: absolute; top: 10px; inset-inline: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.player .tag { font: 600 11px var(--font); padding: 4px 9px; border-radius: 99px; background: rgb(10 13 15 / .75); color: #F3F5F2; }
.player .slow-tag { background: var(--fe-lime); color: var(--fe-obsidian); font-family: var(--font-latin); opacity: 0; transition: opacity var(--dur-base); }
.player.slow .slow-tag { opacity: 1; }
.player .big { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: var(--fe-lime); display: grid; place-items: center; transition: opacity var(--dur-fast), transform var(--dur-base) var(--ease-snap); }
.player .big svg { width: 24px; height: 24px; fill: var(--fe-obsidian); margin-left: 4px; }
.player.playing .big { opacity: 0; transform: scale(.8); pointer-events: none; }
.player .ctrl { direction: ltr; padding: 10px 14px 12px; background: #0A0D0F; color: #F3F5F2; }
.scrub { position: relative; height: 24px; touch-action: none; cursor: pointer; }
.scrub .rail, .scrub .fill { position: absolute; top: 10px; height: 4px; border-radius: 2px; left: 0; }
.scrub .rail { right: 0; background: rgb(255 255 255 / .2); }
.scrub .fill { background: var(--fe-lime); width: 0; }
.scrub .knob { position: absolute; top: 5px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; left: 0; }
.scrub .mk { position: absolute; top: 4px; width: 2px; height: 16px; background: #fff; border-radius: 1px; }
.scrub .mk::after { content: "GOAL"; position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font: 700 9px var(--font-latin); color: var(--fe-lime); letter-spacing: .08em; }
.ctrl-row { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.ctrl-row button { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.ctrl-row button:active { background: rgb(255 255 255 / .12); }
.ctrl-row svg.i { width: 20px; height: 20px; }
.ctrl-row .time { font: 600 12px var(--font-latin); color: #C9D0D3; margin: 0 6px; font-variant-numeric: tabular-nums; }
.ctrl-row .sp { flex: 1; }
.ctrl-row .pill { width: auto; height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid rgb(255 255 255 / .25); font: 700 12px var(--font-latin); }
.ctrl-row .pill.on { background: var(--fe-lime); color: var(--fe-obsidian); border-color: var(--fe-lime); }
.player:fullscreen { display: flex; flex-direction: column; justify-content: center; }

.clip-head { padding: 16px; }
.clip-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.clip-head p { margin: 0; color: var(--text-muted); font-size: 14px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.meta-list { margin: 16px; }
.meta-list > div { display: flex; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.meta-list > div:last-child { border-bottom: 0; }
.meta-list span:first-child { color: var(--text-muted); }

/* ---------- operator ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { padding: 14px; }
.kpi .l { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.kpi .l svg.i { width: 16px; height: 16px; color: var(--accent-text); }
.kpi b { display: block; font: 700 26px var(--font-latin); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--text-muted); }
.pitch-card { overflow: hidden; margin-bottom: 10px; transition: transform var(--dur-instant); display: block; }
.pitch-card:active { transform: scale(.985); }
.pitch-card .live-scene { aspect-ratio: 16/7; position: relative; background: #1C2327; }
.pitch-card .live-scene svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pitch-card .live-scene .badge { position: absolute; z-index: 2; top: 10px; inset-inline-start: 10px; background: rgb(10 13 15 / .78); border-color: transparent; color: #F3F5F2; }
.pitch-card .off { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; background: rgb(10 13 15 / .7); color: #F3F5F2; font-size: 13px; font-weight: 600; gap: 6px; align-content: center; }
.pitch-card .off svg.i { color: var(--danger); margin: 0 auto; }
.pitch-card .row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
.pitch-card .row b { font-size: 15px; }
.pitch-card .row small { display: block; font-size: 12px; color: var(--text-muted); }
.devs { display: flex; gap: 6px; }
.dev { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-muted); position: relative; }
.dev svg.i { width: 15px; height: 15px; }
.dev::after { content: ""; position: absolute; top: -3px; inset-inline-end: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.dev.warn::after { background: var(--warning); }
.dev.err::after { background: var(--danger); }
.dev-list > div { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dev-list > div:last-child { border-bottom: 0; }
.dev-list .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.dev-list b { font-size: 14px; display: block; }
.dev-list small { font-size: 12px; color: var(--text-muted); }
.dev-list .end { margin-inline-start: auto; text-align: end; }
.batt { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--font-latin); direction: ltr; }
.batt span { width: 26px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; padding: 1px; display: inline-block; }
.batt span i { display: block; height: 100%; background: currentColor; border-radius: 1px; }
.alert { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 14px; margin-bottom: 8px; }
.alert .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); }
.alert.err .ic { color: var(--danger); } .alert.warn .ic { color: var(--warning); } .alert.ok .ic { color: var(--accent-text); }
.alert b { display: block; font-size: 14px; }
.alert p { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.alert small { font: 500 11px var(--font-latin); color: var(--text-subtle); }
.alert.unread { border-color: var(--border-strong); }
.alert.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-inline-start: 8px; vertical-align: middle; }

/* ---------- settings ---------- */
.list { overflow: hidden; }
.list > * { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); min-height: 54px; width: 100%; text-align: start; }
.list > *:last-child { border-bottom: 0; }
.list .end { margin-inline-start: auto; color: var(--text-muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); transition: all var(--dur-fast); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background-color var(--dur-base); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start var(--dur-base) var(--ease-snap); }
.switch.on { background: var(--accent); }
.switch.on::after { inset-inline-start: 21px; background: var(--fe-obsidian); }

/* ---------- onboarding ---------- */
.onb { position: absolute; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); }
.onb .top { display: flex; justify-content: space-between; align-items: center; }
.onb .top img { height: 26px; }
.onb .slides { flex: 1; display: grid; align-content: center; }
.onb .slide { display: none; text-align: center; animation: viewIn var(--dur-slow) var(--ease-out); }
.onb .slide.on { display: block; }
.onb .art { width: 220px; height: 220px; margin: 0 auto 36px; position: relative; display: grid; place-items: center; }
.onb h2 { font-size: 32px; line-height: 1.2; margin: 0 0 12px; font-weight: 700; }
.onb h2 em { font-style: normal; color: var(--accent-text); }
.onb p { margin: 0 auto; color: var(--text-muted); max-width: 30ch; font-size: 16px; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 20px 0; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--border-strong); transition: width var(--dur-base) var(--ease-out), background-color var(--dur-base); }
.dots i.on { width: 22px; background: var(--accent); }
html[data-theme="light"] .dots i.on { background: var(--text); }
.role { display: grid; gap: 10px; }
.role button { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 1.5px solid var(--border); text-align: start; transition: border-color var(--dur-fast); }
.role button:active { border-color: var(--accent); }
.role button .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent-text); }
.role button b { display: block; font-size: 16px; }
.role button small { color: var(--text-muted); font-size: 13px; }
.press { width: 180px; height: 180px; border-radius: 50%; background: var(--fe-obsidian); box-shadow: inset 0 0 0 7px var(--fe-lime); display: grid; place-items: center; position: relative; }
.press img { width: 78px; }
.press::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--fe-lime); animation: ring 2s var(--ease-out) infinite; }
@keyframes ring { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.3); } }

/* ---------- empty + toast + sheet ---------- */
.empty { text-align: center; padding: 56px 20px; }
.empty .ic { width: 64px; height: 64px; border-radius: 50%; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; margin: 0 auto 16px; color: var(--text-muted); }
.empty b { display: block; font-size: 18px; margin-bottom: 6px; }
.empty p { margin: 0 auto 18px; color: var(--text-muted); font-size: 14px; max-width: 28ch; }
.toast { position: absolute; z-index: 50; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--fe-graphite); color: var(--fe-offwhite); border: 1px solid #2E373D; box-shadow: var(--shadow-2); font-size: 14px; animation: toastIn var(--dur-base) var(--ease-snap); }
.toast.out { animation: toastOut var(--dur-base) var(--ease-out) forwards; }
.toast svg.i { color: var(--fe-lime); width: 20px; height: 20px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
.sheet-bg { position: absolute; inset: 0; z-index: 40; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity var(--dur-base); }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
.sheet { position: absolute; z-index: 41; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform var(--dur-base) var(--ease-out); }
.sheet.open { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet p { margin: 0 0 16px; color: var(--text-muted); font-size: 14px; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.share-grid button { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); padding: 8px 0; border-radius: 12px; }
.share-grid button:active { background: var(--surface-hover); }
.share-grid span.c { width: 52px; height: 52px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; color: var(--text); }
.linkbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); font: 500 13px var(--font-mono); direction: ltr; }
.linkbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbox .btn { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 9px; font-family: var(--font); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
