* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

body {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #c3aed6, #8675a9);
  color: #fff;
}

.container {
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 30px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  width: min(920px, 92%);
  margin: 4vh auto;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 0.6em;
}

#sectionTitle {
  font-size: 1.5rem;
  margin-bottom: 0.3em;
}
#sectionSubtitle {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

input[type="date"] {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  width: 200px;
  text-align: center;
  color: #333;
}

.btn {
  position: relative;
  background: #7b4bb7;
  color: white;
  border: none;
  padding: 12px 26px;
  border-radius: 40px;
  cursor: pointer;
  margin-top: 15px;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  transition: all 0.3s ease;
  z-index: 1;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.5s ease;
}

.btn:hover::before {
  transform: scale(1);
}

.btn:hover {
  transform: scale(1.05);
}

.btn:active { transform: scale(0.97); }
.btn.small { padding:8px 14px; border-radius:12px; font-size:0.9rem; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 50;
}

.overlay.show {
  visibility: visible;
  opacity: 1;
}

.overlay-content {
  background: rgba(255, 255, 255, 0.08);
  padding: 24px;
  border-radius: 16px;
  text-align: center;
  color: #fff;
}

.play-area {
  position: relative;
  height: 520px;
  margin-top: 18px;
  border-radius: 12px;
  overflow: visible;
  z-index: 2;
  background: rgba(255,255,255,0.06);
}

.card {
  width: 120px;
  height: 120px;
  position: absolute;
  transform: rotate(var(--rot));
  perspective: 1000px;
  cursor: grab;
}

.card:active { cursor: grabbing; }

.cardInner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  border-radius: 12px;
}

.card.flipped .cardInner {
  transform: rotateY(180deg);
}

.front, .back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  padding: 10px;
  text-align: center;
}

.front {
  background: linear-gradient(135deg, #a678de, #7b4bb7);
  color: #fff;
  font-size: 1.2rem;
}

.back {
  background: rgba(255,255,255,0.95);
  color: #7b4bb7;
  transform: rotateY(180deg);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Floating hearts animation */
.heart {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.6;
  animation-name: floatHearts;
  animation-timing-function: linear;
  pointer-events: none;
}

@keyframes floatHearts {
  0% { transform: translateY(100vh) scale(0.5) rotate(0deg); opacity: 0; }
  20% { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1) rotate(360deg); opacity: 0; }
}

/* --- Puzzle --- */
#puzzleSection {
  display: none;
  position: relative;
  width: 100%;
  height: 600px;
  margin-top: 20px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
}

.puzzle-piece {
  position: absolute;
  cursor: grab;
  border-radius: 6px;
  background-size: cover;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.puzzle-piece:active { cursor: grabbing; }

.puzzle-full {
  pointer-events: none;
}

@media (max-width:600px) {
  .card { width: 96px; height: 96px; }
  .play-area { height: 420px; }
  input[type="date"] { width: 160px; }
}
.puzzle-btn {
  position: fixed;
  bottom: 24px;
  right: 28px;
  background: linear-gradient(135deg, #a678de, #7b4bb7);
  color: white;
  border: none;
  padding: 14px 26px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}

.puzzle-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.4) 0%, transparent 70%);
  transition: all 0.5s ease;
}

.puzzle-btn:hover::before {
  left: 100%;
}

.puzzle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(255,255,255,0.4);
}

/* --- NOVÉ: přechodová animace stránky --- */
.page-transition {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(166,120,222,1) 0%, rgba(123,75,183,1) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 1.2s ease;
}

.page-transition.active {
  opacity: 1;
  pointer-events: all;
}
/* === 💜 PUZZLE STYL – ADAPTIVNÍ VERZE 💜 === */

.puzzle-container {
  position: relative;
  margin: 30px auto;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  box-shadow: 0 4px 25px rgba(0,0,0,0.25);
  overflow: hidden;
  touch-action: none;
  backdrop-filter: blur(6px);
  border: 2px solid rgba(255,255,255,0.15);
  display: block;
}

.piece {
  position: absolute;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.25);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  user-select: none;
}

.piece:hover {
  transform: scale(1.05);
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.45);
}

.piece:active {
  cursor: grabbing;
  transform: scale(1.08);
  z-index: 1000;
}

/* Krásná animace pochvaly po složení */
.puzzle-finish {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: linear-gradient(135deg, #9f7ae5, #7b4bb7);
  color: #fff;
  padding: 20px 40px;
  border-radius: 16px;
  font-size: 1.3rem;
  font-weight: 600;
  box-shadow: 0 0 25px rgba(255,255,255,0.4);
  text-align: center;
  animation: popIn 0.6s ease forwards, glow 2.5s ease-in-out infinite alternate;
  z-index: 9999;
}

@keyframes popIn {
  from {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes glow {
  0% { box-shadow: 0 0 15px rgba(255,255,255,0.3); }
  100% { box-shadow: 0 0 30px rgba(255,255,255,0.6); }
}

/* Responsivní úpravy */
@media (max-width: 600px) {
  .puzzle-finish {
    font-size: 1.1rem;
    padding: 16px 28px;
  }
}
/* === 💜 Mřížka puzzle === */

.puzzle-grid {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
  grid-template-rows: repeat(8, 1fr);
  grid-template-columns: repeat(8, 1fr);
  z-index: 0;
}

.grid-cell {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.3s;
}

.puzzle-grid.grid-finished .grid-cell {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
  transition: background 0.6s, border-color 0.6s;
}
/* === 💜 Efekty pro preview, glow a rozletění === */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(1.05); }
  to { opacity: 1; transform: scale(1); }
}

/* Glow efekt při přiblížení dílku */
.cell-glow {
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}
/* === 💜 Text a efekty při preview === */

.puzzle-preview {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  border-radius: 14px;
  animation: fadeIn 1.2s ease;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.preview-text {
  font-size: 1.3rem;
  color: white;
  text-shadow: 0 0 10px rgba(0,0,0,0.5);
  margin-bottom: 25px;
  background: rgba(0,0,0,0.4);
  padding: 10px 18px;
  border-radius: 20px;
  animation: fadeInText 1.5s ease-in-out;
}

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

.fade-out {
  opacity: 0;
  transform: scale(1.03);
  transition: all 1.2s ease-in-out;
}
.preview-countdown {
  position: absolute;
  bottom: 70px; /* 💜 posunuto výš, aby nezasahovalo do textu */
  right: 35px;  /* lehký posun doprava */
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(3px);
  animation: fadeInText 1.5s ease-in-out;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

@media (max-width: 600px) {
  .preview-countdown {
    bottom: 90px; /* 💜 ještě o něco výš na menších obrazovkách */
    right: 20px;
    font-size: 1rem;
    padding: 5px 12px;
  }
}

.restart-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #a678de, #7b4bb7);
  color: white;
  border: 2px solid #fff;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  z-index: 2000;
  box-shadow: 0 0 10px rgba(255,255,255,0.2);
  transition: all 0.3s ease;
}

.restart-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(255,255,255,0.4);
}

/* === HVĚZDIČKY NA POZADÍ S EFEKTY === */

#starCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(ellipse at bottom, #1b0034 0%, #12001a 100%);
}

/* === KOUZELNÉ HESLO UI === */

.magic-input {
  background: rgba(255,255,255,0.95);
  border: none;
  border-radius: 10px;
  padding: 10px;
  margin-top: 10px;
  width: 220px;
  text-align: center;
  color: #6a3ea0;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.magic-input:focus {
  outline: none;
  box-shadow: 0 0 15px rgba(160,100,230,0.8);
}
