/* Album Library - dark, modern, mobile-first. Tested down to 360px width. */

:root {
  --bg: #0b0d12;
  --bg-2: #12151d;
  --bg-3: #1a1e29;
  --line: #262b38;
  --text: #e7eaf3;
  --muted: #98a0b3;
  --accent: #6d8cff;
  --accent-2: #22c58b;
  --danger: #ff5c72;
  --warn: #ffb020;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --max: 1140px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
small { color: var(--muted); }
code { background: var(--bg-3); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hide { display: none !important; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 13, 18, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { display: flex; align-items: center; gap: 10px; height: 56px; }
.brand { font-weight: 700; color: var(--text); font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: var(--muted); padding: 7px 10px; border-radius: 9px; font-size: .92rem; white-space: nowrap;
}
.nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--bg-3); }
.nav .badge {
  background: var(--danger); color: #fff; border-radius: 999px; font-size: .68rem;
  padding: 1px 6px; margin-left: 4px; vertical-align: middle;
}
.header-search { flex: 1 1 auto; min-width: 0; display: none; }
.header-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.menu-btn {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; width: 38px; height: 38px; font-size: 1.05rem; cursor: pointer;
}
@media (min-width: 860px) {
  .header-search { display: block; }
  .menu-btn { display: none; }
}
@media (max-width: 859px) {
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 56px;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 8px; gap: 2px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; font-size: 1rem; }
}

/* ---------- controls ---------- */
input, select, textarea {
  width: 100%; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: .88rem; color: var(--muted); margin: 12px 0 6px; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; transform: scale(1.15); margin-right: 8px; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row > * { flex: 1 1 180px; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent); color: #08101f; border: none; border-radius: 10px;
  padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--accent-2); color: #06231a; }
.btn.sm { padding: 7px 11px; min-height: 34px; font-size: .88rem; font-weight: 500; }
.btn.block { width: 100%; }

/* ---------- cards / layout ---------- */
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (min-width: 760px) { .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; } }

.video-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video-card .thumb {
  position: relative; aspect-ratio: 16 / 9; background: #05070c;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.video-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-card .thumb .ph { color: #333a4b; font-size: 1.6rem; }
.video-card .body { padding: 9px 10px 11px; }
.video-card .title {
  font-size: .92rem; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.video-card .meta { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.video-card a { color: inherit; }
.video-card a:hover { text-decoration: none; }

.album-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: block; color: var(--text);
}
.album-card:hover { border-color: var(--accent); text-decoration: none; }
.album-card .name { font-weight: 650; word-break: break-word; }
.album-card .type {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 999px;
}

.pill {
  display: inline-block; font-size: .74rem; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
}
.pill.ok { color: var(--accent-2); border-color: rgba(34, 197, 139, .4); }
.pill.warn { color: var(--warn); border-color: rgba(255, 176, 32, .4); }
.pill.danger { color: var(--danger); border-color: rgba(255, 92, 114, .4); }
.pill.accent { color: var(--accent); border-color: rgba(109, 140, 255, .45); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: var(--bg-3); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }

/* ---------- states ---------- */
.state { padding: 40px 16px; text-align: center; color: var(--muted); }
.state .big { font-size: 2.2rem; margin-bottom: 8px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert { border-radius: 10px; padding: 11px 13px; font-size: .92rem; margin: 10px 0; border: 1px solid; }
.alert.error { background: rgba(255, 92, 114, .1); border-color: rgba(255, 92, 114, .4); color: #ffb9c3; }
.alert.success { background: rgba(34, 197, 139, .1); border-color: rgba(34, 197, 139, .4); color: #a6f0d3; }
.alert.info { background: rgba(109, 140, 255, .1); border-color: rgba(109, 140, 255, .35); color: #c3d0ff; }
.alert.warn { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .4); color: #ffd999; }

/* ---------- modal / toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  width: 100%; max-width: 520px; max-height: 86vh; overflow: auto; padding: 18px;
  box-shadow: var(--shadow);
}
.modal h3 { margin-top: 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

#toasts { position: fixed; left: 12px; right: 12px; bottom: 14px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-3); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  padding: 11px 13px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--accent-2); }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 18px 0; flex-wrap: wrap; }

/* ---------- upload manager ---------- */
.upload-item {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; margin-bottom: 10px;
}
.upload-item .name { font-size: .92rem; word-break: break-all; }
.progress { height: 7px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.upload-item.done .progress > i { background: var(--accent-2); }
.upload-item.failed .progress > i { background: var(--danger); }

/* ---------- player ---------- */
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- rules corner button ---------- */
#rules-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 50;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 15px; font: inherit; font-size: .86rem; cursor: pointer;
  box-shadow: var(--shadow);
}

/* ---------- maintenance ---------- */
#maintenance {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px;
}

/* ---------- steps / tabs ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.tabs button {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
  padding: 9px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .9rem; white-space: nowrap;
}
.tabs button.active { background: var(--accent); color: #08101f; border-color: var(--accent); font-weight: 600; }

.kbd { background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .85em; }
.notice-item { border-left: 3px solid var(--accent); padding-left: 12px; margin-bottom: 14px; }
.notice-item.pinned { border-left-color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; }
.copyable { display: flex; gap: 8px; align-items: center; }
.copyable input { font-family: ui-monospace, monospace; }

footer.site-footer {
  border-top: 1px solid var(--line); color: var(--muted);
  padding: 22px 0 34px; margin-top: 30px; font-size: .85rem;
}
footer.site-footer a { color: var(--muted); }

::selection { background: rgba(109, 140, 255, .35); }