/* ===================== БАЗОВЫЕ СТИЛИ ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --hell-red: #8b0000;
  --hell-orange: #ff4500;
  --hell-fire: #ff6600;
  --hell-gold: #ffd700;
  --hell-dark: #0a0000;
  --hell-darker: #050000;
  --bone-white: #e8dcc8;
  --bone-shadow: #b8a88c;
  --text-glow: 0 0 20px rgba(255, 69, 0, 0.8), 0 0 40px rgba(255, 69, 0, 0.4);
}

body {
  font-family: 'Segoe UI', 'Arial Black', sans-serif;
  background: var(--hell-darker);
  color: var(--bone-white);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===================== ОГОНЬ CANVAS ===================== */
#fireCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===================== ЭКРАНЫ ===================== */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}
.screen.active { display: flex; }

/* ===================== ТИТУЛЬНЫЙ ЭКРАН ===================== */
#intro {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(139,0,0,0.3) 0%, transparent 70%);
}

.intro-content {
  animation: fadeInUp 1.2s ease-out;
}

.crown-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

h1.glitch {
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hell-orange);
  text-shadow: var(--text-glow);
  position: relative;
  animation: glitchFlicker 4s infinite;
}

h1.glitch::before,
h1.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
h1.glitch::before {
  color: #ff0000;
  animation: glitch1 3s infinite;
  clip-path: inset(0 0 60% 0);
  z-index: -1;
}
h1.glitch::after {
  color: #00ffff;
  animation: glitch2 3s infinite;
  clip-path: inset(60% 0 0 0);
  z-index: -1;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--bone-shadow);
  margin: 1rem 0 2rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hell-btn {
  font-size: 1.3rem;
  font-weight: 800;
  padding: 1rem 3rem;
  border: 3px solid var(--hell-orange);
  background: linear-gradient(135deg, #1a0000 0%, #3a0000 50%, #1a0000 100%);
  color: var(--hell-orange);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  overflow: hidden;
}
.hell-btn::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,69,0,0.15) 0%, transparent 70%);
  animation: btnGlow 2s ease-in-out infinite;
}
.hell-btn:hover {
  background: linear-gradient(135deg, #3a0000 0%, #660000 50%, #3a0000 100%);
  border-color: var(--hell-gold);
  color: var(--hell-gold);
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255,69,0,0.6), 0 0 60px rgba(255,69,0,0.3);
}
.btn-icon { margin-right: 0.5rem; }

/* ===================== ТРОННЫЙ ЗАЛ ===================== */
#throneRoom {
  flex-direction: column;
  align-items: center;
  background: radial-gradient(ellipse at top, rgba(139,0,0,0.15) 0%, transparent 60%);
  padding: 2rem 1rem 4rem;
}

.throne-room {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.king-status {
  text-align: center;
  animation: fadeInDown 0.8s ease-out;
}
.king-status .crown {
  font-size: 3.5rem;
  animation: float 2.5s ease-in-out infinite;
}
.king-status h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--hell-gold);
  text-shadow: 0 0 15px rgba(255,215,0,0.6);
  margin: 0.5rem 0 0.3rem;
}
.king-name {
  font-size: 1.1rem;
  color: var(--bone-shadow);
  font-style: italic;
}

/* ===================== ТРОН ===================== */
.throne-area {
  position: relative;
  width: 260px;
  height: 220px;
  margin: 1rem 0;
}

.throne {
  position: relative;
  width: 100%;
  height: 100%;
}

