/* Игра в браузере — экраны на токенах сайта (см. site/assets/css/style.css).
   Подключается ПОСЛЕ style.css, тут только то, чего там нет. */

.igra-body { min-height: 100vh; display: flex; flex-direction: column; }

/* Фон игры: было ровное фиолетовое звёздное небо (.sky/.stars из style.css) —
   на экранах-приложениях без крупной иллюстрации это читалось холодным и
   мимо тона сайта, где на каждой странице сверху лежит тёплая тонированная
   сцена (.page-head-bg). Тут та же техника — тот же файл и тот же градиент
   поверх, что и в шапках сайта, — а не новая картинка. */
.igra-body .sky {
  background:
    linear-gradient(180deg, rgba(9,7,14,.86) 0%, rgba(9,7,14,.64) 42%, var(--bg) 82%),
    url("/assets/img/art/hero-desktop_sm.webp") center 32% / cover no-repeat;
}
@media (min-width: 900px) {
  .igra-body .sky {
    background-image:
      linear-gradient(180deg, rgba(9,7,14,.86) 0%, rgba(9,7,14,.64) 42%, var(--bg) 82%),
      url("/assets/img/art/hero-desktop.webp");
    background-position: center 32%;
  }
}
.igra-body .sky::after { opacity: .16; }
.igra-body .stars { opacity: .4; }
.igra-main { flex: 1; width: 100%; padding: 24px 16px 40px; }
.igra-shell { width: min(720px, 100%); margin-inline: auto; }
.igra-shell.wide { width: min(960px, 100%); }

.igra-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: rgba(11, 10, 18, 0.72); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 40;
}
.igra-topbar .brand { font-size: 1.15rem; gap: 8px; }
.igra-topbar .brand-mark { width: 30px; height: 30px; }
.igra-topbar-actions { display: flex; align-items: center; gap: 10px; }
.igra-ink { font-size: .85rem; color: var(--text-2); white-space: nowrap; }
.igra-ink b { color: var(--gold-2); }

[hidden] { display: none !important; }

.igra-card {
  padding: 24px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); margin-bottom: 16px;
}
.igra-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.igra-field label { font-size: .85rem; color: var(--text-2); }

/* Тёмная тема для всех полей ввода экранов игры — раньше правило цепляло
   только инпуты, обёрнутые в .igra-field, а textarea хода и select модели
   стоят в разметке БЕЗ такой обёртки и рисовались системным белым полем.
   Селектор широкий (по .igra-shell), чтобы больше не зависеть от обёртки. */
