/* Общие стили и переменные */
:root {
  --primary-bg: #0a0a0a;
  --secondary-bg: #1f2329;
  --accent-bg: #1f2329;
  --text-primary: #f5f0da;
  --text-secondary: #a3977c;
  --accent-color: #845f16;
  --accent-hover: #845f16;
  --accent-check: #a4e2d1;
  --error-color: #c4472b;
  --success-color: #a4e2d1;
  --warning-color: #845f16;
  --border-color: #845f16;
  --shadow-color: rgba(132, 95, 22, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(
      135deg,
      rgba(10, 10, 10, 0.85) 0%,
      rgba(31, 35, 41, 0.85) 100%
    ),
    url("assets/background.svg") center center / cover no-repeat fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Добавляем эффект параллакса для фона */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("assets/background.svg") center center / cover no-repeat;
  z-index: -2;
  opacity: 0.6;
  animation: slowFloat 20s ease-in-out infinite;
}

/* Дополнительный слой для улучшения читаемости */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 10, 0.7) 0%,
    rgba(31, 35, 41, 0.7) 100%
  );
  z-index: -1;
}

/* Поддержка Unicode символов */
@font-face {
  font-family: "Unicode-Support";
  src: local("Noto Sans Symbols"), local("Arial Unicode MS"),
    local("Lucida Grande");
  unicode-range: U+0000- U+FFFF;
}

