*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-body:    #0b0f19;
  --bg-surface: #111827;
  --bg-input:   #0d1321;
  --bg-hover:   #1a2234;
  --border:     #1e293b;
  --border-hl:  #334155;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --accent:     #6366f1;
  --accent-hl:  #818cf8;
  --accent-dim: #4f46e5;
  --green:      #22c55e;
  --green-bg:   #052e16;
  --red:        #ef4444;
  --red-bg:     #450a0a;
  --gold:       #eab308;
  --gold-bg:    #422006;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-xs:  6px;
  --shadow:     0 4px 24px rgba(0,0,0,.35);
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.1rem;  font-weight: 600; }
.muted { color: var(--text-muted); font-size: .85rem; }

/* ── Links ─────────────────────────────────────────────────── */
a { color: var(--accent-hl); text-decoration: none; transition: color var(--transition); }
a:hover { color: #a5b4fc; }

/* ── Layout ────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Navigation Bar ────────────────────────────────────────── */
.navbar {
  background: rgba(17,24,39,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.nav-brand:hover { color: var(--accent-hl); }
.nav-brand .logo { font-size: 1.5rem; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a, .nav-links button {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links button:hover { background: var(--bg-hover); color: var(--text); }
.nav-links .active { background: var(--accent-dim); color: #fff; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .85rem;
}
.nav-coins {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--gold-bg);
  color: var(--gold);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .8rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-hl); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h2, .card-header h3 { margin: 0; }

/* ── Chips / Badges ────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chip {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-plugin     { background: #1e3a5f; color: #60a5fa; }
.badge-texturepack { background: #1a3320; color: #86efac; }
.badge-bundle     { background: #422006; color: #fbbf24; }
.badge-build      { background: #3b1764; color: #c084fc; }

/* ── Forms ─────────────────────────────────────────────────── */
label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 12px;
}
label:first-child { margin-top: 0; }

input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.3 4.3a1 1 0 011.4 0L6 6.6l2.3-2.3a1 1 0 111.4 1.4l-3 3a1 1 0 01-1.4 0l-3-3a1 1 0 010-1.4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input::placeholder, textarea::placeholder { color: var(--text-dim); }

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

/* ── Buttons ───────────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary, button[type="submit"] {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover, button[type="submit"]:hover {
  background: var(--accent-hl);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-hl); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: #dc2626; color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-xs); }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── Grid layouts ──────────────────────────────────────────── */
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ── Project Cards (in list) ───────────────────────────────── */
.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
  transform: translateY(-2px);
}
.project-card .project-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}
.project-card .project-name:hover { color: var(--accent-hl); }
.project-card .project-meta { font-size: .8rem; color: var(--text-muted); }
.project-card .project-actions { display: flex; gap: 6px; margin-top: auto; }

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width .5s ease;
}

/* Unavailable project visual */
.project-card.unavailable {
  background: linear-gradient(180deg, rgba(255,50,50,0.06), rgba(255,50,50,0.02));
  border-color: var(--red);
}
.project-card.unavailable .project-name { color: #ffc6c6; }
.project-card.unavailable .project-meta { color: #ffbcbc; }
.project-card.unavailable .btn-danger { display: inline-flex; }

/* ── Table ─────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── Texture Gallery ───────────────────────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.tile:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.tile img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  display: block;
  background: #050a15;
  image-rendering: pixelated;
}
.tile .name {
  padding: 6px 10px;
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.tile .tile-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

/* ── Create Project Wizard ─────────────────────────────────── */
.wizard-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.wizard-type-btn {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.wizard-type-btn:hover, .wizard-type-btn.active {
  border-color: var(--accent);
  background: rgba(99,102,241,.08);
}
.wizard-type-btn .icon { font-size: 2rem; }
.wizard-type-btn .label { font-weight: 600; font-size: .9rem; }
.wizard-type-btn .desc { font-size: .75rem; color: var(--text-muted); }
.wizard-type-btn .cost { font-size: .75rem; color: var(--gold); margin-top: 4px; }

.wizard-form { display: none; animation: fadeSlide .3s ease; }
.wizard-form.active { display: block; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);

/* blurred sensitive text */
.blur { filter: blur(4px); user-select: none; }
  z-index: 200;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-hl);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  padding: 28px;
  box-shadow: var(--shadow);
  animation: fadeSlide .25s ease;
}
.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: auto;
}
.modal-close:hover { color: var(--text); }

/* ── Flash / Toast ─────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: fadeSlide .3s ease;
}
.flash.ok  { background: var(--green-bg); color: var(--green); border: 1px solid #166534; }
.flash.err { background: var(--red-bg);   color: var(--red);   border: 1px solid #7f1d1d; }

/* ── Status colors ─────────────────────────────────────────── */
.ok { color: var(--green); }
.err { color: var(--red); }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { margin-top: 8px; }

/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar .filter-input { flex: 1; min-width: 200px; }
.filter-bar label { margin: 0; }
.filter-bar select, .filter-bar input { margin: 0; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 10px 20px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-hl); border-bottom-color: var(--accent); }

/* ── Breadcrumbs ───────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent-hl); }
.breadcrumbs .sep { color: var(--text-dim); }

/* ── Stat boxes ────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-box .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-box .stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Responsive ────────────────────────────────────────────── */


@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  .wizard-types { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ── Utilities ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }
@media (max-width: 768px) {
  /* Контейнеры и отступы */
  .container {
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Навигация */
  .navbar .container {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  /* Блок статистики (4 плашки -> 2 плашки в ряд) */
  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Сетка проектов (в 1 колонку) */
  .grid-auto {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Карточки проектов */
  .project-card .flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .project-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .project-actions .btn,
  .project-actions form,
  .project-actions button {
    width: 100%;
    text-align: center;
  }

  /* --- НОВОЕ: Страница конкретного проекта --- */
  /* Перенос длинных хлебных крошек */
  .breadcrumbs {
    flex-wrap: wrap;
  }
  
  /* Делаем шапку с названием и кнопками вертикальной */
  .card > .flex.justify-between {
    flex-direction: column;
    align-items: stretch !important;
  }

  /* Кнопки скачивания и удаления на странице проекта на всю ширину */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  .btn-group a.btn,
  .btn-group form,
  .btn-group form button {
    width: 100%;
    text-align: center;
    margin: 0;
  }

  /* Модальные окна */
  .modal {
    width: 95%;
    padding: 15px;
    margin: 10px auto;
  }
  .modal-close {
    padding: 5px;
    margin-right: -5px;
  }

  /* Формы */
  .form-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  input, select, textarea, button {
    width: 100%;
    box-sizing: border-box;
  }

  /* Выбор типа проекта в модалке */
  .wizard-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Таблицы (в профиле) - скролл по горизонтали */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
  }

  /* Фильтры и поиск */
  .filter-bar form {
    flex-direction: column;
    align-items: stretch !important;
  }
  .filter-bar button {
    width: 100%;
  }
}
