*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #080a0e; --surface: #10141c; --surface2: #171d28;
  --border: rgba(255,255,255,0.07); --accent: #e8c84a; --accent2: #c8a830;
  --text: #e8eaf0; --muted: #6b7280; --danger: #e85454;
  --radius: 12px; --font-head: 'Bebas Neue', sans-serif; --font-body: 'DM Sans', sans-serif;
}
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; overflow: hidden; }
.screen { position: fixed; inset: 0; opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }
.screen.active { opacity: 1; pointer-events: all; }
#browser-screen { overflow-y: auto; padding-bottom: 100px; }
.hidden { display: none !important; }

/* LOGIN */
.login-bg { position: absolute; inset: 0; background: radial-gradient(ellipse 80% 60% at 50% 30%, #1a2340 0%, transparent 70%), radial-gradient(ellipse 60% 40% at 80% 80%, #0d1a2a 0%, transparent 60%), var(--bg); }
.grain { position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"); background-size: 200px; opacity: 0.5; pointer-events: none; }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 40%, rgba(0,0,0,0.7) 100%); pointer-events: none; }
.login-box { position: relative; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; gap: 0.5rem; }
.login-logo { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.25rem; }
.logo-icon { font-size: 1.6rem; color: var(--accent); filter: drop-shadow(0 0 12px var(--accent)); }
.logo-text { font-family: var(--font-head); font-size: 2.8rem; letter-spacing: 0.12em; }
.login-sub { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2.5rem; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 0.75rem; }
.input-wrap input { width: 100%; padding: 0.875rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: var(--font-body); font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,200,74,0.12); }
.input-wrap input::placeholder { color: var(--muted); }
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.875rem 1.5rem; background: var(--accent); color: #0a0c10; border: none; border-radius: var(--radius); font-family: var(--font-head); font-size: 1.15rem; letter-spacing: 0.08em; cursor: pointer; transition: background 0.2s, transform 0.15s; }
.btn-primary svg { width: 18px; height: 18px; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.error-msg { color: var(--danger); font-size: 0.85rem; text-align: center; }

/* NAVBAR */
.navbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem; padding: 0.85rem 2rem; background: rgba(8,10,14,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-logo { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.nav-logo .logo-text { font-size: 1.5rem; }
.nav-logo .logo-icon { font-size: 1rem; }
.breadcrumb { flex: 1; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.85rem; }
.breadcrumb .crumb { cursor: pointer; color: var(--muted); transition: color 0.2s; }
.breadcrumb .crumb:hover { color: var(--accent); }
.breadcrumb .crumb.active { color: var(--text); pointer-events: none; }
.breadcrumb .sep { color: var(--border); user-select: none; }
.btn-ghost { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.9rem; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-family: var(--font-body); font-size: 0.85rem; cursor: pointer; transition: border-color 0.2s, color 0.2s; flex-shrink: 0; }
.btn-ghost svg { width: 16px; height: 16px; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* BROWSER */
.browser-main { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.loader { display: flex; justify-content: center; padding: 4rem; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.section { margin-bottom: 2.5rem; }
.section-title { font-family: var(--font-head); font-size: 1.4rem; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; text-transform: uppercase; }

/* FOLDERS */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.folder-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color 0.2s, transform 0.2s, background 0.2s; }
.folder-card:hover { border-color: var(--accent); background: var(--surface2); transform: translateY(-2px); }
.folder-card .f-icon { font-size: 1.6rem; }
.folder-card .f-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-card .f-count { font-size: 0.78rem; color: var(--muted); }

/* VIDEOS */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.video-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color 0.25s, transform 0.25s; }
.video-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.video-thumb { position: relative; aspect-ratio: 16/9; background: var(--surface2); display: flex; align-items: center; justify-content: center; }
.thumb-play { width: 48px; height: 48px; background: rgba(232,200,74,0.15); border: 2px solid var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--accent); transition: background 0.2s, transform 0.2s; }
.video-card:hover .thumb-play { background: var(--accent); color: #0a0c10; transform: scale(1.1); }
.video-ext-badge { position: absolute; top: 8px; right: 8px; padding: 2px 7px; background: rgba(0,0,0,0.7); border-radius: 4px; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.05em; color: var(--accent); text-transform: uppercase; }
.video-info { padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.video-name { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-meta { font-size: 0.75rem; color: var(--muted); }
.empty-state { text-align: center; padding: 5rem 2rem; color: var(--muted); }

/* AUDIO LIST */
.audio-list { display: flex; flex-direction: column; gap: 0.3rem; }
.audio-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.audio-row:hover { border-color: rgba(232,200,74,0.4); background: var(--surface2); }
.audio-row.playing { border-color: var(--accent); background: var(--surface2); }
.audio-row.playing .audio-row-num { color: var(--accent); }
.audio-row-num { font-size: 0.78rem; color: var(--muted); width: 24px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.audio-row-info { flex: 1; min-width: 0; }
.audio-row-name { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-row.playing .audio-row-name { color: var(--accent); }
.audio-row-meta { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
.audio-row-btn { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; cursor: pointer; flex-shrink: 0; transition: all 0.2s; }
.audio-row:hover .audio-row-btn { border-color: var(--accent); color: var(--accent); }

/* VIDEO PLAYER */
#player-screen { background: #000; display: flex; }
.player-wrap { display: flex; flex-direction: column; width: 100%; min-height: 100vh; }
.player-top { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1.25rem; background: rgba(8,10,14,0.95); border-bottom: 1px solid var(--border); flex-shrink: 0; }
#player-title { flex: 1; font-family: var(--font-head); font-size: 1.2rem; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#video-el { width: 100%; flex: 1; background: #000; display: block; max-height: calc(100vh - 60px); }

/* STICKY AUDIO PLAYER */
.audio-player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: rgba(14, 18, 26, 0.98);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--accent);
  box-shadow: 0 -4px 30px rgba(0,0,0,0.6);
}
.ap-info { display: flex; align-items: center; gap: 0.6rem; flex: 0 0 240px; min-width: 0; }
.ap-icon { font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }
.ap-text { min-width: 0; }
.ap-title { display: block; font-size: 0.82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-counter { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
.ap-controls { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
#audio-el { flex: 1; height: 34px; accent-color: var(--accent); min-width: 0; }
.ap-btn {
  background: none; border: 1px solid var(--border);
  color: var(--muted); font-size: 1rem;
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.ap-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ap-btn:disabled { opacity: 0.3; cursor: default; }
.ap-close { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: color 0.2s; flex-shrink: 0; }
.ap-close:hover { color: var(--danger); }

@media (max-width: 600px) {
  .browser-main { padding: 1rem; }
  .navbar { padding: 0.75rem 1rem; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .ap-info { flex: 0 0 140px; }
}
