/**
 * ПЕТУХОМЕТР — Основная таблица стилей
 * Концепция: помпезный псевдогосударственный интерфейс, премиальная эстетика золота и бархата.
 */

:root {
  --bg-primary: #0D1117;
  --bg-secondary: #161B22;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(30, 36, 45, 0.95);
  --bg-crimson: #4A0811;
  --bg-crimson-dark: #2B0409;

  --gold-primary: #D4AF37;
  --gold-light: #FFDF73;
  --gold-dark: #8A6414;
  --gold-gradient: linear-gradient(135deg, #FFF099 0%, #D4AF37 50%, #996515 100%);
  --crimson-gradient: linear-gradient(180deg, #7A0C1B 0%, #3B050C 100%);

  --text-main: #F0F6FC;
  --text-muted: #8B949E;
  --text-gold: #FFDF73;

  --border-gold: rgba(212, 175, 55, 0.4);
  --border-gold-bright: #D4AF37;
  --border-subtle: rgba(240, 246, 252, 0.1);

  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Consolas', 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-gold: 0 8px 32px rgba(212, 175, 55, 0.18);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Сброс и базовые настройки */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(122, 12, 27, 0.35) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(22, 27, 34, 0.8) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Утилиты */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Контейнер */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Фокус-состояния для доступности */
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

/* Верхняя панель (Header) */
.site-header {
  border-bottom: 1px solid var(--border-gold);
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.header-crest {
  width: 38px;
  height: 38px;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.header-logo-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold-light);
}

.header-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 1.1rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-light);
  transform: translateY(-1px);
}

/* Основной контент */
.site-main {
  flex: 1;
  padding: 40px 0 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   1. ГЛАВНЫЙ ЭКРАН (START)
   ========================================================================== */
.hero-card {
  background: var(--bg-card);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  text-align: center;
  box-shadow: var(--shadow-gold), var(--shadow-card);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gold-gradient);
}

.state-emblem-wrapper {
  margin-bottom: 24px;
}

.main-crest-img {
  width: 110px;
  height: 110px;
  filter: drop-shadow(0 6px 16px rgba(212, 175, 55, 0.4));
}

.protocol-badge {
  display: inline-block;
  background: var(--bg-crimson);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  padding: 4px 14px;
  border-radius: 50px;
  margin-bottom: 18px;
}

.main-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.main-subtitle {
  font-size: 1.15rem;
  color: var(--gold-light);
  font-family: var(--font-serif);
  margin-bottom: 20px;
  font-weight: 500;
}

.lead-description {
  font-size: 1.1rem;
  color: var(--text-main);
  max-width: 580px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.action-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
}

.btn-primary-grand {
  background: var(--gold-gradient);
  color: #1A0D00;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 18px 48px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.4);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary-grand:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 32px rgba(255, 215, 0, 0.6);
}

.btn-primary-grand:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-light);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 28px;
  text-align: left;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold-primary);
}

.info-icon {
  font-size: 1.5rem;
}

.info-title {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--gold-light);
}

.info-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   2. ЭКРАН ТЕСТА (QUIZ)
   ========================================================================== */
.quiz-card {
  background: var(--bg-card);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-gold), var(--shadow-card);
  backdrop-filter: blur(16px);
  position: relative;
}

.quiz-header {
  margin-bottom: 28px;
}

.quiz-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.btn-prev {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-prev:hover:not(:disabled) {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
}

.step-badge {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--gold-light);
  background: var(--bg-crimson);
  border: 1px solid var(--border-gold);
  padding: 4px 12px;
  border-radius: 20px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 4px;
  transition: width 0.35s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  font-family: var(--font-mono);
}

.scenario-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.question-text {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
  line-height: 1.45;
  color: #FFFFFF;
  margin-bottom: 30px;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--bg-secondary);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.5;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.option-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-light);
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.15);
}

.option-card.selected {
  background: rgba(122, 12, 27, 0.6);
  border-color: var(--gold-light);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.35);
}

