/* ==========================================================================
   SŁAWA: 536 – ŚWIT POPIOŁÓW | Główne Style UI & Słowiańska Estetyka
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=MedievalSharp&family=Metamorphous&family=VT323&display=swap');

:root {
  --bg-dark: #0d0907;
  --bg-panel: rgba(22, 14, 10, 0.95);
  --bg-panel-light: rgba(45, 28, 20, 0.92);
  --wood-border: #52311c;
  --wood-border-light: #7c4c2d;
  --gold-primary: #d49b42;
  --gold-bright: #ffe17d;
  --gold-dark: #8c581a;
  --red-fire: #d9381e;
  --blue-perun: #38bdf8;
  --green-forest: #2e7d32;
  --purple-navia: #8b5cf6;
  --text-main: #f5e6d3;
  --text-dim: #bda38b;
  --font-slavic: 'Cinzel', 'MedievalSharp', 'Georgia', serif;
  --font-pixel: 'VT323', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-slavic);
  font-size: 16px;
  touch-action: none;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1e130c 0%, #080504 100%);
}

/* Płótno gry - Pixel Art Canvas */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  z-index: 1;
  background-color: #100b08;
}

/* Warstwa Efektów Pogodowych / Oświetlenia */
#fx-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* ==========================================================================
   Ekrany Menu i Okna Modalne
   ========================================================================== */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
  background: radial-gradient(circle at center, rgba(35, 20, 14, 0.94) 0%, rgba(10, 6, 4, 0.98) 100%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  box-sizing: border-box;
}

.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Główny Tytuł Gry */
.game-title-box {
  text-align: center;
  margin-bottom: 24px;
}

.game-title-sub {
  font-size: 1.1rem;
  letter-spacing: 6px;
  color: var(--gold-primary);
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(212, 155, 66, 0.6);
}

.game-title-main {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  color: var(--gold-bright);
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.9), 0 0 25px rgba(217, 56, 30, 0.7);
  letter-spacing: 4px;
  margin: 4px 0;
}

.game-title-desc {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: #d1b89d;
  font-style: italic;
  max-width: 650px;
  line-height: 1.5;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Słowiańska Ramka Ozdobna */
.slavic-panel {
  background: var(--bg-panel);
  border: 3px solid var(--gold-dark);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.9), inset 0 0 15px rgba(140, 88, 26, 0.3);
  border-radius: 4px;
  position: relative;
}

.slavic-panel::before {
  content: "❖";
  position: absolute;
  top: -12px;
  left: -12px;
  color: var(--gold-primary);
  font-size: 20px;
  text-shadow: 0 0 8px var(--gold-primary);
}

.slavic-panel::after {
  content: "❖";
  position: absolute;
  bottom: -12px;
  right: -12px;
  color: var(--gold-primary);
  font-size: 20px;
  text-shadow: 0 0 8px var(--gold-primary);
}

/* Przyciski Słowiańskie */
.btn-slavic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, #442615 0%, #24140b 100%);
  color: var(--gold-bright);
  font-family: var(--font-slavic);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 24px;
  margin: 6px;
  border: 2px solid var(--gold-dark);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  box-sizing: border-box;
  max-width: 100%;
}

.btn-slavic:hover {
  background: linear-gradient(180deg, #5c351f 0%, #351e11 100%);
  border-color: var(--gold-bright);
  color: #fff;
  box-shadow: 0 0 15px rgba(212, 155, 66, 0.5), 0 4px 12px rgba(0,0,0,0.8);
  transform: translateY(-2px);
}

.btn-slavic:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.btn-slavic.btn-primary {
  background: linear-gradient(180deg, #8c3614 0%, #4a1905 100%);
  border-color: var(--gold-primary);
  font-size: 1.25rem;
  padding: 14px 36px;
}

.btn-slavic.btn-primary:hover {
  background: linear-gradient(180deg, #b04318 0%, #632207 100%);
  border-color: #fff;
  box-shadow: 0 0 20px rgba(217, 56, 30, 0.7);
}

.btn-slavic.btn-small {
  font-size: 0.85rem;
  padding: 6px 14px;
  margin: 4px;
}

/* Menu Przyciski - Lista */
.menu-buttons {
  display: flex;
  flex-direction: column;
  width: 320px;
  max-width: 90vw;
}

/* Wybór Klasy Bohatera (Karty w Kreacji Postaci) */
.char-class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.char-class-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(180deg, #381f11 0%, #1c0e07 100%);
  border: 2px solid var(--gold-dark);
  border-radius: 6px;
  padding: 10px 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-main);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  min-width: 0;
  user-select: none;
}

.char-class-card:hover {
  border-color: var(--gold-primary);
  background: linear-gradient(180deg, #4f2c18 0%, #28140a 100%);
  transform: translateY(-2px);
}

.char-class-card.active {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, #7c3b17 0%, #3d1b08 100%);
  box-shadow: 0 0 15px rgba(212, 155, 66, 0.6), inset 0 0 10px rgba(255, 225, 125, 0.2);
  transform: scale(1.03);
}

.char-class-card-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.char-class-card-title {
  font-family: var(--font-slavic);
  font-size: clamp(0.72rem, 2.8vw, 0.95rem);
  font-weight: bold;
  color: var(--gold-bright);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.char-class-card-type {
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Modale i Okna Informacyjne */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden {
  display: none;
}

.modal-window {
  width: 92%;
  max-width: 780px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  background: var(--bg-panel);
  border: 3px solid var(--gold-primary);
  border-radius: 6px;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.95);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--gold-dark);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.6rem;
  color: var(--gold-bright);
  text-shadow: 0 0 8px rgba(212, 155, 66, 0.5);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--red-fire);
}

/* Suwaki i Paski Przewijania */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #140d09;
}
::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Pasek Powiadomień i Toast */
#toast-container {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  max-width: 80vw;
}

