:root {
  --bg: #050505; --panel: #0a0a0a; --card: #0e0e0e; --line: #222; --line2: #2a2a2a;
  --text: #e0e0e0; --muted: #777; --danger: #ff4444; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); margin: 0; padding: 0; overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: #fff; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.fade-in { animation: fadeIn .4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

button { cursor: pointer; border: none; font-weight: 600; transition: .2s; border-radius: 6px; font-family: inherit;
  letter-spacing: .5px; font-size: 12px; padding: 10px 16px; }
button:hover { opacity: .85; }
button:disabled { opacity: .4; cursor: default; }
.btn-white { background: #fff; color: #000; }
.btn-ghost { background: transparent; color: #ddd; border: 1px solid #333; }
.btn-ghost:hover { border-color: #fff; color: #fff; opacity: 1; }
.danger { color: var(--danger) !important; border-color: #4a1a1a !important; }
.danger:hover { border-color: var(--danger) !important; }
.full { width: 100%; margin-top: 8px; }
.link { background: none; color: var(--muted); padding: 0; font-weight: 400; }

input { width: 100%; padding: 12px; margin: 8px 0; background: #111; border: 1px solid #333; color: #fff;
  border-radius: 6px; font-size: 14px; font-family: inherit; }
input:focus { outline: none; border-color: #666; }

/* Login (same look as Kammii) */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 320px; padding: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.login-box h2 { margin: 0 0 18px; font-weight: 300; letter-spacing: 2px; }
.btn-login { width: 100%; padding: 12px; background: #fff; color: #000; margin-top: 10px; font-size: 13px; }
.error { color: var(--danger); font-size: 12px; min-height: 14px; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 32px;
  border-bottom: 1px solid #141414; position: sticky; top: 0; background: rgba(5,5,5,.92); backdrop-filter: blur(6px); z-index: 20; }
.title { margin: 0; font-weight: 300; letter-spacing: 4px; font-size: 22px; }
.user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #bbb; }
.user span { font-weight: 600; color: #fff; }

.breadcrumb { padding: 16px 32px 0; font-size: 13px; color: var(--muted); }
.breadcrumb a { color: #aaa; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .sep { margin: 0 8px; color: #444; }
.breadcrumb .current { color: #fff; }

main { padding: 20px 32px 120px; }
.empty { color: var(--muted); text-align: center; margin-top: 80px; }

/* Grids */
.grid { display: grid; gap: 18px; }
.grid.albums { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.files { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }

.album-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: .2s; display: flex; flex-direction: column; }
.album-card:hover { border-color: #555; transform: translateY(-2px); }
.album-cover { aspect-ratio: 4 / 5; background: #111; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.album-cover img, .album-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover .folder { width: 64px; height: 64px; opacity: .35; }
.album-info { padding: 12px 14px 12px; }
.album-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.album-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }

.file-tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; transition: .15s; position: relative; }
.file-tile:hover { border-color: #555; }
.file-tile.selected { border-color: #fff; box-shadow: 0 0 0 1px #fff; }
.file-thumb { aspect-ratio: 1 / 1; background: #111; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.file-thumb img, .file-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-name { padding: 8px 10px; font-size: 12px; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; padding: 3px 6px; border-radius: 4px; letter-spacing: .5px; }
.badge.cover { left: auto; right: 8px; }

/* Album header */
.album-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.album-head h2 { margin: 0 0 4px; font-size: 22px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone { border: 1px dashed #2c2c2c; border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.drag-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); border: 2px dashed #fff; z-index: 60; display: flex;
  align-items: center; justify-content: center; font-size: 20px; letter-spacing: 1px; pointer-events: none; }

/* FAB */
.fab { position: fixed; right: 28px; bottom: 28px; width: 58px; height: 58px; border-radius: 50%; background: #fff; color: #000;
  font-size: 32px; font-weight: 300; line-height: 1; padding: 0; box-shadow: 0 6px 24px rgba(0,0,0,.6); z-index: 30; }

/* Side panel */
.panel { position: fixed; top: 0; right: 0; width: 360px; max-width: 100vw; height: 100vh; background: var(--panel); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .25s ease; z-index: 40; overflow-y: auto; }
.panel.open { transform: none; }
.panel-close { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 20px; width: 34px; height: 34px; padding: 0; border-radius: 50%; z-index: 2; }
.panel-preview { background: #000; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.panel-preview img, .panel-preview video { max-width: 100%; max-height: 50vh; display: block; }
.panel-body { padding: 18px 20px 28px; }
.panel-name { font-weight: 700; word-break: break-all; margin-bottom: 12px; }
.meta { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 13px; margin: 0 0 16px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.url { font-size: 12px; color: #bbb; }

/* Uploads */
.uploads { position: fixed; left: 24px; bottom: 24px; width: 340px; max-height: 50vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: var(--radius); padding: 12px 14px; z-index: 35; font-size: 12px; }
.uploads-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
.up-item { margin: 8px 0; }
.up-row { display: flex; justify-content: space-between; gap: 8px; }
.up-row span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; background: #222; border-radius: 2px; margin-top: 4px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: #fff; transition: width .15s; }
.up-item.err .bar > div { background: var(--danger); }
.up-item.err .up-row span:last-child { color: var(--danger); }

/* Modal + toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 70; }
.modal-box { width: 380px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.modal-box h3 { margin: 0 0 8px; font-weight: 400; letter-spacing: 1px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: #fff; color: #000; padding: 10px 18px;
  border-radius: 6px; font-size: 13px; font-weight: 600; z-index: 80; }

@media (max-width: 640px) {
  .topbar, .breadcrumb, main { padding-left: 16px; padding-right: 16px; }
  .grid.albums { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .grid.files { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .title { font-size: 18px; letter-spacing: 3px; }
  .uploads { left: 12px; right: 12px; width: auto; }
}

/* keep the grid visible next to the side panel on wide screens */
@media (min-width: 900px) { body.panel-open main { padding-right: 392px; } body.panel-open .fab { right: 388px; } }
