:root {
  --bg: #0b1020;
  --card: #121833;
  --text: #e8ebff;
  --muted: #9aa3c7;
  --accent: #6ea8fe;
  --accent-2: #a58afe;
  --border: #27305a;
  --ok: #22c55e;
  --warn: #f59e0b;
  --glass-bg: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 10% 10%, #121638, var(--bg)) fixed;
  color: var(--text);
}

.container {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 16px;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  backdrop-filter: blur(14px) saturate(140%);
}

h1 { font-size: 20px; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0 0 16px; }
.dev-only { color: var(--muted); font-size: 14px; }

.uploader {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-switch {
  display: inline-flex;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px) saturate(140%);
}

.mode-switch .seg {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.mode-switch .seg.active {
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  border: 1px solid var(--glass-border);
}

.text-area {
  width: 100%;
  resize: vertical;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #0a0f1f;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(110,168,254,0.35);
}

.button.ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.select {
  appearance: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(16,20,40,0.6);
  color: var(--text);
  backdrop-filter: blur(10px) saturate(140%);
}

/* Нормализация системного выпадающего списка на Windows: контрастный фон */
select option {
  background-color: #141a33;
  color: #eef2ff;
}

.dropdown {
  margin-top: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(16,20,40,0.8);
  color: var(--text);
  border-radius: 10px;
  backdrop-filter: blur(10px) saturate(140%);
  max-height: 220px;
  overflow: auto;
}
.dropdown-item {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}
.dropdown-item:hover {
  background: rgba(255,255,255,0.08);
}

.controls {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.control-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.control {
  display: grid;
  gap: 6px;
}

.control label {
  font-size: 13px;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  backdrop-filter: blur(10px) saturate(140%);
}

.btns-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  vertical-align: middle;
  margin-right: 6px;
}

.error-text {
  color: #fda4af; /* розово-красный */
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(255, 99, 132, 0.15);
  color: #fecaca;
  border: 1px solid rgba(255, 99, 132, 0.35);
  padding: 10px 14px;
  border-radius: 10px;
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  z-index: 100;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-name { color: var(--muted); }
.status { margin-top: 12px; color: var(--muted); font-size: 14px; }

.rules-banner {
  margin: 14px 0 8px;
  padding: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(14px) saturate(140%);
}
.rules-banner-title { font-weight: 700; margin-bottom: 6px; }
.rules-banner-desc { color: var(--muted); margin-bottom: 8px; }
.rules-actions { display: flex; gap: 10px; align-items: center; }
.rules-actions input[type="file"] { display: none; }

.results {
  margin-top: 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(14px) saturate(140%);
}

.hidden { display: none; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

details { border-top: 1px solid var(--border); padding-top: 10px; }
summary { cursor: pointer; }

.result-list {
  margin: 10px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.result-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 18px;
  line-height: 1.35;
}

.nested-list {
  margin-top: 6px;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: #0a0f1f;
  background: linear-gradient(180deg, #c7d2fe, #a5b4fc);
  box-shadow: 0 4px 12px rgba(165, 180, 252, 0.4);
}

.page-badge { background: #a7f3d0; }
.count-badge { background: #fde68a; }

/* Прелоадер поверх страницы */
.preloader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(11,16,32,0.35);
  backdrop-filter: blur(6px);
  z-index: 50;
}

.preloader.hidden { display: none; }

.loader-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  backdrop-filter: blur(16px) saturate(160%);
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #8b5cf6;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}

.loader-text { color: var(--muted); font-size: 14px; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Drag and Drop зона */
.drop-zone {
  border: 2px dashed rgba(255,255,255,0.3);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.02);
  position: relative;
  overflow: hidden;
}

.drop-zone:hover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.04);
  transform: translateY(-2px);
}

.drop-zone.drag-over {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.1);
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(76, 175, 80, 0.2);
}

.drop-zone.drag-over::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(76, 175, 80, 0.1) 50%, transparent 70%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.drop-zone-content {
  position: relative;
  z-index: 1;
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.drop-zone:hover .drop-zone-icon {
  opacity: 1;
  transform: scale(1.1);
}

.drop-zone.drag-over .drop-zone-icon {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.drop-zone-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drop-zone-primary {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.drop-zone-secondary {
  font-size: 14px;
  color: var(--muted);
}

/* Информация о файле */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: 12px;
  margin-top: 16px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-remove {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 16px;
  transition: all 0.2s ease;
}

.btn-remove:hover {
  background: rgba(255, 107, 107, 0.1);
  transform: scale(1.1);
}

/* Имя файла в dropZone */
.drop-zone .file-selected {
  margin-top: 10px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid rgba(76, 175, 80, 0.35);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.drop-zone .file-selected .name {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drop-zone .file-selected .remove {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.drop-zone .file-selected .remove:hover {
  background: rgba(255, 107, 107, 0.12);
}


