:root {
    color-scheme: dark;
    --bg: #090a0f;
    --surface: #12141c;
    --surface-2: #191c27;
    --surface-3: #232737;
    --text: #f5f6fb;
    --muted: #a8adbd;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #7c5cff;
    --accent-2: #b59fff;
    --success: #43d69f;
    --danger: #ff6b7a;
    --warning: #f4c95d;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 10% -10%, rgba(124, 92, 255, 0.22), transparent 32rem), var(--bg); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 5vw;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 10, 15, 0.84);
    backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; color: white; background: linear-gradient(145deg, var(--accent), #d15cff); box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35); }
.main-nav { display: flex; gap: 28px; color: var(--muted); font-size: 0.94rem; }
.main-nav a:hover, .main-nav a:focus-visible { color: var(--text); }

.hero, .docs-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
    gap: 52px;
    align-items: end;
    padding: 86px 7vw 62px;
    border-bottom: 1px solid var(--line);
}
.hero h1, .docs-hero h1 { max-width: 780px; margin: 8px 0 16px; font-size: clamp(2.4rem, 6vw, 5rem); line-height: 0.98; letter-spacing: -0.055em; }
.hero-copy > p:last-child, .docs-hero > p { max-width: 690px; margin: 0; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.eyebrow { margin: 0; color: var(--accent-2); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }

.search-form { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(25, 28, 39, 0.82); box-shadow: var(--shadow); }
.search-form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.search-control { display: flex; gap: 10px; }
input { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--surface-2); outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 17px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--surface-3); font-weight: 750; white-space: nowrap; }
.button:hover, .button:focus-visible { border-color: rgba(255, 255, 255, 0.25); transform: translateY(-1px); }
.button-primary { border-color: transparent; color: white; background: linear-gradient(135deg, var(--accent), #9c56f5); }
.button-danger { color: #ffd9de; background: rgba(255, 107, 122, 0.12); border-color: rgba(255, 107, 122, 0.28); }
.button-quiet { background: transparent; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 0.8rem; }
.button-block { width: 100%; }

.catalog-section, .docs-content { padding: 56px 7vw 110px; }
.section-heading, .panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading h2, .panel-heading h2, .docs-content h2 { margin: 6px 0 0; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: -0.035em; }
.sync-time { color: var(--muted); font-size: 0.84rem; }

.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 22px; }
.track-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform 160ms ease, border-color 160ms ease, background 160ms ease; }
.track-card:hover { transform: translateY(-4px); border-color: rgba(124, 92, 255, 0.5); background: var(--surface-2); }
.track-artwork { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-3); }
.track-artwork img { width: 100%; height: 100%; object-fit: cover; transition: transform 260ms ease; }
.track-card:hover .track-artwork img { transform: scale(1.035); }
.rank { position: absolute; top: 10px; left: 10px; padding: 5px 9px; border-radius: 999px; color: white; background: rgba(0, 0, 0, 0.72); font-size: 0.76rem; font-weight: 800; backdrop-filter: blur(8px); }
.play-button { position: absolute; right: 12px; bottom: 12px; width: 48px; height: 48px; border: 0; border-radius: 50%; color: white; background: var(--accent); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); }
.play-button:hover, .play-button:focus-visible { transform: scale(1.06); background: #9178ff; }
.track-info { padding: 16px; }
.track-info h3 { min-height: 2.7em; margin: 0 0 7px; overflow: hidden; font-size: 1rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.track-info > p { margin: 0; overflow: hidden; color: var(--muted); font-size: 0.87rem; text-overflow: ellipsis; white-space: nowrap; }
.track-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; color: #858b9e; font-size: 0.76rem; }

.empty-state { display: grid; min-height: 330px; padding: 48px 20px; place-items: center; align-content: center; text-align: center; border: 1px dashed rgba(255, 255, 255, 0.18); border-radius: var(--radius); background: rgba(18, 20, 28, 0.55); }
.empty-state > span { font-size: 3rem; color: var(--accent-2); }
.empty-state h1, .empty-state h2 { margin: 14px 0 8px; }
.empty-state p { max-width: 520px; margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
.page-error { margin: 80px 7vw; }

.player-sheet { position: fixed; z-index: 50; right: 24px; bottom: 24px; left: 24px; display: grid; grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr); gap: 22px; max-width: 1120px; max-height: calc(100vh - 48px); margin: 0 auto; padding: 18px; overflow-y: auto; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 24px; background: rgba(18, 20, 28, 0.97); box-shadow: 0 30px 110px rgba(0, 0, 0, 0.72); backdrop-filter: blur(22px); }
.player-video-frame { position: relative; min-width: 200px; min-height: 200px; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 15px; background: #000; }
.player-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-notice { margin: 8px 0 0; color: var(--muted); font-size: 0.72rem; text-align: center; }
.player-controls-column { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: 4px 12px 4px 4px; }
.player-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.player-heading h2 { margin: 6px 0 0; overflow: hidden; font-size: clamp(1.25rem, 2.6vw, 2rem); text-overflow: ellipsis; white-space: nowrap; }
.player-heading p { margin: 0; color: var(--muted); }
.transport-controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 28px 0 22px; }
.icon-button, .primary-round-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: var(--surface-3); }
.primary-round-button { width: 58px; height: 58px; border: 0; color: white; background: var(--accent); font-size: 1.25rem; }
.icon-button:hover, .primary-round-button:hover { transform: scale(1.05); }
.timeline { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 10px; align-items: center; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
input[type="range"] { min-height: 24px; padding: 0; accent-color: var(--accent); background: transparent; box-shadow: none; }
.volume-control { display: grid; grid-template-columns: 42px minmax(0, 160px); gap: 10px; align-items: center; margin-top: 14px; color: var(--muted); font-size: 0.8rem; }
.player-status { min-height: 1.2em; margin: 10px 0 0; color: var(--muted); font-size: 0.76rem; }
.player-open { padding-bottom: 360px; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 7vw; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }
.site-footer a { color: var(--accent-2); }

.docs-hero { grid-template-columns: 1fr; align-items: start; }
.docs-actions { display: flex; gap: 12px; margin-top: 8px; }
.docs-content { max-width: 1060px; }
.docs-content h2 { margin-top: 48px; }
.endpoint-list { display: grid; gap: 1px; margin-top: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.endpoint-list > div { display: grid; grid-template-columns: minmax(280px, 0.65fr) 1fr; gap: 20px; padding: 17px; background: var(--surface); }
.endpoint-list span { color: var(--muted); }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
pre { max-width: 100%; padding: 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); color: #d9d5ff; background: #10121a; line-height: 1.65; }

.standalone-player-body { min-height: 100vh; }
.standalone-player { max-width: 1120px; margin: 0 auto; padding: 36px 24px 70px; }
.back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); }
.standalone-player-card { display: grid; grid-template-columns: minmax(320px, 1.2fr) minmax(300px, 0.8fr); gap: 28px; padding: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.standalone-player-info { display: flex; flex-direction: column; justify-content: center; }
.standalone-player-info h1 { margin: 8px 0; font-size: clamp(1.7rem, 4vw, 3.3rem); letter-spacing: -0.045em; }
.standalone-player-info > p:not(.eyebrow):not(.player-status) { margin: 0; color: var(--muted); }

.admin-body { min-height: 100vh; background: var(--bg); }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; display: flex; width: 260px; padding: 28px 20px; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.admin-brand { padding: 0 8px 28px; }
.admin-sidebar nav { display: grid; gap: 6px; }
.admin-sidebar nav a { padding: 11px 12px; border-radius: 10px; color: var(--muted); }
.admin-sidebar nav a:hover, .admin-sidebar nav a:focus-visible { color: var(--text); background: var(--surface-3); }
.admin-logout { margin-top: auto; }
.admin-logout .button { width: 100%; }
.admin-main { min-height: 100vh; margin-left: 260px; padding: 36px 42px 80px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.admin-topbar h1 { margin: 5px 0 0; font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -0.04em; }
.admin-user { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.82rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-grid article { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-grid span { color: var(--muted); font-size: 0.8rem; }
.stat-grid strong { display: block; margin-top: 12px; font-size: 2rem; }
.admin-panel { margin-bottom: 22px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.admin-panel > p { color: var(--muted); line-height: 1.6; }
.inline-form { display: flex; align-items: end; gap: 10px; }
.inline-form label { display: grid; gap: 6px; color: var(--muted); font-size: 0.78rem; }
.inline-form input { width: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.form-grid label, .stack-form label { display: grid; gap: 7px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.form-grid small { color: #7e8497; font-weight: 400; line-height: 1.4; }
.full-field { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
td small { display: block; margin-top: 5px; color: var(--muted); }
.error-cell { max-width: 270px; overflow-wrap: anywhere; color: var(--muted); }
.action-cell { display: flex; gap: 6px; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--surface-3); font-size: 0.72rem; font-weight: 800; }
.status-active, .status-success { color: var(--success); background: rgba(67, 214, 159, 0.11); }
.status-disabled, .status-revoked, .status-failed { color: var(--danger); background: rgba(255, 107, 122, 0.11); }
.status-running { color: var(--warning); background: rgba(244, 201, 93, 0.11); }
.alert { margin: 0 0 18px; padding: 14px 16px; border-radius: 12px; line-height: 1.5; }
.alert-success { color: #c8ffec; background: rgba(67, 214, 159, 0.12); border: 1px solid rgba(67, 214, 159, 0.22); }
.alert-error { color: #ffd5da; background: rgba(255, 107, 122, 0.12); border: 1px solid rgba(255, 107, 122, 0.24); }
.secret-reveal { margin-bottom: 22px; padding: 24px; border: 1px solid rgba(244, 201, 93, 0.35); border-radius: var(--radius); background: rgba(244, 201, 93, 0.08); }
.secret-reveal h2 { margin: 7px 0 15px; }
.secret-reveal code { display: block; padding: 14px; overflow-wrap: anywhere; border-radius: 10px; background: rgba(0, 0, 0, 0.24); }
.secret-reveal p:last-child { margin-bottom: 0; color: var(--muted); }
.login-main { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.login-card { display: grid; width: min(100%, 440px); gap: 28px; padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h1 { margin: 8px 0; font-size: 2.2rem; letter-spacing: -0.04em; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.stack-form { display: grid; gap: 16px; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 30px; padding-top: 60px; }
    .player-sheet, .standalone-player-card { grid-template-columns: 1fr; }
    .player-sheet { max-width: 660px; }
    .player-open { padding-bottom: 680px; }
    .admin-sidebar { position: static; width: auto; min-height: 0; }
    .admin-sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-logout { margin-top: 18px; }
    .admin-main { margin-left: 0; padding: 28px 22px 70px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .site-header { align-items: flex-start; padding: 16px 20px; gap: 14px; }
    .main-nav { gap: 13px; flex-wrap: wrap; justify-content: flex-end; font-size: 0.78rem; }
    .hero, .docs-hero, .catalog-section, .docs-content { padding-right: 20px; padding-left: 20px; }
    .hero { padding-top: 48px; }
    .search-control { align-items: stretch; flex-direction: column; }
    .section-heading, .panel-heading, .admin-topbar { align-items: flex-start; flex-direction: column; }
    .track-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .track-info { padding: 12px; }
    .player-sheet { inset: auto 8px 8px; grid-template-columns: minmax(0, 1fr); max-height: calc(100vh - 16px); padding: 12px; overflow-x: hidden; border-radius: 18px; }
    .player-video-frame { min-width: 0; min-height: 200px; aspect-ratio: auto; }
    .player-controls-column { padding: 4px; }
    .player-open { padding-bottom: 640px; }
    .site-footer { align-items: flex-start; flex-direction: column; padding-right: 20px; padding-left: 20px; }
    .endpoint-list > div { grid-template-columns: 1fr; gap: 7px; }
    .standalone-player { padding: 18px 12px 50px; }
    .standalone-player-card { padding: 12px; }
    .admin-sidebar nav { grid-template-columns: 1fr; }
    .stat-grid, .form-grid { grid-template-columns: 1fr; }
    .full-field { grid-column: auto; }
    .inline-form { width: 100%; align-items: stretch; flex-direction: column; }
    .inline-form input { width: 100%; }
    .action-cell { flex-direction: column; }
}

@media (max-width: 420px) {
    .track-grid { grid-template-columns: 1fr; }
    .brand > span:last-child { display: none; }
    .hero h1, .docs-hero h1 { font-size: 2.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

