/* Gone Rogue TV — 2012-era video site look, dark by default. */

:root, html.light {
  --page: #f1f1f1;
  --panel: #ffffff;
  --raised: #f8f8f8;
  --border: #e2e2e2;
  --border-strong: #d3d3d3;
  --text: #333333;
  --text-strong: #222222;
  --muted: #767676;
  --link: #167ac6;
  --red: #cc181e;
  --red-hi: #e62117;
  --blue: #2f7bd8;
  --blue-hi: #4d90fe;
  --green: #2b8a1f;
  --mh-top: #ffffff;
  --mh-bot: #f7f7f7;
  --btn-top: #fcfcfc;
  --btn-bot: #f0f0f0;
  --btn-hover-top: #f0f0f0;
  --btn-hover-bot: #e0e0e0;
  --btn-text: #333333;
  --input-bg: #ffffff;
  --guide-active: #e2e2e2;
  --guide-hover: #e9e9e9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .1);
  --focus: #4d90fe;
  --badge-ok: #e5f4e3; --badge-ok-text: #2b6b22;
  --badge-err: #fbe3e3; --badge-err-text: #a3161b;
  --badge-busy: #e3eefb; --badge-busy-text: #1f5fa8;
  color-scheme: light;
}

html.dark {
  --page: #181818;
  --panel: #222222;
  --raised: #2a2a2a;
  --border: #343434;
  --border-strong: #474747;
  --text: #e3e3e3;
  --text-strong: #f4f4f4;
  --muted: #9b9b9b;
  --link: #7cb5ec;
  --mh-top: #2a2a2a;
  --mh-bot: #212121;
  --btn-top: #3a3a3a;
  --btn-bot: #2d2d2d;
  --btn-hover-top: #444444;
  --btn-hover-bot: #363636;
  --btn-text: #e3e3e3;
  --input-bg: #161616;
  --guide-active: #353535;
  --guide-hover: #2c2c2c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --focus: #6aa8ff;
  --badge-ok: #1f3a1c; --badge-ok-text: #9edb93;
  --badge-err: #431a1b; --badge-err-text: #f3a6a8;
  --badge-busy: #1b2d45; --badge-busy-text: #9cc6f7;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 13px/1.38 Arial, Helvetica, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; color: var(--text-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: Consolas, Menlo, monospace; font-size: 12px; }
code { background: var(--raised); border: 1px solid var(--border); padding: 0 4px; border-radius: 2px; }
.muted { color: var(--muted); }
.dot { color: var(--muted); margin: 0 2px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--panel); padding: 8px 12px; }
.skip:focus { left: 8px; }
.ico { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 2px;
  background: linear-gradient(var(--btn-top), var(--btn-bot));
  color: var(--btn-text); font-size: 11px; font-weight: bold;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: linear-gradient(var(--btn-hover-top), var(--btn-hover-bot)); text-decoration: none; }
