* { box-sizing: border-box; }

:root {
 color-scheme: dark;
 --accent: #97dbb9;
 --text: #edf5f0;
 --muted: #9aafa3;
 --surface: rgba(24, 43, 33, 0.62);
 --border: rgba(160, 211, 183, 0.19);
 --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
 --wallpaper: url("/images/themes/xylora.webp");
}

html, body {
 margin: 0;
 padding: 0;
 background: transparent;
 color: var(--text);
 font: 14px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
}

body { min-height: 100dvh; position: relative; isolation: isolate; }
.ambient {
 position: fixed;
 inset: 0;
 z-index: -1;
 pointer-events: none;
 overflow: hidden;
 background: #0a140f;
}
.ambient::before, .ambient::after { content: ""; position: absolute; inset: 0; }
.ambient::before { background: var(--wallpaper) center / cover no-repeat; opacity: 0.55; }
.ambient::after { background: linear-gradient(180deg, #06110b38, #06110b8c 70%, #06110bba); }
.ambient span {
 position: absolute;
 width: min(60vw, 600px);
 aspect-ratio: 1;
 border-radius: 50%;
 background: radial-gradient(circle, #97dbb91c, transparent 70%);
 animation: drift 18s ease-in-out infinite alternate;
}
.ambient span:first-child { top: -15%; left: -10%; }
.ambient span:last-child { bottom: -20%; right: -10%; animation-delay: -9s; }
.is-watching .ambient span { animation-play-state: paused; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
::selection { background: #97dbb940; }
svg { flex-shrink: 0; width: 20px; height: 20px; }
a { color: var(--accent); text-underline-offset: 4px; transition: color 180ms; }
a:hover { color: #d3ffe6; }

button, input, select {
 font: inherit;
 color: inherit;
 background: var(--surface);
 border: 1px solid var(--border);
 border-radius: 999px;
 padding: 9px 16px;
}

button, select {
 transition: transform 200ms var(--ease), background 200ms, border-color 200ms, box-shadow 200ms, color 200ms;
}
button { cursor: pointer; }
button:hover:not(:disabled) {
 background: rgba(88, 140, 108, 0.24);
 border-color: var(--accent);
 transform: translateY(-2px);
 box-shadow: 0 5px 20px #0000001a;
}
button:active:not(:disabled) { transform: translateY(0) scale(0.97); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
 outline: 2px solid var(--accent);
 outline-offset: 4px;
}
button:disabled, select:disabled { opacity: 0.45; cursor: default; }
select option { background: #17251d; color: var(--text); }

.hidden { display: none !important; }
.dim { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.bar {
 display: grid;
 grid-template-columns: auto minmax(0, 660px) auto;
 justify-content: space-between;
 align-items: center;
 gap: 18px;
 padding: 28px 32px;
 max-width: 1400px;
 margin: 0 auto;
 background: transparent;
 position: relative;
 z-index: 20;
}

.brand {
 justify-self: center;
 display: inline-flex;
 align-items: center;
 gap: 12px;
 border: 0;
 background: transparent;
 padding: 4px 10px;
 font-size: 26px;
 font-weight: 750;
 letter-spacing: -1px;
 color: var(--text);
 animation: reveal 600ms var(--ease) backwards;
}
.brand-icon { width: 36px; height: 28px; color: var(--accent); transition: transform 300ms var(--ease); }
.brand:hover:not(:disabled) { background: transparent; box-shadow: none; }
.brand:hover .brand-icon { transform: rotate(-8deg) scale(1.08); }

.search {
 width: min(100%, 660px);
 margin: 0 auto;
 display: flex;
 align-items: center;
 gap: 12px;
 padding: 6px 7px 6px 19px;
 border: 1px solid rgba(151, 219, 185, 0.4);
 border-radius: 999px;
 background: rgba(21, 43, 30, 0.58);
 backdrop-filter: blur(18px);
 -webkit-backdrop-filter: blur(18px);
 box-shadow: 0 12px 40px #00000038, inset 0 1px 0 #ffffff18;
 transition: border-color 220ms, box-shadow 220ms, background 220ms;
 animation: reveal 650ms 140ms var(--ease) backwards;
}
.search:hover { border-color: rgba(151, 219, 185, 0.7); }
.search:focus-within {
 border-color: var(--accent);
 background: rgba(40, 70, 51, 0.8);
 box-shadow: 0 0 0 4px #97dbb910, 0 12px 40px #00000026;
}
.search-icon { width: 18px; height: 18px; color: var(--accent); transition: transform 250ms var(--ease); }
.search:focus-within .search-icon { transform: rotate(-12deg) scale(1.1); }
.search input {
 flex: 1;
 width: 0;
 min-width: 0;
 height: 38px;
 padding: 0;
 border: 0;
 border-radius: 0;
 background: transparent;
 font-size: 15px;
 outline: none;
}
.search input:focus-visible { outline: none; }
.search input::placeholder { color: #c1d1c6; opacity: 0.85; }
.search-submit {
 display: grid;
 place-items: center;
 flex: 0 0 44px;
 width: 44px;
 height: 44px;
 padding: 0;
 border: 0;
 background: var(--accent);
 color: #143123;
}
.search-submit:hover:not(:disabled) { background: #b6f0cf; box-shadow: 0 0 20px #97dbb92e; }
.search-submit svg { transition: transform 200ms var(--ease); }
.search-submit:hover svg { transform: translateX(2px); }
.search-submit:active svg { transform: translateX(4px); }

.nav { justify-self: end; display: flex; align-items: center; gap: 8px; }
.nav button { font-size: 12px; backdrop-filter: blur(12px); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 20px 32px; }
footer.wrap { padding-top: 40px; padding-bottom: 30px; text-align: center; font-size: 11px; opacity: 0.7; }
.is-watching .bar { grid-template-columns: auto minmax(0, 620px) auto; gap: 24px; padding: 20px 32px; }
.is-watching .brand { font-size: 26px; letter-spacing: -1px; }
.is-watching .brand-icon { width: 32px; height: 26px; }
.is-watching .nav { position: static; justify-self: end; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; padding-bottom: 22px; border-bottom: 1px solid #c6ffdd1c; animation: reveal 550ms 180ms var(--ease) backwards; }
.topic { padding: 10px 18px; min-height: 44px; font-size: 12px; background: #0f281b80; border-color: #b2e3c22b; color: #c5d8cc; }
.topic[aria-pressed="true"] { background: #b6f0cf; color: #112c1d; border-color: #b6f0cf; box-shadow: 0 4px 18px #97dbb924; font-weight: 650; }
.topic[aria-pressed="true"]:hover { background: #d4ffe5; }
.topic:active:not(:disabled) { transform: scale(0.94); }

.banner {
 margin-bottom: 14px;
 padding: 14px 18px;
 border: 1px solid #e8a08d40;
 background: #54251d40;
 color: #ffc0ad;
 border-radius: 16px;
 animation: reveal 300ms var(--ease) backwards;
}

.feed-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 20px; animation: reveal 550ms 180ms var(--ease) backwards; }
.heading { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.feed-caption { color: #abc2b3; font-size: 12px; }

.grid {
 display: grid;
 grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
 gap: 24px 20px;
}

.card {
 width: 100%;
 min-width: 0;
 border: 1px solid transparent;
 background: transparent;
 padding: 8px;
 border-radius: 22px;
 text-align: left;
 display: flex;
 flex-direction: column;
 align-items: stretch;
 gap: 0;
 appearance: none;
 -webkit-appearance: none;
 animation: reveal 450ms var(--ease) backwards;
}
.card:nth-child(6n+2) { animation-delay: 40ms; }
.card:nth-child(6n+3) { animation-delay: 80ms; }
.card:nth-child(6n+4) { animation-delay: 120ms; }
.card:nth-child(6n+5) { animation-delay: 160ms; }
.card:nth-child(6n+6) { animation-delay: 200ms; }
.card:hover:not(:disabled) { background: #14291a80; border-color: #b2e3c226; transform: translateY(-3px); box-shadow: 0 8px 24px #00000020; }
.card:hover .card-title { color: #fff; }

.thumb {
 position: relative;
 width: 100%;
 aspect-ratio: 16 / 9;
 background: #0a0a0a;
 border: 1px solid var(--border);
 border-radius: 16px;
 overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 400ms var(--ease); }
.card:is(:hover, :focus-visible) .thumb img, .rel-card:is(:hover, :focus-visible) .thumb img { transform: scale(1.06); }
.thumb::after {
 content: "";
 position: absolute;
 top: 50%; left: 50%;
 width: 48px; height: 48px;
 border: 1px solid #d5ffe56b;
 border-radius: 50%;
 background: #10251ce6;
 box-shadow: 0 8px 24px #00000040;
}
.thumb::before {
 content: "";
 position: absolute;
 z-index: 1;
 top: 50%; left: calc(50% + 2px);
 border-top: 7px solid transparent;
 border-bottom: 7px solid transparent;
 border-left: 11px solid #c1f5d6;
}
.thumb::before, .thumb::after { opacity: 0; transform: translate(-50%, -30%) scale(0.85); transition: transform 250ms var(--ease), opacity 250ms; pointer-events: none; }
:is(.card, .rel-card):is(:hover, :focus-visible) .thumb::before,
:is(.card, .rel-card):is(:hover, :focus-visible) .thumb::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.dur {
 position: absolute;
 right: 6px;
 bottom: 6px;
 padding: 1px 5px;
 font-size: 11px;
 background: rgba(0, 0, 0, 0.85);
 color: #fff;
 border-radius: 6px;
 z-index: 2;
}
.dur.live { background: #b91c1c; }

.card-title {
 width: 100%;
 min-width: 0;
 font-size: 14px;
 font-weight: 600;
 color: var(--text);
 display: -webkit-box;
 -webkit-line-clamp: 2;
 -webkit-box-orient: vertical;
 overflow: hidden;
}
.card-sub { width: 100%; min-width: 0; font-size: 12px; color: #afc4b7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-details { min-width: 0; padding: 12px 2px 6px; }
.card-details .card-title { line-height: 1.45; margin-bottom: 5px; }
.card-details { transition: transform 240ms var(--ease); }
.card:is(:hover, :focus-visible) .card-details { transform: translateY(-2px); }
.card-details .card-sub { font-size: 12px; }
.skeleton-card { padding: 12px; border: 1px solid #b2e3c212; border-radius: 24px; background: #10251b66; }
.skeleton-thumb { aspect-ratio: 16 / 9; border-radius: 16px; }
.skeleton-line { height: 12px; margin-top: 14px; border-radius: 6px; }
.skeleton-line:last-child { width: 65%; margin-top: 10px; height: 9px; }
.skeleton-thumb, .skeleton-line { position: relative; overflow: hidden; background: #b2e3c210; }
.skeleton-thumb::after, .skeleton-line::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, #d2ffe814 50%, transparent 80%); animation: shimmer 1.6s ease-in-out infinite; }

.more { margin: 28px 0; text-align: center; min-height: 48px; }
.more.is-loading button::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 9px; vertical-align: -2px; border: 2px solid #97dbb933; border-top-color: var(--accent); border-radius: 50%; animation: spin 850ms linear infinite; }
.more button { animation: reveal 300ms var(--ease) backwards; }

.watch {
 display: grid;
 grid-template-columns: minmax(0, 1fr) 320px;
 gap: 20px;
 align-items: start;
}
.main-col, .side-col { min-width: 0; }
.side-col { padding: 18px; border: 1px solid var(--border); border-radius: 24px; background: #1021199c; }
.watch:not(.hidden) { animation: reveal 350ms var(--ease) backwards; }

.player-box {
 position: relative;
 width: 100%;
 aspect-ratio: 16 / 9;
 background: #000;
 border: 1px solid var(--border);
 border-radius: 22px;
 overflow: hidden;
 box-shadow: 0 20px 60px #00000040, 0 0 0 1px #c6ffdd08;
}
.player-box video { width: 100%; height: 100%; display: block; background: #000; }
.overlay {
 position: absolute;
 inset: 0;
 display: grid;
 place-items: center;
 background: rgba(12, 27, 18, 0.8);
 color: var(--accent);
 align-content: center;
 gap: 16px;
}
.overlay::before { content: ""; width: 32px; height: 32px; border: 2px solid #97dbb933; border-top-color: var(--accent); border-radius: 50%; animation: spin 850ms linear infinite; }

.controls-row {
 display: flex;
 flex-wrap: wrap;
 justify-content: space-between;
 align-items: center;
 gap: 8px;
 padding: 16px 0;
 border-bottom: 1px solid var(--border);
}
.controls-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ctrl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #b6cbbd; }
.ctrl select { padding: 4px 8px; }

.vtitle { margin: 20px 0 6px; font-size: clamp(18px, 2vw, 24px); font-weight: 650; color: var(--text); letter-spacing: -0.5px; }
.vmeta { font-size: 12.5px; margin-bottom: 12px; }

.desc-box { padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: rgba(16, 36, 24, 0.62); }
.desc { white-space: pre-wrap; font-size: 13px; color: #c4d2c8; overflow-wrap: anywhere; }
.desc.collapsed { max-height: 76px; overflow: hidden; }

.text-btn {
 border: 0;
 background: transparent;
 padding: 2px 0;
 color: #999;
 font-size: 12.5px;
}
.text-btn:hover { background: transparent; color: #fff; }
.text-btn.active { color: #fff; text-decoration: underline; }

.ts-btn {
 border: 0;
 background: transparent;
 padding: 0;
 color: #93c5fd;
 font-size: inherit;
}
.ts-btn:hover { background: transparent; text-decoration: underline; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 18px; }
.tab {
 border: 0;
 border: 1px solid transparent;
 border-radius: 999px;
 background: transparent;
 padding: 9px 16px;
 color: var(--muted);
}
.tab:hover { background: transparent; color: #ddd; border-color: transparent; }
.tab.active { color: var(--accent); background: #97dbb915; border-color: #97dbb94d; }
.tab-body { padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: #0c201780; animation: reveal 250ms var(--ease) backwards; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
#transcript-filter { flex: 1; min-width: 0; width: 0; }
#transcript-load-btn { flex-shrink: 0; }
.sort { display: flex; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.line-btn {
 display: flex;
 gap: 10px;
 text-align: left;
 background: var(--surface);
 border: 1px solid var(--border);
 border-radius: 14px;
 padding: 12px 14px;
}
.line-btn.active { border-color: #555; color: #fff; }

.comment {
 padding: 14px 0;
 border-bottom: 1px solid #b2e3c21a;
 font-size: 13px;
}
.comment-head { font-size: 12px; color: #a7bdaf; margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.comment-head strong { color: #ddd; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.replies { margin-top: 8px; padding-left: 12px; border-left: 1px solid #222; }

.side-head { font-size: 13px; font-weight: 600; color: #c6dace; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.rel-card {
 width: 100%;
 min-width: 0;
 display: flex;
 align-items: flex-start;
 gap: 8px;
 text-align: left;
 border: 0;
 background: transparent;
 padding: 8px;
 border-radius: 16px;
 appearance: none;
 -webkit-appearance: none;
}
.rel-card:hover:not(:disabled) { background: #b2e3c20a; border-color: transparent; }
.rel-card:hover .card-title { color: #fff; }
.rel-thumb { width: 108px; flex: 0 0 auto; }

.dialog { background: transparent; border: 0; padding: 0; color: #e5e5e5; max-width: 560px; width: calc(100% - 24px); }
.dialog::backdrop { background: rgba(0, 8, 4, 0.65); backdrop-filter: blur(7px); }
.dialog-box { background: #15241de8; backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-box pre { margin: 0; padding: 10px; background: #000; border: 1px solid #1a1a1a; overflow-x: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog[open] { animation: reveal 220ms var(--ease) backwards; }
.grid > .dim { grid-column: 1 / -1; padding: 32px 0; text-align: center; }

@keyframes reveal {
 from { opacity: 0; transform: translateY(18px) scale(0.985); }
 to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { to { transform: translate(12%, 15%) scale(1.15); opacity: 0.6; } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (max-width: 960px) {
 .watch { grid-template-columns: 1fr; }
 .bar { grid-template-columns: auto 1fr; gap: 16px; }
 .search { grid-column: 1 / -1; grid-row: 2; }
 .nav { grid-column: 2; grid-row: 1; }
 .is-watching .bar { grid-template-columns: auto 1fr; gap: 16px; }
 .is-watching .search { grid-column: 1 / -1; grid-row: 2; }
 .is-watching .nav { grid-column: 2; grid-row: 1; }
}
@media (max-width: 640px) {
 .bar { padding: 20px 18px; gap: 18px; }
 .wrap { padding: 18px; }
 .is-watching .bar { padding: 18px; }
 .is-watching .brand { font-size: 22px; gap: 8px; padding: 4px 0; }
 .is-watching .nav button { padding: 8px 10px; font-size: 11px; }
 .search { gap: 9px; padding-left: 15px; }
 .search input { font-size: 13px; }
 .grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 18px; }
 .card { padding: 8px; }
 .topics { gap: 7px; margin-bottom: 24px; padding-bottom: 18px; }
 .topic { padding: 9px 13px; }
 .heading { font-size: 20px; }
 .feed-caption { font-size: 11px; }
 .tab-body, .side-col { padding: 12px; }
 .player-box { border-radius: 16px; }
 .controls-right { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation: none !important; transition: none !important; }
 button:hover:not(:disabled), button:active:not(:disabled), .card:hover:not(:disabled), .thumb img, .brand-icon, .search-icon { transform: none !important; }
 .card-details { transform: none !important; }
}
