:root {
    --bg: #16181a;
    --bg-deep: #121212;
    --elev: #1e2124;
    --ink: #ffffff;
    --muted: #a8b0b8;
    --line: rgba(255, 255, 255, 0.08);
    --blue: #00aaff;
    --blue-hot: #33bbff;
    --max: 1280px;
    --pad: clamp(1rem, 3vw, 2rem);
    --sans: "DM Sans", "Segoe UI", system-ui, sans-serif;
    --card-w: clamp(200px, 22vw, 280px);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.dm-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 10% -10%, rgba(0, 170, 255, 0.12), transparent 55%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
.dm-player img,
.dm-thumb img,
.dm-card-related .dm-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dm-preview {
    background: var(--blue);
    color: #041018;
    text-align: center;
    padding: .45rem;
    font-weight: 700;
    font-size: .85rem;
    position: relative;
    z-index: 60;
}
.dm-preview a { text-decoration: underline; }

/* —— Header —— */
.dm-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(22, 24, 26, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.dm-header-inner {
    width: min(var(--max), calc(100% - 2 * var(--pad) + 2 * var(--pad)));
    margin: 0 auto;
    padding: 0 var(--pad);
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.dm-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex-shrink: 0;
}
.dm-brand-name {
    font-weight: 700;
    letter-spacing: -.02em;
    font-size: 1.15rem;
}
.dm-logo { display: grid; }
.dm-search {
    flex: 1;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: .55rem;
    background: var(--elev);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .55rem 1rem;
    color: var(--muted);
    margin: 0 auto;
}
.dm-search input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: .95rem;
}
.dm-nav {
    display: flex;
    align-items: center;
    gap: .15rem .85rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.dm-nav a {
    font-size: .9rem;
    color: var(--muted);
    font-weight: 500;
}
.dm-nav a:hover,
.dm-nav a.is-active { color: var(--ink); }
.dm-nav a.is-active { box-shadow: inset 0 -2px 0 var(--blue); }
.dm-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid !important;
    place-content: center;
    background: linear-gradient(145deg, var(--blue), #0066aa);
    color: #fff !important;
    font-weight: 700;
    box-shadow: none !important;
}
.dm-burger {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--elev);
    color: var(--ink);
    cursor: pointer;
}
.dm-nav-mobile {
    display: none;
    flex-direction: column;
    gap: .25rem;
    padding: .5rem var(--pad) 1rem;
    border-top: 1px solid var(--line);
    background: var(--bg-deep);
}
.dm-nav-mobile.is-open {
    display: flex;
}
.dm-nav-mobile[hidden] {
    display: none !important;
}
.dm-nav-mobile a {
    padding: .65rem .4rem;
    color: var(--muted);
}
.dm-nav-mobile a:hover { color: var(--ink); }

.dm-main {
    width: min(var(--max), 100%);
    margin: 0 auto;
    padding: 1rem var(--pad) 3rem;
}

/* —— Buttons —— */
.dm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .7rem 1.2rem;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    border: 0;
    cursor: pointer;
    transition: transform .2s var(--ease), filter .2s ease, background .2s ease;
}
.dm-btn:hover { transform: translateY(-1px); }
.dm-btn-primary {
    background: var(--blue);
    color: #041018;
    box-shadow: 0 10px 28px rgba(0, 170, 255, 0.28);
}
.dm-btn-primary:hover { background: var(--blue-hot); }
.dm-btn-ghost {
    background: rgba(255,255,255,.08);
    color: var(--ink);
    border: 1px solid rgba(255,255,255,.16);
}

/* —— Hero player —— */
.dm-hero { margin-bottom: 1.75rem; }
.dm-player {
    position: relative;
    aspect-ratio: 21 / 9;
    min-height: 320px;
    border-radius: 18px;
    overflow: hidden;
    background: #0a0b0c;
    border: 1px solid var(--line);
}
.dm-player-watch { aspect-ratio: 16 / 9; min-height: 0; }
.dm-player-veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(10,11,12,.92) 0%, rgba(10,11,12,.45) 48%, transparent 72%),
        linear-gradient(0deg, rgba(10,11,12,.85) 0%, transparent 50%);
    pointer-events: none;
}
.dm-player-copy {
    position: absolute;
    left: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    z-index: 2;
    width: min(520px, calc(100% - 2rem));
}
.dm-player-copy h1 {
    margin: 0 0 .55rem;
    font-size: clamp(1.5rem, 3.5vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
}
.dm-player-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .65rem;
    margin: 0 0 .65rem;
    color: var(--muted);
    font-size: .9rem;
}
.dm-player-syn {
    margin: 0 0 1rem;
    color: #d7dde3;
    line-height: 1.45;
    font-size: .98rem;
}
.dm-player-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.dm-player-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.dm-player-copy { pointer-events: none; }
.dm-player-copy .dm-btn { pointer-events: auto; position: relative; z-index: 3; }

.dm-live-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .65rem;
    border-radius: 999px;
    background: rgba(0, 170, 255, 0.18);
    color: var(--blue-hot);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: .55rem;
}
.dm-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.2);
    margin-right: .35rem;
    vertical-align: middle;
}

