/* ============================================================
   Общие стили генераторов: сквозная шапка, панель параметров,
   контролы, раскрывающаяся кнопка «Скачать», адаптив.
   ============================================================ */

/* ------------------------------------------------------------
   КАТАЛОГ ЦВЕТОВЫХ ПАЛИТР — перебираем варианты, каждый со своим
   именем, до 10 штук, в конце выбираем одну. Активная — в :root
   ниже; остальные хранятся здесь для быстрого возврата.

   Palette 1 — "Sage & ink" (была активна, отложена):
     --bg: #ffffff; --panel: #eff1ea; --panel-border: #d7dbcf;
     --text: #1c201b; --text-dim: #6e7568;
     --accent: #1e8e5a; --accent-hover: #176e46; --warn: #c97a1e;

   Palette 2 — "Ukraine" (сейчас активна, см. :root ниже)
   ------------------------------------------------------------ */

@import url('https://fonts.googleapis.com/css2?family=Bungee&display=swap');

:root {
  --bg: #ffffff;              /* поля ввода — приподнятые, светлее панели */
  --panel: #eaf1fb;           /* светлый холодный голубоватый фон панели */
  --panel-border: #cbdcf0;
  --text: #14181d;            /* тёмно-чернильный, холодный оттенок */
  --text-dim: #5c6773;
  --accent: #0057b7;          /* синий флага Украины */
  --accent-hover: #00447f;
  --warn: #c97a1e;
  --header-h: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

/* ---------- Сквозная шапка сайта (всегда тёмная — "ink") ---------- */
.gen-header {
  height: var(--header-h);
  flex-shrink: 0;
  background: #191a1e;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid #2a2c2f;
}
.gen-logo {
  font-family: 'Bungee', sans-serif;
  font-size: 16px;
  color: #ffffff;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.gen-logo span { color: var(--accent); }
.gen-header-title {
  font-size: 13px;
  color: #9aa39a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gen-home-btn {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: #f2f3f0;
  text-decoration: none;
  padding: 7px 12px;
  border: 1px solid #3a3f3a;
  border-radius: 9px;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.gen-home-btn:hover {
  border-color: var(--accent);
  background: rgba(30, 142, 90, 0.18);
}

/* ---------- Раскладка: панель + сцена ---------- */
#app {
  display: flex;
  flex: 1;
  min-height: 0; /* важно для прокрутки панели внутри flex-колонки */
}
#panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
#scene-container {
  flex: 1;
  position: relative;
  touch-action: none;
}

@media (max-width: 700px) {
  #app { flex-direction: column-reverse; }
  #panel {
    width: 100%;
    max-height: 50%;
    border-right: none;
    border-top: 1px solid var(--panel-border);
    padding: 16px;
  }
}

/* ---------- Заголовок панели ---------- */
#panel h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}
#panel h1 span {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 13px;
  display: block;
  margin-top: 3px;
}
.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ---------- Параметры ---------- */
.param {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.param-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.param-number {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
}
.reset-auto {
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  margin-left: 6px;
  user-select: none;
}
.reset-auto:hover { color: var(--accent); }

.param-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.param-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="text"] {
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

input[type="number"] {
  width: 62px;
  padding: 5px 4px 5px 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  outline: none;
}
input[type="number"]:focus { border-color: var(--accent); }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

select {
  padding: 9px 10px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  width: 100%;
}
select:focus { border-color: var(--accent); }

.color-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
input[type="color"] {
  width: 46px;
  height: 30px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  cursor: pointer;
}

.sub-controls { display: none; }
.sub-controls.active { display: block; }

/* ---------- Кнопки ---------- */
#random-btn {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  cursor: pointer;
}
#random-btn:hover { border-color: var(--accent); color: var(--accent-hover); }
#random-btn:active { transform: translateY(1px); }

/* ---------- Статус и предупреждения ---------- */
#status {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 17px;
}
#warning {
  font-size: 13px;
  color: var(--warn);
  min-height: 0;
  white-space: pre-line;
}

/* ---------- Раскрывающаяся кнопка «Скачать» ---------- */
#download-row {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}
#download-main {
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
#download-main:hover { background: var(--accent-hover); }
#download-main:disabled { background: #d7dbcf; color: #8a9184; cursor: default; }
#download-main .chevron {
  transition: transform 0.25s ease;
  font-size: 12px;
}
#download-row.open #download-main {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
#download-row.open #download-main .chevron { transform: rotate(180deg); }
#download-options {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
  display: flex;
  flex-direction: column;
}
#download-row.open #download-options { max-height: 130px; }
.download-option {
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: color-mix(in srgb, var(--accent) 75%, black);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: left;
}
.download-option:hover { background: color-mix(in srgb, var(--accent) 60%, black); }
.download-option:last-child {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* ---------- Сегментированный переключатель (Pins/Tongue&groove, Bowl/Stand и т.п.) ---------- */
.seg-toggle {
  display: flex;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  overflow: hidden;
}
.seg-toggle button {
  flex: 1;
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  border: none;
  border-right: 1px solid var(--panel-border);
  cursor: pointer;
}
.seg-toggle button:last-child { border-right: none; }
.seg-toggle button.active { background: var(--accent); color: #ffffff; }
.seg-caption { font-size: 12px; color: var(--text-dim); margin-top: 8px; }

/* ---------- Подсказка в сцене ---------- */
#hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: #57606e;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.75);
  padding: 5px 12px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
}
