/* ==========================================================================
   ZÁKLADNÍ NASTAVENÍ A PROMĚNNÉ
   ========================================================================== */
:root {
  --th-primary: #4CAF50; /* Zelená hlavní */
  --th-primary-dark: #2E7D32; /* Tmavě zelená */
  --th-primary-light: #C8E6C9; /* Světle zelená */
  --th-bg-color: #f9fbf9; /* Velmi světlé pozadí */
  --th-text-dark: #1b3a1d;
  --th-text-light: #555;
  --th-card-bg: #ffffff;
  --th-border-radius: 12px;
  --th-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  --th-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.12);
  --th-transition: all 0.3s ease;
}

/* ==========================================================================
   OBECNÉ STYLY HRY
   ========================================================================== */
.th-game-container {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--th-bg-color);
  color: var(--th-text-dark);
  border-radius: var(--th-border-radius);
  box-shadow: var(--th-shadow);
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
}

.th-game-container h1, 
.th-game-container h2, 
.th-game-container h3 {
  color: var(--th-primary-dark);
  text-align: center;
  margin-top: 0;
}

.th-btn {
  background-color: var(--th-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1.1rem;
  border-radius: var(--th-border-radius);
  cursor: pointer;
  transition: var(--th-transition);
  font-weight: bold;
  margin: 5px;
}

.th-btn:hover {
  background-color: var(--th-primary-dark);
  transform: translateY(-2px);
}

.th-btn-secondary {
  background-color: var(--th-primary-light);
  color: var(--th-primary-dark);
}

.th-btn-secondary:hover {
  background-color: #A5D6A7;
}

/* ==========================================================================
   ÚVODNÍ OBRAZOVKA (VÝBĚR HRY)
   ========================================================================== */
.th-screen {
  display: none;
  flex-direction: column;
  flex: 1;
}

.th-screen.active {
  display: flex;
}

.th-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.th-pack-card {
  background: var(--th-card-bg);
  border: 2px solid var(--th-primary-light);
  border-radius: var(--th-border-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--th-transition);
  box-shadow: var(--th-shadow);
}

.th-pack-card:hover {
  border-color: var(--th-primary);
  box-shadow: var(--th-shadow-hover);
  transform: translateY(-5px);
}

.th-pack-card h3 {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.th-pack-card p {
  color: var(--th-text-light);
  margin-bottom: 15px;
}

.th-pack-locked {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.th-pack-locked::after {
  content: '🔒';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
}

/* ==========================================================================
   HERNÍ OBRAZOVKA
   ========================================================================== */
.th-header-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: var(--th-primary-light);
  padding: 10px 20px;
  border-radius: var(--th-border-radius);
  margin-bottom: 20px;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--th-primary-dark);
}

/* KATEGORIE (Hlavní sloupce) */
.th-categories-container {
  display: flex;
  gap: 15px;
  overflow-x: auto; /* Pro mobilní zařízení */
  padding-bottom: 10px;
  margin-bottom: 20px;
  min-height: 150px;
}

.th-category-col {
  flex: 1;
  min-width: 160px;
  background: #f1f8e9;
  border: 2px dashed #c5e1a5;
  border-radius: var(--th-border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  transition: var(--th-transition);
}

.th-category-col.drag-over {
  background: var(--th-primary-light);
  border-color: var(--th-primary);
}

.th-category-header {
  text-align: center;
  margin-bottom: 15px;
  pointer-events: none; /* Aby nebránilo drag & drop eventům */
}

.th-category-icon {
  font-size: 2.5rem;
  margin-bottom: 5px;
  display: block;
}

.th-category-title {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--th-primary-dark);
}

/* PROSTOR PRO KARTY (Balíček ke třídění) */
.th-deck-container {
  background: #e8f5e9;
  border-radius: var(--th-border-radius);
  padding: 20px;
  min-height: 200px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-top: auto;
}

/* SAMOTNÁ KARTA */
.th-card {
  background: var(--th-card-bg);
  border: 2px solid #e0e0e0;
  border-radius: var(--th-border-radius);
  padding: 15px;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--th-text-dark);
  box-shadow: var(--th-shadow);
  cursor: grab;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-width: 120px;
  max-width: 200px;
  min-height: 80px;
  transition: transform 0.2s, box-shadow 0.2s;
  touch-action: none; /* Pro lepší podporu touch drag */
}

