:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --success: #22c55e;
  --error: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 16px;
}

.page-shell {
  width: 100%;
  max-width: 560px;
}

.card {
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.site-footer {
  width: 100%;
  max-width: 560px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* Переключатель языка */
.lang-switch {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 3px;
}

.lang-btn {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-btn:hover {
  background: rgba(148, 163, 184, 0.12);
}

.lang-btn.active {
  background: var(--accent);
  color: white;
}

h1 {
  font-size: 22px;
  margin: 0 36px 8px 0;
}

p.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

.dropzone {
  display: block;
  border: 2px dashed #334155;
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

input[type="file"] {
  display: none;
}

button {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  background: #334155;
  cursor: not-allowed;
  color: var(--muted);
  box-shadow: none;
}

button.secondary {
  background: transparent;
  border: 1px solid #334155;
  color: var(--text);
}

button.secondary:hover {
  background: rgba(148, 163, 184, 0.08);
}

/* Список выбранных файлов */
.file-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
}

.file-row--invalid {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.08);
}

.file-row__info {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.file-row__meta {
  color: var(--muted);
  font-size: 12px;
}

/* Поля ширины/высоты + чекбокс синхронизации */
.file-row__dims {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 auto;
}

.dim-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}

.dim-field__label {
  white-space: nowrap;
}

.dim-field__input {
  width: 68px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.dim-field__input:focus {
  outline: none;
  border-color: var(--accent);
}

.file-row--invalid .dim-field__input {
  border-color: var(--error);
}

.dim-field--link {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding-bottom: 6px;
}

.dim-field--link input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.file-row__remove {
  width: auto;
  margin: 0;
  margin-left: auto;
  padding: 2px 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
}

.file-row__remove:hover {
  color: var(--error);
}

.file-row__hint {
  flex-basis: 100%;
  color: var(--error);
  font-size: 12px;
}

/* Кнопка "Преобразовать" — светится, когда активна */
#convertBtn:not(:disabled) {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 18px rgba(99, 102, 241, 0.55);
  animation: glow-pulse 1.8s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 18px rgba(99, 102, 241, 0.55);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35), 0 0 28px rgba(99, 102, 241, 0.85);
  }
}

#status {
  margin-top: 16px;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

#status.success {
  color: var(--success);
}

#status.error {
  color: var(--error);
}

/* ---------- Адаптивность под мобильные устройства ---------- */
/* Стили для нового описания сайта */
.site-header {
  text-align: center;
  max-width: 560px; /* Ограничиваем по ширине карточки */
  width: 100%;
  margin-bottom: 24px; /* Отступ до карточки */
  animation: fadeIn 0.8s ease-in-out;
}

.site-header .logo {
  font-size: 24px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.22);
  margin-bottom: 8px;
}

.site-header p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

/* Красивое появление при загрузке страницы */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Адаптивность для мобильных */
@media (max-width: 640px) {
  .site-header {
    margin-bottom: 16px;
    padding: 0 8px;
  }
  .site-header .logo {
    font-size: 22px;
  }
  .site-header p {
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 8px;
    align-items: flex-start;
  }

  .card {
    padding: 20px 16px 24px;
    border-radius: 12px;
    max-width: 100%;
  }

  .site-footer {
    max-width: 100%;
    margin-top: 12px;
  }

  .lang-switch {
    position: static;
    justify-content: flex-end;
    margin-bottom: 12px;
    width: fit-content;
    margin-left: auto;
  }

  h1 {
    font-size: 19px;
    margin-right: 0;
  }

  p.subtitle {
    font-size: 13px;
    margin-bottom: 18px;
  }

  .dropzone {
    padding: 20px 14px;
  }

  button {
    padding: 13px;
    font-size: 15px;
  }

  .file-list {
    max-height: 50vh;
  }

  .file-row {
    padding: 10px;
  }

  .file-row__dims {
    width: 100%;
    justify-content: flex-start;
  }

  .dim-field__input {
    width: 100%;
    min-width: 56px;
    flex: 1 1 64px;
  }

  .file-row__remove {
    margin-left: 0;
    padding: 4px 10px;
    font-size: 16px;
  }
}

@media (max-width: 380px) {
  .dim-field {
    flex: 1 1 45%;
  }

  .dim-field--link {
    flex: 1 1 100%;
    order: 3;
  }
}
