/* ==========================================================================
   App specific styles
   ========================================================================== */

/* ---------- calls ---------- */
.call-panel { position: fixed; bottom: calc(var(--taskbar-h) + 16px); inset-inline-end: 16px; width: 320px; height: 220px; z-index: 25000; border-radius: 16px; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #334155, #0f172a); color: #fff; box-shadow: var(--shadow); animation: pop .2s; cursor: grab; }
.call-panel.video, .call-panel.has-remote-video { width: 560px; height: 380px; }
.call-panel:fullscreen { width: 100%; height: 100%; border-radius: 0; }
.call-panel video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.call-panel.has-remote-video video.remote { display: block; }
.call-panel video.local { position: absolute; width: 28%; aspect-ratio: 4/3; top: 10px; inset-inline-end: 10px; border-radius: 10px; object-fit: cover; background: #111; display: none; border: 2px solid rgba(255,255,255,.4); }
.call-panel.video video.local { display: block; }
.call-info { position: absolute; inset: 0 0 60px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.call-panel.has-remote-video .call-info { justify-content: flex-start; align-items: flex-start; padding: 12px; inset: 0 auto auto 0; }
.call-panel.has-remote-video .call-info .avatar { display: none; }
.call-info .avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.call-status { opacity: .75; font-size: .9em; }
.call-ctl { position: absolute; bottom: 12px; inset-inline: 0; display: flex; justify-content: center; gap: 10px; }
.cbtn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(10px); transition: .15s; }
.cbtn:hover { background: rgba(255,255,255,.3); }
.cbtn.off { background: #fff; color: #111; }
.cbtn.on { background: var(--accent); }
.cbtn.end { background: #dc2626; } .cbtn.end:hover { background: #b91c1c; }
.cbtn.ok { background: #16a34a; } .cbtn.ok:hover { background: #15803d; }
.call-incoming { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 26000; background: #0f172a; color: #fff; border-radius: 18px; padding: 16px 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); animation: slideup .3s; min-width: 360px; }
.call-incoming .avatar.lg { width: 56px; height: 56px; font-size: 22px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(59,130,246,.25); } }

/* ---------- File Station ---------- */
.fs { display: flex; flex-direction: column; height: 100%; }
.fs-top { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--bg); }
.fs-crumbs { flex: 1; display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--input); overflow: hidden; min-width: 0; }
.fs-crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 5px; cursor: pointer; white-space: nowrap; color: var(--fg); }
.fs-crumbs button:hover { background: var(--hover); }
.fs-crumbs .ic { width: 12px; height: 12px; color: var(--fg2); }
[dir=rtl] .fs-crumbs .chev { transform: scaleX(-1); }
.fs-crumbs input { border: 0; outline: none; background: none; flex: 1; height: 100%; }
.fs-ribbon { display: flex; align-items: center; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--bg); flex-wrap: wrap; }
.fs-ribbon .btn { height: 30px; padding: 0 9px; }
.fs-ribbon .vsep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.fs-main { flex: 1; display: flex; min-height: 0; }
.fs-side { width: 210px; flex: none; overflow-y: auto; background: var(--bg2); border-inline-end: 1px solid var(--border); padding: 8px 6px; }
.fs-side .grp { font-size: .75em; color: var(--fg2); text-transform: uppercase; letter-spacing: .05em; padding: 10px 10px 4px; font-weight: 600; }
.fs-side button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; text-align: start; color: var(--fg); }
.fs-side button:hover { background: var(--hover); }
.fs-side button.active { background: var(--sel); }
.fs-side button .ic { color: #d97706; } .fs-side button .ic.blue { color: var(--accent); }
.fs-content { flex: 1; min-width: 0; overflow: auto; position: relative; outline: none; }
.fs-status { display: flex; gap: 14px; padding: 5px 12px; font-size: .82em; color: var(--fg2); border-top: 1px solid var(--border); background: var(--bg); }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile, 110px), 1fr)); gap: 4px; padding: 10px; }
.fs-item { border-radius: 8px; border: 1px solid transparent; cursor: default; user-select: none; }
.fs-grid .fs-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; text-align: center; }
.fs-grid .fs-item .nm { font-size: 12.5px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.fs-item:hover { background: var(--hover); }
.fs-item.sel { background: var(--sel); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.fs-item.cut { opacity: .5; }
.fs-thumb { width: calc(var(--tile, 110px) * .6); height: calc(var(--tile, 110px) * .6); display: grid; place-items: center; position: relative; }
.fs-thumb img { max-width: 100%; max-height: 100%; border-radius: 4px; object-fit: cover; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.fs-thumb .ic { width: 70%; height: 70%; }
.fs-list { width: 100%; border-collapse: collapse; }
.fs-list th { text-align: start; font-weight: 500; font-size: .85em; color: var(--fg2); padding: 6px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); cursor: pointer; white-space: nowrap; }
.fs-list td { padding: 5px 10px; white-space: nowrap; }
.fs-list tr.fs-item td:first-child { border-radius: 6px 0 0 6px; } .fs-list tr.fs-item td:last-child { border-radius: 0 6px 6px 0; }
.fs-list .nmcell { display: flex; align-items: center; gap: 9px; max-width: 520px; }
.fs-list .nmcell span { overflow: hidden; text-overflow: ellipsis; }
.fs-preview { width: 280px; flex: none; border-inline-start: 1px solid var(--border); background: var(--bg2); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.fs-preview .pv { display: grid; place-items: center; min-height: 160px; background: var(--bg); border-radius: 10px; overflow: hidden; }
.fs-preview .pv img, .fs-preview .pv video { max-width: 100%; max-height: 240px; }
.ftype { --fc: #64748b; color: var(--fc); }
.ftype.dir { --fc: #f59e0b; } .ftype.image { --fc: #22c55e; } .ftype.video { --fc: #ef4444; } .ftype.audio { --fc: #ec4899; } .ftype.pdf { --fc: #dc2626; }
.ftype.doc { --fc: #2563eb; } .ftype.sheet { --fc: #16a34a; } .ftype.slide { --fc: #ea580c; } .ftype.archive { --fc: #a16207; } .ftype.code { --fc: #7c3aed; } .ftype.text { --fc: #475569; }
.upload-panel { position: absolute; bottom: 36px; inset-inline-end: 12px; width: 320px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; z-index: 20; }

/* ---------- media players ---------- */
.player { position: relative; background: #000; flex: 1; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* subtitles drawn by the player: always on the picture, above the controls (also in full screen) */
.sub-overlay { position: absolute; inset-inline: 4%; bottom: 13%; text-align: center; pointer-events: none; z-index: 2; color: #fff; font-size: clamp(15px, 3.4vh, 44px); line-height: 1.3; font-weight: 600; text-shadow: 0 0 4px #000, 0 0 4px #000, 2px 2px 3px #000; direction: auto; transition: bottom .3s; }
.sub-overlay span { background: rgba(0,0,0,.35); padding: 0 .3em; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.player:not(.idle) .sub-overlay { bottom: calc(var(--ctlh, 110px) + 10px); }
.player.idle .sub-overlay { bottom: 6%; }
.player-ctl { z-index: 3; }
/* real full screen: the whole player fills the screen */
.player:fullscreen, .player:-webkit-full-screen { width: 100vw !important; height: 100vh !important; max-width: none; border-radius: 0; }
.player.pseudo-full { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100dvh !important; z-index: 2147483000; border-radius: 0; }
body.has-pseudo-full #taskbar { display: none !important; }
.player-ctl { position: absolute; inset-inline: 0; bottom: 0; padding: 30px 16px 12px; background: linear-gradient(transparent, rgba(0,0,0,.85)); color: #fff; display: flex; flex-direction: column; gap: 8px; transition: opacity .3s; }
.player.idle .player-ctl { opacity: 0; } .player.idle { cursor: none; }
.player-ctl .row .btn { color: #fff; }
.player-ctl .btn.ghost:hover { background: rgba(255,255,255,.15); }
.seek { width: 100%; }
.player .center-msg { position: absolute; color: #fff; text-align: center; }
.vlib { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 16px; }
.vcard { cursor: pointer; border-radius: 10px; overflow: hidden; background: var(--bg2); transition: transform .15s; }
.vcard:hover { transform: scale(1.03); }
.vcard .poster { aspect-ratio: 16/9; background: #111 center/cover; display: grid; place-items: center; color: #fff; }
.vcard .meta { padding: 8px 10px; } .vcard .meta b { display: block; font-size: .92em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Audio Station */
.au { display: flex; flex-direction: column; height: 100%; }
.au-main { flex: 1; display: flex; min-height: 0; }
.au-bar { height: 84px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-top: 1px solid var(--border); background: var(--bg2); }
.au-bar .cover { width: 56px; height: 56px; border-radius: 8px; background: var(--bg3) center/cover; flex: none; display: grid; place-items: center; }
.au-bar .now { width: 220px; min-width: 0; }
.au-bar .now b, .au-bar .now span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-bar .mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 640px; margin: 0 auto; }
.au-bar .mid .row { gap: 6px; }
.au-bar .playbtn { width: 42px; height: 42px; border-radius: 50%; background: var(--fg); color: var(--bg); border: 0; display: grid; place-items: center; cursor: pointer; }
.au-bar .btn.on { color: var(--accent); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; padding: 18px; }
.album { cursor: pointer; }
.album .art { aspect-ratio: 1; border-radius: 10px; background: linear-gradient(135deg, var(--bg3), var(--bg2)) center/cover; display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: transform .15s; position: relative; overflow: hidden; }
.album:hover .art { transform: translateY(-3px); }
.album b { display: block; margin-top: 8px; font-size: .93em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album small { color: var(--fg2); }
.track-table td { padding: 6px 10px; }
.track-table tr.playing td { color: var(--accent); font-weight: 600; }
.eq { display: flex; gap: 12px; justify-content: center; align-items: flex-end; height: 180px; }
.eq label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .78em; color: var(--fg2); }
.eq input[type=range] { writing-mode: vertical-lr; direction: rtl; width: 24px; height: 140px; }
.lyrics { white-space: pre-wrap; line-height: 2; font-size: 1.1em; text-align: center; padding: 20px; }
.lyrics .cur { color: var(--accent); font-weight: 700; font-size: 1.15em; }
.visualizer { width: 100%; height: 120px; display: block; }

/* Photos */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--ph, 160px), 1fr)); gap: 4px; padding: 4px 16px 16px; }
.ph-grid .ph { aspect-ratio: 1; background: var(--bg3) center/cover; cursor: pointer; border-radius: 4px; position: relative; overflow: hidden; }
.ph-grid .ph:hover { filter: brightness(1.1); }
.ph-grid .ph .vbadge { position: absolute; bottom: 6px; inset-inline-end: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 11px; display: flex; gap: 3px; align-items: center; }
.ph-grid .ph.sel { outline: 3px solid var(--accent); outline-offset: -3px; }
.ph-day { padding: 18px 16px 6px; font-weight: 600; }
.lightbox { position: absolute; inset: 0; background: #000; z-index: 30; display: flex; flex-direction: column; color: #fff; }
.lightbox .stage { flex: 1; display: grid; place-items: center; overflow: hidden; position: relative; min-height: 0; }
.lightbox .stage { touch-action: none; }
.lightbox .stage video { max-width: 100%; max-height: 100%; }
.lightbox .stage img.lb-img { position: absolute; left: 50%; top: 50%; max-width: none; max-height: none; transition: transform .15s; user-select: none; -webkit-user-drag: none; }
.lightbox .lb-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: rgba(0,0,0,.6); }
.lightbox .lb-bar .btn { color: #fff; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.15); border: 0; color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox .nav.prev { inset-inline-start: 16px; } .lightbox .nav.next { inset-inline-end: 16px; }
[dir=rtl] .lightbox .nav .ic { transform: scaleX(-1); }
.edit-panel { width: 280px; background: #111; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.edit-panel label { display: flex; flex-direction: column; gap: 4px; font-size: .9em; }

/* ---------- terminal ---------- */
.term-wrap { flex: 1; background: #0d1117; padding: 6px; min-height: 0; }
.term-wrap .xterm { height: 100%; }

/* ---------- notes / editors ---------- */
.notes { display: flex; height: 100%; }
.notes-side { width: 260px; flex: none; border-inline-end: 1px solid var(--border); background: var(--bg2); display: flex; flex-direction: column; }
.notes-tree { flex: 1; overflow: auto; padding: 6px; }
.tree-item { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.tree-item:hover { background: var(--hover); }
.tree-item.active { background: var(--sel); color: var(--accent); }
.tree-item .tw { width: 14px; display: inline-grid; place-items: center; flex: none; }
.notes-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rt-toolbar { display: flex; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; background: var(--bg); }
.rt-toolbar .btn { height: 30px; min-width: 30px; padding: 0 7px; }
.rt-toolbar select { height: 30px; }
.rt-editor { flex: 1; overflow: auto; padding: 28px max(28px, calc((100% - 860px) / 2)); outline: none; line-height: 1.65; font-size: 1.05em; }
.rt-editor h1 { font-size: 2em; margin: .4em 0; } .rt-editor h2 { font-size: 1.5em; } .rt-editor blockquote { border-inline-start: 4px solid var(--accent); margin: 0; padding: 4px 16px; color: var(--fg2); background: var(--bg2); }
.rt-editor pre, .md-preview pre { background: var(--bg2); padding: 12px; border-radius: 8px; overflow: auto; font-family: var(--mono); }
.rt-editor code, .md-preview code { font-family: var(--mono); background: var(--bg3); padding: 1px 5px; border-radius: 4px; }
.rt-editor table, .md-preview table { border-collapse: collapse; } .rt-editor td, .rt-editor th, .md-preview td, .md-preview th { border: 1px solid var(--border); padding: 6px 10px; }
.rt-editor img { max-width: 100%; }
.md-split { flex: 1; display: flex; min-height: 0; }
.md-split textarea { flex: 1; border: 0; outline: none; resize: none; padding: 20px; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; background: var(--bg); color: var(--fg); }
.md-preview { flex: 1; overflow: auto; padding: 20px 28px; border-inline-start: 1px solid var(--border); line-height: 1.65; }
.code-ed { flex: 1; display: flex; min-height: 0; font-family: var(--mono); font-size: 13.5px; line-height: 1.55; background: var(--bg); }
.code-ed .gutter { padding: 10px 8px; text-align: end; color: var(--fg2); background: var(--bg2); user-select: none; overflow: hidden; min-width: 48px; white-space: pre; border-inline-end: 1px solid var(--border); direction: ltr; }
.code-ed textarea { flex: 1; border: 0; outline: none; resize: none; padding: 10px 12px; font: inherit; line-height: inherit; background: transparent; color: var(--fg); white-space: pre; overflow: auto; tab-size: 4; direction: ltr; }
.code-ed textarea.wrap { white-space: pre-wrap; }
.code-ed.rtl textarea { direction: rtl; text-align: right; font-family: var(--font); font-size: 1.08em; unicode-bidi: plaintext; }
.ed-toolbar .only-phone { display: none; }
@media (max-width: 760px) {
  .ed-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ed-toolbar::-webkit-scrollbar { display: none; }
  .ed-toolbar .lbl { display: none; } .ed-toolbar .only-phone { display: inline-flex; }
  .ed-toolbar .btn { flex: none; min-width: 40px; height: 38px; justify-content: center; }
  .findbar input { flex: 1 1 40%; min-width: 0; }
  .fs-status [data-stats] { display: none; }
  .code-ed .gutter { min-width: 34px; padding-inline: 4px; }
  .code-ed textarea { padding: 10px 8px; }
}
.ed-tabs { display: flex; background: var(--bg2); border-bottom: 1px solid var(--border); overflow-x: auto; flex: none; }
.ed-tabs .tab { display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 14px; border-inline-end: 1px solid var(--border); cursor: pointer; white-space: nowrap; font-size: .9em; color: var(--fg2); }
.ed-tabs .tab.active { background: var(--bg); color: var(--fg); box-shadow: inset 0 2px 0 var(--accent); }
.ed-tabs .tab .x { opacity: .5; border-radius: 4px; display: grid; place-items: center; width: 18px; height: 18px; }
.ed-tabs .tab .x:hover { opacity: 1; background: var(--hover); }
.ed-tabs .tab.dirty .nm::after { content: " ●"; color: var(--accent); }
.findbar { display: flex; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--bg2); align-items: center; flex-wrap: wrap; }

/* ---------- chat ---------- */
.chat { display: flex; height: 100%; }
.chat-side { width: 290px; flex: none; border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg2); }
.chat-list { flex: 1; overflow-y: auto; padding: 4px 6px; }
.chat-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--sel); }
.chat-item .avatar { width: 40px; height: 40px; position: relative; overflow: visible; }
.chat-item .avatar .on { position: absolute; bottom: 0; inset-inline-end: 0; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg2); }
.chat-item .unread { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px;
  background-image: radial-gradient(color-mix(in srgb, var(--fg2) 12%, transparent) 1px, transparent 1px); background-size: 18px 18px; }
.msg { max-width: 70%; padding: 7px 11px; border-radius: 12px; background: var(--bg2); align-self: flex-start; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.08); word-wrap: break-word; white-space: normal; line-height: 1.4; }
.msg .txt { white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 22%, var(--bg)); }
.msg .who { font-size: .78em; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.msg .tm { font-size: .7em; color: var(--fg2); float: inline-end; margin-inline-start: 10px; margin-top: 6px; }
.msg .reacts { display: flex; gap: 3px; margin-top: 4px; }
.msg .reacts span { background: var(--bg); border-radius: 10px; padding: 0 6px; font-size: .85em; border: 1px solid var(--border); cursor: pointer; }
.msg img.att { max-width: 280px; max-height: 260px; border-radius: 8px; display: block; margin: 4px 0; cursor: pointer; }
.msg .file-att { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg); border-radius: 8px; margin: 4px 0; text-decoration: none; color: var(--fg); }
.msg .reply-q { border-inline-start: 3px solid var(--accent); padding: 2px 8px; font-size: .85em; color: var(--fg2); margin-bottom: 4px; background: var(--hover); border-radius: 4px; }
.msg:hover .msg-act { opacity: 1; }
.msg-act { position: absolute; top: -12px; inset-inline-end: 6px; opacity: 0; display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-sm); }
.msg-act button { border: 0; background: none; cursor: pointer; padding: 2px 5px; border-radius: 5px; }
.msg-act button:hover { background: var(--hover); }
.day-sep { align-self: center; background: var(--bg2); padding: 3px 12px; border-radius: 10px; font-size: .78em; color: var(--fg2); margin: 10px 0; }
.chat-input { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input textarea { flex: 1; resize: none; max-height: 140px; min-height: 40px; border-radius: 20px; padding: 10px 16px; border: 1px solid var(--border); background: var(--input); outline: none; }
.emoji-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; font-size: 22px; }
.emoji-pick button { border: 0; background: none; cursor: pointer; border-radius: 6px; padding: 4px; }
.emoji-pick button:hover { background: var(--hover); }

/* ---------- browser ---------- */
.br-tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: var(--bg2); overflow-x: auto; flex: none; }
.br-tab { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px 8px 0 0; max-width: 220px; min-width: 120px; cursor: pointer; font-size: .88em; color: var(--fg2); }
.br-tab.active { background: var(--bg); color: var(--fg); }
.br-tab .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-bar { display: flex; gap: 4px; padding: 6px 8px; align-items: center; border-bottom: 1px solid var(--border); }
.br-bar .url { flex: 1; height: 34px; border-radius: 17px; padding: 0 14px; }
.br-body { flex: 1; position: relative; min-height: 0; display: flex; }
.br-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.br-home { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 60px 20px; gap: 24px; background: var(--wallpaper); background-size: cover; }
.br-home .search { width: min(600px, 100%); height: 48px; border-radius: 24px; padding: 0 22px; font-size: 1.1em; box-shadow: var(--shadow); border: 0; }
.br-speed { display: grid; grid-template-columns: repeat(auto-fill, 100px); gap: 14px; justify-content: center; width: min(760px, 100%); }
.br-speed a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 12px; background: var(--glass); backdrop-filter: blur(20px); text-decoration: none; color: var(--fg); font-size: .85em; cursor: pointer; }
.br-speed a:hover { transform: translateY(-2px); }
.br-speed img { width: 32px; height: 32px; }

/* ---------- calculator ---------- */
/* Calculator */
.calc2 { --c2-key: var(--bg); --c2-fn: var(--bg3); display: flex; flex-direction: column; height: 100%; padding: 12px; gap: 10px; background: var(--bg2); direction: ltr; user-select: none; position: relative; container-type: size; }
:root[data-mode="dark"] .calc2 { --c2-key: #262b35; --c2-fn: #313846; }
.calc2 .c2-top { display: flex; align-items: center; gap: 6px; }
.c2-chip { border: 1px solid var(--border); background: var(--bg); color: var(--fg2); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.c2-chip.icon { padding: 5px 8px; } .c2-chip:hover { color: var(--fg); border-color: var(--accent); }
.c2-disp { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; gap: 4px; padding: 14px 16px; min-height: 108px; flex: 0 0 auto; border-radius: 16px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); cursor: copy; overflow: hidden; }
.c2-expr { color: var(--fg2); font-size: 18px; min-height: 24px; max-width: 100%; white-space: nowrap; overflow-x: auto; scrollbar-width: none; font-variant-numeric: tabular-nums; }
.c2-expr::-webkit-scrollbar { display: none; }
.c2-val { color: var(--fg); font-size: 48px; font-weight: 300; line-height: 1.1; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; transition: color .15s; }
.c2-val.dim { color: var(--fg2); }
.c2-sci { display: none; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 0 0 auto; }
.calc2.sci .c2-sci { display: grid; }
.c2-sci button { padding: 0; line-height: 1; border: 0; border-radius: 10px; background: var(--c2-fn); color: var(--fg); font-size: 15px; height: 36px; cursor: pointer; }
.c2-keys { flex: 1 1 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 8px; min-height: 0; }
.c2-keys button { padding: 0; line-height: 1; border: 0; border-radius: 14px; background: var(--c2-key); color: var(--fg); font-size: 22px; cursor: pointer; min-height: 0; box-shadow: 0 1px 0 rgba(0,0,0,.08); transition: transform .08s, filter .15s; }
.c2-keys button.fn { background: var(--c2-fn); color: var(--accent); font-weight: 600; }
.c2-keys button.op { background: var(--accent-soft); color: var(--accent); font-size: 26px; }
.c2-keys button.c2eq { background: var(--accent); color: var(--accent-fg); font-size: 26px; }
.calc2 button:hover { filter: brightness(1.08); }
.calc2 button.hit, .calc2 button:active { transform: scale(.94); }
.c2-hist { position: absolute; inset: 52px 12px 12px; z-index: 2; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; padding: 8px; gap: 6px; }
.c2-hist.hidden { display: none; }
.c2-hlist { flex: 1; overflow: auto; }
.c2-hrow { display: flex; flex-direction: column; align-items: flex-end; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.c2-hrow:hover { background: var(--hover); } .c2-hrow span { color: var(--fg2); font-size: 13px; } .c2-hrow b { font-size: 20px; font-weight: 500; }
.calc2.shake .c2-disp { animation: c2shake .35s; }
@keyframes c2shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@container (max-height: 620px) { .c2-disp { min-height: 72px; padding: 8px 12px; } .c2-val { font-size: 34px; } .c2-expr { font-size: 15px; min-height: 18px; } .c2-sci { grid-template-columns: repeat(8, 1fr); gap: 4px; } .c2-sci button { height: 32px; font-size: 13px; } .c2-keys { gap: 6px; } }

/* ---------- calendar ---------- */
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; border-top: 1px solid var(--border); min-height: 0; }
.cal-grid .dh { padding: 8px; font-size: .85em; color: var(--fg2); border-bottom: 1px solid var(--border); text-align: center; }
.cal-cell { border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 6px; overflow: hidden; cursor: pointer; min-height: 80px; }
.cal-cell:hover { background: var(--hover); }
.cal-cell .n { font-size: .85em; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .n { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.other { opacity: .45; }
.cal-ev { font-size: .78em; padding: 2px 6px; border-radius: 4px; color: #fff; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- monitor ---------- */
.mon-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mon-chart { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.mon-chart canvas { width: 100%; height: 140px; }
.gauge { width: 120px; height: 120px; position: relative; display: grid; place-items: center; }
.gauge svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.gauge b { font-size: 1.4em; }

/* ---------- storage ---------- */
.disk-bay { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.disk { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; position: relative; cursor: pointer; }
.disk.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.disk .led { position: absolute; top: 12px; inset-inline-end: 12px; }
.disk .slot { font-size: .75em; color: var(--fg2); text-transform: uppercase; letter-spacing: .05em; }
.raid-opt { border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.raid-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.raid-opt.disabled { opacity: .4; pointer-events: none; }

/* ---------- games ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 16px; }
.game { border-radius: 12px; overflow: hidden; background: var(--bg2); cursor: pointer; transition: transform .15s; border: 1px solid var(--border); }
.game:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.game .cv { aspect-ratio: 3/4; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.3em; text-align: center; padding: 10px; }
.game .gm { padding: 8px 10px; } .game .gm b { display: block; font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- screen recorder ---------- */
.rec-preview { flex: 1; background: #000; border-radius: 12px; display: grid; place-items: center; overflow: hidden; min-height: 200px; position: relative; }
.rec-preview video { max-width: 100%; max-height: 100%; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #ef4444; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* file type icon wrapper must fill the thumbnail box */
.fs-thumb .ftype { display: grid; place-items: center; width: 100%; height: 100%; }
.fs-preview .pv .ftype { display: grid; place-items: center; }
.fs-grid .fs-item.sel .nm { color: var(--fg); }

/* Audio Station radio */
.radio-art { position: relative; display: grid; place-items: center; overflow: hidden; }
.radio-art b { color: #fff; font-size: 1.6em; letter-spacing: .5px; text-shadow: 0 2px 8px rgba(0,0,0,.35); }
.radio-art > .ic { width: 42%; height: 42%; background: #fff; opacity: .95; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.cover-in.radio-art > .ic { width: 55%; height: 55%; }
/* radio stations: smaller tiles */
.album-grid.radio-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)) !important; gap: 12px !important; padding: 14px; }
.radio-grid .album .art { border-radius: 14px; }
.radio-grid .album b { font-size: .85em; margin-top: 6px; }
.radio-grid .album small { font-size: .75em; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .album-grid.radio-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important; gap: 10px !important; padding: 10px; } }
.radio-art img { position: absolute; inset: 18%; width: 64%; height: 64%; object-fit: contain; background: #fff; border-radius: 18%; padding: 6%; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.radio-card.playing .art { outline: 3px solid var(--accent); outline-offset: 2px; }
.radio-card .art { border-radius: 16px; }
.cover-in.radio-art { width: 100%; height: 100%; border-radius: inherit; }
.cover-in.radio-art b { font-size: 1em; }
.mini-art.radio-art { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.mini-art.radio-art b { font-size: .8em; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* virtual screen (noVNC) */
.vd-wrap { position: absolute; inset: 0; background: #1e293b; overflow: hidden; }
.vd-screen { position: absolute; inset: 0; }
.vd-screen > div { background: #1e293b !important; }
.vd-msg { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; gap: 10px; align-items: center; color: #cbd5e1; pointer-events: auto; }
.vd-bar { border-bottom: 1px solid var(--border); padding: 4px 8px; }

/* card games & chess */
/* real card faces: pips 2-10, a big ace, framed J / Q / K */
  background: linear-gradient(160deg, rgba(250,204,21,.18), rgba(250,204,21,.04) 55%, rgba(59,130,246,.12)); }

/* Video Player library (posters, details) */
.mtabs { display: flex; gap: 2px; } .mtabs .btn.on { background: var(--hover); color: var(--accent); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; padding: 16px; }
.mrow-t { margin: 18px 16px 8px; font-size: 1.05em; }
.mrow { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 14px; overflow-x: auto; padding: 0 16px 8px; scroll-snap-type: x proximity; }
.mrow .mcard.wide { width: 260px; }
.mrow:has(.mcard.wide) { grid-auto-columns: 260px; }
.mcard { cursor: pointer; scroll-snap-align: start; min-width: 0; }
.mcard b { display: block; margin-top: 6px; font-size: .92em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard small { display: block; }
.mposter { position: relative; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; background: #1f2937 center/cover; box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .15s, box-shadow .15s; }
.mposter.wide { aspect-ratio: 16/9; }
.mcard:hover .mposter { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.mposter img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mposter .noposter { position: absolute; inset: 0; background: #111 center/cover; display: flex; align-items: flex-end; }
.mposter .noposter b { width: 100%; margin: 0; padding: 30px 8px 8px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.85)); white-space: normal; }
.mrate { position: absolute; top: 6px; inset-inline-start: 6px; background: rgba(0,0,0,.7); color: #facc15; font-size: .75em; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.mprog { position: absolute; bottom: 0; inset-inline-start: 0; height: 4px; background: var(--accent); }
.mhero { display: flex; gap: 24px; padding: 24px; color: #fff; background: #0b1220 center/cover; min-height: 280px; align-items: flex-end; }
.mhero .mposter.big { width: 200px; flex: none; }
.mhero .minfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mhero h1 { margin: 0; font-size: 2em; line-height: 1.15; }
.mfacts { display: flex; flex-wrap: wrap; gap: 6px 14px; opacity: .85; font-size: .92em; }
.moverview { max-width: 820px; line-height: 1.6; margin: 6px 0; opacity: .95; }
.meps { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.mep { display: flex; gap: 14px; align-items: flex-start; padding: 8px; border-radius: 10px; cursor: pointer; }
.mep:hover { background: var(--hover); }
.mstill { position: relative; width: 200px; flex: none; aspect-ratio: 16/9; border-radius: 8px; background: #111 center/cover; overflow: hidden; }
.mep b { display: block; } .mep small { display: block; }
.mcast { width: 110px; text-align: center; } .mcast img, .mcast .noimg { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; margin: 0 auto; background: var(--bg2); }
.mcast b { display: block; font-size: .85em; margin-top: 6px; } .mcast small { display: block; font-size: .78em; }
.mrow:has(.mcast) { grid-auto-columns: 110px; }
@media (max-width: 700px) { .mhero { flex-direction: column; align-items: flex-start; } .mhero .mposter.big { width: 130px; } .mstill { width: 130px; } .mgrid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); } }

.album .art { position: relative; overflow: hidden; }
.album .art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.mode-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: start; cursor: pointer; border: 2px solid var(--border); background: var(--bg); color: var(--fg); font: inherit; }
.mode-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.mode-card small { color: var(--fg2); }

/* My apps document */
.adoc-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.adoc-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: .92em; }
.adoc-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.adoc-row small { grid-column: 2 / -1; }
@media (max-width: 640px) { .adoc-row { grid-template-columns: 1fr auto auto; } .adoc-row > .muted:first-child { grid-column: 1 / -1; } }
/* My apps on a phone: compact cards, stacked addresses, big touch targets */
.adoc-apk-phone summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; padding: 2px 0; }
.adoc-apk-phone summary::-webkit-details-marker { display: none; }
.adoc-apk-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; min-height: 52px; }
.adoc-apk-row img { width: 36px; height: 36px; border-radius: 9px; }
.adoc-apk-row small { display: block; }
.adoc-apk-row > .ic { color: var(--accent); width: 22px; height: 22px; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) and (max-height: 900px) {
  .adoc-app .toolbar { flex-wrap: wrap; padding: 8px 10px; gap: 8px; }
  .adoc-app .toolbar [data-kinds] { order: 2; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .adoc-app .toolbar [data-kinds]::-webkit-scrollbar { display: none; }
  .adoc-app .toolbar [data-kinds] .chip { flex: none; padding: 7px 12px; }
  .adoc-app .toolbar .search { order: 1; flex: 1 1 auto; }
  .adoc-app .toolbar .grow, .adoc-app .adoc-extra { display: none !important; }
  .adoc-app .page { padding: 10px !important; }
  .adoc-app .page > h2 { font-size: 1.25em; }
  .adoc { padding: 12px; border-radius: 14px; }
  .adoc > .row:first-child { flex-wrap: wrap; }
  .adoc .app-ico.s48, .adoc > .row:first-child > img { width: 40px !important; height: 40px !important; }
  .adoc .adoc-open { order: 3; flex: 1 1 100%; justify-content: center; min-height: 42px; font-size: 1em; margin-top: 4px; }
  .adoc-row { grid-template-columns: minmax(0, 1fr) 40px 40px !important; gap: 2px 6px; padding: 4px 0; }
  .adoc-row > .muted:first-child { grid-column: 1 / -1; font-size: .8em; }
  .adoc-row a { font-size: .95em; padding: 6px 0; }
  html[dir=rtl] .adoc-row a { text-align: right; }
  .adoc-row .btn.icon { width: 40px; height: 40px; }
  .adoc .row.wrap .btn { flex: 1 1 140px; justify-content: center; min-height: 40px; }
}
@media print { #taskbar, .toolbar, .titlebar, #icons, #widgets, #deskinfo { display: none !important; } .window { position: static !important; box-shadow: none !important; width: auto !important; height: auto !important; } .adoc button { display: none; } }

/* user guide */
.guide { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100%; }
.g-toc { border-inline-end: 1px solid var(--border); padding: 14px 10px; overflow: auto; background: var(--bg2); display: flex; flex-direction: column; gap: 2px; }
.g-toc a { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; font-size: .93em; }
.g-toc a:hover { background: var(--hover); } .g-toc a.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.g-brand { display: flex; gap: 10px; align-items: center; padding: 4px 6px 8px; } .g-brand img { width: 40px; height: 40px; border-radius: 10px; } .g-brand small { display: block; color: var(--fg2); }
.g-main { overflow: auto; padding: 10px 28px 20px; line-height: 1.7; scroll-behavior: smooth; }
.g-main section { max-width: 900px; padding: 14px 0 22px; border-bottom: 1px solid var(--border); }
.g-main h2 { display: flex; gap: 10px; align-items: center; margin: 6px 0 10px; }
.g-main h4 { margin: 16px 0 6px; }
.g-main button[data-open] { border: 1px solid var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 8px; padding: 3px 10px; cursor: pointer; font: inherit; font-size: .88em; margin: 2px; }
.g-main button[data-open]:hover { background: var(--accent); color: #fff; }
.g-main code { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .9em; direction: ltr; unicode-bidi: isolate; }
.g-main code[data-copy] { cursor: copy; } .g-main code[data-copy]:hover { border-color: var(--accent); }
.g-main kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: .85em; background: var(--bg); direction: ltr; unicode-bidi: isolate; }
.g-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .93em; } .g-table th, .g-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: start; vertical-align: top; } .g-table th { background: var(--bg2); }
.g-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 10px 0; } .g-cards > div { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg2); display: flex; flex-direction: column; gap: 4px; }
.g-check { list-style: none; padding: 0; } .g-check li { display: flex; gap: 8px; align-items: center; padding: 5px 0; } .g-check li.done { opacity: .6; text-decoration: line-through; } .g-check li.done button { text-decoration: none; }
.g-main details { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 8px 0; background: var(--bg2); } .g-main summary { cursor: pointer; font-weight: 600; }
.g-flow { width: 100%; max-width: 860px; color: var(--fg); margin: 8px 0; direction: ltr; }
.g-flow rect { fill: color-mix(in srgb, var(--accent) 14%, var(--bg)); stroke: var(--accent); }
.g-flow .b4, .g-flow .b5 { fill: color-mix(in srgb, #22c55e 14%, var(--bg)); stroke: #22c55e; } .g-flow .b6 { fill: color-mix(in srgb, #f97316 14%, var(--bg)); stroke: #f97316; } .g-flow .b8 { fill: color-mix(in srgb, #a855f7 18%, var(--bg)); stroke: #a855f7; }
@container (max-width: 700px) { .guide { grid-template-columns: 1fr; } .g-toc { display: none; } }
@media (max-width: 700px) { .guide { grid-template-columns: 1fr; } .g-toc { display: none; } .g-main { padding: 8px 14px; } }

/* phones: app layouts */
.chat-back { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) and (max-height: 900px) {
  .chat-side { width: 100%; } .chat .chat-main { display: none; }
  .chat.open .chat-side { display: none; } .chat.open .chat-main { display: flex; } .chat-back { display: inline-flex; }
  .msg { max-width: 88%; }
  .au-bar { height: auto; flex-wrap: wrap; gap: 8px; padding: 8px 10px; } .au-bar .now { width: auto; flex: 1; } .au-bar .visualizer, .au-bar [data-vol], .au-bar [data-c=mute] { display: none; } .au-bar .mid { order: 3; flex-basis: 100%; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; gap: 12px !important; }
  .player-ctl .row { flex-wrap: wrap; } .player-ctl [data-p=speed], .player-ctl [data-p=pip], .player-ctl [data-vol], .player-ctl [data-p=back10], .player-ctl [data-p=fwd10] { display: none; }
  .fs-list th:nth-child(n+3), .fs-list td:nth-child(n+3) { display: none; }
  /* File Station on a phone: one scrolling tool row, bigger touch targets, 3-4 items per row */
  .fs-top { gap: 4px; padding: 6px 8px; } .fs-top > .btn.icon { width: 36px; height: 36px; }
  .fs-top .fs-crumbs { order: 9; flex: 1 1 100%; height: 38px; }
  .fs-top { flex-wrap: wrap; }
  .fs-ribbon { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 4px 6px; }
  .fs-ribbon::-webkit-scrollbar { display: none; }
  .fs-ribbon .btn { flex: none; height: 36px; }
  .fs-grid { --tile: 96px !important; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)) !important; padding: 8px; }
  .fs-preview { position: absolute; inset: 0; width: auto; z-index: 25; }
  .fs-list td { padding: 9px 10px; }
  .notes-side { width: min(84vw, 300px); }
  .page h2 { font-size: 1.3em; }
  .mrow { grid-auto-columns: 120px; } .mhero { padding: 14px; min-height: 0; } .mhero h1 { font-size: 1.4em; }
  .guide { grid-template-columns: 1fr; } .g-toc { display: none; }
  .vd-bar { display: none; }
}

.apk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.apk { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--bg2); }
.apk > img:first-child { width: 48px; height: 48px; border-radius: 12px; }
.apk .qr { width: 120px; height: 120px; background: #fff; border-radius: 8px; padding: 4px; image-rendering: pixelated; }

/* ---------- Surveillance Station ---------- */
.sv-body { background: #0b0f17; }
.sv-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 4px; padding: 4px; min-height: 100%; align-content: start; }
.sv-tile { position: relative; background: #000; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; display: grid; place-items: center; color: #475569; }
.sv-tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sv-tile img.err { visibility: hidden; }
.sv-tile img.sv-hq { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; }
.sv-tile img.sv-hq.on { opacity: 1; }
.sv-err { position: absolute; inset-inline: 8px; bottom: 44px; background: rgba(127,29,29,.85); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.sv-grid.single { --cols: 1 !important; }
.sv-grid.single .sv-tile { aspect-ratio: auto; height: calc(100% - 8px); min-height: 50vh; }
/* full screen of the live view: the grid fills the screen, rows share the height */
.sv-body:fullscreen, .sv-body.pseudo-full { background: #000; overflow: hidden; }
.sv-body.pseudo-full { position: fixed !important; inset: 0 !important; z-index: 2147483000; height: 100dvh; }
.sv-body:fullscreen .sv-grid, .sv-body.pseudo-full .sv-grid { height: 100%; grid-auto-rows: 1fr; }
.sv-body:fullscreen .sv-tile, .sv-body.pseudo-full .sv-tile { aspect-ratio: auto; height: 100%; }
.sv-tile.empty-tile .ic { width: 34px; height: 34px; opacity: .4; }
.sv-ov { position: absolute; inset-inline: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; color: #fff; font-size: 13px; pointer-events: none; }
.sv-ov.top { top: 0; background: linear-gradient(rgba(0,0,0,.65), transparent); }
.sv-ov.bottom { bottom: 0; justify-content: flex-end; background: linear-gradient(transparent, rgba(0,0,0,.65)); opacity: 0; transition: opacity .15s; }
.sv-ov.bottom .btn { pointer-events: auto; color: #fff; }
.sv-tile:hover .sv-ov.bottom, .sv-tile:focus-within .sv-ov.bottom { opacity: 1; }
@media (hover: none) { .sv-ov.bottom { opacity: 1; } }
.sv-rec { color: #f87171; font-weight: 700; font-size: 11px; animation: svblink 1.6s infinite; }
.sv-mot { color: #fbbf24; font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }
@keyframes svblink { 50% { opacity: .35; } }
.sv-ptz { position: absolute; inset-inline-end: 10px; bottom: 44px; display: grid; grid-template-areas: "zin up zout" "left . right" ". down ."; gap: 4px; background: rgba(0,0,0,.5); padding: 6px; border-radius: 12px; }
.sv-ptz .btn { color: #fff; background: rgba(255,255,255,.12); }
.sv-tl .sv-player { background: #000; border-radius: 10px; overflow: hidden; margin: 10px 0; position: relative; }
.sv-tl video { width: 100%; max-height: 56vh; display: block; background: #000; }
.sv-now { position: absolute; top: 8px; inset-inline-start: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.sv-bar { position: relative; height: 34px; background: var(--bg3); border-radius: 8px; cursor: pointer; overflow: hidden; }
.sv-bar i { position: absolute; top: 0; bottom: 0; pointer-events: none; }
/* recording = green band, motion = orange marks above it (two different colors, both visible) */
.sv-bar .seg { background: #16a34a; top: 12px; bottom: 6px; border-radius: 2px; }
.sv-bar .ev { background: #f59e0b; top: 2px; height: 10px; min-width: 3px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.sv-bar .cursor { width: 2px; background: #fff; box-shadow: 0 0 4px #000; }
.sv-hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg2); padding: 2px 2px 0; }
.sv-key { display: inline-block; width: 14px; height: 8px; border-radius: 3px; vertical-align: middle; }
.sv-key.seg { background: #16a34a; } .sv-key.ev { background: #f59e0b; }
.sv-bar .cursor[data-t]::after { content: attr(data-t); position: absolute; top: -2px; inset-inline-start: 4px; font-size: 11px; background: rgba(0,0,0,.75); color: #fff; padding: 0 4px; border-radius: 4px; white-space: nowrap; }
/* the timeline of the live view */
.sv-dvr { position: sticky; bottom: 0; z-index: 3; background: var(--bg); border-top: 1px solid var(--border); padding: 8px 8px 4px; display: flex; flex-direction: column; gap: 6px; }
.sv-dvr .sv-bar { height: 30px; touch-action: none; }
.sv-dvr [data-lvbarbox] { position: relative; }
.sv-nowmark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #3b82f6; pointer-events: none; }
/* the strip under the live view: dragged under a marker that stays in the middle; the tiles play their recordings */
.sv-scrub { position: relative; height: 64px; background: var(--bg3); border-radius: 8px; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.sv-scrub:active { cursor: grabbing; }
.sv-scrub canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sv-mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.8); pointer-events: none; }
.sv-midt { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.78); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; direction: ltr; }
.sv-midt.live { background: #dc2626; }
.sv-pbv, .sv-norec, .sv-pbt, .sv-sndb { display: none !important; }
.sv-grid.pb .sv-tile > img { visibility: hidden; }
.sv-grid.pb .sv-pbv { display: block !important; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.sv-grid.pb .sv-tile.norec .sv-pbv { visibility: hidden; }
.sv-grid.pb .sv-tile.norec .sv-norec { display: flex !important; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 6px; color: #94a3b8; font-size: 13px; }
.sv-grid.pb .sv-pbt { display: inline-flex !important; position: absolute; top: 30px; inset-inline-start: 6px; z-index: 2; align-items: center; gap: 4px; background: rgba(37,99,235,.85); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; }
.sv-grid.pb .sv-sndb { display: inline-flex !important; }
.sv-grid.pb .sv-rec, .sv-grid.pb .sv-mot { display: none; }
.sv-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 12px; }
.sv-event { display: flex; gap: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 8px; cursor: pointer; }
.sv-event:hover { border-color: var(--accent); }
.sv-event .thumb { width: 120px; aspect-ratio: 16/9; background: #000; border-radius: 6px; overflow: hidden; display: grid; place-items: center; flex: none; color: #64748b; }
.sv-event .thumb img { width: 100%; height: 100%; object-fit: cover; }
.sv-cams { display: grid; gap: 10px; }
.sv-cam { display: flex; gap: 12px; align-items: center; }
.sv-cam > img { width: 140px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.sv-sched { display: grid; grid-template-columns: 26px repeat(24, minmax(0, 1fr)); gap: 2px; margin-top: 6px; user-select: none; touch-action: none; }
.sv-sched i { height: 18px; border-radius: 3px; cursor: pointer; }
.sv-sched .s-c { background: var(--accent); } .sv-sched .s-m { background: #f59e0b; } .sv-sched .s-off { background: var(--bg3); }
.sv-sched .dl, .sv-sched .hl { font-size: 11px; color: var(--fg2); text-align: center; }
.sv-sched [data-brush] { cursor: pointer; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) and (max-height: 900px) {
  .sv-grid { --cols: 1 !important; }
  .sv-tile.empty-tile { display: none; }
  .sv-hide-s { display: none; }
  .sv-top { flex-wrap: wrap; }
  .sv-top [data-tabs] { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sv-cam { flex-wrap: wrap; } .sv-cam > img { width: 100%; }
  .sv-event .thumb { width: 96px; }
}

/* ---------- Nigi Drive ---------- */
.drv { display: flex; height: 100%; min-height: 0; }
.drv-side { width: 230px; flex: none; background: var(--bg2); border-inline-end: 1px solid var(--border); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.drv-side .drv-brand { display: flex; align-items: center; gap: 8px; padding: 6px 10px 12px; font-size: 1.05em; color: var(--accent); }
.drv-side .nav-title { font-size: .76em; text-transform: uppercase; letter-spacing: .06em; color: var(--fg2); padding: 12px 10px 6px; font-weight: 600; }
.drv-side button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: start; width: 100%; color: var(--fg); }
.drv-side button span:first-of-type { flex: 1; }
.drv-side button:hover { background: var(--hover); }
.drv-side button.active { background: var(--sel); color: var(--accent); font-weight: 600; }
.drv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drv-crumbs { display: flex; align-items: center; gap: 2px; overflow: hidden; min-width: 0; }
.drv-crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--fg); white-space: nowrap; font-weight: 600; }
.drv-crumbs button:hover { background: var(--hover); }
.drv-list { flex: 1; overflow: auto; outline: none; }
.drv-list.drop { outline: 2px dashed var(--accent); outline-offset: -8px; }
.drv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 14px; }
.drv-grid .drv-item { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); cursor: pointer; min-width: 0; }
.drv-grid .drv-item:hover { border-color: var(--accent); }
.drv-item .drv-ic { aspect-ratio: 4/3; border-radius: 8px; background: var(--bg3) center/cover; display: grid; place-items: center; }
.drv-item .drv-ic .ftype { display: contents; }
.drv-item .drv-ic .ic { width: 42%; height: 42%; }
.drv-item .drv-ic > .ic { color: #60a5fa; }
.drv-item .nm { font-size: .92em; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.drv-item .nm .star { color: #f59e0b; flex: none; }
.drv-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drv-grid .drv-more { position: absolute; top: 14px; inset-inline-end: 14px; background: color-mix(in srgb, var(--bg) 80%, transparent); opacity: 0; }
.drv-grid .drv-item:hover .drv-more, .drv-grid .drv-item:focus-within .drv-more { opacity: 1; }
.drv-rows { padding: 6px 10px; }
.drv-rows .drv-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.drv-rows .drv-item:hover { background: var(--hover); }
.drv-rows .drv-ic { width: 44px; aspect-ratio: 1; flex: none; }
.drv-share-list { max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.drv-cmd { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; background: var(--bg3); border-radius: 8px; padding: 8px; }
.drv-cmd code { flex: 1; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) and (max-height: 900px) {
  .drv-hide-s { display: none; }
  .drv-bar { flex-wrap: wrap; } .drv-bar .drv-crumbs { flex: 1 1 100%; order: -1; }
  .drv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .drv-grid .drv-more { opacity: 1; }
}

/* Audio Station: play button on album / folder covers */
.album { position: relative; }
.album .al-play { position: absolute; z-index: 2; inset-inline-end: 8px; top: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.35); opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
.album .al-play .ic { width: 18px; height: 18px; }
.album:hover .al-play, .album:focus-within .al-play { opacity: 1; transform: none; }
@media (hover: none) { .album .al-play { opacity: .92; transform: none; } }

/* Notes: image tools + resize handle, the selected image */
.notes-main { position: relative; }
.rt-editor img { max-width: 100%; height: auto; }
.rt-editor img.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.img-tools { position: absolute; z-index: 5; display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: var(--shadow-sm, 0 2px 10px rgba(0,0,0,.25)); }
.img-handle { position: absolute; z-index: 5; width: 16px; height: 16px; border-radius: 4px; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }

/* PDF viewer (pdf.js) + PDF Studio start screen */
.pdfv { direction: ltr; display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; background: var(--bg3); }
.pdfv-bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--bg); border-bottom: 1px solid var(--border); direction: ltr; }
.pdfv-pages { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; -webkit-overflow-scrolling: touch; }
.pdfv-pages canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); flex: none; max-width: none; }
.pdf-start { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.pdf-drop { border: 2px dashed var(--border); border-radius: 18px; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pdf-drop > .ic { width: 44px; height: 44px; opacity: .6; }
.pdf-dragging .pdf-drop, .pdf-dragging [data-view] { outline: 3px dashed var(--accent); outline-offset: -8px; background: var(--accent-soft); }
.pdf-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.pdf-rc { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--fg); cursor: pointer; }
.pdf-rc .ic { grid-row: span 2; color: #ef4444; width: 26px; height: 26px; } .pdf-rc:hover { border-color: var(--accent); }
@media (max-width: 760px) {
  .pdf-bar { flex-wrap: wrap; } .pdf-bar .lbl { display: none; } .pdf-bar b[data-name] { order: 9; flex-basis: 100%; }
  .pdf-start { padding: 12px; } .pdf-recent { grid-template-columns: 1fr; }
  .hide-phone { display: none !important; }
}
html[dir=ltr] .ic.flip-ltr { transform: scaleX(-1); }

/* Resource Monitor: what is using the server */
.use-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.use-total { display: flex; flex-direction: column; align-items: flex-end; } .use-total b { font-size: 28px; font-weight: 600; }
.use-list { display: flex; flex-direction: column; gap: 6px; }
.use-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); cursor: pointer; }
.use-row:hover { border-color: var(--accent); }
.mon-chart .use-row { padding: 6px 8px; border: 0; border-radius: 8px; } .mon-chart .use-row:hover { background: var(--hover); }
.use-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.use-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.use-bar { height: 5px; border-radius: 3px; background: var(--bg3); overflow: hidden; } .use-bar i { display: block; height: 100%; border-radius: 3px; transition: width .4s; }
.use-num { display: flex; flex-direction: column; align-items: flex-end; min-width: 70px; } .use-num b { font-size: 1.15em; }
.table-wrap { overflow-x: auto; }
@media (max-width: 760px) { .proc-table .hide-phone { display: none; } .use-row { gap: 8px; padding: 8px; } }

.drv-win { border: 1px solid var(--accent); background: var(--accent-soft); }
.drv-win-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }

/* Nigi Karaoke */
.kar { display: grid !important; grid-template-columns: 210px minmax(0, 1fr) 380px; height: 100%; }
.kar-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.kar-list { overflow: auto; padding: 8px 12px 20px; }
.kar-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 2px 10px; } .kar-head > b { font-size: 1.2em; }
.kar-song { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; border: 1px solid transparent; }
.kar-song:hover { background: var(--hover); border-color: var(--border); }
.kar-thumb { width: 64px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: linear-gradient(135deg, #7c3aed, #db2777); display: grid; place-items: center; color: #fff; }
.kar-st { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kar-num { font-size: 11px; background: color-mix(in srgb, #a78bfa 18%, transparent); color: #a78bfa; border-radius: 6px; padding: 0 6px; }
.kar-song .fav-on .ic { background: #f59e0b; }
.badge.kar-yt { background: #dc2626; color: #fff; }
.kar-yt-head { padding: 8px 4px 12px; }
.kar-side { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-inline-start: 1px solid var(--border); background: var(--bg2); min-height: 0; overflow: auto; }
.kar-stage-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #000; flex: none; }
.kar-stage { aspect-ratio: 16 / 9; width: 100%; background: #000; display: flex; }
.kar-stage .kar-idle { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #cbd5e1; text-align: center; padding: 10px; }
.kar-stage .kar-idle .ic { width: 38px; height: 38px; background: #a78bfa; }
.kp-box { position: relative; }
.kp-box .kp-media, .kp-box .kp-yt, .kp-box iframe { width: 100%; height: 100%; display: block; border: 0; background: #000; object-fit: contain; }
.kp-audio { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, #4c1d95, #0b0b1a 70%); position: relative; }
.kp-audio audio { position: absolute; width: 1px; height: 1px; opacity: 0; }
.kp-cdg { height: 100%; max-width: 100%; aspect-ratio: 300 / 216; image-rendering: pixelated; background: #000; }
.kp-cover { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; text-align: center; padding: 10px; } .kp-cover b { font-size: 1.6em; } .kp-cover span { opacity: .75; }
.kar-float-bar { display: none; }
.kar-floating { position: fixed; z-index: 4000; right: 24px; bottom: 80px; width: 420px; min-width: 240px; resize: both; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.15); }
.kar-floating .kar-float-bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: #1e1b2e; color: #fff; cursor: move; font-size: 13px; }
.kar-floating .kar-float-bar .ic { background: #fff; }
.kar-floating .kar-stage { height: calc(100% - 32px); aspect-ratio: auto; }
.kar-now { display: flex; gap: 8px; align-items: center; }
.kar-seek { display: flex; gap: 8px; align-items: center; direction: ltr; } .kar-seek input { flex: 1; }
.kar-ctl { display: flex; gap: 6px; align-items: center; direction: ltr; }
.kar-ctl .kar-play { width: 46px; height: 46px; border-radius: 50%; }
.kar-vol { flex: 1; min-width: 60px; }
.kar-modes { display: flex; gap: 6px; flex-wrap: wrap; } .kar-modes .btn { flex: 1; justify-content: center; }
.kar-roomchip { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; cursor: pointer; font-size: 13px; }
.kar-roomchip .ic { background: #fff; }
.kar-qhead { margin-top: 4px; }
.kar-queue { display: flex; flex-direction: column; gap: 4px; }
.kar-qi { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); cursor: grab; }
.kar-qi.dragging { opacity: .4; }
.kar-qn { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.kar-roomcard { background: linear-gradient(135deg, rgba(124,58,237,.15), rgba(219,39,119,.12)); }
.ic.xs { width: 12px; height: 12px; }
@media (max-width: 1100px) { .kar { grid-template-columns: 190px minmax(0, 1fr) 320px; } }
@media (max-width: 760px) {
  .kar { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
  .kar-side { order: -1; border: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .kar-main { min-height: 60vh; }
  .kar-song .hide-phone { display: none; }
  .kar-song .kar-name { font-size: 13.5px; line-height: 1.3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .kar-song .kar-st .small { font-size: 11.5px; }
  .kar-floating { width: 70vw; right: 8px; bottom: 70px; }
}

/* Music Station > DJ */
.dj-host { overflow: auto; }
.dj { display: flex; flex-direction: column; gap: 10px; padding: 10px; min-height: 100%; background: #0d0f14; color: #e5e7eb; --dj-a: #38bdf8; --dj-b: #f472b6; }
.dj .btn { background: #1c212b; border-color: #2a313d; color: #e5e7eb; } .dj .btn:hover { background: #262d3a; } .dj .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .dj .btn.danger { background: #b91c1c; }
.dj .ic { background: currentColor; } .dj .muted { color: #8b93a3; }
.dj-top { display: grid; grid-template-columns: minmax(0, 1fr) 250px minmax(0, 1fr); gap: 10px; direction: ltr; }
.dj-top .dj-dh .col, .dj-top .small { direction: auto; }
.dj-deck { background: #151922; border: 1px solid #252b36; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dj-deck[data-deck=A] { --col: var(--dj-a); } .dj-deck[data-deck=B] { --col: var(--dj-b); }
.dj-dh { display: flex; align-items: center; gap: 10px; }
.dj-letter { width: 30px; height: 30px; border-radius: 8px; background: var(--col); color: #000; font-weight: 800; display: grid; place-items: center; flex: none; }
.dj-bpm, .dj-time { display: flex; flex-direction: column; align-items: center; line-height: 1.1; } .dj-bpm b { font-size: 20px; color: var(--col); font-variant-numeric: tabular-nums; } .dj-bpm span, .dj-time span { font-size: 11px; color: #8b93a3; } .dj-time b { font-variant-numeric: tabular-nums; }
.dj-wave { position: relative; height: 90px; background: #0a0c10; border-radius: 10px; overflow: hidden; }
.dj-wave canvas { width: 100%; height: 100%; display: block; }
.dj-yt { position: absolute; inset: 0; display: none; } .dj-isyt .dj-yt { display: block; } .dj-isyt .dj-wave canvas { display: none; }
.dj-yt iframe { width: 100%; height: 100%; border: 0; }
.dj-over { width: 100%; height: 34px; background: #0a0c10; border-radius: 8px; cursor: pointer; display: block; background-image: linear-gradient(90deg, rgba(255,255,255,.12) var(--prog), transparent var(--prog)); }
.dj-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dj-play { width: 48px; height: 40px; justify-content: center; } .dj-play.on { background: var(--col) !important; color: #000 !important; }
.dj-cue { color: #facc15 !important; font-weight: 700; }
.dj-hot.set { background: #facc15 !important; color: #000 !important; } .dj-loop.on { background: #16a34a !important; }
.dj-tempo { display: flex; align-items: center; gap: 6px; } .dj-tempo input { width: 130px; } .dj-tempo b { width: 48px; font-variant-numeric: tabular-nums; }
.dj-knob { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: #8b93a3; } .dj-knob input { width: 80px; }
.dj .vsep { width: 1px; height: 20px; background: #2a313d; margin: 0 4px; }
.dj-mixer { background: #151922; border: 1px solid #252b36; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.dj-chs { display: flex; gap: 8px; justify-content: center; }
.dj-ch { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.dj-ch > b { color: var(--dj-a); } .dj-ch[data-ch=B] > b { color: var(--dj-b); }
.dj-eq { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #8b93a3; width: 100%; } .dj-eq span { width: 30px; } .dj-eq input { flex: 1; min-width: 0; }
.dj-eq .btn.xs { padding: 0 4px; font-size: 10px; min-height: 18px; } .dj-eq .btn.on { background: #b91c1c !important; }
.dj-vu { width: 10px; height: 60px; background: #0a0c10; border-radius: 4px; position: relative; overflow: hidden; } .dj-vu i { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(0deg, #22c55e, #facc15 70%, #ef4444); transition: height .05s; }
.dj-fader { writing-mode: vertical-lr; direction: rtl; height: 110px; width: 26px; }
.dj-xf { width: 100%; }
.dj-bottom { background: #151922; border: 1px solid #252b36; border-radius: 14px; padding: 8px 10px; flex: 1; min-height: 220px; display: flex; flex-direction: column; }
.dj-bottom .tabs { border: 0; } .dj-bottom .tabs button { color: #9aa3b2; } .dj-bottom .tabs button.active { color: #fff; }
.dj-list { overflow: auto; flex: 1; padding-top: 8px; }
.dj-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent; }
.dj-item:hover { background: #1c212b; } .dj-item.on { border-color: var(--accent); background: rgba(59,130,246,.12); }
.dj-n { width: 22px; text-align: center; color: #8b93a3; font-size: 12px; }
.dj .input { background: #0d0f14; border-color: #2a313d; color: #e5e7eb; }
.dj-pad { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.dj-padbtn { aspect-ratio: 1.4; border-radius: 14px; border: 1px solid #2a313d; background: linear-gradient(135deg, #1e1b4b, #312e81); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: 600; }
.dj-padbtn .ic { width: 26px; height: 26px; background: #fff; } .dj-padbtn.hit, .dj-padbtn:active { transform: scale(.94); background: linear-gradient(135deg, #7c3aed, #db2777); }
@media (max-width: 1150px) { .dj-top { grid-template-columns: 1fr 1fr; } .dj-mixer { grid-column: 1 / -1; order: 3; flex-direction: row; flex-wrap: wrap; justify-content: center; } }
@media (max-width: 760px) { .dj-top { grid-template-columns: 1fr; } .dj-tempo input { width: 90px; } }

/* Music Station > What is this song? */
.sid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 16px; height: 100%; overflow: auto; }
.sid-hero { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 10px; text-align: center; }
.sid-btn { position: relative; width: 170px; height: 170px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(135deg, #2563eb, #7c3aed); box-shadow: 0 12px 40px rgba(37,99,235,.45); display: grid; place-items: center; }
.sid-btn > .ic { width: 70px; height: 70px; background: #fff; position: relative; z-index: 1; }
.sid-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(124,58,237,.6); opacity: 0; }
.sid.listening .sid-ring { animation: sidp 1.6s infinite; } .sid.listening .sid-ring.r2 { animation-delay: .8s; }
@keyframes sidp { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.sid-status { font-size: 1.15em; min-height: 1.4em; }
.sid-card { display: flex; gap: 14px; align-items: center; text-align: start; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg); max-width: 560px; }
.sid-card img, .sid-noc { width: 110px; height: 110px; border-radius: 12px; object-fit: cover; flex: none; background: var(--bg3); display: grid; place-items: center; }
.sid-t { font-size: 1.3em; }
.sid-hist { border-inline-start: 1px solid var(--border); padding-inline-start: 14px; display: flex; flex-direction: column; gap: 6px; }
.sid-hi { display: flex; gap: 8px; align-items: center; padding: 4px 0; } .sid-hi img, .sid-noc.sm { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
@media (max-width: 760px) { .sid { grid-template-columns: 1fr; } .sid-hist { border: 0; padding: 0; } .sid-btn { width: 140px; height: 140px; } }

/* ===================== Card games / Mahjong / chess (green card table style) ===================== */
.cg { display: flex; height: 100%; min-height: 0; position: relative; background: #0b5a1f; }
.cg-panel { width: 210px; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; color: #e8f5e9; background: linear-gradient(180deg, #0d6b26, #0a5420); border-inline-end: 1px solid rgba(0,0,0,.25); overflow: auto; }
.cg-ptitle { display: flex; align-items: center; gap: 6px; } .cg-ptitle b { font-size: 20px; } .cg-ptitle .btn { color: #e8f5e9; } .cg-ptitle .btn .ic { background: #e8f5e9; }
.cg-vars { display: flex; flex-direction: column; gap: 2px; } .cg-vars button, .cg-link { all: unset; cursor: pointer; padding: 4px 2px; color: #a5d6a7; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.cg-vars button.on { color: #fff; font-weight: 700; } .cg-vars button:hover, .cg-link:hover { color: #fff; }
.cg-link .ic { background: currentColor; }
.cg-icons { display: flex; justify-content: space-between; margin-top: 8px; } .cg-icons button { all: unset; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #c8e6c9; } .cg-icons button:hover { background: rgba(255,255,255,.12); color: #fff; } .cg-icons .ic { background: currentColor; width: 22px; height: 22px; }
.cg-time { display: flex; align-items: center; gap: 8px; font-size: 17px; font-variant-numeric: tabular-nums; } .cg-time .ic { background: #e8f5e9; }
.cg-counts { display: flex; flex-wrap: wrap; gap: 10px 16px; } .cg-counts span { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; } .cg-counts .ic { background: #e8f5e9; }
.cg-auto { margin-top: 4px; } .cg-help { color: #a5d6a7; margin: 6px 0 0; line-height: 1.5; }
.cg-board { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 40% 35%, #179a3e 0%, #0e7a2f 35%, #075a1f 75%, #054616 100%); user-select: none; touch-action: none; direction: ltr; transition: filter .2s; }
.cg-board::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .18; background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1px); background-size: 3px 3px; }
.cg-board.blur { filter: blur(8px) brightness(.7); pointer-events: none; }
.cg-pause { position: absolute; inset: 0; inset-inline-start: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; font-size: 26px; z-index: 50; }
.cg-board .slot { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .08); background: rgba(0,0,0,.14); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); display: grid; place-items: center; color: rgba(0,0,0,.28); font-size: calc(var(--cw) * .32); font-weight: 700; }
.cg-board .slot .suit { font-style: normal; font-size: calc(var(--cw) * .62); line-height: 1; color: rgba(0,0,0,.22); }
.cg-board .slot .ic { width: calc(var(--cw) * .4); height: calc(var(--cw) * .4); background: rgba(255,255,255,.4); }
.cg-board .slot.stock { cursor: pointer; } .cg-board .slot.done { color: rgba(255,255,255,.55); font-size: calc(var(--cw) * .22); }
.cg-board .card { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .07); background: #fff; color: #111; box-shadow: 0 1px 1px rgba(0,0,0,.25), 0 1px 4px rgba(0,0,0,.35); cursor: grab; font-family: 'Georgia', 'Times New Roman', serif; transition: transform .16s ease-out; overflow: hidden; }
.cg-board .card.drag { transition: none; cursor: grabbing; box-shadow: 0 14px 30px rgba(0,0,0,.45); }
.cg-board .card.red { color: #d0021b; }
.cg-board .card.back { background: #fff; cursor: default; }
.cg-board .card.back::before { content: ''; position: absolute; inset: 6%; border-radius: calc(var(--cw) * .045); background: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 1.5px, transparent 1.5px 7px), repeating-linear-gradient(-45deg, rgba(255,255,255,.28) 0 1.5px, transparent 1.5px 7px), linear-gradient(135deg, #5b9bf5, #2f6fd6 55%, #2559b8); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.cg-board .slot.stock + .card.back, .cg-board .card.back[data-k=stock] { cursor: pointer; }
.cg-board .card.hint { outline: 3px solid #ffd600; outline-offset: 1px; }
.cg-board .card.selected { outline: 3px solid #29b6f6; outline-offset: 1px; transform-origin: center; }
.cg-board .card.nope { animation: cgnope .3s; }
@keyframes cgnope { 25% { margin-left: -4px; } 75% { margin-left: 4px; } }
.cg-board .card.blocked { filter: brightness(.82); cursor: default; }
.cg-board .card.free { cursor: pointer; }
.cg-board .card .cr { position: absolute; top: 3%; left: 5%; font-size: calc(var(--cw) * .21); line-height: .95; font-weight: 700; display: flex; flex-direction: column; align-items: center; letter-spacing: -.04em; z-index: 1; }
.cg-board .card .cr i { font-style: normal; font-size: .82em; }
.cg-board .card .cr.br { top: auto; left: auto; bottom: 3%; right: 5%; transform: rotate(180deg); }
.cg-board .card .pips { position: absolute; inset: 7% 17%; }
.cg-board .card .pips i { position: absolute; font-style: normal; font-size: calc(var(--cw) * .23); line-height: 1; transform: translate(-50%, -50%); }
.cg-board .card .ace { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cw) * .5); line-height: 1; }
.cg-board .card .ace.big { font-size: calc(var(--cw) * .78); }
.cg-board .card .court { position: absolute; left: 17%; top: 9%; width: 66%; height: 82%; }
.cg-board .card.is-court .cr { font-size: calc(var(--cw) * .19); }
/* menu */
.cg-menu { height: 100%; overflow: auto; padding: 18px clamp(12px, 3vw, 30px) 24px; background: linear-gradient(180deg, #0d6b26, #075a1f 340px, var(--bg2) 340px); }
.cg-mhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: #fff; margin-bottom: 8px; }
.cg-mhead h2 { margin: 0 0 4px; font-size: 26px; } .cg-mhead h2 .ic { background: #fff; } .cg-mhead .small { opacity: .85; }
.cg-ext { background: #fff !important; color: #0b5a1f !important; font-weight: 700; border: 0 !important; } .cg-ext .ic { background: #0b5a1f !important; }
.cg-menu h3 { color: #e8f5e9; margin: 18px 0 10px; font-size: 17px; } .cg-menu h3 ~ h3 { color: var(--fg); }
.cg-menu h3:nth-of-type(n+2) { color: var(--fg); }
.cg-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.cg-tile { border: 0; border-radius: 16px; padding: 0 0 10px; cursor: pointer; background: var(--bg); color: var(--fg); display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.18); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.cg-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.cg-tile b { font-size: 15px; } .cg-tile small { color: var(--fg2); }
.cg-tip { color: var(--fg2); margin-top: 18px; }
.th { width: 100%; height: 104px; background: radial-gradient(ellipse at 40% 35%, #179a3e, #075a1f); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.th .m { display: block; flex: 1; height: 22px; border-radius: 2px; background: linear-gradient(135deg, #5b9bf5, #2559b8); border: 1.5px solid #fff; } .th .m.up { background: #fff; } .th .m.f { background: rgba(0,0,0,.18); border-color: transparent; }
.th-top, .th-tab { display: flex; gap: 3px; } .th-tab { align-items: flex-start; } .th-tab .m { background: linear-gradient(180deg, #2559b8 0 40%, #fff 40%); }
.th-peaks { flex-direction: row; align-items: flex-end; gap: 3px; } .th-peaks .m { background: #fff; }
.th-pyr { align-items: center; justify-content: center; gap: 2px; } .th-pyr div { display: flex; gap: 2px; } .th-pyr .m { width: 14px; flex: none; height: 15px; }
.th-mj { flex-direction: row; flex-wrap: wrap; align-content: center; justify-content: center; gap: 4px; background: radial-gradient(ellipse at 40% 35%, #8d6e63, #3e2723); }
.th-mj i { width: 28px; height: 36px; border-radius: 4px; background: linear-gradient(135deg, #fffdf6, #efe6cf); box-shadow: 2px 2px 0 #c8b88a, 3px 3px 0 #2e7d32; display: grid; place-items: center; font-style: normal; font-size: 15px; color: #c62828; }
.th-mj .t1 { color: #2e7d32; } .th-mj .t2 { color: #f9a825; } .th-mj .t3 { color: #e91e63; } .th-mj .t4 { color: #1565c0; }
.th-chess { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; gap: 0; position: relative; background: #6d4c41; }
.th-chess i { background: #f0d9b5; } .th-chess i.d { background: #b58863; } .th-chess b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 60px; color: #fff; text-shadow: 0 0 3px #000, 0 3px 6px rgba(0,0,0,.5); }
/* mahjong */
.mj .cg-panel, .mj { background: #4e342e; } .mj .cg-panel { background: linear-gradient(180deg, #5d4037, #3e2723); }
.mj-board { background: radial-gradient(ellipse at 45% 40%, #2e7d32, #1b5e20 60%, #0d3d12); }
.mj-tile { position: absolute; left: 0; top: 0; width: var(--tw); height: var(--th); border-radius: calc(var(--tw) * .12); background: linear-gradient(135deg, #fffdf6, #f1e8d0); box-shadow: 1px 1px 0 #d9c99c, 2px 2px 0 #c2ae78, 3px 3px 0 #2e7d32, 4px 4px 0 #1b5e20, 5px 6px 8px rgba(0,0,0,.35); cursor: default; transition: transform .12s, filter .12s; }
.mj-tile svg { width: 100%; height: 100%; display: block; padding: 6% 7%; box-sizing: border-box; }
.mj-tile.free { cursor: pointer; } .mj-tile:not(.free) { filter: brightness(.86); }
.mj-tile.free:hover { filter: brightness(1.05); }
.mj-tile.sel { background: linear-gradient(135deg, #fff59d, #ffe082); }
.mj-tile.hint { background: linear-gradient(135deg, #b3e5fc, #81d4fa); }
.mj-tile.nope { animation: cgnope .3s; }
/* chess */
.chess-room { background: #1b1410; } .chess-room .cg-panel { background: linear-gradient(180deg, #3e2a1e, #2a1c13); color: #f3e5d0; } .chess-room .cg-vars button { color: #d7b98e; } .chess-room .cg-vars button.on { color: #fff; }
.chess-table { flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; padding: 14px; background: radial-gradient(ellipse at 50% 40%, #4a3426, #1b1410 75%); container-type: size; }
.chess-frame { padding: calc(min(100cqw, 100cqh) * .025); border-radius: 10px; background: linear-gradient(135deg, #6b4423, #3e2412 60%, #5a3a1c); box-shadow: 0 20px 50px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.08); }
.chess { display: grid; grid-template-columns: repeat(8, 1fr); width: min(calc(100cqw - 40px), calc(100cqh - 40px), 760px); aspect-ratio: 1; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 2px #2a1708; }
.chess .sq { position: relative; display: grid; place-items: center; cursor: pointer; aspect-ratio: 1; }
.chess .sq.lt { background: linear-gradient(135deg, #f3dcb4, #e8c99a); } .chess .sq.dk { background: linear-gradient(135deg, #b5835a, #9a6a43); }
.chess .sq.sel { box-shadow: inset 0 0 0 100px rgba(255, 213, 79, .55); } .chess .sq.last { box-shadow: inset 0 0 0 100px rgba(255, 235, 59, .32); }
.chess .sq.chk { background: radial-gradient(circle, #ff1744 15%, rgba(255,23,68,.4) 45%, transparent 72%), linear-gradient(135deg, #b5835a, #9a6a43); }
.chess .sq.dot::after { content: ''; width: 28%; height: 28%; border-radius: 50%; background: rgba(40, 25, 10, .35); }
.chess .sq.cap::after { content: ''; position: absolute; inset: 5%; border-radius: 50%; border: 5px solid rgba(40, 25, 10, .35); }
.chess .pc { font-size: min(calc((100cqh - 40px) / 9.4), calc((100cqw - 40px) / 9.4), 72px); line-height: 1; user-select: none; transform: translateY(-3%); }
.pc.w { color: #fbf6ec; text-shadow: 0 0 1px #3b2a1a, 0 0 1px #3b2a1a, 1px 1px 0 #3b2a1a, -1px -1px 0 #6d5a44, 0 4px 6px rgba(0,0,0,.45); }
.pc.b { color: #1e1712; text-shadow: 0 0 1px #000, 1px 1px 0 #6d5a44, 0 4px 6px rgba(0,0,0,.45); }
.chess .fl, .chess .rk { position: absolute; font-size: 11px; font-style: normal; font-weight: 700; opacity: .75; color: #3b2a1a; font-family: Georgia, serif; }
.chess .fl { bottom: 2px; right: 4px; } .chess .rk { top: 2px; left: 4px; }
.chess-status { padding: 10px; border-radius: 10px; background: rgba(0,0,0,.25); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chess-status .turn { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #d7b98e; } .chess-status .turn.w { background: #fbf6ec; } .chess-status .turn.b { background: #1e1712; }
.chess-status .chk-txt { color: #ff5252; }
.chess-capt { font-size: 22px; min-height: 52px; display: flex; flex-direction: column; gap: 2px; } .chess-capt .pc { font-size: 20px; }
.chess-moves { flex: 1; min-height: 80px; overflow: auto; background: rgba(0,0,0,.2); border-radius: 10px; padding: 6px 8px; font-family: Georgia, serif; font-size: 14px; }
.chess-moves table { width: 100%; border-collapse: collapse; } .chess-moves td { padding: 2px 4px; } .chess-moves td:first-child { color: #a1887f; width: 32px; }
@media (max-width: 760px) {
  .cg { flex-direction: column; }
  .cg-panel { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 10px; border: 0; border-bottom: 1px solid rgba(0,0,0,.25); }
  .cg-ptitle b { font-size: 16px; } .cg-vars { flex-direction: row; gap: 10px; } .cg-icons { margin: 0; gap: 2px; } .cg-time { font-size: 14px; } .cg-counts span { font-size: 13px; } .cg-help, .chess-capt, .chess-moves { display: none; }
  .cg-pause { inset: 0; }
  .chess-status { padding: 4px 8px; font-size: 13px; }
}

/* ---- DJ 1.6: A / B in the direction of the decks, library folders, floating screen ---- */
.dj { position: relative; }
.dj-ab { display: inline-flex; gap: 4px; direction: ltr; flex: none; }
.dj-cats { margin-bottom: 8px; flex-wrap: wrap; }
.dj-cats .chip small { opacity: .65; margin-inline-start: 2px; }
.dj-float { position: absolute; top: 60px; right: 20px; z-index: 30; width: min(480px, calc(100% - 24px)); height: min(300px, 60vh); min-width: 240px; min-height: 160px; max-width: calc(100% - 8px); resize: both; overflow: hidden; display: flex; flex-direction: column; background: #02040c; border: 1px solid #334155; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.dj-float[hidden] { display: none; }
.dj-float-h { position: relative; z-index: 2; flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #111827; cursor: move; user-select: none; touch-action: none; }
.dj-float-h .btn { color: #e5e7eb; }
/* the corner for resizing (visible) */
.dj-float::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; border-right: 2px solid #64748b; border-bottom: 2px solid #64748b; border-radius: 0 0 4px 0; pointer-events: none; z-index: 3; }
@media (max-width: 700px) { .dj-float { position: fixed; left: 8px !important; right: 8px !important; top: auto !important; bottom: 76px; width: auto; height: 42vh; resize: none; } }
.dj-float-b { position: relative; flex: 1; min-height: 0; }
.djs { position: absolute; inset: 0; background: #02040c; overflow: hidden; }
.djs-holo, .djs-video { position: absolute; inset: 0; width: 100%; height: 100%; }
.djs-video { object-fit: contain; background: #000; }
.djs-video[hidden] { display: none; }
.djs-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 16px 10px; background: linear-gradient(transparent, rgba(0,0,0,.75)); display: flex; flex-direction: column; text-align: center; pointer-events: none; }
.djs-title b { font-size: clamp(14px, 3.2vmin, 40px); text-shadow: 0 2px 10px #000; }
.djs-title span { opacity: .75; font-size: clamp(11px, 2vmin, 24px); }
:fullscreen.dj-float-b, :fullscreen .djs { background: #000; }

/* ---- listen + choose start / end (DJ and karaoke) ---- */
.trim { display: flex; flex-direction: column; gap: 10px; min-width: 0; width: 100%; }
.trim-media { position: relative; background: #0b0f19; border-radius: 12px; min-height: 120px; display: grid; place-items: center; overflow: hidden; }
.trim-media video { width: 100%; max-height: 40vh; display: block; background: #000; }
.trim-media audio { display: none; }
.trim-cover { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; color: #e5e7eb; text-align: center; }
.trim-cover .ic { width: 36px; height: 36px; opacity: .6; }
.trim-wait { display: flex; gap: 8px; align-items: center; color: #cbd5e1; padding: 30px; }
.trim-bar { position: relative; height: 56px; border-radius: 10px; background: var(--bg-2, #111827); border: 1px solid var(--line, #334155); cursor: pointer; touch-action: none; user-select: none; }
.trim-bar canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.trim-sel { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent, #3b82f6) 28%, transparent); border-inline: 2px solid var(--accent, #3b82f6); pointer-events: none; }
.trim-h { position: absolute; top: -4px; bottom: -4px; width: 14px; margin-inline-start: -7px; border-radius: 6px; background: #22c55e; cursor: ew-resize; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.trim-h.end { background: #ef4444; }
.trim-ph { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; box-shadow: 0 0 4px #000; }
.trim-ctl { gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.trim-ctl > * { min-width: 0; }
.trim-ctl select { max-width: 100%; }
.kp-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #e9d5ff; background: #0f0b1e; text-align: center; padding: 20px; }
.kp-spin { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.18); border-top-color: #c026d3; border-radius: 50%; animation: kpspin 1s linear infinite; }
@keyframes kpspin { to { transform: rotate(360deg); } }
.sid-rename { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.adoc-apk-row .btn.icon { flex: none; }
