* { box-sizing: border-box; }
:root {
  --bg: #0f1117;
  --panel: #171b25;
  --panel2: #202636;
  --text: #f5f7fb;
  --muted: #aab1c2;
  --accent: #ff8a00;
  --border: rgba(255,255,255,.09);
  --danger: #ff4d4f;
}
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, textarea { font-family: inherit; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 24px; background: rgba(15,17,23,.88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.logout, .back { display: inline-flex; align-items: center; justify-content: center; background: var(--panel2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 12px; color: var(--text); }
.logout:hover, .back:hover { background: #2a3246; }
.container { width: min(1280px, 100%); margin: 0 auto; padding: 24px; }
.section { margin-top: 22px; }
.section h2 { font-size: 18px; margin: 0 0 14px; }
.folder-grid, .media-grid { display: grid; gap: 16px; }
.folder-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.media-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.folder-card, .media-card { border: 1px solid var(--border); background: var(--panel); border-radius: 18px; overflow: hidden; color: var(--text); transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.folder-card:hover, .media-card:hover { transform: translateY(-2px); border-color: rgba(255,138,0,.5); background: #1d2331; }
.folder-card { padding: 20px; display: flex; align-items: center; gap: 12px; }
.folder-icon { font-size: 28px; }
.media-card { padding: 0; cursor: pointer; text-align: left; width: 100%; }
.thumb { position: relative; width: 100%; aspect-ratio: 1 / 1; background: #0a0c11; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-badge { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 999px; background: rgba(0,0,0,.62); display: flex; align-items: center; justify-content: center; font-size: 22px; padding-left: 3px; border: 1px solid rgba(255,255,255,.25); }
.media-info { padding: 12px; }
.media-info strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-info small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.empty { border: 1px dashed var(--border); border-radius: 18px; padding: 28px; color: var(--muted); background: rgba(255,255,255,.025); line-height: 1.5; }
.modal { position: fixed; inset: 0; z-index: 99; background: rgba(0,0,0,.82); display: none; padding: 18px; }
.modal.show { display: flex; align-items: center; justify-content: center; }
.modal-panel { width: min(1100px, 100%); max-height: 94vh; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.modal-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.modal-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-head button { background: var(--accent); border: 0; color: #111; font-weight: 700; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.modal-body { padding: 0; display: flex; align-items: center; justify-content: center; background: #050609; overflow: auto; }
.viewer-image, .viewer-video { max-width: 100%; max-height: calc(94vh - 58px); display: block; }
.viewer-video { width: 100%; background: #000; }
.no-scroll { overflow: hidden; }
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at top, #283149, #0f1117 55%); }
.login-card { width: min(420px, 100%); background: rgba(23,27,37,.96); border: 1px solid var(--border); border-radius: 22px; padding: 28px; box-shadow: 0 20px 70px rgba(0,0,0,.35); }
.login-card.wide { width: min(720px, 100%); }
.login-icon { width: 58px; height: 58px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--panel2); font-size: 28px; margin-bottom: 14px; }
.login-card h1 { margin: 0 0 8px; font-size: 26px; }
.login-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.45; }
label { display: block; margin: 14px 0 7px; color: var(--muted); font-size: 14px; }
input, textarea { width: 100%; border: 1px solid var(--border); background: #0e1118; color: var(--text); padding: 12px; border-radius: 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
form button { width: 100%; margin-top: 18px; border: 0; background: var(--accent); color: #111; font-weight: 800; padding: 13px; border-radius: 12px; cursor: pointer; }
.alert { background: rgba(255,77,79,.12); border: 1px solid rgba(255,77,79,.35); color: #ffb6b8; padding: 12px; border-radius: 12px; margin: 14px 0; }
.note { margin-top: 12px !important; font-size: 13px; }
@media (max-width: 600px) {
  .topbar { padding: 14px; align-items: flex-start; }
  .topbar h1 { font-size: 18px; }
  .container { padding: 16px; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .folder-grid { grid-template-columns: 1fr; }
  .media-info { padding: 10px; }
  .media-info strong { font-size: 13px; }
  .modal { padding: 8px; }
  .modal-panel { border-radius: 14px; }
}

/* Modo video ligero */
.video-start-box{width:100%;display:flex;flex-direction:column;gap:14px;align-items:center;justify-content:center}.video-start-message{text-align:center;opacity:.9;line-height:1.45}.video-start-message span{opacity:.72}.video-start-button{border:0;border-radius:999px;padding:12px 22px;font-weight:800;cursor:pointer;background:#fff;color:#111}.video-start-box .viewer-video{width:100%;max-height:75vh;background:#000;border-radius:14px}