/* Coaches Replay System — dark sideline theme (palette carried over from the
   Sideline Replay coach page so it feels familiar). */
:root {
    --bg-app: #1c1c1e;
    --bg-panel: #161618;
    --bg-card: #232326;
    --bg-input: #101012;
    --border: #333338;
    --text: #ececef;
    --text-dim: #9a9aa2;
    --accent: #c0392b;
    --accent-light: #e74c3c;
    --green: #2ecc71;
    --amber: #f39c12;
    --blue: #5b9cf0;
    --star: #f5c451;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    background: var(--bg-app);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
}
.app-shell { min-height: 100vh; }
h1, h2 { font-weight: 600; }
button { font-family: inherit; touch-action: manipulation; }

/* ---------- shared buttons ---------- */
.btn {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

/* ---------- icons ---------- */
.icon { width: 20px; height: 20px; display: block; flex: none; }
.icon.lg { width: 24px; height: 24px; }
.icon.xl { width: 30px; height: 30px; }
.icon.inline { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; }
.icon.flip { transform: scaleX(-1); }
.btn .icon { width: 17px; height: 17px; }
.btn:hover { border-color: #55555c; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-danger { background: var(--accent); border-color: var(--accent-light); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-ghost.active { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn.dim { color: var(--text-dim); }
.btn-review { background: var(--star); border-color: var(--star); color: #222; font-weight: 600; }

/* ---------- folder picker ---------- */
.picker-page { max-width: 860px; margin: 0 auto; padding: 32px 20px 60px; }
.picker-hero { text-align: center; margin-bottom: 24px; }
.picker-logo { font-size: 52px; }
.picker-hero h1 { margin: 8px 0 4px; font-size: 28px; }
.picker-sub { color: var(--text-dim); margin: 0; }
.picker-error {
    background: #3a1d1a; border: 1px solid var(--accent); color: #ffb3ab;
    border-radius: 8px; padding: 10px 14px; margin-bottom: 14px;
}
.picker-path-row { display: flex; gap: 8px; margin-bottom: 8px; }
.picker-path-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 14px;
}
.picker-h2 { font-size: 15px; color: var(--text-dim); margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item {
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
    text-align: left; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 14px; color: var(--text); cursor: pointer;
}
.recent-item:hover { border-color: var(--accent-light); }
.recent-name { font-weight: 600; }
.recent-path { grid-column: 1; color: var(--text-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-date { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--text-dim); font-size: 12.5px; }
.browse-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.browse-crumbs {
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.crumb { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.crumb:hover { background: var(--bg-card); }
.crumb-sep { color: var(--text-dim); }
.browse-actions { margin-left: auto; }
.browse-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; }
.browse-item {
    display: flex; align-items: center; gap: 10px; text-align: left;
    background: none; border: none; border-bottom: 1px solid #232327;
    color: var(--text); padding: 9px 14px; cursor: pointer; font-size: 14px;
}
.browse-item:hover { background: var(--bg-card); }
.browse-item.is-game .browse-name { font-weight: 600; }
.browse-icon { width: 22px; text-align: center; }
.browse-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browse-badge {
    background: var(--accent); color: #fff; border-radius: 20px;
    font-size: 11.5px; padding: 2px 9px; font-weight: 600;
}
.browse-badge.alt { background: #2c3f5a; color: #bcd6ff; }
.browse-empty { color: var(--text-dim); padding: 16px; }

/* ---------- library page ---------- */
.lib-page { display: flex; flex-direction: column; min-height: 100vh; }
.lib-header {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 16px; background: var(--bg-panel); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.lib-title-block { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lib-title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.lib-subtitle { color: var(--text-dim); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-search {
    flex: 1; max-width: 420px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 20px; color: var(--text); padding: 8px 16px; font-size: 14px;
}
.lib-header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.lib-sort {
    background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 7px 8px; font-size: 13.5px;
}

.game-notes-panel { padding: 10px 16px; background: #1a2030; border-bottom: 1px solid var(--border); }
.game-notes-panel label { display: block; color: var(--text-dim); font-size: 12.5px; margin-bottom: 6px; }
.game-notes-panel textarea {
    width: 100%; background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 14px; resize: vertical;
}

.filter-bar { padding: 10px 16px 4px; display: flex; flex-direction: column; gap: 8px; }
.chip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chip {
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
    border-radius: 18px; padding: 5px 14px; font-size: 13.5px; cursor: pointer; min-height: 32px;
}
.chip.on { background: var(--accent); border-color: var(--accent-light); font-weight: 600; }
.chip.star-chip.on { background: var(--star); border-color: var(--star); color: #222; }
.chip.unit-off.on { background: var(--green); border-color: var(--green); color: #10331f; }
.chip.unit-def.on { background: var(--amber); border-color: var(--amber); color: #38270a; }
.chip.unit-other.on { background: var(--blue); border-color: var(--blue); color: #0e2038; }
.chip-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.filter-count { color: var(--text-dim); font-size: 13px; margin-left: 6px; }

/* convert panel */
.convert-panel { margin: 10px 16px 0; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; }
.convert-head { padding: 8px 14px; font-size: 13px; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.convert-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid #222226; }
.convert-row:last-child { border-bottom: none; }
.convert-name { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convert-size { color: var(--text-dim); font-size: 12.5px; }
.convert-hint { color: var(--text-dim); font-size: 12.5px; font-style: italic; }
.convert-done { color: var(--green); font-weight: 600; }
.convert-fail { color: var(--accent-light); }
.convert-progress { width: 160px; height: 8px; background: var(--bg-input); border-radius: 6px; overflow: hidden; }
.convert-progress-fill { height: 100%; background: var(--green); transition: width .3s; }
.convert-pct { font-size: 12.5px; color: var(--text-dim); width: 36px; text-align: right; }

.empty-state { text-align: center; color: var(--text-dim); padding: 60px 20px; }
.empty-hint { font-size: 13px; }

/* play grid */
.play-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px; padding: 14px 16px 40px;
}
.play-card {
    position: relative; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; cursor: pointer;
}
.play-card:hover { border-color: #56565e; }
.play-card.active { border-color: var(--accent-light); box-shadow: 0 0 0 1px var(--accent-light); }
.play-card.watched .play-thumb { opacity: .75; }
.play-thumb {
    position: relative; aspect-ratio: 16 / 9; background: #0d0d0f;
    display: flex; align-items: center; justify-content: center;
}
.play-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.play-thumb-fallback { font-size: 34px; opacity: .35; }
.play-duration {
    position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.75);
    border-radius: 5px; padding: 1px 7px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.watched-banner {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: rgba(192, 57, 43, .92); color: #fff;
    font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-align: center; padding: 3px 0;
}
.play-card.watched .play-info { border-left: 4px solid var(--accent-light); background: rgba(192, 57, 43, .08); }
.play-card.watched .play-name { color: #ff9d94; }
.play-info { padding: 8px 10px 10px; }
.play-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 30px; }
.play-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.play-sub { color: var(--text-dim); font-size: 12px; margin-top: 5px; }
.play-star {
    position: absolute; right: 4px; bottom: 4px; background: none; border: none;
    color: var(--text-dim); cursor: pointer; padding: 6px; line-height: 1;
}
.play-star .icon { width: 22px; height: 22px; }
.play-star.on { color: var(--star); }
.play-star:hover { color: var(--star); }

.tag {
    display: inline-flex; align-items: center; border-radius: 5px; padding: 1px 7px;
    font-size: 11.5px; font-weight: 600; background: #2b2b30; color: var(--text-dim);
}
.period-tag { background: #33333a; color: #cfcfd6; }
.unit-tag.unit-off { background: rgba(46, 204, 113, .18); color: var(--green); }
.unit-tag.unit-def { background: rgba(243, 156, 18, .2); color: var(--amber); }
.unit-tag.unit-other { background: rgba(91, 156, 240, .18); color: var(--blue); }
.angle-tag { background: rgba(91, 156, 240, .18); color: var(--blue); }
.marker-tag { background: rgba(231, 76, 60, .16); color: var(--accent-light); }
.custom-tag { background: #3a2c4d; color: #141414; font-weight: 700; }
.custom-tag.removable { border: none; cursor: pointer; }
.note-tag { background: transparent; }

/* ---------- player overlay ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 100; background: #101012;
    display: flex; flex-direction: column;
}
.overlay-head {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; background: var(--bg-panel); border-bottom: 1px solid var(--border);
}
.ov-star { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 2px 6px; }
.ov-star.on { color: var(--star); }
.ov-star:hover { color: var(--star); }
.ov-close { display: flex; align-items: center; }
.marker-del .icon { width: 14px; height: 14px; }
.ov-title { font-weight: 700; font-size: 16px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-rename-hint { color: var(--text-dim); font-size: 13px; }
.ov-title:hover .ov-rename-hint { color: var(--blue); }
.ov-rename-input {
    flex: 1; max-width: 420px; background: var(--bg-input); border: 1px solid var(--blue);
    color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 14px;
}
.ov-position { color: var(--text-dim); font-size: 13.5px; margin-left: auto; white-space: nowrap; }
.ov-time { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--text-dim); white-space: nowrap; }
.ov-close { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.ov-error { background: #3a1d1a; color: #ffb3ab; padding: 6px 14px; font-size: 13.5px; }

.overlay-body { flex: 1; display: flex; min-height: 0; }
.overlay-video-col { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 10px 14px; gap: 8px; }
.video-wrap { position: relative; flex: 1; min-height: 0; background: #000; border-radius: 10px; overflow: hidden; }
.video-wrap.zoomed { cursor: grab; }
.video-wrap.panning { cursor: grabbing; }
.zoom-wrap { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.zoom-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#cp-draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.zoom-indicator {
    position: absolute; top: 8px; right: 10px; z-index: 5; display: none; pointer-events: none;
    background: rgba(0,0,0,.72); color: #fff; border-radius: 6px; padding: 2px 9px;
    font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}

.scrub-row { padding: 4px 2px; }
.scrub-track {
    position: relative; height: 14px; background: #2a2a2f; border-radius: 8px;
    cursor: pointer; touch-action: none;
}
.scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-light); border-radius: 8px; pointer-events: none; }
.scrub-marker {
    position: absolute; top: -4px; width: 8px; height: 22px; transform: translateX(-50%);
    background: var(--star); border: 1px solid #22222a; border-radius: 3px; cursor: pointer; padding: 0;
}

.control-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.control-row.secondary { gap: 10px; }
.ctl {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 56px; min-height: 52px; background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border); border-radius: 9px; font-size: 14.5px; cursor: pointer; padding: 4px 8px;
}
.ctl:hover:not(:disabled) { border-color: #5a5a62; }
.ctl:disabled { opacity: .35; cursor: default; }
.ctl-label { font-size: 10px; line-height: 1; color: var(--text-dim); letter-spacing: .02em; }
.ctl.on .ctl-label, .ctl-play .ctl-label { color: inherit; }
.ctl-play { min-width: 76px; min-height: 58px; background: var(--accent); border-color: var(--accent); }
.ctl-play:hover { background: var(--accent-light); }
.speed-group, .angle-group, .zoom-group { display: inline-flex; gap: 4px; }
.ctl.speed { min-width: 46px; min-height: 42px; font-size: 13px; font-weight: 600; }
.ctl.speed.on, .ctl.toggle.on, .ctl.angle.on { background: var(--blue); border-color: var(--blue); color: #0d1b30; font-weight: 700; }
.ctl.toggle, .ctl.angle { font-size: 13px; padding: 4px 12px; }
.zoom-group .ctl { min-width: 46px; min-height: 42px; }
.one2one { font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.res-badge {
    color: var(--text-dim); font-size: 12px; font-weight: 600;
    border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px;
    font-variant-numeric: tabular-nums; cursor: help;
}
.res-badge.uhd { color: var(--star); border-color: var(--star); }

/* draw / telestration toolbar */
.draw-row { gap: 8px; }
.draw-label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.ctl.tool { min-width: 46px; min-height: 42px; }
.ctl.tool.on { background: var(--star); border-color: var(--star); color: #222; }
.ctl.snapshot-btn { flex-direction: row; gap: 6px; padding: 4px 14px; }
.color-dots { display: inline-flex; gap: 6px; align-items: center; }
.color-dot {
    width: 22px; height: 22px; border-radius: 50%; cursor: pointer; padding: 0;
    border: 2px solid rgba(255,255,255,.25);
}
.color-dot.on { border-color: #fff; box-shadow: 0 0 0 2px #111; }
.ov-info { background: #16321e; color: #9fe8b8; padding: 6px 14px; font-size: 13.5px; }
.ov-warn {
    display: flex; align-items: center; gap: 12px;
    background: #3a2c14; color: #f5d9a1; border-bottom: 1px solid #6b4e1d;
    padding: 8px 14px; font-size: 13px; line-height: 1.45;
}
.ov-warn .btn { flex: none; }

.overlay-side {
    width: 330px; background: var(--bg-panel); border-left: 1px solid var(--border);
    display: flex; flex-direction: column; overflow-y: auto;
}
.side-section { padding: 12px 14px; border-bottom: 1px solid #232327; }
.side-section.grow { flex: 1; display: flex; flex-direction: column; min-height: 140px; }
.side-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.save-state { color: var(--green); font-size: 12px; font-weight: 400; }
.side-empty { color: var(--text-dim); font-size: 12.5px; }
.marker-list { display: flex; flex-direction: column; gap: 5px; }
.marker-item { display: flex; align-items: center; gap: 6px; }
.marker-jump {
    background: #2a2a30; border: 1px solid var(--border); color: var(--star);
    border-radius: 6px; padding: 4px 8px; font-size: 12.5px; cursor: pointer;
    font-variant-numeric: tabular-nums; min-width: 48px;
}
.marker-jump:hover { border-color: var(--star); }
.marker-label {
    flex: 1; background: var(--bg-input); border: 1px solid transparent; color: var(--text);
    border-radius: 6px; padding: 4px 8px; font-size: 13px;
}
.marker-label:focus { border-color: var(--border); outline: none; }
.marker-del { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; }
.marker-del:hover { color: var(--accent-light); }
.notes-area {
    flex: 1; width: 100%; min-height: 110px; background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 14px;
    resize: none; font-family: inherit; line-height: 1.45;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Tags are bigger in the player panel, where they get created and edited. */
.overlay-side .tag {
    font-size: 13.5px; padding: 7px 12px; border-radius: 8px;
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.tag-x {
    background: rgba(0,0,0,.22); border: none; border-radius: 50%; color: inherit;
    width: 18px; height: 18px; line-height: 1; font-size: 11px; font-weight: 800;
    cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.tag-x:hover { background: rgba(0,0,0,.45); }
.tag-add-row, .tag-edit-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.tag-add-row .color-dot, .tag-edit-row .color-dot { width: 24px; height: 24px; }
.side-hint { color: var(--text-dim); font-size: 11.5px; margin-top: 6px; flex-basis: 100%; }
.tag-input {
    background: var(--bg-input); border: 1px dashed var(--border); color: var(--text);
    border-radius: 8px; padding: 8px 12px; font-size: 13.5px; width: 150px;
}
.tag-edit-row .tag-input { border-style: solid; border-color: var(--blue); }
.danger-zone { display: flex; gap: 8px; align-items: center; }

/* ---------- header tool cluster + anchored confirm popover ---------- */
.tool-cluster { position: relative; display: inline-flex; gap: 8px; }
.tool-popover {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
    min-width: 400px; max-width: min(560px, 92vw);
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
    display: flex; flex-direction: column; gap: 10px; font-size: 13.5px;
}
.tool-popover .tool-actions { display: flex; gap: 8px; align-items: center; }
.full-reset-btn { color: #ff8a80; border-color: rgba(231, 76, 60, .55); }
.full-reset-btn:hover { border-color: #e74c3c; }
.code-badge {
    background: var(--bg-input); border: 1px solid #e74c3c; color: #ff8a80;
    font-weight: 800; font-size: 15px; letter-spacing: .12em;
    padding: 2px 10px; border-radius: 6px; font-family: inherit;
}
.code-input {
    width: 64px; text-align: center; font-size: 16px; font-weight: 700;
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); padding: 8px;
}
.btn:disabled { opacity: .4; cursor: default; }

/* ---------- export panel ---------- */
.export-panel {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 14px; font-size: 13.5px; margin-top: 4px;
}
.export-name {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 6px 10px; font-size: 13.5px; min-width: 200px;
}

/* ---------- shortcuts page ---------- */
.shortcuts-page { max-width: 780px; margin: 0 auto; padding: 24px 20px 60px; }
.shortcuts-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.shortcuts-head h1 { flex: 1; margin: 0; font-size: 24px; display: flex; align-items: center; gap: 10px; }
.shortcuts-note { color: var(--text-dim); font-size: 14px; }
.shortcut-list { display: flex; flex-direction: column; gap: 4px; }
.shortcut-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
}
.shortcut-row.capturing { border-color: var(--blue); }
.shortcut-label { flex: 1; font-size: 14.5px; }
.shortcut-key {
    background: var(--bg-input); border: 1px solid var(--border); border-bottom-width: 3px;
    border-radius: 6px; padding: 4px 12px; font-size: 13.5px; font-family: inherit;
    min-width: 52px; text-align: center;
}
.shortcut-key.custom { border-color: var(--blue); color: var(--blue); }
.shortcut-capture {
    flex-basis: 280px; background: var(--bg-input); border: 1px solid var(--blue); color: var(--blue);
    border-radius: 6px; padding: 7px 12px; font-size: 13.5px; cursor: default;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .overlay-body { flex-direction: column; overflow-y: auto; }
    .overlay-video-col { flex: none; }
    .video-wrap { min-height: 40vh; max-height: 45vh; flex: none; }
    .overlay-side { width: auto; border-left: none; border-top: 1px solid var(--border); }
    .lib-subtitle { display: none; }
    .lib-search { max-width: none; }
}
@media (max-width: 640px) {
    .lib-header { flex-wrap: wrap; }
    .play-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
    .ov-position { display: none; }
}

/* ================= web-only styles ================= */
.web-shell { min-height: 100vh; }

/* auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 34px 34px 26px; text-align: center;
}
.auth-logo { font-size: 42px; margin-bottom: 6px; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--text-dim); }
.auth-card input, .auth-card select {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: 10px 12px; font-size: 14.5px;
}
.auth-btn { margin-top: 6px; padding: 11px; font-size: 15px; }
.auth-alt { margin-top: 16px; font-size: 13.5px; color: var(--text-dim); }
.auth-alt a { color: var(--blue); }
.auth-hint { font-weight: 400; font-size: 12px; }

/* games list */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding: 18px 22px; }
.game-card {
    display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 18px; text-decoration: none; color: var(--text);
}
.game-card:hover { border-color: var(--blue); }
.game-card-name { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.game-card-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-dim); font-size: 13px; }
.game-card-state { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.game-card-state.released { color: var(--green, #2ecc71); }

/* admin */
.admin-body { max-width: 860px; margin: 0 auto; padding: 10px 22px 60px; }
.admin-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 14px; margin-bottom: 6px;
}
.admin-who { flex: 1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.admin-who .dim, .dim { color: var(--text-dim); }
.admin-actions { display: flex; gap: 8px; align-items: center; }
.admin-actions select {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    border-radius: 7px; padding: 6px 9px;
}

/* invites */
.invite-form { gap: 8px; }
.invite-form input.export-name { min-width: 260px; }
.invite-result .admin-who { flex-direction: column; align-items: stretch; gap: 8px; }
.invite-link { width: 100%; min-width: 0; cursor: copy; color: var(--blue); }

/* film room extras */
.quality-group { display: inline-flex; gap: 4px; }
.notes-read, .game-notes-read {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; color: var(--text);
    min-height: 60px;
}
.marker-label.readonly { flex: 1; font-size: 13px; color: var(--text); padding: 4px 2px; }

/* school logo watermark */
.logo-backdrop {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    background-size: cover, min(65vw, 720px);
    opacity: .08;
    filter: saturate(.8);
}
.web-shell { position: relative; }
.web-shell > *:not(.logo-backdrop) { position: relative; z-index: 1; }
.logo-preview {
    height: 44px; width: auto; max-width: 120px; object-fit: contain;
    background: #fff2; border-radius: 8px; padding: 3px;
}
.admin-who input[type="file"] { color: var(--text-dim); font-size: 13px; max-width: 240px; }

/* release + audit */
.release-state { color: var(--green, #2ecc71); font-size: 13.5px; font-weight: 700; }
.rel-board { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; align-items: center; }
.rel-name {
    padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 700;
}
.rel-name.ok { background: rgba(46, 204, 113, .14); color: #2ecc71; border: 1px solid #2ecc71; }
.rel-name.pending { background: rgba(231, 76, 60, .14); color: #ff8a80; border: 1px solid #e74c3c; }

/* comment hover bubble — readable, word-wrapped, near screen center */
.comment-bubble {
    position: fixed; left: 50%; top: 30%; transform: translateX(-50%); z-index: 400;
    max-width: min(560px, 85vw); background: #0e0e12; border: 1px solid var(--blue);
    border-radius: 12px; padding: 14px 18px; box-shadow: 0 14px 44px rgba(0, 0, 0, .65);
    pointer-events: none;
}
.comment-bubble-text {
    margin-top: 8px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* confirmation modal */
.modal-scrim {
    position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, .6);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
    max-width: 480px; width: 100%; padding: 22px 26px;
}
.modal-card h3 { margin: 0 0 8px; }
.modal-card p { color: var(--text-dim); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.head-tag { background: #6b4e1d; color: #f5d9a1; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0 20px; }
.audit-table th {
    text-align: left; color: var(--text-dim); font-weight: 600; font-size: 12px;
    padding: 6px 10px; border-bottom: 1px solid var(--border);
}
.audit-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.audit-table tr.zero td { color: var(--text-dim); }

/* coach comments */
.comments-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; max-height: 320px; }
.comment { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.comment-head { display: flex; gap: 8px; align-items: center; }
.comment-name { font-weight: 800; font-size: 13px; }
.comment-time { color: var(--text-dim); font-size: 11.5px; flex: 1; }
.comment-text {
    font-size: 13.5px; white-space: pre-wrap; margin-top: 3px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden; cursor: help;
}
.comment-input { min-height: 60px; margin-top: 8px; }
.comment-post { margin-top: 6px; align-self: flex-end; }
.play-star.on { color: var(--star); }

/* classroom mode: collapse the side panel so the video fills the screen */
.overlay-body.side-collapsed .overlay-side { display: none; }