:root {
  color-scheme: dark;
  font-family: "Inter", system-ui, sans-serif;
  color: #f5f4f5;
  background: #101114;
  --panel: #1a1b20;
  --border: #37373f;
  --muted: #bab8c5;
  --accent: #ff576e;
}
* { box-sizing: border-box; }
input, select, textarea, .panel, .card, .card-body, .player-heading { min-width: 0; }
input, select, textarea { max-width: 100%; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  min-height: 72px; padding: 14px clamp(18px, 5vw, 68px); display: flex;
  gap: 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; flex-shrink: 0; align-items: center; text-decoration: none;
}
.brand img { display: block; width: 108px; height: 72px; object-fit: contain; }
#product-nav, #account { display: flex; gap: 7px; align-items: center; }
.account-profile { position: relative; }
.account-identity { display: flex; align-items: center; gap: 9px; padding: 6px 0; }
.account-avatar { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; overflow: hidden; border-radius: 50%; background: #3e202a; color: #ffcbd2; font-weight: 750; }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.account-actions { position: absolute; top: 100%; right: 0; z-index: 10; min-width: 180px; padding: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 25px #0007; visibility: hidden; opacity: 0; pointer-events: none; }
.account-profile:hover .account-actions, .account-profile:focus-within .account-actions { visibility: visible; opacity: 1; pointer-events: auto; }
.account-actions button { width: 100%; text-align: left; }
#product-nav button { min-width: 70px; }
main { max-width: 1280px; margin: 0 auto; padding: 28px clamp(18px, 5vw, 68px) 60px; }
h1 { margin: 0 0 18px; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.055em; line-height: 1.02; }
h2 { margin: 0 0 12px; letter-spacing: -.025em; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.panel { background: var(--panel); padding: clamp(20px, 4vw, 32px); border: 1px solid var(--border); border-radius: 16px; }
.auth { max-width: 480px; margin: min(7vh, 70px) auto 0; }
.auth > * + * { margin-top: 18px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.admin { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); align-items: start; }
label { display: grid; gap: 7px; font-size: .94rem; }
input, select, textarea, button, .button {
  font: inherit; border-radius: 8px; border: 1px solid var(--border); min-height: 42px; padding: 9px 12px;
}
input, textarea, select { width: 100%; color: inherit; background: #131419; }
button, .button { cursor: pointer; color: #111014; background: var(--accent); font-weight: 750; text-decoration: none; }
button:disabled { opacity: .55; cursor: wait; }
.quiet { background: transparent; color: inherit; }
.quiet[aria-pressed="true"] { background: #3e202a; color: #ffb3bf; border-color: #ad4f60; }
:focus-visible { outline: 2px solid #ffcbd2; outline-offset: 3px; }
details summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }
.hero { background: radial-gradient(ellipse at top right, #602432, transparent 70%), #22191f; margin-bottom: 20px; }
.hero p { margin-bottom: 0; }
.hero h1 { margin-bottom: 0; }
.hero #recent-media:not(:empty) { margin-top: 18px; }
.radio-hero { background: radial-gradient(ellipse at top right, #2d4966, transparent 65%), #1b202e; }
.catalog-tools { display: grid; grid-template-columns: minmax(165px, 1.5fr) minmax(135px, 1fr); gap: 12px; align-items: end; }
.catalog-tools .provider-filter { max-width: none; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.provider-filter { max-width: 320px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr)); gap: 14px; }
#more { margin: 18px auto 0; display: block; }
.card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); }
.tv-grid, .radio-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 175px), 1fr)); }
.radio-grid .art { background: linear-gradient(140deg, #263857, #1f2538); color: #bbd8ff; }
.art { height: 118px; display: grid; place-items: center; background: linear-gradient(140deg, #3b202b, #25263b); font-size: 2rem; color: #ffa8b6; }
.art img { display: block; width: 100%; height: 118px; object-fit: contain; padding: 18px; }
.card-body { display: grid; gap: 9px; padding: 13px; }
.card h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button:first-child { flex: 1; }
[role="alert"], .error { color: #ffb0bb; }
#player {
  width: min(1500px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  border: 1px solid var(--border); border-radius: 20px; padding: clamp(14px, 2vw, 24px);
  background: #14151a; color: inherit; box-shadow: 0 24px 80px #0009; overscroll-behavior: contain;
}
#player::backdrop { background: #08090dee; }
.player-head { display: flex; gap: 14px; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.player-head h2 { margin: 0; font-size: clamp(1.3rem, 3vw, 2.1rem); overflow-wrap: anywhere; }
.player-head button { flex-shrink: 0; }
.player-heading p { margin: 4px 0 0; }
#player-live { display: inline-block; color: #ff8d9c; font-size: .68rem; font-weight: 800; letter-spacing: .11em; margin-bottom: 5px; }
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
#player[data-live] .player-layout { grid-template-columns: minmax(0, 1fr) minmax(230px, 295px); }
.player-main { min-width: 0; }
.player-stage { border: 1px solid #292a34; border-radius: 14px; overflow: hidden; background: #060709; }
video { display: block; width: 100%; max-height: 67dvh; background: #060709; aspect-ratio: 16 / 9; border: 0; }
#player[data-radio] { width: min(580px, calc(100% - 24px)); }
#player[data-radio] video { aspect-ratio: auto; height: 64px; }
#station-cover { display: grid; justify-items: center; align-items: center; margin: 0; padding: 25px; min-height: 165px; font-size: 4rem; color: #aac6f4; background: radial-gradient(circle at 60% 10%, #465980, #1c263d 72%); }
#station-cover img { width: min(30vw, 115px); height: 95px; object-fit: contain; }
#station-cover img:not([hidden]) + span { display: none; }
.player-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding-top: 14px; }
.player-controls label { flex: 1 1 145px; max-width: 310px; min-width: 0; }
.player-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#canal-options { margin-top: 12px; }
#recent-media { display: flex; flex-wrap: wrap; gap: 8px; }
#playback-status { color: var(--muted); }
#player-channels { border: 1px solid #2d2e38; border-radius: 14px; padding: 14px; min-width: 0; background: #191a22; }
.channels-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 14px; }
.channels-head h3 { margin: 0; font-size: 1rem; }
.channel-nav { display: flex; gap: 6px; }
.channel-nav button { min-height: 32px; min-width: 35px; padding: 3px 8px; }
#channel-search { margin-bottom: 10px; }
#channel-list { position: relative; display: grid; gap: 6px; max-height: min(48dvh, 520px); overflow-y: auto; padding: 2px 5px 4px 2px; }
.channel-option { display: flex; gap: 10px; align-items: center; min-width: 0; text-align: left; background: #15161d; }
.channel-option[aria-current="true"] { background: #3c2029; border-color: #b65162; }
.channel-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-option img { width: 32px; height: 28px; object-fit: contain; flex: 0 0 32px; }
.admin-users { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h2, .admin-users p { margin: 0; }
.table-scroll { overflow-x: auto; }
.admin-users table { width: 100%; border-collapse: collapse; text-align: left; }
.admin-users td, .admin-users th { padding: 11px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-users td small { display: block; margin-top: 4px; }
.online { color: #9ce4b3; }
#playback-error:empty, #playback-status:empty, .message:empty { display: none; }
@media (max-width: 850px) {
  #tv-categories { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
  #tv-categories button { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }
  header { flex-wrap: wrap; }
  #account { margin-left: auto; }
  #product-nav { order: 3; width: 100%; }
  #player[data-live] .player-layout { grid-template-columns: minmax(0, 1fr); }
  #channel-list { max-height: 31dvh; }
}
@media (max-width: 700px) {
  .account-name { display: none; }
}
@media (max-width: 450px) {
  header { flex-wrap: wrap; padding: 12px 16px; }
  .brand img { width: 96px; height: 64px; }
  #product-nav { order: 3; width: 100%; }
  .catalog-tools { grid-template-columns: 1fr; }
  .tv-grid, .radio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  header button { padding: 7px; font-size: .8rem; }
  #player { width: 100%; height: 100dvh; max-height: none; margin: 0; border-radius: 0; border: 0; }
  .player-head button { padding: 7px; font-size: .8rem; }
}
