@font-face {
  font-family: "PyidaungsuBook";
  src: url("./assets/fonts/PyidaungsuBook-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --bg: #04100f;
  --panel: #092b28;
  --panel-soft: #123e38;
  --primary: #19d3a2;
  --accent: #ffc400;
  --focus: #fbbf24;
  --text: #f9fafb;
  --muted: #b6c8c4;
  --danger: #ff2d20;
  --rail: 190px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: PyidaungsuBook, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 0 0, rgba(25, 211, 162, 0.24), transparent 34rem),
    var(--bg);
}

.app-shell.rail-hidden {
  grid-template-columns: 0 1fr;
}

.rail {
  overflow: hidden;
  min-width: 0;
  padding: 26px 14px 20px 18px;
  background: linear-gradient(180deg, rgba(31, 203, 165, 0.88), rgba(10, 87, 79, 0.82));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px 2px;
  font-size: 20px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-btn,
.icon-btn,
.primary-btn,
.ghost-btn,
.poster-card,
.chip,
.quality-row,
.episode-row {
  border: 0;
  outline: 0;
  cursor: pointer;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 15px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.82);
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
}

.nav-btn:focus-visible,
.icon-btn:focus-visible,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.poster-card:focus-visible,
.chip:focus-visible,
.quality-row:focus-visible,
.episode-row:focus-visible,
.search-input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.content {
  min-width: 0;
  height: 100%;
  padding: 18px 24px 0 26px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  margin-bottom: 10px;
}

.title-block h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
}

.title-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.account-pill strong {
  display: block;
  max-width: 260px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 18px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.search-input {
  width: min(760px, 100%);
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  outline: 0;
  padding: 0 16px;
  background: rgba(4, 16, 15, 0.7);
  color: var(--text);
}

.pane {
  height: calc(100% - 78px);
  overflow: auto;
  padding: 4px 4px 28px;
}

.pane.with-search {
  height: calc(100% - 140px);
}

.featured-row {
  display: grid;
  grid-auto-columns: minmax(250px, 34vw);
  grid-auto-flow: column;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 4px 20px;
}

.featured-card {
  position: relative;
  height: 170px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.featured-card img,
.poster-card img,
.detail-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-card::after,
.poster-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(2, 7, 6, 0.86));
}

.featured-title,
.poster-meta {
  position: absolute;
  z-index: 1;
  left: 12px;
  right: 12px;
  bottom: 10px;
}

.section-title {
  margin: 6px 0 12px;
  font-size: 17px;
  color: var(--muted);
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 18px 14px;
  align-items: start;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 24px 0 34px;
}

.load-more-row .ghost-btn {
  min-width: 170px;
}

.poster-card {
  position: relative;
  aspect-ratio: 0.68;
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.poster-card:focus-visible {
  transform: scale(1.045);
}

.poster-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 900;
}

.poster-year {
  margin-top: 4px;
  color: var(--accent);
  font-size: 11px;
}

.badges {
  position: absolute;
  z-index: 1;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.badge {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(18, 62, 56, 0.9);
  font-size: 10px;
  font-weight: 900;
}

.badge.danger {
  background: rgba(255, 45, 32, 0.9);
}

.fallback-poster {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.38);
  font-size: 40px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 14px;
}

.empty,
.loading,
.error {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1fr);
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 10%, rgba(25, 211, 162, 0.28), transparent 28rem),
    var(--bg);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7vw;
}

.auth-brand h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 78px);
}

.auth-brand p {
  max-width: 440px;
  color: var(--muted);
  font-size: 18px;
}

.auth-form {
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 32px;
}

