/* PlaySubtitle Web. Tokens are the playsubtitle.com tokens (src/styles/globals.css); one accent colour. */
:root {
  --bg: #1d1106; --bg-deep: #140c04; --surface: #26160c; --raised: #2e1b0f; --control: #2a170b; --media: #0d0703;
  --text: #fcf1e1; --text2: #d8c7b7; --muted: #b0a292;
  --accent: #fd8251; --accent-hover: #ff9a70; --accent-pressed: #e06a38; --on-accent: #140c04;
  --border: rgb(253 130 81 / .28); --border-subtle: rgb(252 241 225 / .12); --border-strong: rgb(252 241 225 / .28);
  --notice: #33200f; --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --pill: 999px;
  --font: "IBM Plex Sans Thai", "Segoe UI", "Leelawadee UI", "Noto Sans Thai", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
[hidden] { display: none !important; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 6px 12px; border-radius: var(--pill); z-index: 50; }
.skip:focus { left: 8px; }
.spacer { flex: 1; }

/* header */
.top { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border-subtle); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }
.brand img { border-radius: 7px; }
/* player screen: the video's name (short, the whole name on hover, inside the bar) and the subtitle status */
.top .player-only { display: none; }
body[data-screen="s-player"] .top .player-only { display: inline-flex; }
.head-sep { width: 1px; height: 22px; background: var(--border-subtle); flex: none; }
.head-file { flex: 0 1 auto; min-width: 0; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px; border: 0; border-radius: var(--pill);
  background: none; color: var(--text2); font: 14px var(--font); cursor: pointer; transition: background .15s, color .15s; }
.head-file .arrow { flex: none; color: var(--muted); transition: color .15s, transform .15s; }
.head-file .name { display: block; min-width: 0; max-width: 44ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: max-width .3s ease; }
.head-file:hover, .head-file:focus-visible { background: var(--raised); color: var(--text); }
.head-file:hover .arrow, .head-file:focus-visible .arrow { color: var(--accent); transform: translateX(-2px); }
.head-file:hover .name, .head-file:focus-visible .name { max-width: 160ch; }
.head-ready { flex: none; }
.head-ready .orb { width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--pill); font: 13px var(--font);
  background: var(--control); border: 1px solid var(--border-subtle); color: var(--text2); white-space: nowrap; }
button.chip { cursor: pointer; }
.ring { width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--accent) 0 var(--p, 0%), rgb(252 241 225 / .15) var(--p, 0%) 100%);
  -webkit-mask: radial-gradient(circle 5px, transparent 98%, #000 100%); mask: radial-gradient(circle 5px, transparent 98%, #000 100%); }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 3px 8px; border-radius: var(--pill); border: 1px solid var(--border-strong); color: var(--text2); }
.badge.pro { border-color: var(--accent); color: var(--accent); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--raised); border: 1px solid var(--border-strong); color: var(--text); font: 600 13px var(--font); cursor: pointer; }
.menu-wrap, .pop-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 38px; min-width: 200px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 12px; padding: 6px; z-index: 20; box-shadow: 0 18px 40px rgb(0 0 0 / .5); }
.menu-head { font-size: 12px; color: var(--muted); padding: 6px 10px; }
.menu button { width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: 14px var(--font); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--raised); }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14px var(--font); padding: 10px 20px; border-radius: var(--pill);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); } .btn.primary:active { background: var(--accent-pressed); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
select { font: 14px var(--font); color: var(--text); background: var(--control); border: 1px solid var(--border); border-radius: var(--r-md); padding: 9px 12px; max-width: 100%; }
.label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field { display: block; margin-bottom: 16px; }
.field select { width: 100%; }
.switch { appearance: none; width: 40px; height: 22px; border-radius: var(--pill); background: var(--border-strong); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text2); transition: left .2s; }
.switch:checked { background: var(--accent); } .switch:checked::after { left: 21px; background: var(--on-accent); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--text2); font: 13px var(--font); padding: 5px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* setup cards */
.center { display: grid; place-items: center; padding: 48px 20px; min-height: calc(100vh - 56px); }
.card { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 32px; }
.card h1 { font-size: 24px; margin: 6px 0; line-height: 1.3; }
.card p { margin: 0 0 18px; color: var(--text2); }
.steps { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.steps i { width: 22px; height: 4px; border-radius: 4px; background: var(--border-strong); } .steps i.on { background: var(--accent); }
.steps span { margin-left: 4px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.checks li:last-child { border-bottom: 1px solid var(--border-subtle); }
.tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgb(253 130 81 / .14); color: var(--accent); font-weight: 600; flex: none; }
.tick.no { background: var(--raised); color: var(--muted); }
.checks b { display: block; } .checks span.sub { color: var(--muted); font-size: 13px; }
.result { margin: 18px 0; padding: 12px 14px; border-radius: var(--r-md); background: rgb(253 130 81 / .1); border: 1px solid var(--border); font-size: 14px; }
.signed { display: flex; align-items: center; gap: 10px; background: var(--control); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 10px 14px; font-size: 14px; min-height: 46px; }
.dev-plan { margin-top: 10px; }
.notice { display: flex; gap: 10px; background: var(--notice); border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; color: var(--text2) !important; margin: 6px 0 18px !important; }
.notice .i { color: var(--accent); font-weight: 600; }
.opts { display: grid; gap: 10px; margin-top: 6px; }
.opt { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border-subtle); border-radius: var(--r-md); background: var(--control); }
.opt img { border-radius: 8px; } .opt .t { flex: 1; font-size: 14px; color: var(--text2); } .opt .t b { display: block; color: var(--text); }