.throne-back {
  position: absolute;
  top: 0; left: 20px;
  width: 220px; height: 120px;
  background: linear-gradient(180deg, #4a0000, #2a0000);
  border: 4px solid var(--hell-orange);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 0 20px rgba(255,69,0,0.4), inset 0 0 30px rgba(0,0,0,0.5);
}
.throne-back::before {
  content: '☠️';
  position: absolute;
  top: 15px; left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  filter: drop-shadow(0 0 8px rgba(255,69,0,0.8));
}

.throne-seat {
  position: absolute;
  top: 116px; left: 30px;
  width: 200px; height: 40px;
  background: linear-gradient(180deg, #5a1000, #3a0800);
  border: 3px solid var(--hell-fire);
  border-radius: 5px;
  box-shadow: 0 4px 15px rgba(255,69,0,0.3);
}

.throne-arm-left, .throne-arm-right {
  position: absolute;
  top: 80px;
  width: 35px; height: 75px;
  background: linear-gradient(180deg, #4a0800, #2a0000);
  border: 3px solid var(--hell-orange);
  border-radius: 5px;
}
.throne-arm-left { left: 0; }
.throne-arm-right { right: 0; }

.throne-base {
  position: absolute;
  bottom: 0; left: 15px;
  width: 230px; height: 50px;
  background: linear-gradient(180deg, #3a0800, #1a0000);
  border: 3px solid var(--hell-orange);
  border-radius: 0 0 8px 8px;
}

.king-sitting {
  position: absolute;
  top: 55px; left: 50%;
  transform: translateX(-50%);
  font-size: 3.5rem;
  z-index: 5;
  animation: kingPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255,215,0,0.8));
}

/* ===================== СКЕЛЕТЫ ===================== */
.skeletons-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 700px;
  gap: 1rem;
}

.skeleton-row {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.skeleton {
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s;
}
.skeleton:hover { transform: scale(1.15); }

.skull {
  font-size: 3rem;
  filter: drop-shadow(0 0 8px rgba(255,69,0,0.5));
  transition: transform 0.3s;
}
.skel-name {
  font-size: 0.85rem;
  color: var(--bone-shadow);
  margin-top: 0.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Анимации скелетов */
.skeleton.bowing .skull {
  animation: bow 1s ease-in-out;
}
.skeleton.dancing .skull {
  animation: dance 0.6s ease-in-out infinite;
}
.skeleton.attacking .skull {
  animation: attack 0.5s ease-in-out;
}
.skeleton.waving .skull {
  animation: wave 0.8s ease-in-out infinite;
}
.skeleton.spinning .skull {
  animation: spin 1s linear;
}
.skeleton.sleeping .skull {
  animation: sleep 2s ease-in-out infinite;
  filter: grayscale(0.5);
}

/* ===================== ПАНЕЛЬ КОМАНД ===================== */
.command-panel {
  background: rgba(20, 0, 0, 0.85);
  border: 2px solid var(--hell-orange);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 0 30px rgba(255,69,0,0.2);
}
.command-panel h3 {
  text-align: center;
  color: var(--hell-gold);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px rgba(255,215,0,0.4);
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.cmd-btn {
  padding: 0.8rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  border: 2px solid #5a1000;
  background: linear-gradient(135deg, #1a0500, #2a0800);
  color: var(--bone-white);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
}
.cmd-btn:hover {
  border-color: var(--hell-orange);
  background: linear-gradient(135deg, #3a0800, #5a1000);
  color: var(--hell-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255,69,0,0.4);
}
.cmd-btn:active {
  transform: scale(0.95);
}

/* ===================== УКАЗЫ ===================== */
.decree-panel {
  background: rgba(20, 0, 0, 0.85);
  border: 2px solid var(--hell-gold);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 0 30px rgba(255,215,0,0.15);
}
.decree-panel h3 {
  text-align: center;
  color: var(--hell-gold);
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

.decree-log {
  max-height: 180px;
  overflow-y: auto;
  padding: 0.8rem;
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(255,215,0,0.15);
}
.decree-log::-webkit-scrollbar { width: 6px; }
.decree-log::-webkit-scrollbar-track { background: transparent; }
.decree-log::-webkit-scrollbar-thumb { background: var(--hell-orange); border-radius: 3px; }

.decree-entry {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,69,0,0.15);
  font-size: 0.9rem;
  line-height: 1.5;
}
.decree-entry:last-child { border-bottom: none; }

.decree-input {
  display: flex;
  gap: 0.5rem;
}
.decree-input input {
  flex: 1;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border: 2px solid #5a1000;
  background: rgba(10,0,0,0.8);
  color: var(--bone-white);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.3s;
}
.decree-input input:focus {
  border-color: var(--hell-gold);
}
.decree-input input::placeholder {
  color: #664444;
}
.decree-btn {
  padding: 0.8rem 1.2rem;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid var(--hell-gold);
  background: linear-gradient(135deg, #2a1500, #3a2000);
  color: var(--hell-gold);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}
.decree-btn:hover {
  background: linear-gradient(135deg, #3a2000, #5a3000);
  box-shadow: 0 0 15px rgba(255,215,0,0.4);
}

/* ===================== АНИМАЦИИ ===================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes kingPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); }
}
@keyframes bow {
  0% { transform: rotate(0); }
  40% { transform: rotate(30deg) translateY(10px); }
  70% { transform: rotate(25deg) translateY(8px); }
  100% { transform: rotate(0); }
}
@keyframes dance {
  0%, 100% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-15deg) translateY(-8px); }
  50% { transform: rotate(0) translateY(0); }
  75% { transform: rotate(15deg) translateY(-8px); }
}
@keyframes attack {
  0% { transform: scale(1) rotate(0); }
  30% { transform: scale(1.3) rotate(-10deg); }
  50% { transform: scale(0.9) rotate(15deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes wave {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-20deg); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes sleep {
  0%, 100% { transform: translateY(0) rotate(0); opacity: 1; }
  50% { transform: translateY(5px) rotate(-5deg); opacity: 0.6; }
}

/* Glitch */
@keyframes glitchFlicker {
  0%, 92%, 94%, 96%, 100% { opacity: 1; }
  93% { opacity: 0.8; transform: translateX(2px); }
  95% { opacity: 0.9; transform: translateX(-1px); }
}
@keyframes glitch1 {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(3px, -2px); }
  94% { transform: translate(-3px, 1px); }
}
@keyframes glitch2 {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(-2px, 2px); }
  95% { transform: translate(2px, -1px); }
}
@keyframes btnGlow {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}

/* ===================== АДАПТИВ ===================== */
@media (max-width: 500px) {
  .command-grid { grid-template-columns: repeat(2, 1fr); }
  .throne-area { transform: scale(0.8); }
  .skeletons-container { max-width: 100%; }
  .skull { font-size: 2.2rem; }
}
