:root {
  --brand: #ff5a5f;
  --brand-soft: #ffe4d8;
  --bg: #fff7f2;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #e9e9ef;
}

html[data-theme='dark'] {
  --bg: #0f141b;
  --card: #151c26;
  --text: #e4e7ec;
  --muted: #98a2b3;
  --line: #2a3342;
  --brand-soft: #3a1f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 650px at 20% -20%, #ffd5be, transparent 58%),
    radial-gradient(800px 500px at 120% 15%, #ffdbe5, transparent 60%),
    var(--bg);
}

html[data-theme='dark'] body {
  background:
    radial-gradient(1200px 650px at 20% -20%, #2a1c1b, transparent 58%),
    radial-gradient(800px 500px at 120% 15%, #231827, transparent 60%),
    var(--bg);
}

.app-shell {
  width: 100%;
  max-width: min(100vw, 640px);
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 94px;
}

.app-shell.no-nav {
  padding-bottom: 0;
}

.glass {
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(12px);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #ff9a60);
}

.brand-logo {
  height: 34px;
  border-radius: 10px;
}

.search-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  width: 150px;
  height: 36px;
  border: 1px solid #efeff5;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

html[data-theme='dark'] .search-input {
  background: #111827;
  border-color: #263041;
}

.section {
  padding: 12px clamp(12px, 3.8vw, 20px);
}

.section-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.poster-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.poster-row::-webkit-scrollbar,
.vertical-player::-webkit-scrollbar {
  display: none;
}

.poster-card {
  min-width: 126px;
  width: 126px;
  border-radius: 16px;
  overflow: hidden;
  scroll-snap-align: center;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

.poster-card.wide {
  min-width: 154px;
  width: 154px;
}

.poster-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #f2f4f7;
}

.poster-card .meta {
  padding: 8px;
  font-size: 12px;
}

.poster-card .meta strong {
  display: block;
  line-height: 1.35;
}

.inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border-radius: 999px;
  padding: 7px 12px;
  background: #f3f4f6;
  font-size: 12px;
  color: var(--text);
  border: 1px solid transparent;
}

html[data-theme='dark'] .chip {
  background: #1b2431;
  border-color: #2a3444;
}

.chip.active {
  background: var(--brand-soft);
  color: #7a2c00;
}

.disclaimer {
  font-size: 12px;
  color: #5f6373;
  line-height: 1.56;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  width: calc(100% - 18px);
  max-width: 640px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.12);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 7px;
  z-index: 40;
}

.bottom-nav a {
  text-decoration: none;
  color: #404858;
  border-radius: 12px;
  font-size: 11px;
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.bottom-nav a i {
  font-size: 16px;
}

.bottom-nav a.active {
  color: #fff;
  background: linear-gradient(130deg, var(--brand), #ff9a60);
}

.floating-chat {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(100px + env(safe-area-inset-bottom));
  z-index: 39;
}

.floating-theme {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: calc(100px + env(safe-area-inset-bottom));
  z-index: 39;
}

.floating-theme button {
  border: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(140deg, #334155, #0f172a);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
}

body.no-bottom-nav .floating-theme {
  bottom: calc(18px + env(safe-area-inset-bottom));
}

@media (max-width: 420px) {
  .search-input {
    width: 122px;
  }

  .bottom-nav a {
    font-size: 10px;
    padding: 7px 2px;
  }
}

.floating-chat button {
  border: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), #ff9a60);
  box-shadow: 0 12px 28px rgba(255, 90, 95, 0.34);
}

.vertical-player {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  background: #000;
}

.player-back-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 70;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  text-decoration: none;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.player-back-btn i {
  font-size: 20px;
  line-height: 1;
}

.episode-slide {
  position: relative;
  height: 100vh;
  scroll-snap-align: start;
}

.episode-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.episode-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent 74%);
}

.episode-actions {
  position: absolute;
  right: 12px;
  bottom: 110px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.episode-actions button {
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
}

.player-status {
  position: absolute;
  top: 14px;
  left: 12px;
  right: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.45);
  display: none;
}

.player-status.show {
  display: block;
}

.player-empty {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  color: #fff;
  background: #050505;
}

.info-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 12px rgba(16, 24, 40, 0.07);
}

.vip-plan {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--card);
}

.vip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.team-grid {
  display: grid;
  gap: 10px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.06);
}

.history-item img {
  width: 64px;
  height: 84px;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f3f9;
}

.empty-state {
  text-align: center;
  color: #667085;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 20px;
  background: var(--card);
}

.admin-shell {
  min-height: 100vh;
  background: #f8fafc;
}

.admin-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: #111827;
  color: #fff;
  padding: 20px;
}

.admin-sidebar a {
  color: #d1d5db;
  text-decoration: none;
  display: block;
  padding: 10px;
  border-radius: 10px;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-content {
  padding: 20px;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.07);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
}

.form-control {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(130deg, var(--brand), #ff9a60);
  color: #fff;
}

.btn-secondary {
  background: #d9dde5;
  color: #111827;
}

html[data-theme='dark'] .btn-secondary {
  background: #283344;
  color: #e5e7eb;
}

.flash {
  margin: 10px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
  }
}