.option-key-badge {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.option-card.selected .option-key-badge {
  background: var(--gold-gradient);
  color: #1A0D00;
  border-color: #FFF;
}

.option-content-text {
  font-size: 1.02rem;
  font-weight: 500;
}

.option-shortcut-hint {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ==========================================================================
   3. ЭКРАН АНАЛИЗА (ANALYSIS)
   ========================================================================== */
.analysis-card {
  background: var(--bg-card);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow-gold), var(--shadow-card);
  max-width: 680px;
  margin: 0 auto;
}

.radar-spinner-container {
  width: 110px;
  height: 110px;
  margin: 0 auto 24px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-circle {
  position: absolute;
  inset: 0;
  border: 2px dashed var(--gold-primary);
  border-radius: 50%;
  animation: radarSpin 6s linear infinite;
}

.radar-inner-icon {
  font-size: 2.8rem;
}

.analysis-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--gold-light);
  margin-bottom: 12px;
}

.analysis-stage-text {
  font-size: 1.05rem;
  color: var(--text-main);
  min-height: 32px;
  margin-bottom: 24px;
  font-weight: 500;
}

.terminal-log {
  background: #06090E;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #A0AEC0;
  text-align: left;
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.terminal-line {
  display: flex;
  gap: 8px;
}

.terminal-time {
  color: var(--text-muted);
}

.terminal-ok {
  color: #2ECC71;
  font-weight: bold;
}

/* ==========================================================================
   4. ЭКРАН РЕЗУЛЬТАТА (RESULT)
   ========================================================================== */
.result-card {
  background: var(--bg-card);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-gold), var(--shadow-card);
  backdrop-filter: blur(16px);
  position: relative;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gold-gradient);
}

.result-header-seal {
  text-align: center;
  margin-bottom: 20px;
}

.seal-img {
  width: 72px;
  height: 72px;
}

.result-header-text {
  text-align: center;
  margin-bottom: 30px;
}

.official-verdict-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gold-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-rank-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.result-tags-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-rank-class {
  background: var(--bg-crimson);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 20px;
}

.badge-rarity {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #E2E8F0;
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 20px;
}

/* Сетка портрета и характеристик */
.result-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.result-portrait-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rooster-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 3px solid var(--gold-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  aspect-ratio: 1 / 1;
}

.rooster-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.overall-cockiness-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.cockiness-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.cockiness-val {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 900;
  color: #FF4757;
}

/* Правая колонка характеристик */
.result-details-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quote-box {
  background: rgba(212, 175, 55, 0.08);
  border-left: 4px solid var(--gold-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
}

.quote-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: #FFF2A1;
  line-height: 1.6;
}

.traits-section-title {
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--gold-light);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.traits-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trait-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trait-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.trait-value {
  font-family: var(--font-mono);
  color: var(--gold-light);
}

.trait-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.trait-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.25, 1, 0.5, 1);
}

.diagnosis-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #D1D5DB;
}

.recommendation-box {
  background: rgba(46, 204, 113, 0.08);
  border-left: 3px solid #2ECC71;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: #E2E8F0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Кнопки действий */
.result-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 28px;
}

.btn-action {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-action-primary {
  background: var(--gold-gradient);
  color: #1A0D00;
  border: none;
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-action-outline {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
}

.btn-action-outline:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-light);
  transform: translateY(-2px);
}

/* ==========================================================================
   5. ПОДВАЛ (FOOTER)
   ========================================================================== */
.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(13, 17, 23, 0.9);
}

.footer-protocol {
  font-family: var(--font-mono);
  margin-bottom: 6px;
  color: var(--gold-primary);
}

/* ==========================================================================
   6. ТОСТ-УВЕДОМЛЕНИЯ
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #1F2937;
  color: #FFFFFF;
  border: 1px solid var(--gold-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   7. АДАПТИВНОСТЬ (RESPONSIVE)
   ========================================================================== */
@media (max-width: 768px) {
  .hero-card, .quiz-card, .analysis-card, .result-card {
    padding: 28px 20px;
  }
  
  .result-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .result-portrait-wrapper {
    max-width: 320px;
    margin: 0 auto;
  }

  .option-card {
    grid-template-columns: 36px 1fr;
    padding: 14px 16px;
    gap: 12px;
  }

  .option-shortcut-hint {
    display: none;
  }

  .option-key-badge {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .badges-grid {
    grid-template-columns: 1fr;
  }
}
