/* ==========================================================================
   Дизайн-система pigmus.online – общая для всех pet-проектов
   Эталон: TIA Web (/opt/tia-web/frontend/src/index.css), 13.09.2026
   ========================================================================== */

:root {
  /* Палитра */
  --bg: #0f1412;
  --surface: #161d19;
  --surface-2: #1b231f;
  --line: rgba(232, 228, 216, 0.09);
  --text: #e8e4d8;
  --text-dim: #9aa39c;
  --accent: #d4af37;
  --accent-soft: #e3c355;
  --cream: #e8dcc0;

  /* Раскладка */
  --radius: 14px;
  --container: 768px; /* max-w-3xl */

  /* Шрифты */
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(212, 175, 55, 0.25); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a332e; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a453e; }

.font-display { font-family: var(--font-display); }

/* ── Шапка (sticky, h-16) ───────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 18, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  color: var(--cream);
}
.brand .accent { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.site-nav a {
  font-size: 0.875rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--accent); }

/* ── Подвал ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 64px;
}
.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px 20px;
  font-size: 0.875rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-footer__inner a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer__inner a:hover { color: var(--accent); }

/* ── Основной контейнер и заголовок страницы ────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px 20px;
  flex: 1;
}

.page-head { margin-bottom: 2rem; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.25rem);
  line-height: 1.2;
  color: var(--cream);
  margin-bottom: 0.6rem;
}
.page-head p {
  color: var(--text-dim);
  font-size: 1rem;
  max-width: 640px;
}

/* ── Карточки ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ── Поля ввода ─────────────────────────────────────────────────────── */
textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}
textarea { resize: vertical; min-height: 90px; }
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
select { appearance: none; cursor: pointer; }
::placeholder { color: #5c655f; }

/* ── Настройки: две колонки ─────────────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.option-group { display: flex; flex-direction: column; gap: 0.4rem; }
.option-title {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 0.95rem;
  color: var(--text);
}
.radio-option:hover { border-color: rgba(212, 175, 55, 0.5); }
.radio-option input[type="radio"] { accent-color: var(--accent); width: 1rem; height: 1rem; flex-shrink: 0; cursor: pointer; }
.radio-option.selected { border-color: var(--accent); }

/* «?» и всплывающая подсказка */
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: auto;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--accent);
  font-size: 0.75rem;
  cursor: help;
  flex-shrink: 0;
  user-select: none;
}
.tip:hover, .tip.tip-open { background: rgba(212, 175, 55, 0.15); }
.tip-popover {
  position: fixed;
  z-index: 100;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ── Кнопки ─────────────────────────────────────────────────────────── */
button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  margin-top: 1.25rem;
}
button:hover:not(:disabled) { background: var(--accent-soft); }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Спиннер и ошибки ───────────────────────────────────────────────── */
.spinner { display: none; text-align: center; padding: 1rem; color: var(--text-dim); }
.spinner.active { display: block; }
.spinner::after {
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(212, 175, 55, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  color: #e8b4b4;
  padding: 1rem;
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius);
  display: none;
  margin-top: 1rem;
}
.error.visible { display: block; }

.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Результат ──────────────────────────────────────────────────────── */
.result { display: none; margin-top: 1.5rem; }
.result.visible { display: block; }
.result-head {
  text-align: center;
  font-family: var(--font-display);
  color: var(--cream);
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.positions { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.25rem; }
.position-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.position-name {
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.position-rune { font-family: var(--font-display); font-size: 1.15rem; color: var(--cream); }
.position-rune .meaning { color: var(--text-dim); font-size: 0.9rem; }
.position-state { display: inline-block; margin-top: 0.4rem; font-size: 0.8rem; padding: 0.15rem 0.6rem; border-radius: 999px; }
.position-state.upright { background: rgba(212, 175, 55, 0.15); color: var(--accent); }
.position-state.reversed { background: rgba(231, 76, 60, 0.2); color: #e8b4b4; }
.reading {
  padding: 1.5rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
  line-height: 1.7;
}
.reading h3 { font-family: var(--font-display); color: var(--cream); margin-bottom: 0.75rem; }
.reading .stub-note { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.75rem; }

@media (max-width: 600px) {
  .container { padding: 24px 16px; }
  .options-grid { grid-template-columns: 1fr; }
  .site-header__inner { padding: 0 16px; }
  .site-footer__inner { padding: 20px 16px; }
}