/* home */
.drop { margin: 36px auto 22px; max-width: 720px; border: 2px dashed var(--border); border-radius: 22px; padding: 46px 24px; text-align: center; background: rgb(253 130 81 / .04); }
.drop.over { background: rgb(253 130 81 / .12); border-color: var(--accent); }
.drop svg { color: var(--accent); } .drop .big { font-size: 26px; font-weight: 600; margin: 12px 0 4px; }
.drop .or { color: var(--muted); margin: 10px 0 14px; font-size: 14px; } .drop .fine { margin-top: 14px; font-size: 12px; color: var(--muted); }
.promo { max-width: 720px; margin: 0 auto 36px; display: flex; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); padding: 16px 18px; }
.promo .t { flex: 1; font-size: 14px; color: var(--text2); } .promo .t b { display: block; color: var(--text); font-size: 15px; }
.orb { width: 18px; height: 18px; border-radius: 50%; flex: none; } .orb.mid { width: 34px; height: 34px; } .orb.big { width: 40px; height: 40px; }

/* player */
.player { padding: 0; }
.stage { position: relative; width: 100%; height: calc(100vh - 56px); min-height: 360px; background: #000; overflow: hidden; }
.stage:fullscreen { height: 100vh; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.stage:not(.idle) .overlay { --ps-sub-bottom: max(9.5%, 84px); }   /* above the control bar while it shows */
.hold-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 18px; border-radius: var(--pill); background: rgb(20 12 4 / .78); border: 1px solid var(--border-subtle);
  color: var(--text); font-size: 14px; white-space: nowrap; }
.hold-note button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: var(--pill); padding: 6px 14px; font: 600 13px var(--font); cursor: pointer; }
.hold-note button:hover { background: var(--accent-hover); }
.hold-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: hold-pulse 1.2s ease-in-out infinite; }
@keyframes hold-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.hold-note.ask .hold-dot { display: none; }
.controls { position: absolute; left: 14px; right: 14px; bottom: 12px; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: rgb(29 17 6 / .88); backdrop-filter: blur(14px); border: 1px solid var(--border-subtle); border-radius: 14px; transition: opacity .3s; }
.controls img { border-radius: 5px; }
.stage.idle .controls { opacity: 0; } .stage.idle { cursor: none; }
.ctl { background: none; border: 0; color: var(--text); font-size: 15px; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.ctl:hover { background: var(--raised); }
.time { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.seek { position: relative; flex: 1; height: 36px; cursor: pointer; }
.seek canvas { width: 100%; height: 100%; display: block; }
.tip { position: absolute; bottom: 38px; transform: translateX(-50%); font-size: 11px; color: var(--text2); background: var(--raised); border: 1px solid var(--border-subtle); padding: 3px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.lang { font-size: 12px; padding: 5px 10px; cursor: pointer; }
.aa { font: 600 14px var(--font); border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 7px; color: var(--text); background: none; cursor: pointer; }
.pop { position: absolute; right: 0; bottom: 46px; width: 280px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 14px; padding: 14px; display: grid; gap: 10px; font-size: 13px; z-index: 10; box-shadow: 0 18px 40px rgb(0 0 0 / .5); }
.pop h2 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.pop .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pop select { padding: 5px 8px; font-size: 13px; max-width: 150px; }
.lock { font-size: 11px; color: var(--accent); font-weight: 600; letter-spacing: .05em; }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; padding: 0; }
.swatches button[aria-pressed="true"] { border-color: var(--text); }
.swatches button:disabled { opacity: .4; cursor: not-allowed; }
.swatches input.custom { width: 24px; height: 24px; padding: 0; border: 2px solid var(--border-strong); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.swatches input.custom[aria-pressed="true"] { border-color: var(--text); }
.swatches input.custom:disabled { opacity: .4; cursor: not-allowed; }
.swatches input.custom::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input.custom::-webkit-color-swatch { border: 0; border-radius: 50%; }
.range { display: inline-flex; align-items: center; gap: 8px; }
.range input { width: 120px; accent-color: var(--accent); }
.range input:disabled { opacity: .5; }
.range output { min-width: 3.2em; text-align: right; color: var(--text2); font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(560px, 92vw); background: var(--raised); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; font-size: 14px; z-index: 60; box-shadow: 0 12px 30px rgb(0 0 0 / .45); }
.free-card { position: fixed; right: 24px; bottom: 96px; width: min(420px, 92vw); background: var(--raised); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; z-index: 61; box-shadow: 0 12px 30px rgb(0 0 0 / .45); }
.free-card p { margin: 6px 0 10px; font-size: 14px; color: var(--text2); }
.free-card .x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--text2); font-size: 20px; cursor: pointer; }
.free-card .all { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--text2); }
@media (max-width: 700px) {
  .top { padding: 0 12px; gap: 8px; } .time { display: none; } .controls { gap: 6px; padding: 0 8px; }
  body[data-screen="s-player"] .top .brand-name, body[data-screen="s-player"] .top .head-sep { display: none; }
  .head-file .name { max-width: 22ch; } .head-ready { padding: 6px; } .head-ready #readyText { display: none; }
  .card { padding: 22px; } .drop { padding: 30px 16px; margin: 20px 16px; } .promo { margin: 0 16px 24px; }
  .hold-note { white-space: normal; width: max-content; max-width: calc(100% - 32px); font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
