/* RC-505mkII trainer v2 — violet stage, lime accents, rails + overlay drawers, YouTube-Music-style player */
:root {
  --bg: #0e0a1c; --bg-2: #150f29; --bg-3: #1d1636; --bg-4: #261d45; --line: #2b2150; --line-2: #3a2d66;
  --text: #f1edff; --muted: #a79bc9; --accent: #c6ff3d; --accent-2: #9fe01f; --accent-ink: #1a2400; --violet: #7c3aed; --magenta: #b026d3; --green: #3fe3a6; --amber: #ffb347; --red: #ff4b57;
  --head-h: 56px; --bar-h: 88px; --rail-w: 56px; --drawer-w: 420px;
  --font-ui: 'Manrope', system-ui, -apple-system, sans-serif; --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 14px; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select { font: inherit; color: inherit; }
kbd { font: 600 11px/1 var(--font-ui); background: var(--bg-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; }
.app { position: fixed; inset: 0; display: grid; grid-template-rows: var(--head-h) 1fr var(--bar-h); }

/* header */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 18px; background: linear-gradient(180deg, #1a1233, var(--bg-2)); border-bottom: 1px solid var(--line); z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); justify-self: start; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(145deg, #d7ff5a, #86c000); display: grid; place-items: center; font: 700 12px var(--font-display); color: var(--accent-ink); letter-spacing: .5px; box-shadow: 0 4px 14px rgba(198,255,61,.35); }
.brand-img { height: 32px; width: auto; }
.brand-text { font: 700 14px var(--font-display); letter-spacing: 1.5px; }
.top-center { text-align: center; line-height: 1.15; }
.top-title { display: block; font: 700 14px var(--font-display); letter-spacing: 1px; }
.top-sub { display: block; font-size: 11.5px; color: var(--muted); }
.top-right { justify-self: end; display: flex; align-items: center; gap: 8px; }
.pill { font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--muted); }
.pill-ok { color: var(--accent); border-color: rgba(198,255,61,.4); }
.pill-bad { color: var(--red); border-color: rgba(255,75,87,.4); }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-3); display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: #4c3b86; }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: rgba(198,255,61,.5); }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }

/* body: rails + stage */
.body { display: grid; grid-template-columns: var(--rail-w) 1fr var(--rail-w); min-height: 0; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; background: var(--bg-2); border-right: 1px solid var(--line); z-index: 7; }
.rail-right { border-right: 0; border-left: 1px solid var(--line); }
.rail-btn { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: var(--muted); border: 1px solid transparent; }
.rail-btn:hover { color: var(--text); background: var(--bg-3); border-color: var(--line-2); }
.rail-btn.is-on { color: var(--accent); background: rgba(198,255,61,.1); border-color: rgba(198,255,61,.35); }
.rail-toggle { color: var(--text); margin-bottom: 6px; }
.rail-spacer { flex: 1; }
.rail-lang { font: 700 11px var(--font-display); letter-spacing: .5px; }

.stage { position: relative; overflow: hidden; display: grid; place-items: center; background: radial-gradient(1300px 560px at 50% 112%, #2a1a52 0%, #160f2b 45%, var(--bg) 75%); }
.stage-glow { position: absolute; left: 50%; bottom: 4%; width: 80%; height: 62%; transform: translateX(-50%); pointer-events: none; will-change: transform; background: radial-gradient(ellipse at 50% 100%, rgba(139,72,255,.42) 0%, rgba(176,38,211,.16) 38%, transparent 66%); filter: blur(12px); }
.panel-wrap { position: relative; width: min(100%, calc((100vh - var(--head-h) - var(--bar-h) - 72px) * 1.826)); max-width: 1500px; aspect-ratio: 1245 / 682; margin: 0 24px; }
.panel { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.panel-shadow { position: absolute; pointer-events: none; border-radius: 3%; box-shadow: 0 30px 50px rgba(0,0,0,.65); }
.panel-shadow-top { left: 0; top: 0; width: 100%; height: 70.2%; }
.panel-shadow-bottom { left: 3.86%; top: 38.7%; width: 92.2%; height: 61.3%; border-radius: 0 0 2% 2%; }
.panel-floor { position: absolute; left: 6%; right: 6%; bottom: -26px; height: 40px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(168,85,247,.45), transparent 70%); filter: blur(12px); pointer-events: none; }
.stage-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 12px; white-space: nowrap; opacity: .75; pointer-events: none; }

/* lesson mode banner */
.lesson-mode { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 140px); padding: 6px 8px 6px 14px; border-radius: 999px; background: rgba(21,15,41,.92); border: 1px solid rgba(198,255,61,.55); box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 4px rgba(198,255,61,.08); backdrop-filter: blur(6px); }
.lm-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: lmPulse 1.4s ease-in-out infinite; flex: none; }
@keyframes lmPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.8); } }
.lm-label { font: 700 11px var(--font-display); letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.lm-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lm-step { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lm-btn { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.lm-btn:hover { border-color: #4c3b86; }
.lm-exit { border-color: rgba(198,255,61,.6); color: var(--accent-ink); background: var(--accent); }
.lm-exit:hover { background: #d9ff6a; }
body.in-lesson .panel-wrap { box-shadow: 0 0 0 3px rgba(198,255,61,.25), 0 0 60px rgba(198,255,61,.12); border-radius: 3%; }
@media (max-width: 900px) { .lesson-mode { top: 8px; max-width: calc(100% - 16px); padding: 5px 6px 5px 12px; gap: 8px; } .lm-label, .lm-title { display: none; } .lm-step { display: inline; } }
@media (max-width: 900px) and (orientation: landscape) { .lesson-mode { top: 6px; left: 12px; transform: none; } }

/* station views: top (interactive panel) / rear (patching) */
.view-switch { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 8; display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(21,15,41,.9); border: 1px solid var(--line-2); }
.view-btn { height: 28px; padding: 0 14px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .3px; }
.view-btn:hover { color: var(--text); } .view-btn.is-on { background: var(--accent); color: var(--accent-ink); }
body.in-lesson .view-switch { display: none; }
body.view-rear .stage-hint { display: none; }
.prefs-sec .row-inline > .btn { justify-self: start; width: auto; }
.prefs-sec .row-inline { grid-template-columns: auto auto 1fr; }
.rear-wrap { position: relative; width: min(100%, calc((100vh - var(--head-h) - var(--bar-h) - 72px) * 2.4)); max-width: 1500px; margin: 0 24px; display: grid; grid-template-rows: auto auto; gap: 26px; align-content: center; }
.rear-svg { width: 100%; aspect-ratio: 1680 / 269; filter: drop-shadow(0 30px 40px rgba(0,0,0,.6)); }
.rear-svg svg { width: 100%; height: 100%; display: block; }
.rear-svg .jack:hover .hit { stroke: var(--accent); stroke-width: 3; }
.rear-cables { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.rear-cables .cable { fill: none; stroke-width: 3; stroke-linecap: round; opacity: .85; }
.rear-cables .cable.is-in { stroke: var(--accent); } .rear-cables .cable.is-out { stroke: #7cc4ff; } .rear-cables .cable.is-midi { stroke: var(--amber); }
.rear-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 44px; }
.rear-chip { display: grid; gap: 2px; padding: 8px 14px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line-2); font-size: 12px; max-width: 260px; }
.rear-chip b { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; } .rear-chip span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rear-chip.is-in b { color: var(--accent); } .rear-chip.is-out b { color: #7cc4ff; } .rear-chip.is-midi b { color: var(--amber); }
.rear-tip { position: absolute; z-index: 9; width: 280px; padding: 10px 12px; border-radius: 10px; background: rgba(21,15,41,.97); border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,.5); font-size: 12.5px; line-height: 1.4; pointer-events: none; display: grid; gap: 4px; }
.rear-tip b { font-size: 12px; letter-spacing: 1px; color: var(--accent); } .rear-tip span { color: #d8d1ee; } .rear-tip em { color: var(--muted); font-style: normal; }
.rear-pop { position: absolute; z-index: 10; width: 320px; border-radius: 14px; background: var(--bg-2); border: 1px solid rgba(198,255,61,.5); box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.rp-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 8px 14px; border-bottom: 1px solid var(--line); } .rp-head b { font: 700 12px var(--font-display); letter-spacing: 1px; color: var(--accent); }
.rp-desc { padding: 10px 14px 4px; color: #d8d1ee; font-size: 12.5px; line-height: 1.45; }
.rp-body { display: grid; gap: 8px; padding: 8px 14px 14px; } .rp-body .select { width: 100%; } .rp-hint { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.rear-hint { text-align: center; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .view-switch { bottom: 6px; } .rear-wrap { margin: 0 8px; width: calc(100% - 16px); } .rear-tip { display: none; } }

/* LCD mirror */
.lcd-mirror { position: absolute; top: 14px; right: 14px; width: 330px; background: rgba(21,15,41,.96); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 6; }
.lcd-mirror-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; font-weight: 700; font-size: 12px; letter-spacing: .5px; border-bottom: 1px solid var(--line); }
.lcd { margin: 12px; height: 150px; border-radius: 6px; background: linear-gradient(180deg, #252568 0%, #31338a 45%, #22245c 100%); box-shadow: inset 0 2px 8px rgba(0,0,0,.7), inset 0 0 0 1px #1b1c4a; color: #eef0ff; font-family: 'Pixelify Sans', 'VT323', monospace; position: relative; padding: 8px 10px; }
.lcd-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.lcd-big { text-align: center; font-size: 46px; font-weight: 700; line-height: 1; margin-top: 4px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; }
.lcd-sub { text-align: center; font-size: 20px; line-height: 1.1; white-space: nowrap; overflow: hidden; }
.lcd-cols { position: absolute; left: 8px; right: 8px; bottom: 6px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; text-align: center; }
.lcd-cols b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; } .lcd-cols i { display: block; font-style: normal; font-size: 10.5px; white-space: nowrap; overflow: hidden; }

/* drawers overlay the stage */
.drawer { position: absolute; top: 0; bottom: 0; width: var(--drawer-w); max-width: 100%; background: rgba(21,15,41,.97); display: grid; grid-template-rows: auto auto 1fr; transition: transform .28s cubic-bezier(.2,.8,.2,1); z-index: 8; box-shadow: 0 0 40px rgba(0,0,0,.45); }
.drawer-left { left: 0; border-right: 1px solid var(--line-2); transform: translateX(-102%); }
.drawer-right { right: 0; border-left: 1px solid var(--line-2); transform: translateX(102%); grid-template-rows: auto 1fr auto; }
.drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font: 700 13px var(--font-display); letter-spacing: 1px; }
.drawer-tools { display: grid; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow: auto; padding: 12px 14px; scrollbar-width: thin; }
.search { width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text); outline: none; }
.search:focus { border-color: rgba(198,255,61,.5); }
.select { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.chip.is-on, .chip:hover { color: var(--text); border-color: #4c3b86; background: var(--bg-3); }
.chip.is-on { border-color: rgba(198,255,61,.55); color: var(--accent); }
.mk summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 4px 0; }
.mk-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 8px; }
.mk input[type=file] { padding-top: 8px; font-size: 12px; }

/* cards */
.card { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-3); margin-bottom: 8px; cursor: pointer; }
.card:hover { border-color: #4c3b86; }
.card.is-now { border-color: rgba(198,255,61,.5); }
.card-thumb { width: 64px; height: 46px; border-radius: 8px; background: var(--bg-4) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-main { min-width: 0; }
.card-title { font-weight: 700; font-size: 13px; line-height: 1.3; }
.card-meta { color: var(--muted); font-size: 11px; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.tag { padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 10.5px; white-space: nowrap; }
.tag-basic { color: var(--green); } .tag-intermediate { color: var(--amber); } .tag-advanced { color: var(--red); }
.card-sum { color: #cfc6ea; font-size: 12px; line-height: 1.4; margin-top: 4px; }
.card-fav { color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 4px; }
.card-fav.is-on { color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }
.detail-back { margin-bottom: 10px; }
.detail h3 { margin: 6px 0 4px; font-size: 16px; line-height: 1.3; }
.detail .video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 10px; background: #000; margin: 10px 0; }
.detail p { color: #cfc6ea; line-height: 1.45; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3); font-weight: 600; text-decoration: none; color: var(--text); }
.btn-primary { background: linear-gradient(180deg, #d4ff5c, #9fe01f); border-color: #6f9c0c; color: var(--accent-ink); }
.btn:hover { border-color: #4c3b86; } .btn-primary:hover { filter: brightness(1.05); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; line-height: 1.45; font-size: 13.5px; }
.msg-user { align-self: flex-end; background: rgba(198,255,61,.12); border: 1px solid rgba(198,255,61,.35); }
.msg-teacher { align-self: flex-start; background: var(--bg-3); border: 1px solid var(--line); }
.msg-sys { align-self: center; color: var(--muted); font-size: 12px; text-align: center; }
.msg.is-thinking .msg-text { display: flex; gap: 4px; align-items: center; }
.msg.is-thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: think 1.1s ease-in-out infinite; }
.msg.is-thinking i:nth-child(2) { animation-delay: .15s } .msg.is-thinking i:nth-child(3) { animation-delay: .3s }
@keyframes think { 0%, 100% { opacity: .3; transform: translateY(0) } 50% { opacity: 1; transform: translateY(-3px) } }
.msg-actions { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; } .msg-actions .tag { cursor: pointer; }
.chat-form { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.mic-btn { position: relative; width: 40px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--muted); display: grid; place-items: center; touch-action: none; user-select: none; }
.mic-btn.is-rec { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.send { width: 42px; height: 38px; border-radius: 9px; border: 1px solid #6f9c0c; background: linear-gradient(180deg, #d4ff5c, #9fe01f); color: var(--accent-ink); }

/* bottom sheets (steps = lyrics, queue) */
.sheet { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 0); width: min(1180px, 100% - 40px); height: 64%; background: rgba(19,13,38,.985); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 18px 18px 0 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 1fr); z-index: 9; box-shadow: 0 -16px 40px rgba(0,0,0,.45); overflow: hidden; }
.sheet-media { display: grid; align-content: center; gap: 12px; padding: 22px 26px; border-right: 1px solid var(--line); min-width: 0; background: radial-gradient(900px 400px at 30% 120%, rgba(124,58,237,.18), transparent 60%); }
.sheet-media .video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; background: #000; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.sheet-media .cover { width: 100%; aspect-ratio: 16/9; border-radius: 12px; background: linear-gradient(145deg, #2a1f52, #17102e); display: grid; place-items: center; color: var(--accent); box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.sheet-media .cover svg { width: 64px; height: 64px; }
.sheet-media .m-title { font: 700 18px var(--font-display); line-height: 1.25; }
.sheet-media .m-sub { color: var(--muted); font-size: 13.5px; }
.sheet-media .m-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sheet-side { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px 0 12px; border-bottom: 1px solid var(--line); }
.sheet-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.stab { height: 46px; padding: 0 12px; text-transform: uppercase; letter-spacing: .9px; font-weight: 700; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.stab:hover { color: var(--text); }
.stab.is-on { color: var(--text); border-bottom-color: var(--accent); }
.sheet-body { overflow: auto; padding: 10px 12px; scrollbar-width: thin; }
.sheet-lyrics { padding: 18px 22px; }
.step { padding: 8px 0; color: rgba(167,155,201,.55); font-size: 20px; font-weight: 700; line-height: 1.35; cursor: pointer; transition: color .2s, transform .2s; transform-origin: left center; }
.step:hover { color: var(--muted); }
.step.is-current { color: var(--text); }
.step.is-done { color: rgba(127,209,168,.55); }
.step-n { font-weight: 800; margin-right: 10px; color: var(--accent); font-size: 13px; vertical-align: 3px; }
.qitem { display: grid; grid-template-columns: 24px 48px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.qitem:hover { background: var(--bg-3); } .qitem.is-now { background: rgba(198,255,61,.08); }
.qitem .n { color: var(--muted); font-size: 12px; text-align: center; } .qitem.is-now .n { color: var(--accent); }
.qitem .th { width: 48px; height: 34px; border-radius: 6px; background: var(--bg-4) center/cover; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
/* thumbEl() кладёт <img> в этот div без своих размеров — без правила ниже картинка
   рендерится в родном разрешении YouTube-превью (320×180) и заливает собой соседние
   строки списка "Далее" вместо того чтобы обрезаться по рамке 48×34. */
.qitem .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qitem .ti { font-weight: 600; font-size: 13px; line-height: 1.25; } .qitem .su { color: var(--muted); font-size: 11.5px; }
.qitem .rm { color: var(--muted); font-size: 16px; padding: 4px 8px; }

/* player bar — YouTube Music layout: transport | now playing | controls; thin progress line on the top edge */
/* Правовая строка рядом со штампом сборки: видно всегда, но не мешает. */
.build-stamp .legal-line { margin-left: 8px; }
.build-stamp .legal-line::before { content: '·'; margin-right: 8px; opacity: .6; }
.build-stamp span:empty + .legal-line { margin-left: 0; }
.build-stamp span:empty + .legal-line::before { content: none; }
/* Вставка транскрипта: YouTube не отдаёт субтитры нашему серверу, поэтому текст можно принести руками. */
.mk-col { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.mk-area { resize: vertical; min-height: 64px; font: inherit; line-height: 1.35; padding: 8px 10px; }
/* Ползунок громкости учителя — единственный range в проекте, поэтому стиль тут же. */
.range { flex: 1; min-width: 120px; max-width: 220px; accent-color: #7c5cff; background: transparent; cursor: pointer; }
/* Штамп сборки: мелко в свободной нижней полосе плеера — видно, подхватилась ли выкладка. */
.build-stamp { position: absolute; left: 10px; bottom: 2px; font-size: 9px; line-height: 1; letter-spacing: .2px; opacity: .38; pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.player { position: relative; display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: 12px; padding: 0 12px 0 8px; background: linear-gradient(0deg, #120c24, var(--bg-2)); border-top: 1px solid var(--line); z-index: 5; }
.pb-progress { position: absolute; left: 0; right: 0; top: -7px; height: 14px; cursor: pointer; z-index: 1; }
.pb-track { position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: rgba(255,255,255,.16); transition: height .12s, top .12s; }
.pb-progress:hover .pb-track { height: 5px; top: 4.5px; }
.pb-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width .25s; }
.pb-steps { position: absolute; inset: 0; }
.pb-steps i { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(14,10,28,.75); }
.pb-knob { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); opacity: 0; transition: opacity .12s, left .25s; box-shadow: 0 0 0 4px rgba(198,255,61,.18); }
.pb-progress:hover .pb-knob { opacity: 1; }
.pb-progress[aria-disabled="true"] { cursor: default; } .pb-progress[aria-disabled="true"]:hover .pb-track { height: 2px; top: 6px; } .pb-progress[aria-disabled="true"] .pb-knob { display: none; }
.pb-left { display: flex; align-items: center; gap: 2px; justify-self: start; }
.tr-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); opacity: .92; }
.tr-btn:hover { opacity: 1; background: rgba(255,255,255,.07); }
.tr-btn:disabled { opacity: .3; cursor: default; background: none; }
.tr-play { width: 52px; height: 52px; }
.tr-play svg { width: 38px; height: 38px; }
.tr-time { margin-left: 10px; color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.np { display: flex; align-items: center; gap: 14px; min-width: 0; max-width: min(640px, 44vw); justify-self: center; }
.np-thumb { width: 48px; height: 48px; border-radius: 4px; background: var(--bg-4) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); flex: none; overflow: hidden; cursor: pointer; }
.np-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-text { min-width: 0; }
.np-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.np-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-actions { display: flex; align-items: center; gap: 0; flex: none; margin-left: 4px; }
.pb-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); position: relative; }
.pb-icon:hover { color: var(--text); background: rgba(255,255,255,.07); }
.pb-icon[aria-pressed="true"] { color: var(--accent); }
.pb-icon[aria-pressed="true"]::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.np-fav[aria-pressed="true"]::after, .pb-expand::after { display: none; }
#btnRepeat[data-mode="one"]::before { content: "1"; position: absolute; right: 7px; top: 7px; font: 800 9px var(--font-ui); color: var(--accent-ink); background: var(--accent); border-radius: 999px; width: 13px; height: 13px; display: grid; place-items: center; }
.pb-right { display: flex; align-items: center; gap: 0; justify-self: end; }
.pb-expand svg { transition: transform .2s; } .pb-expand[aria-pressed="true"] svg { transform: rotate(180deg); }
.orb-wrap { display: grid; justify-items: center; gap: 2px; margin: 0 10px 0 8px; }
.orb { position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; }
/* PIN не введён — приглушаем и кружок, и микрофон в чате ОДИНАКОВО (updateLockUI в app.js),
   чтобы не было как раньше: чат уже просит код, а кружок как ни в чём не бывало "Listening". */
.orb.is-locked, .mic-btn.is-locked { opacity: .4; filter: grayscale(.6); }
/* живой режим: микрофон временно отключён от соединения, пока ты молчишь (экономия) */
.orb.is-muted .orb-core { filter: saturate(.35) brightness(.8); }
.orb.is-locked::after, .mic-btn.is-locked::after { content: '🔒'; position: absolute; right: -2px; bottom: -2px; font-size: 11px; line-height: 1; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(198,255,61,.35); transition: transform .12s; }
.orb-core { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e6ff8a, #9fe01f 55%, #5d8a12); box-shadow: 0 6px 22px rgba(198,255,61,.45); display: grid; place-items: center; transition: transform .15s; }
.orb-bars { display: flex; gap: 3px; align-items: center; height: 18px; opacity: 0; transition: opacity .2s; }
.orb-bars i { width: 3px; height: 6px; border-radius: 2px; background: var(--accent-ink); }
.orb[data-state="idle"] .orb-core { animation: orbBreath 3.2s ease-in-out infinite; }
.orb[data-state="starting"] .orb-ring { border-color: var(--accent); border-style: dashed; animation: orbSpin 1.6s linear infinite; }
.orb[data-state="listening"] .orb-ring { border-color: var(--accent); box-shadow: 0 0 0 6px rgba(198,255,61,.12), 0 0 24px rgba(198,255,61,.35); transform: scale(calc(1 + var(--level, 0) * 0.35)); }
.orb[data-state="listening"] .orb-core { transform: scale(calc(1 + var(--level, 0) * 0.12)); }
.orb[data-state="thinking"] .orb-ring { border: 2px solid transparent; background: conic-gradient(from 0deg, transparent 0 60%, var(--accent) 100%) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: orbSpin 1s linear infinite; }
.orb[data-state="speaking"] .orb-bars { opacity: 1; }
.orb[data-state="speaking"] .orb-bars i { animation: orbBar .7s ease-in-out infinite; }
.orb[data-state="speaking"] .orb-bars i:nth-child(2) { animation-delay: .1s } .orb[data-state="speaking"] .orb-bars i:nth-child(3) { animation-delay: .2s } .orb[data-state="speaking"] .orb-bars i:nth-child(4) { animation-delay: .3s } .orb[data-state="speaking"] .orb-bars i:nth-child(5) { animation-delay: .4s }
.orb[data-state="off"] .orb-core, .orb.is-unavailable .orb-core { background: radial-gradient(circle at 35% 30%, #6d6a80, #3a3550 60%); box-shadow: none; animation: none; }
.orb-label { font-size: 10.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
@keyframes orbBreath { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbBar { 0%,100% { height: 5px; } 50% { height: 18px; } }
/* chat: sources under a teacher answer */
.msg-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-sources .src { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); cursor: pointer; }
.msg-sources .src:hover { color: var(--text); border-color: #4c3b86; }
.msg-sources .src.is-lesson { color: var(--accent); border-color: rgba(198,255,61,.45); }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 12px 8px; } .chat-suggest .src-label { font-size: 11.5px; color: var(--muted); } .chat-suggest-list { display: contents; }
.chat-suggest .src { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); cursor: pointer; }
.chat-suggest .src:hover { color: var(--text); border-color: #4c3b86; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 20; }
.modal-card { width: 480px; max-width: calc(100vw - 40px); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; }
.modal-card.prefs { width: 760px; }
.cost-body { padding: 4px 16px 16px; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cost-table th { text-align: left; padding: 8px 10px; color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.cost-table td { padding: 12px 10px; vertical-align: top; border-bottom: 1px solid var(--line); line-height: 1.45; }
.cost-table tr.is-pick td { background: rgba(198,255,61,.07); }
.cost-table tr.is-pick b { color: var(--accent); }
.cost-table .hint { padding: 4px 0 0; font-size: 11.5px; }
.prefs-body { display: grid; grid-template-columns: 170px 1fr; min-height: 380px; }
.prefs-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-right: 1px solid var(--line); background: rgba(0,0,0,.15); border-radius: 0 0 0 14px; }
.prefs-tab { text-align: left; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; }
.prefs-tab:hover { color: var(--text); background: var(--bg-3); } .prefs-tab.is-on { color: var(--accent); background: rgba(198,255,61,.1); }
.prefs-panes { padding: 6px 4px 10px; min-width: 0; }
.prefs-sec .set-h { padding-top: 4px; }
@media (max-width: 900px) { .prefs-body { grid-template-columns: 1fr; } .prefs-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); border-radius: 0; } }
.modal-card .row { display: grid; gap: 6px; padding: 10px 16px; }
.modal-card .hint { padding: 0 16px 16px; color: var(--muted); font-size: 12.5px; margin: 0; }
.modal-card { max-height: calc(100vh - 40px); overflow: auto; scrollbar-width: thin; }
.set-audio { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.set-h { display: flex; align-items: center; gap: 10px; padding: 8px 16px 2px; font: 700 12px var(--font-display); letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.hint-inline { color: var(--muted); font-size: 12px; font-weight: 500; }
.row-inline { grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.meter-row { grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; }
.meter { height: 8px; border-radius: 4px; background: var(--bg-4); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ffb347 80%, var(--red)); transition: width .08s linear; }
#btnAudioTest[disabled] { opacity: .6; cursor: default; }
@media (max-width: 1180px) { :root { --drawer-w: 360px; } .stage-hint { display: none; } .np { max-width: 38vw; } .tr-time { display: none; } #btnShuffle, #btnRepeat { display: none; } .sheet { grid-template-columns: 1fr; grid-template-rows: auto 1fr; width: min(820px, 100% - 40px); } .sheet-media { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px 10px; grid-template-columns: 120px 1fr; align-items: center; column-gap: 14px; } .sheet-media .video, .sheet-media .cover { grid-row: 1 / span 3; box-shadow: none; } .sheet-media .m-title { font-size: 15px; } }

/* guided tour */
.tour { position: fixed; inset: 0; z-index: 50; display: none; }
.tour.is-on { display: block; }
.tour-spot { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(6,3,16,.78), 0 0 0 3px rgba(198,255,61,.85), 0 0 30px rgba(198,255,61,.45); transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-card { position: absolute; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.6); transition: left .25s, top .25s; }
.tour-n { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: .5px; }
.tour-title { margin: 6px 0 6px; font: 700 15px var(--font-display); }
.tour-text { margin: 0 0 14px; color: #d8d1ee; line-height: 1.5; font-size: 13.5px; }
.tour-btns { display: flex; gap: 8px; align-items: center; }
.tour-spacer { flex: 1; }
.tour-prev { width: 38px; padding: 0; justify-content: center; }
.tour-prev:disabled { opacity: .4; cursor: default; }
body.tour-on .drawer, body.tour-on .sheet { pointer-events: none; }

/* key map mode */
.keymap { position: fixed; inset: 0; z-index: 40; background: rgba(6,3,16,.55); display: grid; align-items: start; justify-items: center; padding-top: 70px; pointer-events: auto; }
.keymap-card { width: min(720px, calc(100vw - 40px)); background: var(--bg-2); border: 1px solid rgba(198,255,61,.5); border-radius: 14px; padding: 14px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.6); pointer-events: auto; }
.keymap-title { font: 700 14px var(--font-display); color: var(--accent); letter-spacing: 1px; }
.keymap-text { color: #d8d1ee; font-size: 13px; margin: 6px 0 8px; line-height: 1.45; }
.keymap-sel { font: 700 14px var(--font-ui); min-height: 20px; color: var(--text); margin-bottom: 10px; }
.keymap-btns { display: flex; gap: 8px; align-items: center; }
.keymap-legend { margin-top: 10px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
body:has(.keymap:not([hidden])) .stage { z-index: 41; position: relative; }
body:has(.keymap:not([hidden])) .drawer, body:has(.keymap:not([hidden])) .sheet, body:has(.keymap:not([hidden])) .lcd-mirror { visibility: hidden; }

/* context menu (⋮) */
.card-more, .qitem .more { color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.card-more:hover, .qitem .more:hover { background: var(--bg-4); color: var(--text); }
.ctxmenu { position: fixed; z-index: 60; min-width: 240px; background: #1a1230; border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.6); }
.ctxmenu button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 13.5px; }
.ctxmenu button:hover { background: var(--bg-3); }
.ctxmenu .ico { width: 18px; text-align: center; color: var(--muted); }
.ctxmenu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
/* now-playing info pane */
.now-info h3 { margin: 4px 0 8px; font-size: 16px; }
.now-info .video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 10px; background: #000; margin-bottom: 10px; }
.now-info p { color: #cfc6ea; line-height: 1.5; }
/* mobile */
.mobile-only { display: none; }
.m-fab { display: none; position: absolute; right: 10px; top: 10px; z-index: 13; gap: 8px; }
.m-fab .icon-btn { background: rgba(21,15,41,.85); }
.rotate-hint { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(6,3,16,.7); padding: 20px; }
.rotate-card { max-width: 420px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; text-align: center; }
.rotate-icon { font-size: 40px; margin-bottom: 10px; }
.rotate-text { color: #d8d1ee; line-height: 1.5; margin-bottom: 14px; }
.rotate-card .keymap-btns { justify-content: center; }
@media (max-width: 900px) {
  :root { --head-h: 52px; --bar-h: 72px; --drawer-w: 100%; }
  .rail { display: none; }
  .body { grid-template-columns: 1fr; }
  .mobile-only { display: grid; }
  .top { padding: 0 12px; grid-template-columns: auto 1fr auto; }
  .top-center { text-align: left; padding-left: 10px; } .brand-text { display: none; }
  #srvStatus, #micStatus, #btnAccount, #btnKeys { display: none; }
  .stage-hint, .lcd-mirror { display: none; }
  .panel-wrap { margin: 0 8px; width: calc(100% - 16px); }
  .drawer { width: 100%; }
  .sheet { width: 100%; height: 70%; border-radius: 16px 16px 0 0; }
  .player { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; padding: 0 8px 0 10px; }
  .build-stamp { display: none; }
  .np { order: 1; justify-self: stretch; max-width: none; gap: 10px; } .np-thumb { width: 44px; height: 44px; } .np-actions { display: none; }
  .pb-left { order: 2; } #trPrev, .tr-time { display: none; } .tr-btn { width: 40px; height: 40px; } .tr-play { width: 44px; height: 44px; } .tr-play svg { width: 32px; height: 32px; }
  .pb-right { order: 3; } .pb-right .pb-icon { display: none; } .orb-wrap { margin: 0 0 0 4px; } .orb { width: 44px; height: 44px; } .orb-core { width: 32px; height: 32px; } .orb-label { display: none; }
  .sheet { width: 100%; height: 72%; border-radius: 16px 16px 0 0; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sheet-media { padding: 10px 12px 8px; grid-template-columns: 1fr; gap: 6px; } .sheet-media .video, .sheet-media .cover { grid-row: auto; max-height: 30vh; }
  .sheet-lyrics { padding: 12px 16px; } .step { font-size: 17px; }
}
@media (max-width: 900px) and (orientation: landscape) {
  :root { --head-h: 0px; --bar-h: 0px; }
  .top, .player { display: none; }
  .panel-wrap { width: min(100%, calc((100vh - 16px) * 1.826)); margin: 0; }
  .m-fab { display: flex; }
}

/* language switch (header + first-open notice) */
html.i18n-wait body { visibility: hidden; }
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-3); flex: none; }
.lang-opt { height: 30px; min-width: 36px; padding: 0 9px; border-radius: 7px; font: 700 11px var(--font-display); letter-spacing: .5px; color: var(--muted); }
.lang-opt:hover { color: var(--text); }
.lang-opt[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* first-open notice: unofficial trainer, no rights claimed */
.disclaimer { z-index: 70; background: rgba(6,3,16,.82); padding: 16px; }
.disc-card { width: 720px; max-width: calc(100vw - 32px); border-color: rgba(198,255,61,.5); box-shadow: 0 24px 60px rgba(0,0,0,.65); }
.disc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.disc-badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.disc-head h2 { margin: 0; font: 700 20px var(--font-display); letter-spacing: .5px; }
.disc-lead { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.disc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
.disc-table th { width: 168px; text-align: left; vertical-align: top; padding: 11px 12px 11px 20px; color: var(--accent); font: 700 11px var(--font-display); letter-spacing: .8px; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.disc-table td { padding: 11px 20px 11px 8px; vertical-align: top; color: #e2dcf5; border-bottom: 1px solid var(--line); }
.disc-table tr:last-child th, .disc-table tr:last-child td { border-bottom: 0; }
.disc-foot { display: flex; justify-content: flex-end; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.disc-foot .btn { height: 44px; padding: 0 22px; font-weight: 700; }
.build-stamp .legal-line { pointer-events: auto; cursor: pointer; }
.build-stamp .legal-line:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .lang-opt { height: 28px; min-width: 32px; padding: 0 7px; }
  .top-right { gap: 6px; } .top .icon-btn { width: 32px; height: 32px; }
  .top-center { min-width: 0; overflow: hidden; } .top-title { font-size: 13px; white-space: nowrap; } .top-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .disclaimer { padding: 8px; } .disc-card { max-width: calc(100vw - 16px); }
  .disc-head { padding: 14px 14px 10px; } .disc-head h2 { font-size: 17px; }
  .disc-table, .disc-table tbody, .disc-table tr, .disc-table th, .disc-table td { display: block; width: auto; }
  .disc-table th { padding: 10px 14px 2px; border-bottom: 0; }
  .disc-table td { padding: 0 14px 10px; font-size: 13px; }
  .disc-foot { padding: 12px 14px 14px; } .disc-foot .btn { width: 100%; justify-content: center; }
}