.btn:active { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(var(--blue-hi), var(--blue)); border-color: #2a6bbf; color: #fff; }
.btn-primary:hover { background: linear-gradient(#5a9bff, #2c74cf); }
.btn-danger { background: linear-gradient(var(--red-hi), var(--red)); border-color: #a3161b; color: #fff; }
.btn-danger:hover { background: linear-gradient(#f0352b, #b9151b); }
.btn-lg { height: 34px; padding: 0 18px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

input[type=text], input[type=search], input[type=password], textarea, select {
  background: var(--input-bg); border: 1px solid var(--border-strong); border-radius: 2px;
  padding: 6px 8px; min-height: 30px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 1px var(--focus); }
input:disabled { opacity: .6; }
textarea { resize: vertical; line-height: 1.4; }
select { width: auto; max-width: 100%; }

.panel { background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 15px; margin-bottom: 10px; }
.panel-title { font-size: 15px; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- Masthead ---------- */
#masthead {
  background: linear-gradient(var(--mh-top), var(--mh-bot));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  position: relative; z-index: 40;
}
.mh-inner { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 15px; max-width: 1280px; margin: 0 auto; }
.mh-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; background: none; border-radius: 2px; cursor: pointer; color: var(--muted); flex: none;
}
.mh-icon:hover { background: var(--guide-hover); color: var(--text); }

.logo { display: inline-flex; align-items: center; gap: 2px; text-decoration: none !important; flex: none; line-height: 1; }
.logo-word { font: bold 21px/1 Arial, Helvetica, sans-serif; letter-spacing: -1px; color: var(--text-strong); }
.logo-tv {
  font: bold 17px/1 Arial, Helvetica, sans-serif; color: #fff; letter-spacing: -.5px;
  background: linear-gradient(var(--red-hi), var(--red)); padding: 4px 5px 4px; border-radius: 6px; margin-left: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.mh-search { flex: 1; display: flex; max-width: 560px; margin-left: 20px; }
.mh-search input { border-radius: 2px 0 0 2px; height: 29px; min-height: 29px; border-right: 0; }
.search-btn { height: 29px; width: 62px; border-radius: 0 2px 2px 0; }
.search-btn .ico { width: 18px; height: 18px; opacity: .7; }
.search-back, .search-open { display: none; }
.mh-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.theme-btn .ico-sun, html.light .theme-btn .ico-moon { display: none; }
html.light .theme-btn .ico-sun { display: block; }
.upload-btn { margin-left: 4px; }
.mh-user { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: bold; }
.mh-user:hover { text-decoration: none; }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: #777; color: #fff; font-weight: bold; text-transform: uppercase; object-fit: cover;
}
.avatar-owner { background: linear-gradient(var(--red-hi), var(--red)); }
.avatar-blank { background: var(--raised); color: var(--muted); border: 1px solid var(--border); }
.avatar-sm { width: 28px; height: 28px; font-size: 13px; }
.avatar-md { width: 48px; height: 48px; font-size: 20px; }
.avatar-lg { width: 48px; height: 48px; font-size: 22px; }
.avatar-xl { width: 100px; height: 100px; font-size: 46px; border: 3px solid var(--panel); box-shadow: var(--shadow); }

/* ---------- Page & guide ---------- */
#page { flex: 1; display: flex; width: 100%; max-width: 1280px; margin: 0 auto; }
#content { flex: 1; min-width: 0; padding: 15px 15px 30px; }

#guide { width: 210px; flex: none; padding: 12px 0 20px; font-size: 13px; }
.guide-top { display: none; padding: 4px 18px 14px; }
.guide-section { padding: 0 0 8px; }
.guide-head { padding: 12px 18px 6px; font-size: 11px; font-weight: bold; color: var(--muted); letter-spacing: .3px; }
.guide-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 18px;
  color: var(--text); border-left: 3px solid transparent;
}
.guide-item:hover { background: var(--guide-hover); text-decoration: none; }
.guide-item.is-active { background: var(--guide-active); border-left-color: var(--red); font-weight: bold; color: var(--text-strong); }
.gi-icon { width: 20px; display: inline-flex; justify-content: center; color: var(--muted); }
.gi-icon .ico { width: 18px; height: 18px; }
.gi-letter {
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--raised); border: 1px solid var(--border); color: var(--text); font-size: 11px; font-weight: bold;
}
.gi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-count { color: var(--muted); font-size: 11px; }

body.guide-static #guide { position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto; }
body.guide-static .guide-btn { display: none; }

/* Drawer (watch page, and every page on small screens) */
#guide-backdrop { display: none; }
body.guide-drawer #guide {
  position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 60;
  background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto;
  transform: translateX(-102%); transition: transform .2s ease; box-shadow: 2px 0 8px rgba(0, 0, 0, .3);
}
body.guide-drawer .guide-top { display: block; }
body.guide-open #guide { transform: none; }
body.guide-open #guide-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 55; }

/* ---------- Flash, empty states ---------- */
.flash { padding: 10px 14px; margin-bottom: 12px; border: 1px solid; font-weight: bold; }
.flash-ok { background: var(--badge-ok); color: var(--badge-ok-text); border-color: transparent; }
.flash-error { background: var(--badge-err); color: var(--badge-err-text); border-color: transparent; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h1, .empty h2 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty.big { padding: 90px 20px; }
.empty-ico { font-size: 60px; font-weight: bold; color: var(--border-strong); margin-bottom: 14px; }

/* ---------- Section heads ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.page-title { font-size: 19px; font-weight: normal; display: flex; align-items: center; gap: 10px; }
.cat-badge {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(var(--red-hi), var(--red)); color: #fff; font-weight: bold; font-size: 16px;
}
.sort-tabs { display: flex; border: 1px solid var(--border-strong); border-radius: 2px; overflow: hidden; }
.sort-tabs a { padding: 5px 12px; color: var(--text); font-size: 12px; font-weight: bold; background: linear-gradient(var(--btn-top), var(--btn-bot)); }
.sort-tabs a + a { border-left: 1px solid var(--border-strong); }
.sort-tabs a.is-active { background: var(--guide-active); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.sort-tabs a:hover { text-decoration: none; }

/* ---------- Channel header ---------- */
.channel-head { background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 15px; }
.channel-banner {
  height: 130px; position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 14px),
    linear-gradient(115deg, #3a0a0c 0%, #8e1015 45%, #1f1f1f 100%);
}
.channel-banner span {
  position: absolute; right: 22px; bottom: 6px; font: bold 64px/1 Arial, sans-serif; letter-spacing: -4px;
  color: rgba(255, 255, 255, .09); white-space: nowrap;
}
.channel-info { display: flex; align-items: flex-end; gap: 16px; padding: 0 20px 16px; margin-top: -40px; position: relative; }
.channel-text { padding-bottom: 2px; min-width: 0; }
.channel-name { font-size: 24px; }
.channel-stats { color: var(--muted); margin-top: 3px; }
.channel-about { margin: 6px 0 0; max-width: 70ch; }

/* ---------- Shelves & grid ---------- */
.shelf { background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 12px 15px 4px; margin-bottom: 15px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.shelf-head h2 { font-size: 15px; }
.shelf-head h2 a { color: var(--text-strong); }
.shelf-more { font-size: 12px; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 18px 14px; }
.tile { min-width: 0; padding-bottom: 10px; }
.tile-link { display: block; color: var(--text-strong); }
.tile-link:hover { text-decoration: none; }
.tile-link:hover .tile-title { color: var(--link); text-decoration: underline; }
.tile-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: bold; font-size: 13px; line-height: 1.3; margin: 7px 0 3px; word-break: break-word;
}
.tile-meta { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }
.tile-meta a { color: var(--muted); }

.thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-portrait img { object-fit: contain; }
.dur {
  position: absolute; right: 3px; bottom: 3px; background: rgba(0, 0, 0, .8); color: #fff;
  font-size: 11px; font-weight: bold; padding: 1px 4px; border-radius: 2px; line-height: 14px;
}

/* search rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row-thumb { width: 196px; flex: none; }
.row-info { min-width: 0; }
.row-title { font-size: 15px; font-weight: bold; display: block; margin-bottom: 3px; }
.row-meta, .row-desc { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.row-meta a { color: var(--muted); }
.row-cat { font-size: 11px; display: inline-block; border: 1px solid var(--border); background: var(--raised); padding: 1px 6px; color: var(--muted); }

.pager { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin: 20px 0 6px; }
.pager-btn.is-current { background: var(--guide-active); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }

/* ---------- Watch page ---------- */
#watch {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr;
  grid-template-areas: "player sidebar" "main sidebar";
  column-gap: 15px; max-width: 1240px; margin: 0 auto;
}
#watch-player { grid-area: player; min-width: 0; }
body.page-watch #content { padding-top: 15px; }
#watch-main { grid-area: main; min-width: 0; }
#watch-sidebar { grid-area: sidebar; }

#watch-headline { background: var(--panel); border: 1px solid var(--border); border-bottom: 0; padding: 14px 15px 6px; }
#watch-title { font-size: 20px; font-weight: normal; line-height: 1.25; word-break: break-word; }

#watch-userbar { background: var(--panel); border: 1px solid var(--border); border-top: 0; padding: 6px 15px 12px; display: flex; align-items: center; gap: 10px; }
.wu-owner { flex: none; }
.wu-info { min-width: 0; flex: 1; }
.wu-name { font-weight: bold; font-size: 13px; color: var(--text-strong); }
.wu-sub { color: var(--muted); font-size: 11px; }
.wu-stats { text-align: right; flex: none; }
.view-count { font-size: 19px; font-weight: bold; color: var(--text-strong); line-height: 1.1; }
.sparkbars { display: flex; width: 160px; height: 4px; margin: 5px 0 4px auto; background: var(--border); overflow: hidden; }
.spark-likes { background: var(--green); height: 100%; transition: width .3s; }
.spark-dislikes { background: var(--red); height: 100%; transition: width .3s; }
.wu-votes { color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }
.wu-votes .ico { width: 12px; height: 12px; }
.wu-votes .dislike-ico { margin-left: 8px; }

#watch-actions { background: var(--panel); border: 1px solid var(--border); border-top: 1px solid var(--border); padding: 8px 15px; display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; box-shadow: var(--shadow); }
.act-btn.is-on { background: var(--guide-active); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
.act-btn[data-vote="1"].is-on { color: var(--green); }
html.dark .act-btn[data-vote="1"].is-on { color: #7fd36e; }
.act-btn[data-vote="-1"].is-on { color: var(--red-hi); }
.btn-icon { padding: 0 8px; }
.act-edit { margin-left: auto; }

#share-panel { padding: 12px 15px; }
.share-row { display: flex; gap: 6px; }
.share-row input { font-size: 12px; }
.share-start { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); cursor: pointer; }

#watch-description { padding: 12px 15px 0; }
.wd-published { font-weight: bold; color: var(--text-strong); margin-bottom: 6px; }
.wd-text { word-break: break-word; max-width: 80ch; }
#watch-description.is-collapsed .wd-text { max-height: 4.2em; overflow: hidden; }
#watch-description.is-collapsed .wd-extras { display: none; }
.wd-extras { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; margin: 12px 0 0; font-size: 12px; }
.wd-extras dt { color: var(--muted); }
.wd-extras dd { margin: 0; }
.wd-toggle {
  display: block; width: calc(100% + 30px); margin: 10px -15px 0; padding: 7px; border: 0; border-top: 1px solid var(--border);
  background: var(--raised); color: var(--muted); font-size: 11px; font-weight: bold; cursor: pointer;
}
.wd-toggle:hover { color: var(--text); }
.wd-toggle .less, #watch-description.is-collapsed .wd-toggle .more { display: inline; }
.wd-toggle .more, #watch-description.is-collapsed .wd-toggle .less { display: none; }

/* comments */
.comments-title { font-size: 13px; font-weight: bold; text-transform: none; margin-bottom: 12px; }
.comment-form { display: flex; gap: 10px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.cf-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf-name { max-width: 260px; }
.cf-as { color: var(--muted); font-size: 12px; }
.cf-body { min-height: 34px; height: 34px; transition: height .15s; }
.comment-form.cf-open .cf-body { height: 84px; }
.cf-bar { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.cf-error { flex: 1; color: var(--red-hi); font-weight: bold; font-size: 12px; }
html.dark .cf-error { color: #ff7b7f; }
.cf-count { color: var(--muted); font-size: 11px; }
.comment-form:not(.cf-open) .cf-count { visibility: hidden; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.comment-list { list-style: none; padding: 0; margin: 0; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment + .comment { border-top: 1px solid var(--border); }
.comment-main { min-width: 0; flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.comment-author { font-weight: bold; color: var(--text-strong); }
.comment.is-owner .comment-author { color: var(--link); }
.owner-badge { background: var(--red); color: #fff; font-size: 10px; font-weight: bold; padding: 1px 4px; border-radius: 2px; }
.comment-time { color: var(--muted); font-size: 11px; }
.comment-del { font-size: 11px; margin-left: auto; color: var(--muted); }
.comment-text { word-break: break-word; }
.comment.is-new { animation: newComment 1.6s ease-out; }
@keyframes newComment { from { background: var(--badge-busy); } to { background: transparent; } }
.no-comments { margin: 4px 0 6px; }

/* sidebar */
#watch-sidebar { min-width: 0; }
.sidebar-title { font-size: 13px; margin: 2px 0 10px; }
.compact-list { list-style: none; margin: 0; padding: 0; }
.compact a { display: flex; gap: 8px; padding: 4px 0 8px; color: var(--text-strong); }
.compact a:hover { text-decoration: none; }
.compact a:hover .compact-title { color: var(--link); }
.compact .thumb { width: 168px; flex: none; }
.compact-info { min-width: 0; }
.compact-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: bold; line-height: 1.3; margin-bottom: 3px; }
.compact-meta { display: block; color: var(--muted); font-size: 11px; }

/* processing placeholder */
.gr-processing { display: flex; align-items: center; justify-content: center; position: relative; }
.proc-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .25; filter: blur(3px); }
.proc-box { position: relative; text-align: center; color: #eee; width: min(360px, 86%); }
.proc-title { font-size: 15px; font-weight: bold; margin-bottom: 10px; }
.proc-pct { margin-top: 6px; font-weight: bold; }
.proc-note { margin-top: 10px; font-size: 11px; color: #aaa; }
.proc-err { font-size: 12px; color: #f3a6a8; margin-bottom: 12px; word-break: break-word; }

.progress { height: 10px; background: rgba(127, 127, 127, .25); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(var(--red-hi), var(--red)); transition: width .4s; }

/* ---------- Player (2012 chrome) ---------- */
.gr-player {
  position: relative; background: #000; aspect-ratio: 16 / 9; width: 100%; overflow: hidden;
  -webkit-user-select: none; user-select: none; outline: none;
}
.gr-player video, .gr-noscript { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; display: block; }
.gp-surface { position: absolute; inset: 0 0 0 0; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1; }
.gp-big {
  width: 76px; height: 54px; border: 0; border-radius: 12px; cursor: pointer; display: none;
  background: rgba(23, 23, 23, .85); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); transition: background .1s;
}
.gp-big svg { width: 34px; height: 34px; fill: #fff; }
.gp-big:hover, .gp-big:focus-visible { background: linear-gradient(var(--red-hi), var(--red)); }
.gr-player.gp-paused:not(.gp-wait) .gp-big { display: inline-flex; align-items: center; justify-content: center; }
.gp-big .i-replay, .gr-player.gp-ended .gp-big .i-play { display: none; }
.gr-player.gp-ended .gp-big .i-replay { display: block; }
.gp-spin {
  position: absolute; width: 46px; height: 46px; border-radius: 50%; display: none;
  border: 4px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .8s linear infinite;
}
.gr-player.gp-wait .gp-spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.gp-err { position: absolute; left: 10%; right: 10%; text-align: center; color: #eee; background: rgba(0, 0, 0, .75); padding: 12px; }
.gp-unmute {
  position: absolute; top: 12px; left: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .95); color: #222; border: 0; border-radius: 2px; padding: 6px 10px 6px 6px;
  font-weight: bold; font-size: 12px; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.gp-unmute svg { width: 20px; height: 20px; fill: #222; }

.gp-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  background: linear-gradient(#3c3c3c, #1d1d1d 55%, #141414);
  border-top: 1px solid #4a4a4a;
  transform: translateY(100%); transition: transform .2s ease;
}
.gr-player.gp-active .gp-controls, .gr-player.gp-paused .gp-controls { transform: none; }
/* thin progress line remains while controls are hidden */
.gp-progress { position: absolute; left: 0; right: 0; top: -9px; height: 14px; cursor: pointer; touch-action: none; }
.gr-player:not(.gp-active):not(.gp-paused) .gp-progress { top: -12px; }
.gp-rail { position: absolute; left: 0; right: 0; bottom: 5px; height: 4px; background: rgba(255, 255, 255, .22); transition: height .1s, bottom .1s; }
.gp-progress:hover .gp-rail, .gr-player.gp-scrubbing .gp-rail { height: 7px; }
.gp-buf { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, .38); }
.gp-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#ff3b30, var(--red)); }
.gp-knob {
  position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #ccc); box-shadow: 0 1px 3px rgba(0, 0, 0, .6); display: none;
}
.gp-progress:hover .gp-knob, .gr-player.gp-scrubbing .gp-knob { display: block; }
.gp-tip {
  position: absolute; bottom: 18px; transform: translateX(-50%); background: #111; color: #fff; font-size: 11px; font-weight: bold;
  padding: 2px 6px; border: 1px solid #444; display: none; pointer-events: none; white-space: nowrap;
}
.gp-progress:hover .gp-tip, .gr-player.gp-scrubbing .gp-tip { display: block; }

.gp-bar { display: flex; align-items: center; height: 36px; padding: 0 4px; color: #ddd; }
.gp-btn {
  height: 36px; min-width: 36px; padding: 0 6px; border: 0; background: none; color: #ccc; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold;
}
.gp-btn:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.gp-btn svg { width: 22px; height: 22px; fill: currentColor; }
.gp-play { border-right: 1px solid #111; box-shadow: 1px 0 0 #3a3a3a; min-width: 44px; }
.gp-play .i-pause, .gp-play .i-replay { display: none; }
.gr-player:not(.gp-paused) .gp-play .i-play { display: none; }
.gr-player:not(.gp-paused) .gp-play .i-pause { display: block; }
.gr-player.gp-ended .gp-play .i-play { display: none; }
.gr-player.gp-ended .gp-play .i-replay { display: block; }
.gp-mute .i-mute, .gr-player.gp-muted .gp-mute .i-vol { display: none; }
.gr-player.gp-muted .gp-mute .i-mute { display: block; }
.gp-vol { display: flex; align-items: center; }
.gp-vslider { width: 0; overflow: hidden; height: 36px; display: flex; align-items: center; transition: width .15s; cursor: pointer; touch-action: none; }
.gp-vol:hover .gp-vslider, .gp-vslider:focus-visible { width: 70px; padding: 0 6px 0 2px; }
.gp-vrail { position: relative; width: 100%; height: 4px; background: #555; box-shadow: inset 0 1px 1px #000; }
.gp-vfill { position: absolute; left: 0; top: 0; bottom: 0; background: #ddd; }
.gp-time { font-size: 12px; color: #bbb; padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gp-cur { color: #fff; }
.gp-sp { flex: 1; }
.gp-q { position: relative; }
.gp-qbtn sup, .gp-qmenu sup { color: var(--red-hi); font-size: 9px; margin-left: 1px; }
.gr-player.gp-single .gp-qbtn { pointer-events: none; color: #888; }
.gp-qmenu {
  position: absolute; right: 0; bottom: 40px; list-style: none; margin: 0; padding: 4px 0; min-width: 92px;
  background: rgba(20, 20, 20, .96); border: 1px solid #444; box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}
.gp-qmenu button { display: block; width: 100%; text-align: left; padding: 7px 14px 7px 24px; background: none; border: 0; color: #ddd; cursor: pointer; font-size: 12px; font-weight: bold; position: relative; }
.gp-qmenu button:hover { background: #333; color: #fff; }
.gp-qmenu button[aria-checked="true"]::before { content: ''; position: absolute; left: 10px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--red-hi); }
.gp-wide .i-narrow, html.wide .gp-wide .i-wide { display: none; }
html.wide .gp-wide .i-narrow { display: block; }
.gr-player.gp-fullscreen .gp-wide { display: none; }
.gp-fs .i-fsx, .gr-player.gp-fullscreen .gp-fs .i-fs { display: none; }
.gr-player.gp-fullscreen .gp-fs .i-fsx { display: block; }
.gr-player.gp-fullscreen { aspect-ratio: auto; }
.gr-player:not(.gp-active):not(.gp-paused) { cursor: none; }
.gr-player:not(.gp-active):not(.gp-paused) .gp-surface { cursor: none; }

@media (pointer: coarse) {
  .gp-vslider { display: none; }
  .gp-bar { height: 42px; }
  .gp-btn { height: 42px; min-width: 42px; }
  .gp-progress { height: 22px; top: -14px; }
  .gp-rail { bottom: 8px; }
  .gp-knob { display: block; }
  .gr-player:not(.gp-active):not(.gp-paused) .gp-knob { display: none; }
}

/* ---------- Admin ---------- */
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 15px; }
.admin-head .page-title { padding-bottom: 10px; }
.admin-tabs { display: flex; gap: 2px; overflow-x: auto; }
.admin-tabs a { padding: 9px 14px; color: var(--muted); font-weight: bold; border-bottom: 3px solid transparent; white-space: nowrap; }
.admin-tabs a:hover { color: var(--text); text-decoration: none; }
.admin-tabs a.is-active { color: var(--text-strong); border-bottom-color: var(--red); }

.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-stack label, .up-fields label { display: flex; flex-direction: column; gap: 4px; font-weight: bold; font-size: 12px; }
.form-stack.narrow { max-width: 360px; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { flex: 1; min-width: 160px; width: auto; }
form.inline { display: inline; }

.upload-panel { padding: 0; }
.upload-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 340px; padding: 30px 20px; border-right: 1px solid var(--border); background: var(--raised); cursor: pointer;
}
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.is-over { background: var(--badge-busy); outline: 2px dashed var(--focus); outline-offset: -10px; }
.dz-arrow { width: 92px; height: 92px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--panel); border: 1px solid var(--border); margin-bottom: 10px; }
.dz-arrow .ico { width: 54px; height: 54px; color: var(--border-strong); }
.dropzone.has-file .dz-arrow .ico { color: var(--red); }
.dz-title { font-size: 19px; color: var(--text-strong); }
.dz-sub { color: var(--muted); margin-bottom: 10px; }
.dz-btn { pointer-events: none; }
.dz-file { margin-top: 10px; font-weight: bold; word-break: break-all; }
.up-fields { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.up-fields .btn-lg { align-self: flex-start; }
.up-status { padding: 30px; }
.up-name { font-size: 15px; font-weight: bold; margin-bottom: 10px; word-break: break-all; }
.up-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); }
.up-status.is-error .up-line span { color: var(--red-hi); font-weight: bold; }
.up-status.is-converting .progress-fill { background: linear-gradient(var(--blue-hi), var(--blue)); }
.up-status.is-ready .progress-fill { background: var(--green); }
.up-done { display: flex; gap: 8px; margin-top: 16px; }

.vm-list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.vm-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; }
.vm-item + .vm-item { border-top: 1px solid var(--border); }
.vm-thumb { width: 140px; flex: none; }
.vm-info { flex: 1; min-width: 0; }
.vm-title { font-weight: bold; font-size: 14px; display: block; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vm-meta { color: var(--muted); font-size: 12px; margin-bottom: 2px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.vm-actions { display: flex; gap: 6px; flex: none; }
.badge { display: inline-block; font-size: 11px; font-weight: bold; padding: 1px 6px; border-radius: 2px; }
.badge-ok { background: var(--badge-ok); color: var(--badge-ok-text); }
.badge-err { background: var(--badge-err); color: var(--badge-err-text); }
.badge-busy, .badge-wait { background: var(--badge-busy); color: var(--badge-busy-text); }

.edit-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; align-items: start; }
.edit-status { margin: 10px 0; }
.err-text { color: var(--badge-err-text); font-size: 12px; word-break: break-word; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; margin: 10px 0 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.edit-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; flex-wrap: wrap; }
.cat-row + .cat-row { border-top: 1px solid var(--border); }
.cat-rename { flex: 1; min-width: 240px; }
.cat-count { color: var(--muted); min-width: 70px; }
.move-to { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

.checks { border-collapse: collapse; width: 100%; font-size: 12px; margin-bottom: 10px; }
.checks td, .checks th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; word-break: break-word; }
.checks th { white-space: nowrap; }
.checks .ok { color: var(--green); font-weight: bold; width: 20px; }
html.dark .checks .ok { color: #7fd36e; }
.checks .bad { color: var(--red-hi); font-weight: bold; width: 20px; }

.auth-card { max-width: 380px; margin: 40px auto; padding: 28px; }
.auth-card .logo { margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-card p { margin: 0 0 18px; }
.auth-card .btn-lg { margin-top: 4px; }

/* ---------- Footer ---------- */
#footer { background: linear-gradient(var(--mh-bot), var(--page)); border-top: 1px solid var(--border); margin-top: 10px; }
.ft-inner { max-width: 1280px; margin: 0 auto; padding: 18px 15px 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.logo-ft .logo-word { font-size: 16px; color: var(--muted); }
.logo-ft .logo-tv { font-size: 13px; padding: 3px 4px; filter: saturate(.7); }
.ft-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ft-links a, .ft-links .link-btn { color: var(--text); font-weight: bold; font-size: 12px; }
.ft-copy { margin-left: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1099px) {
  body.guide-static #guide {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px; max-height: none; z-index: 60;
    background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: 2px 0 8px rgba(0, 0, 0, .3);
  }
  body.guide-static .guide-top { display: block; }
  body.guide-static.guide-open #guide { transform: none; }
  body.guide-static .guide-btn { display: inline-flex; }
}

/* Wide view: player runs edge to edge on a black stage, capped so it fits the window height */
@media (min-width: 1001px) {
  html.wide body.page-watch { overflow-x: clip; }
  html.wide #watch { grid-template-areas: "player player" "main sidebar"; }
  html.wide #watch-player {
    background: #000; margin: -15px calc(50% - 50vw) 15px; padding: 0;
    border-bottom: 1px solid var(--border);
  }
  html.wide #watch-player .gr-player {
    width: min(100%, calc((100vh - 110px) * 16 / 9), 1920px); margin: 0 auto;
  }
  html.wide #watch-player .gr-player.gp-fullscreen { width: 100%; }
}

@media (max-width: 1000px) {
  #watch { grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "main" "sidebar"; grid-template-rows: auto; }
  .gp-wide { display: none; }
  .compact .thumb { width: 168px; }
}

@media (max-width: 720px) {
  .mh-inner { padding: 0 6px; gap: 4px; }
  .mh-search { display: none; margin: 0; }
  .search-open { display: inline-flex; }
  body.search-open .mh-search {
    display: flex; position: absolute; inset: 0; background: var(--mh-top); align-items: center; padding: 0 8px; gap: 4px; max-width: none; z-index: 2;
  }
  body.search-open .search-back { display: inline-flex; }
  .upload-btn span, .mh-user-name { display: none; }
  .upload-btn { padding: 0 7px; }
  .logo-word { font-size: 18px; }
  .logo-tv { font-size: 14px; }

  #content { padding: 10px 0 20px; }
  .section-head, .shelf-head, .admin-head { padding: 0 10px; }
  .shelf, .channel-head, .panel, .vm-list { border-left: 0; border-right: 0; }
  .flash { margin: 0 10px 10px; }
  .page-title { font-size: 17px; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .shelf { padding: 12px 10px 2px; }
  #content > .grid, #content > .rows { padding: 0 10px; }

  .channel-banner { height: 90px; }
  .channel-banner span { font-size: 44px; }
  .channel-info { padding: 0 12px 14px; margin-top: -30px; gap: 12px; }
  .avatar-xl { width: 72px; height: 72px; font-size: 32px; }
  .channel-name { font-size: 20px; }

  body.page-watch #content { padding-top: 0; }
  #watch { gap: 0 10px; }
  #watch-headline, #watch-userbar, #watch-actions { border-left: 0; border-right: 0; }
  #watch-headline { padding: 10px 12px 4px; }
  #watch-title { font-size: 17px; }
  #watch-userbar { padding: 4px 12px 10px; }
  .sparkbars { width: 110px; }
  .view-count { font-size: 16px; }
  #watch-actions { padding: 8px 12px; }
  #watch-sidebar { padding: 0 10px; }
  #watch-player { position: sticky; top: 0; z-index: 30; }

  .row-thumb { width: 150px; }
  .row-title { font-size: 13px; }
  .row-desc { display: none; }

  .upload-form { grid-template-columns: minmax(0, 1fr); }
  .dropzone { min-height: 230px; border-right: 0; border-bottom: 1px solid var(--border); }
  .edit-grid { grid-template-columns: minmax(0, 1fr); }
  .vm-item { flex-wrap: wrap; }
  .vm-thumb { width: 120px; }
  .vm-actions { width: 100%; justify-content: flex-end; }
  .auth-card { margin: 20px 0; }
  .ft-copy { margin-left: 0; width: 100%; }
}

@media (max-width: 460px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid .tile { display: grid; grid-template-columns: 1fr; }
  .compact .thumb { width: 140px; }
  .row { flex-direction: column; }
  .row-thumb { width: 100%; }
  .cf-name { max-width: none; }
  .comment-form > .avatar, .comment > .avatar { width: 36px; height: 36px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
  .gp-spin { animation: spin 1.6s linear infinite !important; }
}
