:root {
  color-scheme: dark;
  --bg: #070a13;
  --panel: #0d1220;
  --panel-2: #111727;
  --line: #232b40;
  --muted: #8991a5;
  --text: #f4f6fb;
  --purple: #5140b8;
  --purple-light: #7564e9;
  --cyan: #55dcff;
  --green: #55d995;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; font-size: 14px; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
.app-shell { display: flex; width: 100vw; height: 100vh; min-height: 360px; overflow: hidden; background: var(--bg); }
.side-rail { z-index: 5; width: 62px; flex: 0 0 62px; display: flex; flex-direction: column; align-items: center; background: #05070d; border-right: 1px solid #171d2c; padding: 13px 0 15px; }
.rail-brand { width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 31px; }
.rail-brand img { width: 29px; height: 29px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(83, 134, 255, .6)); }
.rail-nav { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.rail-link { width: 39px; height: 39px; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #aeb5c4; display: grid; place-items: center; transition: .18s ease; }
.rail-link span { font-size: 22px; line-height: 1; font-weight: 700; }
.rail-link:hover, .rail-link.active { color: #fff; border-color: #fff; background: rgba(255,255,255,.06); }
.rail-settings { margin-top: auto; }
.main-stage { min-width: 0; flex: 1; height: 100%; overflow: auto; background: radial-gradient(circle at 70% -10%, rgba(72, 69, 151, .16), transparent 40%), var(--bg); scrollbar-width: thin; scrollbar-color: #303a54 transparent; }
.view { display: none; min-height: 100%; }
.view.active { display: block; }

.home-view { position: relative; padding-bottom: 30px; }
.home-topbar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 57px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 4vw, 65px); background: linear-gradient(180deg, rgba(5,7,13,.75), transparent); }
.brand-lockup { display: flex; align-items: center; gap: 9px; text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 800; color: #d7dced; }
.brand-lockup img { width: 23px; height: 23px; object-fit: contain; }
.home-clock, .catalog-clock { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.home-feature { position: relative; min-height: 54vh; height: 430px; background-image: url('./assets/newbraz-background.png'); background-position: center; background-size: cover; overflow: hidden; }
.feature-overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5, 7, 13, .98) 0%, rgba(5, 7, 13, .72) 25%, rgba(5, 7, 13, .18) 70%, rgba(5, 7, 13, .7) 100%), linear-gradient(0deg, var(--bg) 0%, transparent 28%); }
.feature-content { position: relative; z-index: 1; max-width: 590px; padding: 112px clamp(34px, 8vw, 124px) 44px; }
.feature-eyebrow, .catalog-eyebrow, .import-kicker { display: block; color: var(--cyan); text-transform: uppercase; letter-spacing: .25em; font-size: 10px; font-weight: 800; }
.feature-content h1 { margin: 9px 0 8px; font-size: clamp(28px, 4vw, 54px); line-height: .98; letter-spacing: -.035em; text-transform: uppercase; }
.feature-meta { display: flex; align-items: center; gap: 10px; color: #e8eaf0; font-size: 12px; margin: 12px 0; }
.feature-meta span:first-child { color: #f5d64a; font-size: 15px; }
.feature-content p { max-width: 520px; margin: 0; color: #ccd1dc; line-height: 1.5; font-size: 13px; }
.feature-actions, .import-buttons, .settings-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.button { border: 1px solid transparent; border-radius: 7px; min-height: 38px; padding: 0 18px; font-weight: 800; font-size: 12px; letter-spacing: .01em; }
.button-light { background: #f5f6fa; color: #090b12; }
.button-dark { background: rgba(18, 22, 32, .85); border-color: rgba(255,255,255,.16); color: #fff; }
.button-primary { background: var(--purple); color: #fff; }
.button-outline { background: transparent; border-color: #45506b; color: #e4e8f3; }
.button-danger { background: #371b2a; border-color: #6e2b45; color: #ffb5ca; }
.button:hover { filter: brightness(1.18); }
.circle-button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.27); background: rgba(255,255,255,.08); color: #fff; font-weight: 800; }

.top-ten-section, .continue-section { padding: 0 clamp(25px, 5vw, 75px); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.section-heading h2 { margin: 0; font-size: 17px; }
.section-heading span { color: #afb6c7; font-size: 13px; }
.top-ten-grid { display: flex; gap: clamp(12px, 2vw, 25px); min-height: 155px; overflow-x: auto; padding: 3px 0 12px; scrollbar-width: none; }
.top-ten-grid::-webkit-scrollbar { display: none; }
.rank-card { position: relative; min-width: 122px; width: 122px; min-height: 145px; padding-left: 24px; cursor: pointer; }
.rank-number { position: absolute; left: 0; bottom: 26px; color: rgba(207, 213, 227, .23); font-size: 104px; line-height: .75; font-weight: 900; z-index: 0; }
.rank-poster { position: relative; z-index: 1; width: 82px; height: 112px; overflow: hidden; border-radius: 10px; background: #1a2132; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.rank-poster img { width: 100%; height: 100%; object-fit: cover; }
.rank-title { display: block; position: relative; z-index: 2; width: 101px; padding-top: 6px; overflow: hidden; color: #dce1eb; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.top-ten-empty { color: var(--muted); font-size: 12px; padding: 10px 0 22px; }
.home-import-card { margin: 10px clamp(25px, 5vw, 75px) 0; padding: 16px 19px; display: flex; justify-content: space-between; align-items: center; gap: 24px; border: 1px solid var(--line); border-radius: 8px; background: rgba(13, 18, 32, .8); }
.home-import-card h2 { margin: 5px 0 3px; font-size: 16px; }
.home-import-card p { margin: 0; color: var(--muted); font-size: 11px; }
.import-controls { width: min(530px, 50%); }
input { border: 1px solid #2c3650; outline: none; border-radius: 6px; color: #f4f6fb; background: #080b13; }
input:focus { border-color: var(--purple-light); box-shadow: 0 0 0 2px rgba(117,100,233,.15); }
.import-controls input, .settings-panel input { width: 100%; height: 38px; padding: 0 12px; }
.import-buttons { margin-top: 8px; }
.import-buttons .button { min-height: 34px; }
.quick-row { display: none; }

.catalog-view { display: none; height: 100%; min-height: 100%; grid-template-columns: minmax(236px, 29vw) minmax(0, 1fr); }
.catalog-view.active { display: grid; }
.catalog-sidebar { min-width: 0; padding: 14px 9px; overflow-y: auto; background: #090d17; border-right: 1px solid #1c2334; }
.catalog-source { height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 11px; margin-bottom: 8px; border: 1px solid #2b3140; border-radius: 5px; background: #131313; }
.catalog-source strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.refresh-button { border: 0; background: transparent; color: #fff; font-size: 25px; line-height: 1; }
.stack-icon { font-size: 25px; color: #e7e9ef; }
.catalog-shortcuts { display: grid; gap: 4px; }
.catalog-shortcut { min-width: 0; height: 45px; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #23283a; border-radius: 2px; color: #eef0f6; background: #0d0f17; text-align: left; }
.catalog-shortcut:hover, .catalog-shortcut:focus { border-color: #6657cc; background: #171b2c; }
.catalog-shortcut span { font-size: 18px; text-align: center; }
.catalog-shortcut b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-shortcut em { color: #fff; font-size: 12px; font-style: normal; font-weight: 800; }
.side-groups-title { padding: 18px 10px 7px; color: #7f8799; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.group-chips { display: grid; gap: 3px; }
.chip { min-height: 39px; padding: 0 12px; border: 1px solid #1f2534; border-radius: 2px; background: #0e111a; color: #e7e9ef; text-align: left; font-size: 12px; font-weight: 800; }
.chip.active { border-color: #8576f0; background: #4b3da2; }
.catalog-main { min-width: 0; padding: 14px clamp(14px, 3vw, 42px) 28px; overflow-y: auto; }
.catalog-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 5px 3px 13px; }
.catalog-header h1 { margin: 5px 0 0; font-size: 22px; }
.catalog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 13px; }
.catalog-toolbar input { width: min(340px, 52%); height: 36px; padding: 0 12px; }
.catalog-toolbar > span { color: var(--muted); font-size: 11px; }
.catalog-toolbar b { color: #fff; }
.stage-preview { position: relative; min-height: 245px; margin-bottom: 18px; background: #020307; border: 1px solid #101725; overflow: hidden; }
.stage-screen-inner { position: absolute; inset: 0; background: radial-gradient(circle at 50% 20%, rgba(48,57,90,.12), transparent 44%); }
.epg-message { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; color: #818798; }
.epg-message span { font-size: 38px; line-height: 1; }
.epg-message b { font-size: 18px; }
.results-heading { display: flex; justify-content: space-between; margin: 2px 0 10px; color: #9ea6b7; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 17px 12px; }
.compact-grid { grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); }
.content-card { min-width: 0; position: relative; overflow: hidden; cursor: pointer; }
.poster { position: relative; height: 175px; overflow: hidden; border: 1px solid #252e43; border-radius: 7px; background: #131a29; }
.poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-star { position: absolute; top: 7px; right: 7px; width: 25px; height: 25px; border: 0; border-radius: 50%; background: rgba(0,0,0,.64); color: #d8dce6; opacity: 0; }
.content-card:hover .card-star, .card-star.on { opacity: 1; }
.card-star.on { color: #f5d64a; }
.poster-badge { position: absolute; left: 7px; bottom: 7px; padding: 4px 6px; border-radius: 3px; background: rgba(0,0,0,.72); color: #fff; font-size: 8px; font-weight: 800; }
.card-info { min-width: 0; padding: 7px 2px 0; }
.card-title, .card-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { color: #f0f2f7; font-size: 11px; font-weight: 800; }
.card-meta { margin-top: 4px; color: #8992a7; font-size: 10px; }
.progress-track, .episode-progress { display: block; height: 3px; margin-top: 6px; overflow: hidden; background: #252c3d; }
.progress-track i, .episode-progress i { display: block; height: 100%; background: var(--purple-light); }
.load-more-button { display: block; margin: 22px auto 0; padding: 10px 17px; border: 1px solid #3c4560; border-radius: 6px; background: #12192a; color: #dfe3ed; }
.empty-state { padding: 38px 5px; color: var(--muted); text-align: center; }

.settings-view { padding: clamp(25px, 7vw, 90px); }
.settings-panel { max-width: 620px; padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(135deg, rgba(24,29,52,.9), rgba(10,13,24,.95)); }
.settings-panel h1 { margin: 10px 0 8px; font-size: 28px; }
.settings-panel p { max-width: 520px; margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.settings-panel label { display: block; margin-bottom: 7px; color: #cbd1df; font-size: 12px; font-weight: 700; }
.settings-note { margin-top: 20px; color: #778198; font-size: 11px; line-height: 1.45; }

.modal { position: fixed; z-index: 30; inset: 0; display: none; place-items: center; padding: 18px; background: rgba(0,0,0,.78); }
.modal.open { display: grid; }
.player-panel { width: min(1100px, 96vw); height: min(650px, 92vh); overflow: hidden; border: 1px solid #34405b; border-radius: 10px; background: #090d17; box-shadow: 0 18px 60px rgba(0,0,0,.55); }
.player-header { height: 61px; display: flex; justify-content: space-between; align-items: center; padding: 0 17px; border-bottom: 1px solid #222c42; }
.player-kind { color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.player-header h2 { margin: 4px 0 0; font-size: 16px; }
.player-actions { display: flex; gap: 7px; }
.icon-button { width: 34px; height: 34px; border: 1px solid #35425d; border-radius: 6px; background: #111827; color: #e6eaf2; font-size: 18px; }
.player-body { display: grid; grid-template-columns: minmax(0, 1fr) 245px; height: calc(100% - 61px); }
.video-wrap { position: relative; min-width: 0; background: #000; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #c4cada; font-size: 12px; pointer-events: none; }
.video-loading.hidden { display: none; }
.next-episode { position: absolute; right: 16px; bottom: 55px; padding: 11px 15px; border: 0; border-radius: 6px; background: var(--purple-light); color: #fff; font-size: 12px; font-weight: 800; box-shadow: 0 4px 18px #000; }
.episode-panel { overflow-y: auto; border-left: 1px solid #222c42; background: #0e1421; }
.episode-panel-heading { display: flex; justify-content: space-between; padding: 15px; color: #aab2c4; font-size: 10px; letter-spacing: .15em; }
.episode-row { width: 100%; display: grid; grid-template-columns: 24px 1fr; gap: 7px; padding: 10px 13px; border: 0; border-top: 1px solid #1c2537; background: transparent; color: #dce1eb; text-align: left; }
.episode-row.current, .episode-row:hover { background: #1d2140; }
.episode-number { color: #808aa1; font-size: 11px; }
.episode-name { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.episode-meta { display: block; margin-top: 4px; color: #8994a9; font-size: 10px; }
.episode-progress { margin-top: 6px; }
.resume-modal { z-index: 40; }
.dialog { width: min(390px, 92vw); padding: 25px; border: 1px solid #384561; border-radius: 10px; background: #101626; text-align: center; }
.dialog-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: auto; border-radius: 50%; background: #44369a; }
.dialog h2 { margin: 13px 0 8px; font-size: 18px; }
.dialog p { margin: 0; color: #a8b0c1; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 22px; max-width: min(480px, 90vw); padding: 11px 16px; border: 1px solid #3b4967; border-radius: 6px; background: #11192b; color: #eff2fa; opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .2s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.rotate-overlay { display: none; }

@media (orientation: portrait) {
  .rotate-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; background: #070a13; text-align: center; }
  .rotate-card { width: min(280px, 82vw); padding: 28px 20px; border: 1px solid #303c58; border-radius: 12px; background: #101626; }
  .rotate-symbol { display: block; margin-bottom: 15px; color: var(--cyan); font-size: 46px; }
  .rotate-card strong { display: block; font-size: 18px; }
  .rotate-card p { margin: 9px 0 0; color: var(--muted); line-height: 1.4; font-size: 12px; }
}

@media (max-width: 800px) and (orientation: landscape) {
  .side-rail { width: 52px; flex-basis: 52px; }
  .rail-brand { margin-bottom: 16px; }
  .rail-nav { gap: 7px; }
  .rail-link { width: 34px; height: 34px; }
  .rail-link span { font-size: 18px; }
  .home-feature { min-height: 58vh; height: 240px; }
  .feature-content { max-width: 58%; padding: 68px 34px 25px; }
  .feature-content h1 { font-size: 24px; }
  .feature-content p { max-height: 38px; overflow: hidden; font-size: 11px; }
  .home-import-card { padding: 10px 13px; }
  .home-import-card h2 { font-size: 13px; }
  .home-import-card p { display: none; }
  .import-controls { width: 48%; }
  .import-controls input { height: 30px; }
  .import-buttons .button { min-height: 28px; padding: 0 10px; font-size: 10px; }
  .catalog-view { grid-template-columns: 225px minmax(0, 1fr); }
  .catalog-sidebar { padding: 8px 6px; }
  .catalog-source { height: 35px; }
  .catalog-shortcut { height: 34px; }
  .side-groups-title { padding-top: 9px; }
  .stage-preview { min-height: 145px; }
  .poster { height: 125px; }
  .player-panel { height: 96vh; }
  .player-body { grid-template-columns: minmax(0, 1fr) 190px; }
}