.igra-field input, .igra-field textarea, .igra-field select,
.igra-shell input, .igra-shell textarea, .igra-shell select {
  padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.05);
  border: 1px solid var(--border-strong); color: var(--text); font: inherit;
  width: 100%; accent-color: var(--gold);
}
.igra-field textarea { min-height: 90px; resize: vertical; }
.igra-field input:focus, .igra-field textarea:focus, .igra-field select:focus,
.igra-shell input:focus, .igra-shell textarea:focus, .igra-shell select:focus {
  outline: none; border-color: var(--gold);
}
.igra-shell select::-webkit-scrollbar { width: 10px; }
.igra-shell option { background: #17131f; color: var(--text); }

/* Обводка фокуса с клавиатуры — везде в игре, поверх обычного :focus выше */
.igra-shell :focus-visible, .igra-topbar :focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

/* Выбор модели: системная стрелка select тоже белая на белом — рисуем свою */
.igra-select-wrap { position: relative; min-width: 220px; }
.igra-select-wrap select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8934c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.igra-row { display: flex; gap: 10px; flex-wrap: wrap; }
.igra-row .btn { flex: none; }
.igra-error {
  padding: 12px 14px; border-radius: 12px; background: rgba(240,143,176,.1);
  border: 1px solid rgba(240,143,176,.35); color: var(--rose); font-size: .92rem;
  margin-bottom: 14px;
}
.igra-error[hidden] { display: none !important; }
.igra-hint { font-size: .82rem; color: var(--text-3); }

/* Список партий */
.igra-list { display: flex; flex-direction: column; gap: 10px; }
.igra-chat-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; text-align: left; width: 100%;
}
.igra-chat-item:hover { background: var(--surface-2); border-color: var(--border-strong); }
.igra-chat-item .txt { flex: 1; min-width: 0; }
.igra-chat-item b { display: block; font-size: 1rem; }
.igra-chat-item span { display: block; font-size: .85rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.igra-chat-item .del { flex: none; }
.igra-empty { padding: 40px 20px; text-align: center; color: var(--text-3); }

/* Карточки миров/героев */
.igra-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 8px; }
.igra-pick {
  padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; text-align: left;
}
.igra-pick b { display: block; margin-bottom: 6px; }
.igra-pick span { font-size: .82rem; color: var(--text-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.igra-pick.is-selected { border-color: var(--gold); background: rgba(232,147,76,.1); }
.igra-pick.is-add { display: flex; align-items: center; justify-content: center; color: var(--text-3); border-style: dashed; }
.igra-cards-empty { grid-column: 1 / -1; padding: 4px 2px 10px; font-size: .85rem; color: var(--text-3); }

/* Игровой экран */
.igra-game-head { justify-content: space-between; align-items: center; margin-bottom: 6px; flex-wrap: nowrap; gap: 14px; }
.igra-title-wrap { min-width: 0; flex: 1; }
.igra-title {
  margin: 0; cursor: pointer; border-radius: 8px; padding: 4px 8px; margin-left: -8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.igra-title:hover { background: var(--surface-2); }
.igra-title-input {
  font: inherit; font-family: var(--font-display); font-size: inherit; font-weight: 600;
  color: var(--text); background: rgba(255,255,255,.05); border: 1px solid var(--gold);
  border-radius: 8px; padding: 4px 8px; margin-left: -8px; width: 100%; max-width: 420px;
}
#modelHint { margin: 0 0 14px; }
.igra-turns { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.igra-turn-assistant { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.55; color: #e9e3f5; white-space: pre-wrap; }
.igra-turn-user {
  align-self: flex-end; max-width: 80%; padding: 10px 14px; border-radius: 14px 14px 2px 14px;
  background: rgba(232,180,92,.12); border: 1px solid rgba(232,180,92,.3); color: var(--gold-2);
  white-space: pre-wrap; font-size: .95rem;
}
.igra-caret { display: inline-block; width: 2px; height: 1em; background: var(--gold); vertical-align: -0.15em; margin-left: 2px; animation: igra-blink 1s steps(2) infinite; }
@keyframes igra-blink { 50% { opacity: 0; } }
.igra-input-bar { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 0; background: linear-gradient(0deg, var(--bg) 60%, transparent); }
.igra-input-bar textarea { flex: 1; min-height: 52px; max-height: 160px; }
.igra-world-panel { margin-bottom: 18px; }
.igra-world-panel summary { cursor: pointer; font-size: .9rem; color: var(--text-2); padding: 8px 0; }
.igra-world-panel .body { font-size: .9rem; color: var(--text-2); white-space: pre-wrap; padding: 10px 0; }

@media (max-width: 600px) {
  .igra-main { padding: 16px 16px 32px; }
  .igra-topbar { padding: 10px 12px; flex-wrap: wrap; row-gap: 8px; }
  .igra-topbar .brand span:last-child { display: none; }
  .igra-topbar-actions { gap: 6px; }
  .igra-ink { font-size: .78rem; }
  .igra-topbar-actions .btn-sm { padding: 8px 10px; font-size: .82rem; }
  .igra-game-head { flex-wrap: wrap; }
  .igra-select-wrap { min-width: 0; width: 100%; }
  .igra-title { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .igra-caret { animation: none; }
}
