/* AVA Companion — тёмная игровая панель с неоновыми акцентами */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0d17;
  --bg2: #11142400;
  --panel: rgba(23, 27, 48, 0.72);
  --panel-solid: #171b30;
  --line: rgba(130, 150, 255, 0.16);
  --line-bright: rgba(0, 229, 255, 0.45);
  --cyan: #22e3ff;
  --magenta: #ff4ecd;
  --violet: #8b7cff;
  --lime: #3ef0a8;
  --text: #e8ebff;
  --muted: #8c94bd;
  --danger: #ff5c7a;
  --grad: linear-gradient(135deg, #22e3ff 0%, #8b7cff 55%, #ff4ecd 100%);
  --radius: 18px;
  --glow: 0 0 24px rgba(34, 227, 255, 0.25);
}

html { color-scheme: dark; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  padding: 18px;
  position: relative;
  overflow-x: hidden;
}

/* Фон: сетка-перспектива и два световых пятна */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(34, 227, 255, 0.16), transparent 70%),
    radial-gradient(800px 520px at 92% 8%, rgba(255, 78, 205, 0.14), transparent 70%),
    linear-gradient(180deg, #0b0d17 0%, #0a0b14 100%);
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(130, 150, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(130, 150, 255, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 75%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 75%);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
}

h1 {
  font-size: 24px;
  letter-spacing: 0.4px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.muted { color: var(--muted); font-size: 14px; }

/* ---- Поля и кнопки ---- */
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  background: rgba(8, 10, 20, 0.75);
  color: var(--text);
  font-family: inherit;
}
input::placeholder { color: #666f99; }
input:focus { outline: none; border-color: var(--line-bright); box-shadow: var(--glow); }
button:focus-visible, .btn:focus-visible, .drop:focus-visible,
.ttl-opt input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit; font-size: 15px; font-weight: 700;
  letter-spacing: 0.3px;
  color: #061018;
  background: var(--grad);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(34, 227, 255, 0.3); filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.secondary {
  background: rgba(139, 124, 255, 0.1);
  border-color: var(--line);
  color: var(--text);
}
.btn.secondary:hover { background: rgba(139, 124, 255, 0.2); box-shadow: none; }
.btn.small { padding: 9px 12px; font-size: 13px; border-radius: 10px; }
.btn.copy { background: linear-gradient(135deg, var(--cyan), var(--lime)); color: #04131a; }
.btn.danger {
  background: rgba(255, 92, 122, 0.12);
  border-color: rgba(255, 92, 122, 0.4);
  color: var(--danger);
}
.btn.danger:hover { background: rgba(255, 92, 122, 0.22); box-shadow: 0 8px 22px rgba(255, 92, 122, 0.22); }

.msg {
  display: none;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid transparent;
}
.msg.show { display: block; }
.msg.error { background: rgba(255, 92, 122, 0.12); border-color: rgba(255, 92, 122, 0.4); color: #ffb3c1; }
.msg.success { background: rgba(62, 240, 168, 0.1); border-color: rgba(62, 240, 168, 0.35); color: #9cf6d2; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Вход ---- */
.login-wrap { min-height: calc(100vh - 36px); display: flex; align-items: center; justify-content: center; }
.login { padding: 40px 28px; max-width: 430px; width: 100%; text-align: center; position: relative; overflow: hidden; }
.logo {
  width: 58px; height: 58px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #061018;
  background: var(--grad);
  border-radius: 16px;
  box-shadow: 0 0 26px rgba(34, 227, 255, 0.35);
}
/* Неоновая полоска сверху панели */
.login::before, .topbar::before {
  content: '';
  position: absolute; top: 0; left: 18px; right: 18px; height: 2px;
  background: var(--grad);
  opacity: 0.85;
  border-radius: 2px;
}
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; text-align: left; }
.field { position: relative; }
.field input { padding-right: 54px; letter-spacing: 0.5px; }
.eye {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 9px; border-radius: 10px;
  color: var(--muted);
}
.eye:hover { background: rgba(34, 227, 255, 0.12); }

/* ---- Промо-кнопка ботов ---- */
.promo { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.promo .muted { margin-bottom: 12px; font-size: 13px; }
.promo .promo-btn { width: 100%; }
.promo-btn {
  background: linear-gradient(135deg, var(--magenta) 0%, var(--violet) 100%);
  color: #120a1c;
  text-decoration: none;
}
.promo-btn:hover { box-shadow: 0 8px 26px rgba(255, 78, 205, 0.35); }

/* ---- Галерея ---- */
.page { max-width: 1180px; margin: 0 auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 24px; margin-bottom: 16px;
  flex-wrap: wrap; position: relative; overflow: hidden;
}
.brand h1 { font-size: 22px; }
.brand .muted { font-size: 13px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.counter {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-weight: 700; font-size: 14px;
  color: var(--cyan);
  padding: 7px 13px; border-radius: 999px;
  background: rgba(34, 227, 255, 0.1);
  border: 1px solid rgba(34, 227, 255, 0.3);
}
.uploader { padding: 22px 24px; margin-bottom: 18px; }
.uploader form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; }
.drop {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 54px; padding: 12px 16px;
  border: 1px dashed rgba(34, 227, 255, 0.45);
  border-radius: 12px;
  background: rgba(34, 227, 255, 0.05);
  color: #9fd9ee;
  cursor: pointer; font-weight: 500; font-size: 14px; line-height: 1.45;
  overflow-wrap: anywhere;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.drop { flex-direction: column; gap: 3px; }
.drop-main { font-weight: 600; }
.drop-sub { font-size: 11.5px; letter-spacing: 0.4px; color: var(--muted); }
.drop.chosen { border-style: solid; border-color: var(--lime); background: rgba(62, 240, 168, 0.08); color: #a9f7d6; }
.drop.chosen .drop-main { overflow-wrap: anywhere; }
.drop:hover, .drop.over {
  background: rgba(34, 227, 255, 0.12);
  border-color: var(--cyan);
  box-shadow: var(--glow);
}
.uploader .msg { margin-top: 14px; }

/* Срок хранения: кнопки-переключатели (не сбиваются колесом мыши) */
.ttl { border: none; display: flex; align-items: center; gap: 7px; }
.ttl legend {
  float: left; margin-right: 10px; line-height: 40px;
  font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted);
}
.ttl-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.ttl-opt span {
  display: block; padding: 10px 15px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(8, 10, 20, 0.6);
  font-size: 13px; font-weight: 700; color: var(--muted);
  white-space: nowrap; user-select: none;
  transition: all 0.15s ease;
}
.ttl-opt input:checked + span {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(34, 227, 255, 0.14);
  box-shadow: 0 0 14px rgba(34, 227, 255, 0.25);
}
.ttl-opt input:not(:checked) + span:hover { color: var(--text); border-color: rgba(130, 150, 255, 0.4); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.item {
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.item:hover {
  transform: translateY(-3px);
  border-color: var(--line-bright);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.5), 0 0 22px rgba(34, 227, 255, 0.16);
}
.thumb {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0% 25%, transparent 0% 50%) 50% / 18px 18px,
    #0a0c16;
  border-bottom: 1px solid var(--line);
}
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.meta { padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.meta .info { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.meta .info span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .info span:last-child { color: var(--violet); font-weight: 600; flex-shrink: 0; }
.url {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 11px; padding: 9px 10px; border-radius: 9px;
  background: rgba(5, 7, 14, 0.8);
  border: 1px solid var(--line);
  width: 100%; min-width: 0;
  color: #93e8ff;
}
.actions { display: flex; gap: 8px; }
.actions .btn { flex: 1; }
.empty {
  padding: 56px 24px; text-align: center; grid-column: 1 / -1;
  color: var(--muted); font-size: 15px;
}

@media (max-width: 880px) {
  .uploader form { grid-template-columns: 1fr; }
  .ttl { flex-wrap: wrap; }
  .ttl legend { line-height: 1.4; margin-bottom: 8px; }
  .topbar { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:hover, .item:hover { transform: none; }
}