.container {
  max-width: 1200px; /* Увеличиваем максимальную ширину */
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Заголовок */
header {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeInDown 0.8s ease-out;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  background: linear-gradient(45deg, var(--accent-color), #a67c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px var(--shadow-color);
  position: relative;
  z-index: 2;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Основной интерфейс */
.quest-interface {
  background: rgba(31, 35, 41, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.3);
  animation: fadeInUp 0.8s ease-out;
  position: relative;
  z-index: 1;
}

/* Новый layout для игры */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  min-height: 600px;
}

/* Левая колонка - ввод и клавиатура */
.input-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Правая колонка - результаты */
.results-column {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Placeholder для пустой правой колонки */
.results-placeholder {
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 2px dashed rgba(132, 95, 22, 0.4);
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.placeholder-content {
  color: var(--text-secondary);
  text-align: center;
  width: 100%;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  opacity: 0.7;
}

.placeholder-content h3 {
  margin-bottom: 10px;
  color: var(--text-secondary);
  text-align: center;
  width: 100%;
}

.placeholder-content p {
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 250px;
  text-align: center;
  margin: 0 auto;
}



/* Индикатор прогресса */
.progress-indicator {
  text-align: center;
  margin-bottom: 30px;
}

#progress-text {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--secondary-bg);
  border-radius: 10px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 300px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #a67c00);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

/* Поля ввода */
.input-section {
  margin-bottom: 30px;
}

/* Обновляем поля ввода для новой компоновки */
.symbol-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.symbol-input {
  width: 100%;
  height: 80px;
  background: rgba(31, 35, 41, 0.9);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 2px solid var(--border-color);
  border-radius: 15px;
  color: var(--text-primary);
  font-size: 2.5rem;
  font-family: "Unicode-Support", monospace, serif;
  font-variant-emoji: text;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.symbol-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 20px var(--shadow-color);
  transform: scale(1.05);
}

.symbol-input.filled {
  background: var(--accent-bg);
  border-color: var(--accent-color);
  animation: pulse 0.5s ease-in-out;
}

.clear-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 25px;
  height: 25px;
  background: var(--error-color);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.input-group:hover .clear-btn,
.symbol-input.filled + .clear-btn {
  display: flex;
}

.clear-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Кнопки действий */
.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  min-width: 120px;
}

.btn-primary {
  background: linear-gradient(45deg, var(--accent-color), #a67c00);
  color: #f5f0da;
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Виртуальная клавиатура */
/* Обновляем виртуальную клавиатуру для новой компоновки */
.virtual-keyboard {
  margin-bottom: 20px;
}

.virtual-keyboard h3 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  gap: 8px;
  max-width: 100%;
}

.symbol-key {
  background: rgba(31, 35, 41, 0.9);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 15px;
  font-size: 3rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Unicode-Support", monospace, serif;
  font-variant-emoji: text;
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.symbol-key:hover {
  background: var(--accent-bg);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.symbol-key:active {
  transform: translateY(0);
}

.symbol-key.used {
  opacity: 0.5;
  background: var(--border-color);
  cursor: not-allowed;
}

/* Сообщения */
.error-message {
  background: rgba(196, 71, 43, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
  animation: shake 0.5s ease-in-out;
}

.success-message {
  background: rgba(164, 226, 209, 0.1);
  border: 1px solid var(--success-color);
  color: var(--success-color);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
  animation: bounce 0.5s ease-in-out;
}

/* Результат истории */
/* Обновленные стили для результатов */
.story-result {
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 25px;
  border: 1px solid var(--accent-color);
  animation: fadeIn 0.8s ease-out;
  height: fit-content;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.story-result h3 {
  color: var(--accent-color);
  margin-bottom: 20px;
  text-align: center;
}

.story-fragments {
  margin-bottom: 20px;
}

.story-fragment {
  background: rgba(31, 35, 41, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 10px;
  border-left: 4px solid var(--accent-color);
  animation: slideInLeft 0.5s ease-out;
  position: relative;
  z-index: 1;
}

.story-fragment:last-child {
  margin-bottom: 0;
}

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

/* Загрузка */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: var(--text-primary);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

/* Футер */
footer {
  margin-top: auto;
  background: linear-gradient(
    135deg,
    rgba(31, 35, 41, 0.9) 0%,
    rgba(10, 10, 10, 0.95) 100%
  );
  border-top: 1px solid rgba(132, 95, 22, 0.3);
  position: relative;
  overflow: hidden;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

.footer-divider {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-color) 20%,
    #ffd700 50%,
    var(--accent-color) 80%,
    transparent 100%
  );
  margin: 0 auto;
  animation: shimmer 3s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(132, 95, 22, 0.5);
}

.footer-main {
  text-align: center;
  padding: 25px 0 15px 0;
}

.footer-motto {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(132, 95, 22, 0.3);
  animation: fadeInDown 0.8s ease-out;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  animation: fadeInUp 1s ease-out;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.footer-links a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(132, 95, 22, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

.footer-links a:hover {
  color: var(--accent-color);
  background: rgba(132, 95, 22, 0.1);
  text-shadow: 0 0 10px var(--shadow-color);
  transform: translateY(-2px);
}

.footer-links a:hover::before {
  left: 100%;
}

.footer-links .main-site-link {
  background: linear-gradient(
    135deg,
    rgba(132, 95, 22, 0.2) 0%,
    rgba(132, 95, 22, 0.1) 100%
  );
  border: 1px solid rgba(132, 95, 22, 0.3);
  color: var(--accent-color);
  font-weight: 500;
}

.footer-links .main-site-link:hover {
  background: linear-gradient(
    135deg,
    rgba(132, 95, 22, 0.3) 0%,
    rgba(132, 95, 22, 0.2) 100%
  );
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(132, 95, 22, 0.4);
}

.footer-links .separator {
  color: var(--text-secondary);
  opacity: 0.6;
  margin: 0 5px;
  font-size: 0.8rem;
}

.footer-bottom {
  text-align: center;
  padding: 15px 0 20px 0;
  border-top: 1px solid rgba(132, 95, 22, 0.1);
  margin-top: 10px;
}

.footer-copyright {
  color: var(--text-secondary);
  font-size: 0.8rem;
  opacity: 0.8;
  margin: 0;
  animation: fadeIn 1.2s ease-out;
}

/* Анимация мерцания для разделителя */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .footer-links {
    flex-direction: column;
    gap: 15px;
  }

  .footer-links .separator {
    display: none;
  }

  .footer-motto {
    font-size: 1rem;
  }

  .footer-links a {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
}

/* Анимации */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Анимация для медленного движения фона */
@keyframes slowFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1.05);
  }
  50% {
    transform: translate(-10px, -10px) scale(1.1);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  header h1 {
    font-size: 2rem;
  }

  .quest-interface {
    padding: 20px;
  }

  /* На мобильных возвращаемся к вертикальному layout */
  .game-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: auto;
  }

  .results-column {
    order: 2;
  }

  .input-column {
    order: 1;
  }

  .results-placeholder {
    min-height: 200px;
    padding: 30px 20px;
  }

  .placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
  }

  .story-result {
    max-height: 60vh;
  }

  .symbol-inputs {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .symbol-input {
    height: 75px;
    font-size: 2.2rem;
    font-variant-emoji: text;
  }

  .keyboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 8px;
  }

  .symbol-key {
    padding: 12px;
    font-size: 1.3rem;
    min-height: 50px;
  }

  .action-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .symbol-inputs {
    grid-template-columns: 1fr 1fr;
  }

  .symbol-input {
    height: 65px;
    font-size: 2rem;
    font-variant-emoji: text;
  }

  .keyboard-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .symbol-key {
    padding: 10px;
    font-size: 1.8rem;
    font-variant-emoji: text;
    min-height: 50px;
  }

  .results-placeholder {
    min-height: 150px;
    padding: 20px 15px;
  }

  .placeholder-icon {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .placeholder-content h3 {
    font-size: 1.1rem;
    text-align: center;
  }

  .placeholder-content p {
    font-size: 0.85rem;
    text-align: center;
  }
}