.toast {
  background: rgba(22, 14, 10, 0.92);
  border: 1.5px solid var(--gold-primary);
  color: var(--text-main);
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  animation: toastFadeIn 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast-icon {
  font-size: 1rem;
  color: var(--gold-bright);
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Style Kart Slotów Zapisu Gry (Save & Load Slots)
   ========================================================================== */

.save-slot-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  padding: 10px 12px;
  transition: all 0.2s;
}

.save-slot-card:hover {
  border-color: var(--gold-bright);
  background: rgba(30, 18, 12, 0.6);
}

.save-slot-card.populated {
  border-left: 3px solid var(--gold-bright);
}

.save-slot-card.empty {
  border-style: dashed;
  opacity: 0.85;
}

.save-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(212, 155, 66, 0.2);
  padding-bottom: 4px;
}

.save-slot-title {
  font-weight: bold;
  color: var(--gold-bright);
  font-size: 0.88rem;
}

.save-slot-date {
  font-size: 0.72rem;
  color: var(--gold-primary);
}

.save-slot-body {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.save-hero-avatar {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  background: #140b07;
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.save-hero-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.save-hero-name {
  font-weight: bold;
  font-size: 0.88rem;
  color: #fff;
}

.save-hero-lvl {
  font-size: 0.72rem;
  color: var(--gold-bright);
  margin-left: 4px;
}

.save-act-name {
  font-size: 0.75rem;
  color: #d1b89d;
}

.save-resources-preview {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.save-slot-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.btn-danger {
  border-color: #ef4444;
  color: #fca5a5;
}

.btn-danger:hover {
  background: #991b1b;
  color: #fff;
}

/* ==========================================================================
   Kompendium Słowiańskie (Encyklopedia, Bestiariusz, Budowle, NPC)
   ========================================================================== */

.codex-tab-btn {
  background: rgba(30, 18, 12, 0.85);
  border: 1px solid var(--gold-dark);
  color: var(--text-dim);
  padding: 8px 12px;
  font-family: var(--font-slavic);
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.codex-tab-btn:hover {
  background: rgba(65, 40, 25, 0.9);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

.codex-tab-btn.active {
  background: linear-gradient(180deg, #78350f 0%, #451a03 100%);
  border-color: var(--gold-bright);
  color: #fff;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(212, 155, 66, 0.4);
}

.codex-count-badge {
  font-size: 0.7rem;
  opacity: 0.8;
}

.codex-list-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 155, 66, 0.25);
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.codex-list-card:hover {
  background: rgba(65, 40, 25, 0.5);
  border-color: var(--gold-primary);
  transform: translateX(2px);
}

.codex-list-card.selected {
  background: rgba(120, 53, 15, 0.6);
  border-color: var(--gold-bright);
  box-shadow: inset 0 0 8px rgba(212, 155, 66, 0.3);
}

.codex-card-icon {
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  border: 1px solid rgba(212, 155, 66, 0.4);
  flex-shrink: 0;
}

.codex-card-name {
  font-weight: bold;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.codex-card-sub {
  font-size: 0.72rem;
  color: var(--gold-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.codex-detail-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(212, 155, 66, 0.3);
  padding-bottom: 10px;
}

.codex-big-avatar {
  font-size: 2.8rem;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--gold-primary);
  border-radius: 6px;
  flex-shrink: 0;
}

.codex-lore-box {
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  border-radius: 4px;
  border-left: 3px solid var(--gold-primary);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 12px;
  font-style: italic;
}


