:root {
  --primary: #0ff0fc;
  --secondary: #ff2a6d;
  --tertiary: #d300c5;
  --bg-dark: #0d0221;
  --bg-darker: #070119;
  --text-light: #e5f7f8;
  --text-lighter: #ffffff;
  --correct: #05f0a5;
  --incorrect: #ff3864;
  --glow: 0 0 10px rgba(5, 240, 165, 0.8);
  --glow-secondary: 0 0 10px rgba(255, 42, 109, 0.8);
}

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

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  user-select: none;
}

.cyber-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 2;
}

.neon-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.neon-header:hover {
  transform: scale(1.02);
}

.neon-header:active {
  transform: scale(0.98);
}

.neon-header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.neon-text {
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary), 
               0 0 20px var(--primary), 
               0 0 30px var(--primary);
}

.neon-line {
  height: 3px;
  width: 200px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: 0 auto;
  box-shadow: 0 0 10px var(--primary);
}

/* Cyber Buttons */
.cyber-buttons {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.cyber-button {
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  width: 180px;
  height: 60px;
  perspective: 1000px;
}

.cyber-button-content {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-light);
  background: var(--bg-darker);
  border: 2px solid var(--primary);
  transform-style: preserve-3d;
  transform: translateZ(15px);
  transition: all 0.3s ease;
  z-index: 2;
}

.cyber-button:hover .cyber-button-content {
  color: var(--primary);
  transform: translateZ(25px);
  box-shadow: var(--glow);
}

.cyber-button:active .cyber-button-content {
  transform: translateZ(10px);
}

.cyber-button-glitch {
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--primary);
  top: 5px;
  left: 5px;
  opacity: 0.5;
  filter: blur(2px);
  transition: all 0.3s ease;
  z-index: 1;
}

.cyber-button:hover .cyber-button-glitch {
  opacity: 0.8;
  top: 8px;
  left: 8px;
}

/* Question Grid */
.cyber-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.question-block {
  background: rgba(13, 2, 33, 0.7);
  border: 1px solid var(--tertiary);
  border-radius: 5px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.question-block:hover {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(5, 240, 165, 0.3);
}

.question-block h3 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--text-lighter);
  position: relative;
  padding-bottom: 0.5rem;
}

.question-block h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.option-button {
  display: block;
  width: 100%;
  padding: 0.8rem;
  margin: 0.5rem 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  text-align: left;
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.option-button:hover:enabled {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  transform: translateX(5px);
}

.option-button.correct {
  background: rgba(5, 240, 165, 0.1);
  border-color: var(--correct);
  color: var(--correct);
  font-weight: 500;
}

.option-button.incorrect {
  background: rgba(255, 56, 100, 0.1);
  border-color: var(--incorrect);
  color: var(--incorrect);
  font-weight: 500;
}

/* Result Display */
.cyber-result {
  margin-top: 3rem;
  text-align: center;
}

.result-container {
  display: inline-block;
  padding: 1.5rem 2.5rem;
  background: rgba(13, 2, 33, 0.8);
  border: 1px solid var(--secondary);
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}

.result-digits {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  color: var(--primary);
  text-shadow: 0 0 5px var(--primary);
  margin-bottom: 0.5rem;
}

.result-text {
  font-size: 1.2rem;
  color: var(--text-light);
}

/* Enhanced Background Effects */
.cyber-bg-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.grid-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(5, 240, 165, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(5, 240, 165, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.3;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0% { background-position: 0 0; }
  100% { background-position: 30px 30px; }
}

/* Abstract Shapes */
.abstract-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.abstract-shape {
  position: absolute;
  opacity: 0.15;
  animation: float 15s ease-in-out infinite;
  pointer-events: none;
}

.abstract-shape.poly1 {
  width: 150px;
  height: 150px;
  background: linear-gradient(45deg, var(--primary), transparent);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  top: 10%;
  left: 15%;
  animation-duration: 18s;
}

.abstract-shape.poly2 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--secondary), transparent);
  clip-path: polygon(30% 10%, 90% 30%, 70% 90%, 20% 80%);
  top: 60%;
  left: 70%;
  animation-duration: 22s;
  animation-delay: -5s;
}

.abstract-shape.orb1 {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, var(--tertiary), transparent);
  border-radius: 50%;
  top: 30%;
  left: 40%;
  animation-duration: 12s;
  animation-delay: -2s;
  filter: blur(20px);
}

.abstract-shape.line1 {
  width: 300px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  top: 80%;
  left: 10%;
  animation-duration: 25s;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0.15; }
  50% { transform: translate(50px, -30px) rotate(180deg); opacity: 0.25; }
  100% { transform: translate(0, 0) rotate(360deg); opacity: 0.15; }
}

/* Enhanced Particles */
.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.particles::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 30%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tertiary), transparent 70%);
  filter: blur(30px);
  opacity: 0.2;
  animation: pulse 10s ease-in-out infinite;
}

