:root {
  --bg: #faf8ff;
  --surface: #ffffff;
  --text: #2f2340;
  --purple: #6e2baf;
  --line: #e8dcfa;
}
html[data-theme='dark'] {
  --bg: linear-gradient(120deg, #13081f, #1c1d48 55%, #10263f);
  --surface: #1b1530;
  --text: #f0ecff;
  --purple: #9a5cff;
  --line: #40345f;
}
* { box-sizing: border-box; }
body { margin:0; font-family:Arial,sans-serif; color:var(--text); background:var(--bg); min-height:100vh; }
a { color: var(--purple); text-decoration: none; }
.top-nav { position: sticky; top:0; z-index:30; display:flex; justify-content:space-between; align-items:center; padding:12px 20px; background:var(--surface); border-bottom:1px solid var(--line); }
.logo-wrap { display:flex; align-items:center; gap:10px; font-weight:700; }
.logo { width:34px; height:34px; }
.menu-toggle { background:transparent; border:1px solid var(--line); border-radius:8px; padding:4px; width:38px; height:34px; display:flex; align-items:center; justify-content:center; }
.ham { width:18px; height:18px; }
.ham.dark { display:none; }
html[data-theme='dark'] .ham.light { display:none; }
html[data-theme='dark'] .ham.dark { display:block; }
.top-links { display:flex; gap:12px; }
.app-layout { display:flex; min-height:calc(100vh - 60px); }
.sidebar { width:260px; background:var(--surface); border-right:1px solid var(--line); padding:16px; display:flex; flex-direction:column; gap:8px; position:sticky; top:60px; height:calc(100vh - 60px); overflow:auto; transition: all .25s ease; }
.sidebar.collapsed { width:0; padding:0; overflow:hidden; border-right:none; }
.sidebar a { padding:10px; border-radius:10px; transition:.22s ease; }
.sidebar a:hover { transform:translateX(5px); background:rgba(130,90,210,.18); }
.upload-link { background:var(--purple); color:#fff; }
.content { flex:1; padding:20px; }
.hero { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.welcome-card { display:flex; align-items:center; gap:12px; margin-bottom:16px; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:10px; }
.pfp-right { flex-direction: row-reverse; justify-content: flex-end; }
.pfp { width:52px; height:52px; border-radius:50%; object-fit:cover; }
.search-form,.auth-form { display:flex; gap:8px; flex-wrap:wrap; }
.auth-form { flex-direction:column; }
input,select,button,textarea { border:1px solid var(--line); padding:10px; border-radius:10px; }
button,.btn { background:var(--purple); color:#fff; border:none; cursor:pointer; }
.btn { padding:8px 12px; border-radius:9px; display:inline-block; }
.btn.small { padding:6px 10px; font-size:12px; }
.btn.danger { background:#d43737; }
.cards-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:16px; }
.material-card { background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; animation:fadeUp .45s ease; transition:.22s ease; }
.material-card:hover { transform:translateY(-4px); box-shadow:0 12px 30px rgba(93,61,157,.25); }
.material-card img { width:100%; height:150px; object-fit:cover; }
.material-card.square-preview img { object-fit:contain; height:160px; background:#120f23; }
.no-image-thumb { height:150px; background:transparent; border-bottom:1px dashed var(--line); }
html[data-theme='dark'] .no-image-thumb { background:linear-gradient(90deg, rgba(50,30,90,.28), rgba(22,55,88,.28)); }
.card-body { padding:12px; }
.card-actions { display:flex; gap:8px; margin-top:8px; align-items:center; }
.comments-box { margin-top:10px; border-top:1px solid var(--line); padding-top:8px; }
.comment { border-left:2px solid var(--line); margin:8px 0; padding-left:8px; }
.comment-actions { display:flex; gap:6px; flex-wrap:wrap; }
.comment-new { display:flex; gap:8px; margin-bottom:8px; }
.form-wrap,.viewer-wrap { max-width:900px; background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:18px; }
.text-viewer { background:rgba(130,90,210,.08); border-radius:10px; padding:12px; white-space:pre-wrap; }
.flash { padding:10px; border-radius:8px; margin:8px 0; }
.flash.success { background:#ddf6e1; color:#124b24; }
.flash.error { background:#ffe1e1; color:#731e1e; }
.yt-layout { display:grid; grid-template-columns: 2fr 1fr; gap:16px; }
.yt-player iframe,.yt-player video { width:100%; min-height:380px; border:0; border-radius:12px; background:#000; }
.yt-side { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:10px; }
.yt-item { display:flex; gap:8px; padding:8px; border-radius:8px; }
.yt-item:hover { background:rgba(130,90,210,.15); }
.yt-thumb { width:90px; height:54px; background:#20143a; color:#fff; display:flex; align-items:center; justify-content:center; border-radius:6px; }
.yt-thumb-img { width:90px; height:54px; object-fit:cover; border-radius:6px; }
@keyframes fadeUp { from {opacity:0; transform:translateY(10px);} to {opacity:1; transform:translateY(0);} }
/* Like / dislike horizontal alignment */
.yt-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.async-material-react {
  display: inline-flex;
}

.async-material-react button {
  display: flex;
  align-items: center;
  gap: 6px;
}
@media (max-width: 900px) {
  .app-layout { flex-direction:column; }
  .sidebar { position:relative; top:0; width:100%; height:auto; display:none; }
  .sidebar.open { display:flex; }
  .sidebar.collapsed { width:100%; }
  .top-links { gap:8px; font-size:14px; }
  .content { padding:12px; }
  .cards-grid { grid-template-columns:1fr; }
  .yt-layout { grid-template-columns:1fr; }
}