.auth-form h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.field {
  display: grid;
  gap: 7px;
  width: min(420px, 80vw);
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input {
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  outline: 0;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.primary-btn,
.ghost-btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-btn {
  background: var(--primary);
  color: #02201c;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.ghost-btn[disabled] {
  cursor: wait;
  opacity: 0.58;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.detail-view,
.player-view {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
}

.detail-bg {
  position: absolute;
  inset: 0;
}

.detail-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(9, 11, 16, 0.94) 44%, rgba(9, 11, 16, 0.35) 100%),
    linear-gradient(0deg, var(--bg), transparent 46%);
}

.detail-content {
  position: relative;
  z-index: 1;
  width: min(720px, 72vw);
  height: 100%;
  overflow: auto;
  padding: 48px 34px 34px;
}

.detail-content h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 22px;
}

.pill {
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.description {
  max-width: 680px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}

.dialog {
  width: min(680px, calc(100vw - 44px));
  max-height: min(76vh, 680px);
  overflow: auto;
  border-radius: 8px;
  padding: 20px;
  background: #09211f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.dialog h3 {
  margin: 0 0 14px;
  font-size: 22px;
}

.quality-row,
.episode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  margin-bottom: 8px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.quality-row[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
}

.row-note {
  color: var(--accent);
  font-size: 12px;
}

.player-view {
  z-index: 40;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #000;
}

.video-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-view video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-quality-bar {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(18, 27, 39, 0.78);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
  font-weight: 900;
  backdrop-filter: blur(10px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.player-quality-bar select {
  min-width: min(320px, 46vw);
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  padding: 0 42px 0 14px;
  background: rgba(61, 71, 86, 0.92);
  color: white;
  font: inherit;
  outline: 0;
}

.simple-player-bar {
  position: absolute;
  z-index: 3;
  left: 28px;
  right: 28px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(26, 36, 50, 0.72), rgba(16, 24, 35, 0.88));
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.player-view.controls-hidden {
  cursor: none;
}

.player-view.controls-hidden .player-quality-bar,
.player-view.controls-hidden .simple-player-bar {
  pointer-events: none;
  opacity: 0;
}

.player-view.controls-hidden .player-quality-bar {
  transform: translateY(-18px);
}

.player-view.controls-hidden .simple-player-bar {
  transform: translateY(18px);
}

.simple-player-btn {
  display: grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
  border: 0;
  border-radius: 7px;
  outline: 0;
  background: transparent;
  color: white;
  cursor: pointer;
  font: inherit;
}

.simple-player-btn.volume {
  width: 44px;
  min-width: 44px;
}

.simple-player-btn:focus-visible,
.player-quality-bar select:focus-visible {
  outline: 3px solid #38a8ff;
  outline-offset: 0;
  background: rgba(51, 163, 255, 0.18);
}

.seek-range {
  flex: 1;
  min-width: 80px;
  accent-color: #33a3ff;
  height: 22px;
}

.seek-range::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.5);
}

.seek-range::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
}

.remaining-time {
  min-width: 86px;
  text-align: right;
  color: rgba(255, 255, 255, 0.9);
  font-family: Arial, sans-serif;
  font-size: 15px;
}

.control-icon {
  width: 26px;
  height: 26px;
  fill: #fff;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.play-icon,
.volume-icon {
  stroke: none;
}

.pause-shape,
.volume-slash {
  display: none;
}

.simple-player-btn.is-playing .play-shape {
  display: none;
}

.simple-player-btn.is-playing .pause-shape,
.volume-icon.muted .volume-slash {
  display: block;
}

.volume-icon .volume-wave {
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
}

.volume-icon.muted .volume-wave {
  display: none;
}

.volume-icon .volume-slash {
  fill: none;
  stroke: #ffdf70;
  stroke-width: 3;
}

.fullscreen-icon {
  fill: none;
}

.profile-pane {
  max-width: 720px;
  padding-top: 20px;
}

.profile-line {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  max-width: min(680px, calc(100vw - 48px));
  padding: 13px 18px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

#toast.show {
  opacity: 1;
}

@media (max-width: 760px) {
  :root {
    --rail: 154px;
  }

  .content {
    padding: 14px 14px 0;
  }

  .title-block h1 {
    font-size: 24px;
  }

  .poster-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 12px;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: 28px 28px 0;
  }

  .detail-content {
    width: 100%;
    padding: 34px 20px;
  }
}