.dm-play-center {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-content: center;
}
.dm-play-center span {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    background: var(--blue);
    color: #041018;
    font-size: 1.4rem;
    box-shadow: 0 12px 40px rgba(0, 170, 255, 0.35);
    transition: transform .2s var(--ease);
}
.dm-play-center:hover span { transform: scale(1.06); }

/* —— Sections / rails —— */
.dm-section { margin-bottom: 1.75rem; }
.dm-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}
.dm-section-head h1,
.dm-section-head h2 {
    margin: 0;
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    font-weight: 700;
}
.dm-section-head p {
    margin: .25rem 0 0;
    color: var(--muted);
    font-size: .9rem;
    width: 100%;
}
.dm-see-all {
    color: var(--blue);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
}
.dm-rail { position: relative; }
.dm-track {
    display: flex;
    gap: .85rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: .25rem 0 1rem;
    scrollbar-width: none;
}
.dm-track::-webkit-scrollbar { display: none; }
.dm-rail-btn {
    position: absolute;
    top: 0;
    bottom: 1rem;
    z-index: 3;
    width: 2.5rem;
    border: 0;
    background: rgba(12, 14, 16, 0.55);
    color: var(--ink);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease;
}
.dm-rail:hover .dm-rail-btn { opacity: 1; }
.dm-rail-btn { left: 0; border-radius: 0 8px 8px 0; }
.dm-rail-btn-next { left: auto; right: 0; border-radius: 8px 0 0 8px; }

.dm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.15rem;
}

/* —— Cards —— */
.dm-card { flex: 0 0 var(--card-w); scroll-snap-align: start; min-width: 0; }
.dm-card-grid { flex: none; width: 100%; }
.dm-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--elev);
    margin-bottom: .65rem;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.dm-card:hover .dm-thumb {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.dm-fallback {
    display: grid;
    place-content: center;
    height: 100%;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: .06em;
}
.dm-fallback-lg { font-size: 1.4rem; }
.dm-play-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    background: rgba(0, 170, 255, 0.95);
    color: #041018;
    font-size: .7rem;
    opacity: 0;
    transition: opacity .2s ease;
}
.dm-card:hover .dm-play-badge { opacity: 1; }
.dm-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: .12rem .4rem;
    border-radius: 4px;
}
.dm-duration-lg { z-index: 2; font-size: .85rem; }
.dm-card-body h3 {
    margin: 0 0 .35rem;
    font-size: .98rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dm-card-meta {
    margin: 0;
    font-size: .82rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}
.dm-card-meta a:hover { color: var(--blue-hot); }

.dm-empty {
    padding: 2rem 0;
    color: var(--muted);
}
.dm-empty-page {
    min-height: 50vh;
    display: grid;
    place-content: center;
    text-align: center;
    gap: .65rem;
}
.dm-empty-page h1 { margin: 0; color: var(--ink); }

/* —— Watch —— */
.dm-watch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.5rem;
    align-items: start;
}
.dm-watch-main h1 {
    margin: 1rem 0 .75rem;
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    font-weight: 700;
    line-height: 1.25;
}
.dm-watch-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.dm-channel {
    display: block;
    font-weight: 700;
    color: var(--blue-hot);
    margin-bottom: .2rem;
}
.dm-watch-meta p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}
.dm-watch-actions { display: flex; gap: .5rem; }
.dm-desc {
    background: var(--elev);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem 1.15rem;
}
.dm-excerpt { margin: 0 0 .75rem; font-weight: 600; }
.dm-prose {
    color: #d5dbe1;
    line-height: 1.65;
    font-size: .98rem;
}
.dm-prose p { margin: 0 0 .9rem; }
.dm-prose img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin: .75rem 0;
}
.dm-related h2 {
    margin: 0 0 .85rem;
    font-size: 1.05rem;
}
.dm-related-list {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.dm-card-related { flex: none; width: 100%; display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: .75rem; }
.dm-card-related .dm-thumb { margin: 0; }
.dm-card-related .dm-card-body h3 { font-size: .88rem; }

.dm-footer {
    border-top: 1px solid var(--line);
    margin-top: 1rem;
    padding: 2rem var(--pad) 2.5rem;
    color: var(--muted);
    font-size: .9rem;
    background: rgba(18, 18, 18, 0.55);
}
.dm-footer-inner { width: min(var(--max), 100%); margin: 0 auto; }
.dm-footer-brand strong { color: var(--ink); display: block; margin-bottom: .35rem; }
.dm-footer-brand p { margin: 0 0 1rem; }
.dm-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.1rem;
    margin-bottom: 1.25rem;
}
.dm-footer-links a:hover { color: var(--blue-hot); }
.dm-footer-copy { margin: 0; font-size: .8rem; }

@media (max-width: 980px) {
    .dm-watch { grid-template-columns: 1fr; }
    .dm-player { aspect-ratio: 16 / 9; }
    .dm-card-related { grid-template-columns: 140px 1fr; }
}
@media (max-width: 820px) {
    .dm-nav { display: none; }
    .dm-burger { display: grid; place-content: center; margin-left: auto; }
    .dm-search { max-width: none; }
    .dm-rail-btn { opacity: .65; }
}
@media (max-width: 560px) {
    .dm-header-inner { flex-wrap: wrap; }
    .dm-search { order: 3; flex: 1 1 100%; max-width: none; }
    .dm-brand-name { font-size: 1rem; }
}