.th-card:active {
  cursor: grabbing;
  transform: scale(1.05);
  box-shadow: var(--th-shadow-hover);
}

.th-card.dragging {
  opacity: 0.5;
}

.th-card.placed {
  cursor: default;
  transform: none;
  box-shadow: none;
  border-color: var(--th-primary);
  background-color: white;
  margin-bottom: 10px;
  width: 90%;
  font-size: 1rem;
  min-height: 60px;
}

/* Obrázková karta */
.th-card-image img {
  max-width: 100%;
  max-height: 100px;
  border-radius: 8px;
  pointer-events: none;
}

/* Vlajková karta */
.th-card-flag {
  padding: 8px;
  min-width: 100px;
  min-height: 70px;
}

.th-card-flag img {
  max-width: 100%;
  max-height: 80px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Zpětná vazba (toast/alert) */
.th-feedback {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--th-primary);
  color: white;
  padding: 10px 25px;
  border-radius: 30px;
  font-weight: bold;
  box-shadow: var(--th-shadow-hover);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  font-size: 1.2rem;
}

.th-feedback.show {
  opacity: 1;
  visibility: visible;
  bottom: 50px;
}

.th-feedback.error {
  background: #f44336;
}

/* Animace chyby */
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(10px); }
  75% { transform: translateX(-10px); }
  100% { transform: translateX(0); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* ==========================================================================
   ZÁVĚREČNÁ OBRAZOVKA
   ========================================================================== */
.th-result-content {
  text-align: center;
  margin: auto;
  background: white;
  padding: 40px;
  border-radius: var(--th-border-radius);
  box-shadow: var(--th-shadow);
  max-width: 600px;
}

.th-result-content h2 {
  font-size: 2.5rem;
  color: var(--th-primary-dark);
  margin-bottom: 20px;
}

.th-score-display {
  font-size: 1.5rem;
  margin-bottom: 30px;
}

.th-score-display span {
  font-weight: bold;
  color: var(--th-primary);
}

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

/* ==========================================================================
   RESPONZIVITA
   ========================================================================== */
@media (max-width: 768px) {
  .th-header-stats {
    flex-direction: column;
    gap: 10px;
  }
  
  .th-category-col {
    min-width: 130px;
  }
  
  .th-card {
    min-width: 100px;
    font-size: 1rem;
    padding: 10px;
  }
}

/* ==========================================================================
   BREADCRUMB / NAVIGACE ZPĚT
   ========================================================================== */
.th-breadcrumb {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.th-breadcrumb h2 {
  text-align: left;
  margin: 0;
  flex: 1;
}

/* ==========================================================================
   SEKČNÍ KARTIČKY
   ========================================================================== */
.th-section-card {
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  border-color: var(--th-primary-light);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.th-section-card:hover {
  background: linear-gradient(135deg, #c8e6c9 0%, #dcedc8 100%);
}

/* ==========================================================================
   FULLSCREEN REŽIM (UČITEL / INTERAKTIVNÍ TABULE)
   ========================================================================== */
.th-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: var(--th-bg-color);
  border-radius: 0;
  max-width: none;
  padding: 20px;
  overflow-y: auto;
}

.th-fullscreen .th-card {
  font-size: 1.5rem;
  min-width: 160px;
  min-height: 100px;
  padding: 20px;
}

.th-fullscreen .th-category-title {
  font-size: 1.4rem;
}

.th-fullscreen .th-category-icon {
  font-size: 3.5rem;
}

.th-fullscreen .th-header-stats {
  font-size: 1.3rem;
}