.particles::after {
  content: '';
  position: absolute;
  top: 60%;
  left: 70%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--secondary), transparent 70%);
  filter: blur(40px);
  opacity: 0.1;
  animation: pulse 15s ease-in-out infinite;
  animation-delay: -5s;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.1; }
  50% { transform: scale(1.2); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.1; }
}

/* Animations */
@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

/* Responsive */
@media screen and (max-width: 768px) {
  .neon-header h1 {
    font-size: 2.5rem;
  }
  
  .cyber-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .cyber-button {
    width: 220px;
  }

  .abstract-shape {
    transform: scale(0.7);
  }
}

.hidden {
  display: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 5px var(--primary), 0 0 10px var(--primary);
  animation: fadeOut 2s linear forwards;
}

@keyframes fadeOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

/* Styl pro vesmírné kočky */
.space-cat {
  position: absolute;
  width: 40px;
  height: 40px;
  font-size: 30px;
  color: var(--primary);
  text-shadow: 0 0 5px var(--primary), 0 0 10px var(--primary);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease;
  z-index: 3;
}

.space-cat:hover {
  transform: scale(1.2);
  text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
}

/* Styl pro částice exploze */
.explosion-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 5px var(--primary), 0 0 10px var(--primary);
  animation: explode 1s ease-out forwards;
}

@keyframes explode {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

/* Topic selection buttons */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.topic-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.topic-item input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--primary);
}

.topic-item label {
  cursor: pointer;
  font-size: 0.9rem;
}

/* H2 Styling */
h2 {
  font-family: 'Orbitron', sans-serif;
  color: var(--primary);
  text-shadow: 
    0 0 5px var(--primary),
    0 0 10px var(--primary),
    0 0 20px var(--primary);
  letter-spacing: 2px;
  margin: 1.5rem auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  padding: 0 20px;
  animation: h2-flicker 3s infinite alternate;
}

h2::before, h2::after {
  content: '';
  flex: 1;
  height: 3px;
  background: linear-gradient(
    90deg, 
    transparent, 
    var(--primary), 
    transparent
  );
  box-shadow: 0 0 5px var(--primary);
  margin: 0 15px;
  max-width: 100px;
}

@keyframes h2-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow: 
      0 0 5px var(--primary),
      0 0 10px var(--primary),
      0 0 20px var(--primary);
  }
  20%, 24%, 55% {
    text-shadow: none;
  }
}

/* Certificate Styling */
.certificate {
  background-color: #0d0221;
  color: white;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  font-family: 'Roboto', sans-serif;
}

.certificate-border {
  border: 3px solid var(--primary);
  padding: 30px;
  position: relative;
}

.certificate h1 {
  color: var(--primary);
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  margin-bottom: 30px;
  text-shadow: 0 0 10px var(--primary);
}

.certificate-body {
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.certificate-body p {
  margin: 5px 0;
}

.certificate-score {
  font-size: 2.5rem;
  color: var(--correct);
  margin: 20px 0;
  font-weight: bold;
  text-shadow: 0 0 10px var(--correct);
}

.certificate-stamp {
  width: 150px;
  height: 150px;
  background: radial-gradient(transparent 25%, var(--secondary) 75%);
  margin: 30px auto;
  position: relative;
  opacity: 0.7;
  border-radius: 25%;
}

.certificate-stamp::before {
  content: "POTVRZENO";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  color: var(--secondary);
  font-size: 1.5rem;
  font-weight: bold;
}

.certificate-subject {
  font-size: 1.8rem;
  color: var(--primary);
  margin: 15px 0;
  font-family: 'Orbitron', sans-serif;
  text-shadow: 0 0 10px var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.certificate-topics {
  margin: 15px 0;
  text-align: left;
  width: 100%;
}

.certificate-topics h3 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.certificate-topics ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 5px;
}

.certificate-topics li {
  padding: 5px;
  border-left: 2px solid var(--tertiary);
  margin-left: 10px;
}

/* Topic Buttons */
.topic-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin: 25px 0;
}

.topic-btn {
  border: none;
  padding: 15px;
  border-radius: 5px;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border: 1px solid var(--primary);
}

.topic-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3);
}

.topic-btn.selected {
  background: var(--primary);
  color: var(--bg-dark);
  font-weight: bold;
  box-shadow: 0 0 15px var(--primary);
}

.topic-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.topic-btn:hover::after {
  transform: translateX(100%);
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  #certificate, #certificate * {
    visibility: visible;
  }
  #certificate {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    color: black;
  }
  .cyber-button {
    display: none;
  }
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  h2 {
    padding: 0 10px;
    font-size: 1.2rem;
  }
  h2::before, h2::after {
    margin: 0 8px;
    max-width: 50px;
  }
}