/* 666 FILES — тёмное стекло */
:root {
  --bg: #0b0715;
  --text: #f5f2ff;
  --muted: rgba(245, 242, 255, .64);
  --faint: rgba(245, 242, 255, .40);
  --glass: rgba(255, 255, 255, .06);
  --glass-hi: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .13);
  --violet: #8b3dff;
  --pink: #ff3dbf;
  --blue: #4d7cff;
  --grad: linear-gradient(135deg, #7b2ff7 0%, #c915b0 100%);
  --danger: #ff5a76;
  --ok: #38e0a0;
  --r: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
.ic { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- Фон ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora::before, .aurora::after {
  content: ""; position: absolute; width: 75vmax; height: 75vmax; border-radius: 50%; opacity: .6;
}
.aurora::before {
  background: radial-gradient(circle, #7b2ff7 0%, transparent 62%);
  top: -32vmax; left: -22vmax; animation: drift1 24s ease-in-out infinite alternate;
}
.aurora::after {
  background: radial-gradient(circle, #d4169f 0%, transparent 62%);
  bottom: -38vmax; right: -26vmax; animation: drift2 28s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(14vmax, 9vmax) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-12vmax, -7vmax) scale(1.18); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Стекло ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 18px; }

/* ---------- Шапка ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--grad); box-shadow: 0 8px 24px rgba(201, 21, 176, .4);
}
.brand-mark .ic { width: 22px; height: 22px; }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 17px; letter-spacing: .06em; }
.brand-text small { color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 6px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px;
  color: var(--muted); font-weight: 600; font-size: 14px; transition: background .2s, color .2s;
}
.nav-link:hover { background: var(--glass-hi); color: var(--text); }
.nav-link.active { background: var(--glass-hi); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.nav-out:hover { color: var(--danger); }

/* ---------- Статистика ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.stat-ic {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, rgba(139, 61, 255, .35), rgba(255, 61, 191, .25));
  box-shadow: inset 0 0 0 1px var(--line);
}
.stat-val { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-lbl { color: var(--muted); font-size: 13px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; cursor: pointer;
  padding: 14px 22px; border-radius: 15px; font-weight: 650; font-size: 15px; line-height: 1;
  transition: transform .15s, filter .2s, background .2s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 28px rgba(160, 30, 200, .38); }
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-ghost { background: var(--glass-hi); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, .15); }
.btn-block { width: 100%; }
.btn-sm { padding: 12px 14px; font-size: 14px; border-radius: 13px; }
.btn-icon { width: 46px; padding: 0; flex: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: rgba(255, 90, 118, .12); color: var(--danger); box-shadow: inset 0 0 0 1px rgba(255, 90, 118, .25); }
.btn-danger-ghost:hover { background: var(--danger); color: #fff; }

/* ---------- Поля ---------- */
.field { display: grid; gap: 8px; align-content: start; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.field small { color: var(--faint); font-size: 12px; }
input[type=text], input[type=password], input[type=search], textarea {
  width: 100%; background: rgba(8, 4, 20, .5); border: 1px solid var(--line); border-radius: 15px;
  padding: 13px 15px; outline: none; transition: border-color .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139, 61, 255, .22); }
textarea { min-height: 180px; resize: vertical; }
.pw { position: relative; }
.pw input { padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  border: 0; background: transparent; color: var(--muted); border-radius: 12px; cursor: pointer; display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--text); background: var(--glass-hi); }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 15px; font-size: 14px;
  background: rgba(255, 90, 118, .12); border: 1px solid rgba(255, 90, 118, .35); color: #ffc2cc;
}
.alert .ic { margin-top: 1px; }
.alert-ok { background: rgba(56, 224, 160, .12); border-color: rgba(56, 224, 160, .35); color: #b6f5dc; }

/* ---------- Вход ---------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.login { width: 100%; max-width: 430px; padding: 34px 30px 26px; display: grid; gap: 20px; }
.login-logo { text-align: center; display: grid; gap: 6px; justify-items: center; }
.login-logo .brand-mark { width: 62px; height: 62px; border-radius: 20px; margin-bottom: 8px; }
.login-logo .brand-mark .ic { width: 32px; height: 32px; }
.login-logo h1 { font-size: 28px; letter-spacing: .09em; }
.login-logo p { color: var(--muted); font-size: 14px; }
.login form { display: grid; gap: 16px; }
.foot { text-align: center; color: var(--faint); font-size: 12.5px; }

/* ---------- Загрузка ---------- */
.card { padding: 24px; display: grid; gap: 18px; }
.card-head h2 { font-size: 22px; }
.card-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dropzone {
  position: relative; min-height: 180px; border: 2px dashed rgba(255, 255, 255, .22); border-radius: 18px;
  display: grid; place-items: center; text-align: center; padding: 18px; transition: border-color .2s, background .2s;
  background: rgba(8, 4, 20, .35);
}
.dropzone:hover, .dropzone.over { border-color: var(--pink); background: rgba(255, 61, 191, .08); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz-empty { display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.dz-empty .ic { width: 38px; height: 38px; color: var(--pink); }
.dz-empty b { font-size: 16px; }
.dz-empty small { color: var(--faint); font-size: 12px; max-width: 280px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-row > span { font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.count { font-style: normal; font-weight: 600; font-size: 12px; color: var(--faint); background: var(--glass); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }
.add-btn {
  width: 28px; height: 28px; border-radius: 9px; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: var(--grad); box-shadow: 0 4px 12px rgba(160, 30, 200, .4); transition: transform .15s, filter .2s;
}
.add-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.add-btn:active { transform: scale(.94); }
.add-btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.dropzone.has-files { display: block; place-items: stretch; text-align: left; padding: 10px; }
.dropzone.has-files input[type=file] { pointer-events: none; }
.dz-list { list-style: none; display: grid; gap: 8px; max-height: 300px; overflow-y: auto; position: relative; z-index: 2; }
.dz-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.dz-item .thumb-ic { width: 42px; height: 42px; flex: none; }
.dz-item .meta { min-width: 0; flex: 1; }
.dz-item .name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.dz-item .size { color: var(--muted); font-size: 12.5px; }
.dz-clear {
  width: 38px; height: 38px; border-radius: 12px; border: 0; cursor: pointer; flex: none;
  background: var(--glass-hi); display: grid; place-items: center; color: var(--muted);
}
.dz-clear:hover { color: var(--danger); }
.progress { display: grid; gap: 8px; }
.bar { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #7b2ff7, #ff3dbf); transition: width .15s linear; }
.progress-text { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 12px; }
.actions .btn-primary { flex: 1; padding: 16px; font-size: 16px; }

/* ---------- Результат загрузки ---------- */
.result { width: 100%; max-width: 560px; padding: 32px 26px; display: grid; gap: 20px; text-align: center; }
.result-ic {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center;
  background: rgba(56, 224, 160, .14); color: var(--ok); box-shadow: 0 0 0 8px rgba(56, 224, 160, .08), 0 0 40px rgba(56, 224, 160, .25);
}
.result-ic .ic { width: 38px; height: 38px; }
.result-ic.err { background: rgba(255, 90, 118, .14); color: var(--danger); box-shadow: 0 0 0 8px rgba(255, 90, 118, .08); }
.result h2 { font-size: 26px; }
.result .sub { color: var(--muted); }
.items { display: grid; gap: 12px; text-align: left; }
.item { background: rgba(8, 4, 20, .45); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 12px; }
.item-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.item .thumb-ic { width: 46px; height: 46px; flex: none; }
.item-info { min-width: 0; }
.item-label { font-size: 12px; color: var(--ok); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.item-name { overflow-wrap: anywhere; font-weight: 600; }
.item-orig { color: var(--faint); font-size: 12.5px; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 10px; }
.item-actions .btn { flex: 1; }
.result .buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.result .buttons .btn { flex: 1; min-width: 160px; }

/* ---------- Список файлов ---------- */
.toolbar { display: grid; gap: 12px; }
.search { position: relative; }
.search .ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 46px; padding-right: 100px; }
.search .btn { position: absolute; right: 5px; top: 5px; bottom: 5px; padding: 0 16px; border-radius: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 99px; font-size: 14px; font-weight: 600;
  background: var(--glass); border: 1px solid var(--line); color: var(--muted); transition: background .2s, color .2s;
}
.chip:hover { color: var(--text); background: var(--glass-hi); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; }
.chip em { font-style: normal; font-size: 12px; opacity: .75; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.file { overflow: hidden; display: grid; grid-template-rows: auto 1fr; transition: transform .2s, box-shadow .2s, border-color .2s; }
.file:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .25); box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .1); }
.thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden;
  background: linear-gradient(135deg, rgba(139, 61, 255, .22), rgba(255, 61, 191, .14));
}
.cat-image .thumb { background: linear-gradient(135deg, rgba(77, 124, 255, .28), rgba(139, 61, 255, .22)); }
.cat-video .thumb { background: linear-gradient(135deg, rgba(255, 61, 191, .28), rgba(255, 140, 61, .18)); }
.cat-audio .thumb { background: linear-gradient(135deg, rgba(56, 224, 160, .24), rgba(77, 124, 255, .2)); }
.cat-archive .thumb { background: linear-gradient(135deg, rgba(255, 190, 61, .24), rgba(255, 61, 120, .16)); }
.thumb-ic { display: grid; place-items: center; border-radius: 15px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px var(--line); }
.thumb > .thumb-ic { width: 72px; height: 72px; }
.thumb-ic .ic { width: 50%; height: 50%; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb img.broken { display: none; }
.ext {
  position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  background: rgba(8, 4, 20, .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--line); text-transform: uppercase;
}
.file-body { padding: 14px; display: grid; gap: 10px; align-content: start; }
.file-name { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--faint); font-size: 12.5px; }
.file-actions { display: flex; gap: 8px; margin-top: 2px; }
.file-actions .grow { flex: 1; }

.empty { padding: 56px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty .ic { width: 52px; height: 52px; color: var(--faint); }
.empty h3 { font-size: 20px; }
.empty p { color: var(--muted); }

.pager { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 42px; height: 42px; padding: 0 14px; display: inline-grid; place-items: center; border-radius: 13px; font-weight: 600; font-size: 14px;
  background: var(--glass); border: 1px solid var(--line); color: var(--muted);
}
.pager a:hover { background: var(--glass-hi); color: var(--text); }
.pager .cur { background: var(--grad); color: #fff; border-color: transparent; }
.pager .dis { opacity: .35; }
.pager-info { text-align: center; color: var(--faint); font-size: 13px; }

/* ---------- Окно удаления ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 3, 12, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal-box { width: 100%; max-width: 420px; padding: 26px; display: grid; gap: 14px; text-align: center; background: rgba(24, 14, 46, .92); }
.modal-box .ic { width: 40px; height: 40px; margin: 0 auto; color: var(--danger); }
.modal-box h3 { font-size: 20px; }
.modal-box p { color: var(--muted); font-size: 14.5px; }
.modal-name { color: var(--text); font-weight: 600; overflow-wrap: anywhere; font-size: 13.5px; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* ---------- Конфетти ---------- */
.confetti { position: fixed; top: -48px; z-index: 100; pointer-events: none; will-change: transform; line-height: 1; user-select: none; }

/* ---------- Мобильный вид ---------- */
@media (max-width: 720px) {
  .wrap { padding: 12px 12px 36px; gap: 14px; }
  .brand-text small { display: none; }
  .nav-link { padding: 10px 12px; }
  .nav-link span { display: none; }
  .nav-link .ic { width: 22px; height: 22px; }
  .stat { padding: 14px; gap: 10px; }
  .stat-ic { width: 40px; height: 40px; }
  .stat-val { font-size: 19px; }
  .card { padding: 18px; }
  .upload-grid { grid-template-columns: 1fr; }
  textarea { min-height: 130px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .file-body { padding: 10px; gap: 8px; }
  .file-name { font-size: 13px; }
  .file-meta { flex-direction: column; gap: 0; }
  .btn-sm { padding: 13px 10px; }
  .login { padding: 28px 20px 22px; }
  .actions .btn-primary { padding: 17px; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
}

/* список ошибок на странице результата */
.res-errors { text-align: left; display: grid; gap: 6px; }
.res-errors b { font-size: 13px; }
.res-errors ul { margin: 0 0 0 18px; font-size: 13.5px; }

/* ---------- Google Диск ---------- */
.nav-google { gap: 8px; }
.nav-google .g-logo { width: 1.15em; height: 1.15em; }
.g-logo-btn { width: 20px; height: 20px; background: #fff; border-radius: 50%; padding: 2px; box-sizing: content-box; }
.g-status { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; }
.g-status-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 14px; background: #fff; }
.g-status-ic .ic { width: 24px; height: 24px; }
.g-status-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.g-status-text small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.g-status.ok .g-status-text b { color: #8ff0c8; }
.g-steps { display: grid; gap: 12px; padding-left: 22px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.g-steps b { color: var(--text); }
.g-steps code, .card-head code { background: rgba(255, 255, 255, .1); padding: 2px 6px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }
.card-head h2 .g-logo { width: 22px; height: 22px; vertical-align: -3px; margin-right: 6px; }
.g-results { margin-top: 14px; }

/* Список файлов Google Диска */
#gdList .toolbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
#gdList .toolbar .search { flex: 1; min-width: 220px; }
#gdList .muted { color: var(--faint); font-size: 14px; margin: 10px 2px; }
#gdList .buttons { margin-top: 14px; display: flex; justify-content: center; }

/* Форма загрузки: колонки выровнены по строкам (заголовок / поле / подсказка) */
.upload-grid > .field { align-content: stretch; grid-template-rows: 28px minmax(180px, 1fr) auto; }
.upload-grid > .field > span:first-child { height: 28px; }
.add-btn .ic { width: 16px; height: 16px; }
.upload-grid > .field > textarea { min-height: 180px; height: 100%; }

/* Текстовое превью (txt и подобные) */
.thumb-txt {
  position: absolute; inset: 0; padding: 42px 14px 10px; overflow: hidden; white-space: pre-wrap; word-break: break-word;
  font: 500 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: rgba(255, 255, 255, .82);
  background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  -webkit-mask-image: linear-gradient(#000 62%, transparent 100%); mask-image: linear-gradient(#000 62%, transparent 100%);
}
.thumb:has(.thumb-txt) > .thumb-ic { display: none; }
