﻿:root {
  --bg: #0b1020;
  --panel: #131a2e;
  --panel-2: #18213a;
  --line: #26314d;
  --text: #edf3ff;
  --muted: #94a3c4;
  --accent: #62e6a7;
  --accent-2: #4aa8ff;
  --danger: #ff6b7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 22px; margin-top: 12px; }

.login-shell {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at 20% 20%, #17365e 0, transparent 35%), radial-gradient(circle at 80% 70%, #1d5f52 0, transparent 40%), var(--bg);
}
.login-card {
  width: min(420px, calc(100vw - 32px)); padding: 34px; border: 1px solid var(--line);
  border-radius: 22px; background: rgba(19,26,46,.94); box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.login-card h1 { margin: 16px 0 4px; font-size: 26px; }
.login-card label { display: block; margin-top: 18px; color: var(--muted); }
.login-card input { width: 100%; margin-top: 8px; padding: 12px 14px; color: var(--text); background: #0d1427; border: 1px solid var(--line); border-radius: 12px; outline: none; }
.login-card input:focus { border-color: var(--accent-2); }
.primary { width: 100%; margin-top: 22px; padding: 12px; border: 0; border-radius: 12px; color: #06121b; font-weight: 700; background: linear-gradient(135deg, var(--accent), #9af2c5); cursor: pointer; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; font-weight: 800; color: #06121b; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.brand-mark.small { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; grid-template-rows: 64px 1fr; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(11,16,32,.92); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 230px; }
.search-box { flex: 1; display: flex; max-width: 760px; }
.search-box input { flex: 1; padding: 10px 14px; color: var(--text); background: #0d1427; border: 1px solid var(--line); border-radius: 11px 0 0 11px; outline: none; }
.search-box button { padding: 0 18px; border: 0; border-radius: 0 11px 11px 0; color: #06121b; background: var(--accent); cursor: pointer; }
.ghost { padding: 9px 13px; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.ghost:hover { border-color: var(--accent-2); }
.sidebar { padding: 18px; border-right: 1px solid var(--line); background: #0e1528; overflow: auto; }
.sidebar-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 12px; }
.drive-list { display: grid; gap: 10px; }
.drive-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; }
.drive-card:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.drive-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(98,230,167,.3); }
.drive-name { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.drive-meta { margin-top: 8px; color: var(--muted); font-size: 12px; }
.usage { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #0a1020; }
.usage span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.sidebar-note { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.main { padding: 18px; overflow: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.breadcrumb { color: var(--muted); word-break: break-all; }
.breadcrumb span { cursor: pointer; color: var(--text); }
.filters { display: flex; gap: 8px; }
.filter { padding: 8px 12px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.filter.active { color: #06121b; background: var(--accent); border-color: var(--accent); }
.status-line { min-height: 24px; margin: 14px 0 8px; color: var(--muted); }
.content-list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 38px minmax(0,1fr) 110px 130px 90px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid transparent; border-radius: 12px; background: var(--panel); cursor: pointer; }
.item:hover { border-color: var(--line); background: var(--panel-2); }
.item-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #06121b; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-kind, .item-size, .item-date { color: var(--muted); font-size: 12px; }
.item-actions { display: none; gap: 6px; }
.item:hover .item-actions { display: flex; }
.item-actions button { padding: 6px 9px; color: var(--text); background: #0d1427; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(2,6,18,.82); }
.modal-card { width: min(1100px, 96vw); max-height: 92vh; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #11182b; box-shadow: 0 30px 100px rgba(0,0,0,.6); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-title { font-weight: 700; word-break: break-all; }
.player-body { display: grid; place-items: center; min-height: 240px; background: #050912; border-radius: 14px; overflow: hidden; }
.player-body video, .player-body audio, .player-body img { max-width: 100%; max-height: 70vh; display: block; }
.modal-actions { margin-top: 14px; }
.button-link { display: inline-block; padding: 9px 13px; color: #06121b; text-decoration: none; background: var(--accent); border-radius: 10px; font-weight: 700; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 80; max-width: 420px; padding: 12px 16px; color: var(--text); background: #17213a; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 50px rgba(0,0,0,.4); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .topbar { flex-wrap: wrap; padding: 12px; }
  .brand { min-width: 0; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .drive-list { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .item { grid-template-columns: 38px minmax(0,1fr) 80px; }
  .item-date, .item-actions { display: none; }
}

/* Captcha, registration, and admin */
.login-actions, .admin-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.link-button { padding: 0; color: var(--accent-2); background: transparent; border: 0; cursor: pointer; }
.captcha-wrap { position: relative; margin-top: 18px; padding-bottom: 0; }
.captcha-track { position: relative; height: 46px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, #15213b, #0d1427); }
.captcha-track:after { z-index: 1; content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px); background-size: 9px 9px; opacity: .45; }
.captcha-gap { z-index: 2; position: absolute; top: 6px; width: 34px; height: 34px; border-radius: 9px; background: #050912; box-shadow: inset 0 0 0 2px rgba(98,230,167,.5); }
.captcha-handle { z-index: 3; position: absolute; left: 0; top: 2px; bottom: auto; width: 34px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--panel-2); cursor: grab; user-select: none; touch-action: none; }
.captcha-handle.dragging { cursor: grabbing; border-color: var(--accent); }
.captcha-status { margin-top: 8px; color: var(--muted); font-size: 12px; }
.captcha-status.ok { color: var(--accent); }
.modal-card.small { width: min(420px, calc(100vw - 32px)); }
.modal-card.small label { display: block; margin-top: 14px; color: var(--muted); }
.modal-card.small input { width: 100%; margin-top: 8px; padding: 11px 13px; color: var(--text); background: #0d1427; border: 1px solid var(--line); border-radius: 11px; }
.primary.compact { width: auto; margin-top: 0; padding: 9px 16px; }
.admin-card { width: min(1100px, 96vw); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-section { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #0f172a; min-width: 0; }
.admin-section h3 { margin: 0 0 12px; }
.user-list { max-height: 460px; overflow: auto; display: grid; gap: 8px; margin-top: 12px; }
.user-row { display: grid; grid-template-columns: minmax(110px,1fr) auto auto auto auto auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #101a30; }
.user-row button { padding: 6px 8px; color: var(--text); background: #0b1324; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.user-name { overflow: hidden; text-overflow: ellipsis; }
.badge { padding: 3px 7px; border-radius: 999px; color: #06121b; background: var(--accent); font-size: 11px; }
.badge.user { color: var(--text); background: #31405f; }
.badge.disabled { color: var(--text); background: #713546; }
.scan-summary { margin-top: 14px; color: var(--muted); line-height: 1.8; }
.scan-path { margin-top: 10px; color: var(--muted); font-size: 12px; word-break: break-all; }
.progress { height: 8px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: #050912; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }




/* Slide-to-right captcha redesign */
.captcha-wrap { padding-bottom: 0; }
.captcha-track { position: relative; height: 48px; overflow: hidden; border-radius: 999px; background: #0b1224; border: 1px solid var(--line); }
.captcha-track:after { z-index: 0; }
.captcha-fill { position: absolute; z-index: 0; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(98,230,167,.18), rgba(74,168,255,.42)); }
.captcha-label { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--muted); font-size: 13px; }
.captcha-handle { z-index: 3; position: absolute; left: 3px; top: 3px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: var(--panel-2); box-shadow: 0 4px 14px rgba(0,0,0,.35); cursor: grab; user-select: none; touch-action: none; }
.captcha-handle.dragging { cursor: grabbing; border-color: var(--accent); background: #1b2b45; }
.captcha-status { margin-top: 8px; color: var(--muted); font-size: 12px; }
.captcha-status.ok { color: var(--accent); }

/* Image puzzle captcha */
.captcha-track { position: relative; height: 180px; overflow: hidden; border-radius: 14px; background: #050912; border: 1px solid var(--line); }
.captcha-track:after { display: none; }
.captcha-image { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.captcha-piece-image { position: absolute; z-index: 3; left: 0; display: block; cursor: grab; touch-action: none; user-select: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.45)); }
.captcha-piece-image.dragging { cursor: grabbing; filter: drop-shadow(0 0 10px rgba(98,230,167,.7)); }
.captcha-label { position: absolute; z-index: 2; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; text-shadow: 0 1px 4px #000; font-size: 12px; pointer-events: none; }
.captcha-fill, .captcha-handle, .captcha-gap { display: none !important; }
.captcha-wrap { padding-bottom: 0; }

/* Text click captcha */
.captcha-prompt { margin-bottom: 10px; color: var(--text); font-weight: 700; }
.captcha-options { display: flex; flex-wrap: wrap; gap: 8px; }
.captcha-option { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: #0d1427; font-size: 20px; cursor: pointer; }
.captcha-option:hover { border-color: var(--accent-2); }
.captcha-option.selected { color: #06121b; background: var(--accent); border-color: var(--accent); cursor: default; }
.captcha-option:disabled { opacity: .9; }
/* Numeric captcha */
.captcha-code { margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #0d1427; color: var(--accent); font-family: Consolas, "Courier New", monospace; font-size: 28px; font-weight: 700; letter-spacing: 10px; text-align: center; user-select: none; }
.captcha-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #0d1427; color: var(--text); font-family: Consolas, "Courier New", monospace; font-size: 18px; letter-spacing: 6px; text-align: center; }
.captcha-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98,230,167,.15); }
/* Scan progress animation */
.progress span.active { animation: scan-pulse 1.1s ease-in-out infinite; }
@keyframes scan-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
/* Mobile adaptation */
@media (max-width: 640px) {
  .login-card { padding: 24px 18px; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .brand { order: 1; }
  .topbar .ghost { order: 2; margin-left: auto; }
  .search-box { order: 3; flex-basis: 100%; max-width: none; }
  .sidebar { padding: 12px; }
  .drive-list { grid-template-columns: 1fr 1fr; }
  .main { padding: 12px; }
  .toolbar { align-items: flex-start; }
  .filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter { flex: 0 0 auto; white-space: nowrap; }
  .item { grid-template-columns: 38px minmax(0,1fr) auto; }
  .item-icon { grid-column: 1; }
  .item-name { grid-column: 2; }
  .item-kind { display: none; }
  .item-size { grid-column: 3; }
  .item-date { display: none; }
  .modal { padding: 8px; }
  .modal-card { max-height: 96vh; padding: 14px; border-radius: 14px; }
  .admin-card { width: 100%; }
  .admin-section { padding: 12px; }
  .user-row { grid-template-columns: 1fr 1fr; }
  .user-name { grid-column: 1 / -1; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .player-body video, .player-body img { max-height: 62vh; }
  .captcha-code { font-size: 24px; letter-spacing: 6px; }
}
/* Admin add-user form */
.admin-actions .admin-input { min-width: 150px; padding: 9px 12px; color: var(--text); background: #0d1427; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.admin-actions .admin-input:focus { border-color: var(--accent-2); }
@media (max-width: 640px) { .admin-actions .admin-input { width: 100%; } }
/* Breadcrumb path */
.breadcrumb .path-label { color: var(--muted); cursor: default; }
.breadcrumb span:not(.path-label):hover { color: var(--accent); }
/* Clickable path navigation */
.path-up { margin-right: 10px; padding: 5px 9px; color: var(--text); background: #0d1427; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.path-up:hover { border-color: var(--accent); color: var(--accent); }
.breadcrumb .path-segment { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.breadcrumb .path-segment:hover { color: var(--accent); }
.breadcrumb .path-current { color: var(--text); font-weight: 700; }