:root{
  --bg:#101010;
  --panel:#181818;
  --panel2:#1f1f1f;
  --accent:#4285F4;
  --text:#ffffff;
  --muted:#d3d3d3;
  --danger:#ff4d4d;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

/* When launched from iOS Home Screen, hide the marketing header for an app feel */
body.standalone .site-header,
body.standalone .site-footer {
  display: none;
}

.watch-shell{
  background: var(--bg);
  color: var(--text);
  min-height: calc(100vh - 80px);
}

body.standalone .watch-shell{
  min-height: 100vh;
}

.watch-appbar{
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(24,24,24,0.92);
  backdrop-filter: blur(10px);
  padding: calc(10px + var(--safe-top)) 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.watch-appbar-inner{
  display:flex;
  align-items:center;
  gap:10px;
}

.watch-brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.watch-brand img{
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.watch-title{
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .2px;
}

.watch-subtitle{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.watch-grow{ flex: 1; }

.watch-search{
  display:flex;
  align-items:center;
  gap:8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 480px;
  flex: 1;
}

.watch-search input{
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  width: 100%;
  font-size: 14px;
}

.watch-tabs{
  display:flex;
  gap:8px;
  margin-top: 10px;
}

.watch-tab{
  flex: 1;
  text-align:center;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  user-select:none;
}

.watch-tab.active{
  background: rgba(66,133,244,0.18);
  border-color: rgba(66,133,244,0.35);
  color: #fff;
}

.watch-main{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: calc(100vh - 140px);
}

body.standalone .watch-main{
  min-height: calc(100vh - 118px);
}

.watch-sidebar{
  border-right: 1px solid rgba(255,255,255,0.08);
  background: var(--bg);
  padding: 12px;
  overflow:auto;
}

.watch-sidebar h3{
  margin: 4px 0 10px;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: .3px;
}

.watch-cat{
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--muted);
  border: 1px solid transparent;
}

.watch-cat:hover{ background: rgba(255,255,255,0.04); }

.watch-cat.active{
  background: rgba(66,133,244,0.14);
  border-color: rgba(66,133,244,0.35);
  color: #fff;
}

.watch-content{
  padding: 14px;
  overflow:auto;
}

.watch-meta{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.watch-meta .chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 12px;
}

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

.watch-card{
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow:hidden;
  cursor:pointer;
  position:relative;
}

.watch-thumb{
  width:100%;
  height: 90px;
  background: #0c0c0c;
  display:flex;
  align-items:center;
  justify-content:center;
}

.watch-thumb img{
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.watch-card .title{
  padding: 10px 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}

.watch-card .sub{
  padding: 0 10px 12px;
  margin-top: -8px;
  color: var(--muted);
  font-size: 12px;
}

.fav-btn{
  position:absolute;
  top:8px;
  right:8px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 16px;
}

.fav-btn.active{
  border-color: rgba(66,133,244,0.55);
  background: rgba(66,133,244,0.25);
}

/* Player modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display:none;
  z-index: 9999;
  padding: calc(14px + var(--safe-top)) 14px calc(14px + var(--safe-bottom));
}

.modal.show{ display:block; }

.modal-inner{
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  overflow:hidden;
  max-width: 980px;
  margin: 0 auto;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.modal-header .name{
  font-weight: 900;
  font-size: 14px;
}

.modal-header button{
  border: none;
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor:pointer;
}

.video-wrap{
  background: #000;
}

.video-wrap video{
  width: 100%;
  height: auto;
  max-height: 70vh;
  background: #000;
}

/* Settings */
.settings{
  max-width: 520px;
  margin: 0 auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
}

.settings h2{
  margin: 0 0 10px;
  font-size: 18px;
}

.field{ margin: 10px 0; }
.field label{ display:block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.field input{
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  outline:none;
}

.actions{ display:flex; gap:10px; margin-top: 12px; }

.btn{
  flex: 1;
  border:none;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 900;
  cursor:pointer;
}

.btn.primary{ background: var(--accent); color:#fff; }
.btn.ghost{ background: rgba(255,255,255,0.08); color:#fff; }

.note{
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 900px){
  .watch-main{ grid-template-columns: 1fr; }
  .watch-sidebar{ border-right:none; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .watch-grid{ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
