/* Studio — phong cách phòng chiếu. Mobile-first, không framework. */
:root {
  --bg: #0b0b0d;
  --bg-2: #121216;
  --panel: #16161b;
  --panel-2: #1d1d24;
  --line: #2a2a33;
  --text: #f1ede4;
  --muted: #a39d92;
  --gold: #f5b301;
  --gold-2: #ffcb3d;
  --gold-ink: #1a1200;
  --tenant: #e4002b;
  --ok: #4cc38a;
  --info: #6aa8ff;
  --danger: #ff5a5f;
  --radius: 14px;
  --font-head: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 64px;
  --maxw: 1120px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% -10%, #1c1710 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--gold-2); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.sm { font-size: .85rem; }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic.xl { width: 44px; height: 44px; stroke-width: 1.5; color: var(--muted); }

/* ---------- film grain + vignette (tĩnh, rẻ) ---------- */
.fx-grain, .fx-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.fx-grain {
  opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.fx-vignette { background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; min-height: 60px;
  background: rgba(8, 8, 10, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar::after { /* lỗ phim */
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 8px, rgba(245, 179, 1, .22) 8px 16px) 0 50% / 100% 3px no-repeat, #050506;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; flex: 1; }
.topbar-logo { display: grid; place-items: center; height: 38px; padding: 4px 8px; background: #fff; border-radius: 8px; flex: none; }
.topbar-logo img { height: 30px; width: auto; max-width: 80px; object-fit: contain; }
img.topbar-logo.sm { height: 30px; max-width: 80px; object-fit: contain; padding: 3px 6px; margin-left: auto; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text); text-decoration: none; padding: 8px 10px 8px 4px; margin-left: -4px; font-weight: 600; min-height: 44px; }
.topbar-code { font-family: var(--font-head); letter-spacing: .12em; color: var(--muted); font-size: .9rem; }
.mock-pill { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-ink); background: var(--gold); border-radius: 99px; padding: 3px 9px; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: center;
  padding: 6px 8px calc(6px + var(--safe-b)); background: rgba(8, 8, 10, .95); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabbar a { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-height: 52px;
  color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600; border-radius: 12px; }
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a.on { color: var(--gold); }
.tabbar a.on .ic { filter: drop-shadow(0 0 6px rgba(245, 179, 1, .45)); }

/* ---------- layout ---------- */
#app { position: relative; z-index: 1; outline: none; }
.page, .script { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px calc(var(--tabbar-h) + 28px + var(--safe-b)); }
.page-title { font-family: var(--font-head); font-weight: 600; font-size: 1.7rem; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 6px; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; font-family: var(--font-head); font-weight: 500; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text); }
.sec-title > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.sec-title > span:first-child::before { content: ''; width: 18px; height: 3px; background: var(--gold); border-radius: 2px; }
.sec-title .muted { margin-left: auto; font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: .85rem; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--panel-2); color: var(--text); font: 700 .78rem var(--font-body); letter-spacing: 0; }
.sec-title .count { background: var(--tenant); color: #fff; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 16px; margin-top: 20px; }
.card > .sec-title:first-child { margin-top: 14px; }
.quiet { color: var(--muted); padding: 14px 0; display: flex; gap: 8px; align-items: flex-start; }
.quiet .ic { color: var(--ok); margin-top: 3px; }
.boot { display: grid; place-items: center; gap: 14px; padding: 80px 16px; color: var(--muted); }
.boot-reel { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold);
  background: radial-gradient(circle, var(--bg) 0 4px, transparent 5px), conic-gradient(from 0deg, transparent 0 20%, #26262e 20% 30%, transparent 30% 53%, #26262e 53% 63%, transparent 63% 86%, #26262e 86% 96%, transparent 96%);
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { display: grid; justify-items: center; gap: 14px; padding: 60px 16px; text-align: center; color: var(--muted); }
.credit { text-align: center; margin: 44px 0 0; color: var(--muted); font-size: .82rem; }
.credit-line { display: block; width: 60px; height: 2px; margin: 0 auto 12px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.credit b { color: var(--text); font-weight: 600; }
.credit small { display: block; margin-top: 2px; opacity: .8; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background .15s ease, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); box-shadow: 0 6px 20px -8px rgba(245, 179, 1, .7); }
.btn-outline { background: transparent; color: var(--text); border-color: #4a4a55; }
.btn-ghost { background: transparent; color: var(--muted); border: 0; }
.btn-text { background: transparent; color: var(--muted); border: 0; padding: 0 10px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 20px; height: 20px; border: 2.5px solid rgba(0, 0, 0, .35); border-top-color: #000; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-danger.loading::after { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.link { background: none; border: 0; padding: 0; color: var(--gold-2); text-decoration: underline; font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 2px; border-radius: 4px; border: 1px solid currentColor;
  font: 600 .72rem/1.4 var(--font-head); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.badge.tone-action { color: var(--gold); background: rgba(245, 179, 1, .1); }
.badge.tone-work { color: var(--info); background: rgba(106, 168, 255, .08); }
.badge.tone-done { color: var(--ok); background: rgba(76, 195, 138, .08); }
.badge.tone-off { color: #8a8580; }
.rec { width: 7px; height: 7px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 6px #ff3b3b; animation: blink 1.4s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 0 0 calc(20px + var(--safe-b)); }
.letterbox { height: 7vh; max-height: 64px; background: #000; flex: none; }
.letterbox.top { margin-bottom: auto; box-shadow: 0 6px 30px rgba(0, 0, 0, .6); }
.letterbox.bottom { margin-top: auto; }
.login-inner { width: 100%; max-width: 380px; margin: 0 auto; padding: 24px 20px 12px; text-align: center; }
.marquee { position: relative; padding: 22px 16px 18px; margin-bottom: 18px; }
.marquee::before { content: ''; position: absolute; inset: 0; border-radius: 18px; border: 1px solid rgba(245, 179, 1, .35);
  background: radial-gradient(80% 100% at 50% 0%, rgba(245, 179, 1, .12), transparent 70%);
  -webkit-mask: radial-gradient(circle at 50% 0, #000 0 100%); }
.marquee-logo { display: inline-grid; place-items: center; background: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8); }
.marquee-logo img { height: 54px; width: auto; max-width: 200px; object-fit: contain; }
.marquee h1 { margin-top: 14px; font-family: var(--font-head); font-weight: 700; font-size: 2.1rem; text-transform: uppercase; letter-spacing: .04em; line-height: 1.3; }
.tagline { color: var(--gold-2); font-style: italic; margin-top: 2px; }
.login-hint { color: var(--muted); }
.login-hint b { color: var(--text); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #5a5a66; transition: background .12s, border-color .12s, transform .12s; }
.pin-dots i.on { background: var(--gold); border-color: var(--gold); transform: scale(1.1); box-shadow: 0 0 10px rgba(245, 179, 1, .5); }
.pin-dots.busy i { animation: pulse .8s ease-in-out infinite alternate; }
.pin-dots.busy i:nth-child(2n) { animation-delay: .2s; }
@keyframes pulse { to { opacity: .35; } }
.pin-dots.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 15%, 85% { transform: translateX(-3px); } 30%, 70% { transform: translateX(6px); } 45% { transform: translateX(-9px); } 55% { transform: translateX(9px); } }
.pin-msg { min-height: 1.6em; font-size: .92rem; color: var(--muted); }
.pin-msg.err { color: #ff8a8d; }
.pin-msg.ok { color: var(--ok); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px auto 0; max-width: 320px; }
.keypad button { height: 66px; border-radius: 18px; border: 1px solid #2e2e38; background: linear-gradient(180deg, #1c1c22, #141418);
  font: 500 1.75rem var(--font-head); color: var(--text); touch-action: manipulation; transition: background .1s, transform .08s; }
.keypad button:active { background: #2a2a33; transform: scale(.95); }
.keypad button.kp-fn { font: 600 .95rem var(--font-body); color: var(--muted); background: transparent; border-color: transparent; }
.keypad button.kp-fn .ic { width: 26px; height: 26px; }
.keypad button[disabled] { opacity: .4; }
.login-help { margin-top: 18px; color: var(--muted); font-size: .85rem; }
.login .credit { margin-top: 14px; }

/* ---------- wallet strip ---------- */
.wallet-strip { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; text-decoration: none; color: var(--text);
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wallet-strip > div { background: var(--panel); padding: 10px 12px; min-width: 0; }
.wallet-strip small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.wallet-strip b { display: block; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wallet-strip .held { color: var(--info); }
.wallet-strip .avail { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-right: 34px;
  background: linear-gradient(180deg, rgba(245, 179, 1, .12), rgba(245, 179, 1, .04)), var(--panel); }
.wallet-strip .avail b { color: var(--gold-2); font: 700 1.5rem var(--font-head); letter-spacing: .02em; }
.wallet-strip .chev { top: 28px; }
.wallet-strip .chev { position: absolute; right: 12px; transform: translateY(-50%); color: var(--muted); font-size: 1.4rem; }

/* ---------- needs ---------- */
.needs-list { display: grid; gap: 14px; }
.needs-card { display: flex; gap: 14px; padding: 12px; text-decoration: none; color: var(--text); border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(245, 179, 1, .14), rgba(245, 179, 1, .02) 60%), var(--panel);
  border: 1px solid rgba(245, 179, 1, .45); box-shadow: 0 10px 30px -18px rgba(245, 179, 1, .6); }
.needs-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; flex: 1; }
.needs-body h3 { font-family: var(--font-head); font-weight: 600; font-size: 1.3rem; line-height: 1.3; }
.needs-do { font-size: .9rem; color: #d9d3c7; }
.needs-body .btn { margin-top: auto; }
.thumb { display: grid; place-items: center; flex: none; overflow: hidden; background: #000; border-radius: 8px; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.poster { width: 96px; aspect-ratio: 9 / 16; align-self: flex-start; box-shadow: 0 0 0 1px #000, 0 8px 18px -6px #000; }
.thumb.mini { width: 54px; aspect-ratio: 9 / 16; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; margin: 28px 0 14px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }

/* ---------- script list ---------- */
.script-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.script-row { display: flex; gap: 12px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color .15s; }
.script-row:hover { border-color: #3c3c48; }
.row-body { min-width: 0; flex: 1; display: grid; gap: 3px; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.code { font: 500 .78rem var(--font-head); letter-spacing: .14em; color: var(--muted); white-space: nowrap; }
.row-body h3 { font-size: 1.02rem; font-weight: 600; }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .82rem; }
.row-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- video grid ---------- */
.video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 14px; }
.video-card { display: flex; flex-direction: column; gap: 6px; text-align: left; background: none; border: 0; padding: 0; color: var(--text); }
.poster { position: relative; display: block; width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px #24242c, 0 10px 24px -12px #000; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .play { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); border: 2px solid rgba(255, 255, 255, .85); color: #fff; backdrop-filter: blur(2px); }
.poster .play .ic { width: 22px; height: 22px; fill: currentColor; stroke: none; margin-left: 3px; }
.poster .dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .75); font-size: .75rem; font-weight: 600; }
.vc-title { font-weight: 600; font-size: .92rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vc-meta { color: var(--muted); font-size: .78rem; }

/* ---------- script detail ---------- */
.script.has-actions { padding-bottom: calc(110px + var(--safe-b)); }
.screen { margin: -4px -16px 18px; padding: 16px 16px 12px; background: #000; box-shadow: inset 0 -1px 0 #222; }
.screen-frame { width: min(100%, calc(68vh * 9 / 16)); margin: 0 auto; aspect-ratio: 9 / 16; background: #000; border-radius: 6px; overflow: hidden; box-shadow: 0 0 60px -20px rgba(245, 179, 1, .35); }
.screen-frame video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.screen-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 420px; margin: 12px auto 0; color: var(--muted); font-size: .88rem; }
.script-head { display: grid; gap: 10px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.script-head h1 { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.9rem, 7vw, 2.8rem); line-height: 1.22; text-transform: uppercase; letter-spacing: .01em; }
.logline { font-size: 1.02rem; color: #ddd6c9; font-style: italic; border-left: 3px solid var(--tenant); padding-left: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: .84rem; color: #d7d1c6; }
.chip.product b { color: #fff; background: var(--tenant); padding: 0 6px; border-radius: 4px; font-size: .76rem; letter-spacing: .04em; }
.status-note { margin-top: 18px; padding: 12px 14px; border-radius: 12px; font-size: .93rem; background: var(--panel); border: 1px solid var(--line); }
.status-note.tone-action { border-color: rgba(245, 179, 1, .45); background: rgba(245, 179, 1, .07); }
.status-note b { color: var(--gold-2); }
.cast-list { list-style: none; margin: 0 -16px; padding: 0 16px 4px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.cast-list::-webkit-scrollbar { display: none; }
.cast-list li { flex: 0 0 132px; scroll-snap-align: start; display: grid; justify-items: center; text-align: center; gap: 2px; padding: 12px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--gold); margin-bottom: 6px; font: 700 1.4rem var(--font-head); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.cast-list b { font-size: .92rem; }
.cast-list small { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.music { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px dashed #3a3a46; }
.music > .ic { width: 26px; height: 26px; color: var(--gold); margin-top: 2px; }
.music small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.music audio { margin-top: 8px; width: 100%; height: 36px; }

/* storyboard / film strip */
.filmstrip { display: grid; gap: 22px; }
.scene { position: relative; background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  content-visibility: auto; contain-intrinsic-size: 1px 900px; }
.slate { background: #0a0a0c; }
.slate-stripes { height: 14px; background: repeating-linear-gradient(-55deg, #f1ede4 0 14px, #111 14px 28px); }
.slate-board { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 14px 10px; border-bottom: 1px solid #222; }
.slate-no { font: 700 1.35rem var(--font-head); letter-spacing: .08em; color: #fff; }
.slate-dur { font: 500 1rem var(--font-head); color: var(--gold); letter-spacing: .06em; }
.slate-dur::before { content: '· '; color: var(--muted); }
.slate-cmt { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--gold-ink); background: var(--gold); padding: 1px 8px; border-radius: 99px; }
.slate-cmt .ic { width: .95em; height: .95em; }
.slate-title { flex-basis: 100%; font-weight: 600; color: #d7d1c6; font-size: .95rem; }
.shot { position: relative; display: block; width: min(100%, calc(62vh * 9 / 16)); margin: 0 auto; padding: 0; border: 0; background: #000; aspect-ratio: 9 / 16; overflow: hidden; cursor: zoom-in; }
.shot-wrap { background: #050506; } /* nền đen hai bên như màn chiếu */
.shot img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s; }
.shot img.in, .shot img[src^="data:"] { opacity: 1; }
.shot img.broken { opacity: .15; }
.zoom-hint { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; }
.burn-sub { position: absolute; left: 6%; right: 6%; bottom: 9%; text-align: center; color: #fff; font: 700 clamp(.95rem, 4.6vw, 1.12rem)/1.3 var(--font-body);
  text-shadow: 0 0 2px #000, 0 0 2px #000, 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 2px 6px rgba(0, 0, 0, .9); pointer-events: none; }
.sub-sample span { display: inline-block; background: #000; color: #fff; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
.scene-body { display: grid; gap: 14px; padding: 16px 14px 6px; }
.field { display: grid; gap: 4px; }
.flabel { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.flabel .ic { color: var(--gold); }
.dialogue { display: grid; gap: 6px; padding-left: 12px; border-left: 2px solid var(--tenant); }
.dialogue b { color: #fff; }
.vo { font-style: italic; color: #e6dfd2; }

/* comments */
.comments { padding: 4px 14px 14px; }
.general .comments { padding: 0; }
.cmt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cmt-list:not(:empty) { margin: 6px 0 10px; }
.cmt { padding: 9px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: .92rem; }
.cmt.mine { background: rgba(245, 179, 1, .07); border-color: rgba(245, 179, 1, .25); }
.cmt-head { display: flex; align-items: center; gap: 8px; font-size: .8rem; margin-bottom: 2px; }
.cmt-head time { color: var(--muted); }
.cmt-tag { font-size: .7rem; padding: 0 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.cmt-del { margin-left: auto; min-width: 36px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.cmt-del.confirm { background: var(--danger); color: #fff; font-size: .8rem; font-weight: 700; padding: 0 10px; }
.cmt p { white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt-form { display: flex; gap: 8px; align-items: flex-end; }
.cmt-form textarea, .sheet textarea { flex: 1; width: 100%; min-height: 46px; resize: none; padding: 11px 14px; border-radius: 12px; border: 1px solid #3a3a46; background: #0e0e12; color: var(--text); font-size: 16px; line-height: 1.4; }
.cmt-form textarea:focus, .sheet textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245, 179, 1, .18); }
.send { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 0; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; }
.send[disabled] { opacity: .5; }

/* folds */
.fold { border-top: 1px solid var(--line); }
.fold:first-child { border-top: 0; }
.fold summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; cursor: pointer; list-style: none; font-weight: 600; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '▾'; color: var(--muted); transition: transform .2s; }
.fold[open] summary::after { transform: rotate(180deg); }
.fold summary b { margin-left: auto; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.charges, .versions { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.charges li { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.charges small, .versions small { display: block; color: var(--muted); font-size: .76rem; }
.charges b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.versions li { display: flex; gap: 12px; font-size: .92rem; }
.versions li > b { font: 600 .95rem var(--font-head); color: var(--muted); min-width: 30px; }
.versions li.cur > b { color: var(--gold); }

/* sticky action bar */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; gap: 8px; align-items: center; justify-content: flex-end;
  padding: 10px 12px calc(10px + var(--safe-b)); background: rgba(8, 8, 10, .96); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.actionbar::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .5; }
.actionbar .btn-outline, .actionbar .btn-gold { flex: 1; max-width: 240px; }
.actionbar .btn-text { margin-right: auto; }

/* ---------- wallet ---------- */
.balance { margin-top: 14px; padding: 20px 18px; border-radius: 18px; text-align: center;
  background: radial-gradient(120% 100% at 50% 0%, rgba(245, 179, 1, .18), transparent 70%), var(--panel); border: 1px solid rgba(245, 179, 1, .35); }
.balance > small { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; }
.balance strong { display: block; font: 700 clamp(2.2rem, 11vw, 3rem)/1.15 var(--font-head); color: var(--gold-2); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.balance-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.balance-sub div { padding: 10px; background: var(--bg-2); border-radius: 10px; }
.balance-sub small { display: flex; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: .76rem; }
.balance-sub b { font-variant-numeric: tabular-nums; }
.balance-note { margin-top: 12px; font-size: .82rem; color: var(--muted); }
.topup-grid { display: grid; gap: 16px; margin-top: 14px; }
.qr { margin: 0; justify-self: center; text-align: center; }
.qr img { width: 200px; height: 200px; object-fit: contain; background: #fff; padding: 8px; border-radius: 12px; }
.qr figcaption { margin-top: 6px; font-size: .8rem; color: var(--muted); }
.bank { display: grid; gap: 2px; }
.bank-row { display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid var(--line); }
.bank-row > span { color: var(--muted); font-size: .85rem; width: 92px; flex: none; }
.bank-row b { flex: 1; min-width: 0; overflow-wrap: break-word; font-variant-numeric: tabular-nums; }
.copy { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid #3a3a46; background: var(--panel-2); color: var(--text); font-size: .85rem; font-weight: 600; }
.bank-note { display: flex; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(245, 179, 1, .08); color: var(--gold-2); font-size: .9rem; font-weight: 600; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledger li:last-child { border-bottom: 0; }
.led-ic { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); }
.led-body { flex: 1; min-width: 0; display: grid; }
.led-body b { font-size: .95rem; font-weight: 600; }
.led-body .code { margin-left: 4px; }
.led-body small { color: var(--muted); font-size: .8rem; }
.led-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .tone-in .led-ic, .ledger .tone-in .led-amt { color: var(--ok); }
.ledger .tone-out .led-ic, .ledger .tone-out .led-amt { color: #ff8a8d; }
.ledger .tone-hold .led-ic, .ledger .tone-hold .led-amt { color: var(--info); }
.ledger .tone-release .led-ic, .ledger .tone-release .led-amt { color: #9db7d8; }
.price-table { margin: 0; display: grid; }
.price-table > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.price-table dt { font-weight: 600; }
.price-table dt small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.price-table dd { margin: 0; color: var(--gold-2); font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-flow { margin: 14px 0 0; padding-left: 20px; color: #d7d1c6; font-size: .9rem; display: grid; gap: 4px; }
.logout { margin: 24px auto 0; display: flex; }

/* ---------- sheet / theater ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0); transition: background .2s; }
.overlay.in { background: rgba(0, 0, 0, .7); }
.overlay .sheet { position: relative; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 18px calc(18px + var(--safe-b)); background: var(--panel); border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0;
  transform: translateY(100%); transition: transform .22s ease-out; }
.overlay.in .sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: #44444f; margin: 0 auto 10px; }
.sheet-title { font: 600 1.4rem var(--font-head); text-transform: uppercase; letter-spacing: .03em; padding-right: 40px; margin-bottom: 12px; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--panel-2); color: var(--text); display: grid; place-items: center; }
.sheet-body { display: grid; gap: 12px; }
.sheet-body > p { color: #ddd6c9; }
.money-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: .93rem; }
.money-box .ic { color: var(--gold); margin-top: 3px; }
.hint { padding: 10px 12px; border-left: 3px solid var(--gold); background: rgba(245, 179, 1, .06); border-radius: 0 10px 10px 0; font-weight: 600; }
.nudge { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: rgba(106, 168, 255, .08); border: 1px solid rgba(106, 168, 255, .3); font-size: .93rem; }
.nudge.ok { background: rgba(76, 195, 138, .08); border-color: rgba(76, 195, 138, .3); }
.nudge .ic { margin-top: 3px; color: var(--info); }
.nudge.ok .ic { color: var(--ok); }
.field-label { font-weight: 600; font-size: .9rem; }
.fee { display: grid; justify-items: center; gap: 2px; padding: 16px; border-radius: 14px; background: rgba(255, 90, 95, .08); border: 1px solid rgba(255, 90, 95, .35); text-align: center; }
.fee strong { font: 700 2.2rem var(--font-head); color: #ff8a8d; }
.fee small { color: var(--muted); font-size: .82rem; }
.sheet-err { color: #ff8a8d; font-weight: 600; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }
.nomoney { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.nomoney .ic.xl { color: var(--gold); }
.nomoney .sheet-actions { width: 100%; }
.overlay.theater { align-items: center; background: rgba(0, 0, 0, 0); }
.overlay.theater.in { background: rgba(0, 0, 0, .97); }
.overlay.theater .sheet { max-width: none; max-height: none; height: 100%; padding: calc(56px + var(--safe-t)) 12px calc(12px + var(--safe-b)); background: transparent; border: 0; border-radius: 0; display: grid; place-items: center; transform: scale(.97); opacity: 0; transition: transform .2s, opacity .2s; }
.overlay.theater.in .sheet { transform: none; opacity: 1; }
.overlay.theater .sheet-x { top: calc(10px + var(--safe-t)); right: 12px; background: rgba(255, 255, 255, .12); }
.theater-img { position: relative; margin: 0; height: min(100%, calc((100vw - 24px) * 16 / 9)); aspect-ratio: 9 / 16; max-width: 100%; }
.theater-img img { width: 100%; height: 100%; object-fit: contain; }
.theater-img .burn-sub { font-size: clamp(1rem, 4.8vw, 1.4rem); }
.theater-video { display: grid; gap: 12px; justify-items: center; width: 100%; height: 100%; grid-template-rows: 1fr auto; }
.theater-video video { height: 100%; max-height: calc(100vh - 150px); max-width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 6px; }
.theater-meta { display: flex; align-items: center; gap: 14px; justify-content: center; flex-wrap: wrap; text-align: center; }

/* ---------- toast ---------- */
#toast { position: fixed; z-index: 120; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); max-width: min(92vw, 460px);
  padding: 12px 18px; border-radius: 12px; background: #f1ede4; color: #111; font-weight: 600; font-size: .93rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); text-align: center; }
#toast.ok { background: var(--gold); color: var(--gold-ink); }

/* ---------- lớn hơn: tablet / desktop ---------- */
@media (min-width: 700px) {
  .page, .script { padding-left: 28px; padding-right: 28px; }
  .needs-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .script-list { grid-template-columns: repeat(2, 1fr); }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .filmstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .shot { width: 100%; }
  .screen { margin: 0 0 22px; border-radius: 18px; }
  .topup-grid { grid-template-columns: auto 1fr; align-items: start; }
  .wallet-strip { grid-template-columns: 1fr 1fr 1.3fr; }
  .wallet-strip .avail { grid-column: 3; display: block; }
  .wallet-strip .chev { top: 50%; }
  .wallet-strip > div { padding: 14px 18px; }
  .wallet-strip b { font-size: 1.15rem; }
  .cast-list { margin: 0; padding: 0 0 4px; }
  .actionbar { justify-content: center; }
  .actionbar .btn-text { margin-right: 0; }
  .wallet-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .overlay { align-items: center; }
  .overlay .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); }
  #toast { bottom: calc(110px + var(--safe-b)); }
}
@media (min-width: 1100px) {
  .filmstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tabbar { top: 0; bottom: auto; left: auto; right: 24px; width: auto; padding: 8px 0; background: transparent; border: 0; backdrop-filter: none; z-index: 41; }
  .tabbar a { flex-direction: row; min-height: 44px; padding: 0 14px; font-size: .9rem; gap: 6px; }
  .tabbar a .ic { width: 20px; height: 20px; }
  body:not([data-view=script]) .topbar { padding-right: 330px; }
  .tabbar a span { white-space: nowrap; }
  .page, .script { padding-bottom: 48px; }
  .script.has-actions { padding-bottom: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
body.modal-open #toast { bottom: auto; top: calc(16px + var(--safe-t)); }

/* ---------- nạp tiền payOS ---------- */
.btn-block { width: 100%; }
.amount-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 10px; }
.amt { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-weight: 600; font-variant-numeric: tabular-nums; transition: border-color .15s, background .15s; }
.amt.on { border-color: var(--gold); background: rgba(245, 179, 1, .12); color: var(--gold-2); }
.amt-custom { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 0 14px; min-height: 52px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.amt-custom span { color: var(--muted); font-size: .85rem; flex: none; }
.amt-custom input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; text-align: right;
  font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.amt-custom em { font-style: normal; color: var(--muted); }
.topup #topup-err { margin: 0 0 10px; }
.manual { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.manual summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 6px 0; }
.topup-sheet { display: grid; gap: 14px; }
.ts-pending { display: grid; gap: 14px; }
.qr.big img { width: min(260px, 70vw); height: auto; aspect-ratio: 1; }
.ts-info { margin: 0; display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); }
.ts-info div { display: flex; justify-content: space-between; gap: 12px; }
.ts-info dt { color: var(--muted); font-size: .88rem; }
.ts-info dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.ts-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: var(--gold-2); font-weight: 600; }
.ts-status b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.dot-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
.small { font-size: .82rem; }
.ts-done { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 10px 0 4px; }
.ts-check { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(76, 195, 138, .15); color: var(--ok); border: 2px solid var(--ok); animation: pop .35s ease-out; }
.ts-done h3 { font-family: var(--font-head); font-size: 1.6rem; letter-spacing: .02em; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (min-width: 720px) { .amount-chips { grid-template-columns: repeat(5, 1fr); } }
@media (prefers-reduced-motion: reduce) { .dot-pulse, .ts-check { animation: none; } }
.qr.void img { opacity: .15; filter: grayscale(1); }
