/* Tananyaglejátszó – képközpontú felület (Claude–Codex konszenzus, 2026-11-05; vizuális terv és ikonok: Codex).
   A geometriát a player.js layout() számolja: a #viewport a kép tartománya, ablakban a kezelősáv mindig dokkol
   (a kép és a sáv metszete 0), teljes képernyőn és Tiszta kép módban ráúszik és elrejthető. */
:root {
  color-scheme: dark;
  --bg: #091114; --surface: #132226; --panel: #142328; --border: #2d4247; --line: #ffffff14;
  --text: #ecf3f1; --muted: #a2b4b6; --accent: #b8ead1; --accent-ink: #112b22; --warn: #f1d58a;
  --bar-h: 56px; --radius: 14px;
  font: 14px/1.45 'Segoe UI', system-ui, sans-serif; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
input { accent-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }

#player { position: relative; height: 100vh; height: 100dvh; display: flex; overflow: hidden; background: var(--bg); }
#canvas { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#viewport { position: absolute; overflow: hidden; background: #030610; }
#viewport.zoomed { cursor: grab; touch-action: none; }
#viewport.dragging { cursor: grabbing; }
#picture { position: absolute; overflow: hidden; transform-origin: 0 0; visibility: hidden; }
iframe { position: absolute; border: 0; width: 1920px; height: 1080px; pointer-events: none; }

/* ---------- ikongombok és buborék (hoverre és fókuszra) ---------- */
.icon { width: 40px; height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; position: relative; color: #dbe7e4; }
.icon:hover:not(:disabled) { background: #ffffff12; }
.icon[aria-pressed="true"], .icon[aria-expanded="true"] { color: var(--accent); background: #b8ead119; }
.icon[data-tip]:is(:hover, :focus-visible)::after {
  content: attr(data-tip); position: absolute; z-index: 30; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 240px; padding: 6px 10px; border-radius: 7px; background: #2c4548; border: 1px solid #69877b;
  box-shadow: 0 4px 16px #0006; font-size: 12px; line-height: 1.4; color: #eef7f0; pointer-events: none; white-space: normal; text-align: center;
}
#controls .icon:last-child::after { left: auto; right: 0; transform: none; }
#controls .icon:first-child::after { left: 0; transform: none; }
.top-actions .icon::after, .panel-heading .icon::after { bottom: auto !important; top: calc(100% + 8px); left: auto !important; right: 0; transform: none !important; }

/* ---------- felső rész: cím, Tiszta kép, súgó; fejezetgomb ---------- */
#top { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 12px 4px 16px; }
#title { font-size: 14px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-actions { display: flex; gap: 2px; flex-shrink: 0; }
.chapter-pill { position: absolute; z-index: 3; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 11px; font-size: 13px; color: #dfebe7;
  border: 1px solid #ffffff1c; border-radius: 9px; background: #0d1a1dcc; max-width: 420px; }
.chapter-pill:hover:not(:disabled) { background: #16282c; }
.chapter-pill svg { width: 15px; height: 15px; }
.chapter-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.pill-label { display: none; }
#scene-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* széles, alacsony ablak: a cím és a fejezetgomb a kép melletti szabad oszlopban */
#top { pointer-events: none; }
#top > * { pointer-events: auto; }
#player.side-chrome #top { height: auto; align-items: flex-start; padding: 16px 8px 16px 12px; }
#player.side-chrome #title { width: calc(var(--side) - 24px); white-space: normal; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
#player.side-chrome .top-actions { flex-direction: column; }
#player.side-chrome .chapter-pill { top: var(--pill-top); left: 12px; max-width: calc(var(--side) - 24px); padding: 6px 9px; }
#player.side-chrome #scene-title, #player.side-chrome .chapter-dot { display: none; }
#player.side-chrome .pill-label { display: inline; }
/* keskenyebb ablak: 48 px-es felső sáv */
#player.compact-top #top { padding-left: 16px; }
#player.compact-top #title { flex: 0 1 auto; max-width: 40%; color: var(--muted); font-weight: 500; font-size: 13px; }
#player.compact-top .chapter-pill { top: 4px; left: var(--pill-left); max-width: calc(100% - var(--pill-left) - 110px); }
/* álló telefon: cím + ikonok, alatta a fejezetgomb */
#player.portrait #top { height: 52px; }
#player.portrait .chapter-pill { top: 52px; left: 14px; max-width: calc(100% - 28px); }

/* ---------- kezelősáv ---------- */
#controls { position: absolute; z-index: 4; left: 16px; right: 16px; bottom: 4px; height: var(--bar-h); display: flex; align-items: center; gap: 4px; padding: 0 8px;
  border: 1px solid #ffffff1a; border-radius: var(--radius); background: #132226f0; box-shadow: 0 10px 40px #0004;
  will-change: transform; }
#controls .icon svg { will-change: transform; }   /* saját réteg: az idő és a haladás változása nem raszterizálja újra az ikonokat */
#play { color: var(--accent-ink); background: var(--accent); margin-right: 2px; }
#play:hover:not(:disabled) { background: #d0f5e2; }
#play svg { fill: currentColor; stroke-width: 1.4; }
#play.playing svg { fill: none; stroke-width: 3; }
.scrub { position: relative; flex: 1; min-width: 60px; height: 40px; margin: 0 10px; display: flex; align-items: center; }
.rail { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: #ffffff20; pointer-events: none; }
#buffer { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: #ffffff2e; }
#progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--accent); }
.marker { position: absolute; top: -2px; width: 2px; height: 8px; margin-left: -1px; background: #091114; }
#seek { position: relative; width: 100%; height: 32px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
#seek::-webkit-slider-runnable-track { background: transparent; height: 32px; }
#seek::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #b8ead126; }
#seek::-moz-range-track { background: transparent; }
#seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--accent); }
#seek:disabled { cursor: default; }
#seek-tip { position: absolute; bottom: 44px; transform: translateX(-50%); padding: 6px 9px; border-radius: 7px; background: #23383d; border: 1px solid var(--border); font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 30; }
#seek-tip b { color: var(--accent); font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; }
#time { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: 8px; }
#time span { color: var(--muted); }

/* ráúszó sáv (teljes képernyő, Tiszta kép) és elrejtés */
#player.overlay #controls { bottom: 14px; left: 24px; right: 24px; }
.chrome { transition: opacity .2s ease; }
#player.ui-hidden .chrome { opacity: 0; pointer-events: none; }
#player.ui-hidden #viewport { cursor: none; }
#player.clean .chrome, #player.clean #below { display: none !important; }
#reveal { position: absolute; z-index: 8; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: #172a2ee8; border: 1px solid #46625c; font-size: 13px; }

/* ---------- felirat ---------- */
#caption { position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: 88%; width: max-content; margin: 0; padding: 7px 14px; border-radius: 7px;
  background: #080e12e8; color: #fff; font-size: calc(clamp(14px, 1.6vw, 24px) * var(--caption-scale, 1)); line-height: 1.45; text-align: center; white-space: pre-line; pointer-events: none; }
#below { position: absolute; z-index: 3; left: 16px; right: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#portrait-caption { margin: 0; text-align: center; font-size: calc(20px * var(--caption-scale, 1)); line-height: 1.5; white-space: pre-line; }
#quick-zoom { border: 1px solid #405b56; background: #132622; color: var(--accent); align-self: flex-end; }

/* ---------- középső állapotok ---------- */
#center { position: absolute; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: none; }
#start { pointer-events: auto; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 45px #0006; border: 1px solid #ffffff40; }
#start:hover { background: #d0f5e2; }
#start svg { width: 32px; height: 32px; fill: currentColor; }
#start.replay svg { fill: none; stroke-width: 2.2; }
#start:not(.replay) svg { margin-left: 4px; }
#center-text { font-size: 13px; padding: 5px 13px; border-radius: 20px; background: #0b171de0; color: #d9e8e3; }
#center-text:empty { display: none; }
#state { position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 360px; max-width: calc(100% - 32px); padding: 22px 24px; text-align: center;
  border: 1px solid #44645e; border-radius: 16px; background: #142328f5; box-shadow: 0 20px 80px #000a; }
#state.quiet { width: auto; padding: 14px 18px; }
#state:not(.busy) .loading-wheel { display: none; }
#state.error { border-color: #a8822c; }
#status { margin: 0; font-size: 14px; line-height: 1.6; color: #d4e2de; }
.loading-wheel { display: block; width: 30px; height: 30px; margin: 0 auto 14px; border: 3px solid #b8ead125; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- előugró panelek ---------- */
.popover { position: absolute; z-index: 6; width: 330px; max-width: calc(100% - 24px); overflow: auto; padding: 16px 18px; border: 1px solid #354c51; border-radius: 16px; background: var(--panel); box-shadow: 0 20px 70px #0009; }
#settings { right: 16px; bottom: calc(var(--bar-h) + 14px); max-height: calc(100% - var(--bar-h) - 30px); }
#player.overlay #settings { right: 24px; bottom: calc(var(--bar-h) + 24px); }
#chapter-panel { left: 16px; top: var(--panel-top, 56px); width: 380px; max-height: calc(100% - var(--panel-top, 56px) - var(--bar-h) - 24px); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-heading h2 { font-size: 18px; margin: 0; letter-spacing: -.2px; }
.panel-heading .icon { color: #a7babc; }
.setting { padding: 12px 0; border-top: 1px solid var(--line); }
.setting h3, .setting label { display: block; margin: 0 0 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.setting-label { display: flex; align-items: center; justify-content: space-between; }
.setting-label h3 { margin: 0; }
.segments { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: #08131680; }
.segments button { flex: 1; min-height: 40px; border-radius: 6px; font-size: 13px; color: #a9bcbd; white-space: nowrap; }
.segments button:hover { background: #ffffff0d; }
.segments button[aria-pressed="true"] { background: #355047; color: #d5f5e5; box-shadow: 0 1px 5px #0003; }
#volume { display: block; width: 100%; min-height: 24px; margin: 0; }
.text-button { min-height: 40px; padding: 6px 9px; border-radius: 7px; font-size: 13px; color: var(--accent); }
.text-button:hover { background: #ffffff0d; }
.text-button[aria-pressed="true"] { background: #b8ead11c; }
.panel-link { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 2px; border-top: 1px solid var(--line); text-align: left; font-size: 13px; color: #dbe9e3; }
.panel-link span:last-child { color: var(--muted); }
.mobile-actions { display: none; }
#chapters { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
#chapters .chapter-row { width: 100%; }
.chapter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 9px 10px; border-radius: 8px; text-align: left; font-size: 13px; color: #c3d3cf; }
.chapter-row:hover { background: #ffffff0d; }
.chapter-row small { flex-shrink: 0; font-variant-numeric: tabular-nums; color: #93a7a6; }
.chapter-row[aria-current="true"] { background: #b8ead118; color: var(--accent); }

/* ---------- értesítés (hang nélküli mód, tippek): nem tolja el a tartalmat ---------- */
.toast { position: absolute; z-index: 10; top: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(620px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 16px; border-radius: 11px; background: #2b2615f5; border: 1px solid #a8822c; color: #fff3d6; box-shadow: 0 8px 30px #0006; font-size: 13px; }
.toast p { margin: 0; flex: 1 1 240px; }
.toast-actions { display: flex; gap: 6px; }
.toast button { min-height: 34px; padding: 5px 11px; border-radius: 7px; background: #4a3d18; border: 1px solid #a8822c; font-size: 13px; }
.toast.ok { background: #28483cf5; border-color: #5f9a80; color: #dbf8e9; }
.toast.ok button { background: #315448; border-color: #5f9a80; }

/* ---------- átirat ---------- */
#transcript { position: relative; z-index: 5; width: 340px; min-width: 340px; display: flex; flex-direction: column; padding: 16px 18px 0; background: var(--surface); border-left: 1px solid #2a3e42; font-size: 15px; line-height: 1.55; }
.eyebrow { display: block; margin-bottom: 3px; font-size: 10px; letter-spacing: 2px; color: #89a69c; }
.panel-actions { display: flex; align-items: center; gap: 2px; }
#sheet-size, .sheet-grip { display: none; }
.search { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0 10px; border: 1px solid #354b4f; border-radius: 9px; background: #0c171c; }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.search svg { width: 17px; height: 17px; color: #89a1a4; }
#tr-search { flex: 1; min-width: 0; min-height: 40px; border: 0; outline: 0; background: transparent; font-size: 14px; }
.tr-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 13px; color: #a5b9b8; }
.tr-tools label { display: flex; align-items: center; gap: 6px; min-height: 32px; }
#tr-count { color: var(--accent); }
#tr-now { margin-bottom: 10px; padding: 9px 12px; border: 1px solid #b8ead11e; border-radius: 9px; background: #b8ead109; font-size: 14px; }
#tr-now summary { cursor: pointer; font-weight: 600; color: #d8e9e2; min-height: 26px; }
#tr-now-body { max-height: 30vh; overflow: auto; margin-top: 6px; color: #b9cdc6; }
#tr-list { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 0 2px 16px; }
.tr-scene h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 16px 6px 6px; font-size: 14px; }
.tr-scene h3 a { color: #9fdcd0; text-decoration: none; }
.tr-scene h3 a:hover { text-decoration: underline; }
.tr-time { font-size: 12px; font-weight: 400; color: #7d9c9a; font-variant-numeric: tabular-nums; }
.pre { margin: 4px 6px; padding: 4px 8px; border-left: 3px solid #e3b341; background: #2a2414; font-size: 14px; }
.goal { margin: 4px 6px; }
.steps-title { margin: 6px 0 0; font-weight: 700; font-size: 13px; color: var(--muted); }
.steps { margin: 4px 0 8px; padding-left: 24px; }
.cue { display: grid; grid-template-columns: 42px 1fr; align-items: start; gap: 6px; min-height: 40px; margin: 1px 0; padding: 8px 6px; cursor: pointer; border-radius: 8px; color: #b6c9c5; border: 1px solid transparent; }
.cue:hover { background: #ffffff0a; }
.cue.now { background: #b8ead116; border-color: #b8ead12d; color: #eef7f2; }
.ct { min-height: 24px; padding: 2px 0; font-size: 12px; text-align: left; font-variant-numeric: tabular-nums; color: #7fa5a0; border-radius: 4px; }
.cue.now .ct { color: var(--accent); }
.hit { outline: 2px solid #e3b341; outline-offset: 1px; border-radius: 4px; }
.transcript-footer { margin: 0; padding: 9px 0 11px; border-top: 1px solid #ffffff0d; font-size: 12px; color: #7d9899; }
/* keskeny vagy alacsony ablak: alsó olvasólap */
#player.sheet #transcript { overflow: hidden; position: absolute; left: 0; right: 0; bottom: 0; width: auto; min-width: 0; height: var(--sheet-h, 46%); padding: 8px 16px 0; border: 1px solid #3c5557; border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -15px 70px #0009; }
#player.sheet #transcript.expanded { height: calc(100% - 56px); }
#player.sheet .sheet-grip { display: block; width: 36px; height: 4px; margin: 0 auto 6px; border-radius: 4px; background: #4f6b6a; }
#player.sheet #sheet-size { display: block; }
#player.sheet .transcript-footer { display: none; }

/* ---------- információ ---------- */
dialog { width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 20px 22px; color: inherit; background: var(--panel); border: 1px solid #365157; border-radius: 18px; box-shadow: 0 30px 100px #0008; line-height: 1.5; }
dialog::backdrop { background: #03090bc4; }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; margin: 0; font-size: 14px; }
.shortcuts dt { color: #b7c8c4; }
.shortcuts dd { margin: 0; text-align: right; color: var(--accent); }
kbd { font: inherit; font-size: 12px; padding: 1px 6px; border: 1px solid #4f6b6a; border-radius: 5px; background: #0c171c; color: #e5f1ec; }
.info-note { margin: 16px 0 12px; font-size: 13px; color: #9fb4b1; }
#info-data { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 6px; font-size: 13px; }
#info-data dt { color: var(--muted); }
#info-data dd { margin: 0; }

/* ---------- keskeny ablak, telefon ---------- */
@media (max-width: 680px) {
  #controls { left: 8px; right: 8px; gap: 2px; padding: 0 5px; }
  #controls [data-extra] { display: none; }
  .scrub { margin: 0 6px; }
  #time { font-size: 12px; margin-right: 2px; }
  #time span { display: none; }
  .mobile-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
  .mobile-actions button { min-height: 40px; padding: 8px 11px; border-radius: 8px; background: #22383b; font-size: 13px; }
  .mobile-actions button[aria-pressed="true"] { color: var(--accent); }
  #settings, #player.overlay #settings { right: 8px; left: 8px; width: auto; }
  #chapter-panel { left: 8px; right: 8px; width: auto; }
  .toast { top: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, .chrome { transition: none !important; animation: none !important; }
}

/* nyitott panel mellett a nyitó gomb buboréka nem kell; alacsony ablakon tömörebb beállításpanel */
.icon[aria-expanded="true"]::after { display: none !important; }
@media (max-height: 700px) {
  .popover { padding: 12px 16px; }
  .panel-heading { margin-bottom: 6px; }
  .setting { padding: 8px 0; }
  .setting h3, .setting label { margin-bottom: 6px; }
  .panel-link { min-height: 40px; }
}
#player.portrait .toast { top: auto; bottom: calc(var(--bar-h) + 16px); }
