/* ==============================
   RESET & BASE
============================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:    #c9a227;
  --gold-lt: #f0d060;
  --dark:    #0d0a06;
  --dark2:   #1a1409;
  --stone:   #2b2318;
  --brown:   #3d2c10;
  --cream:   #f5e8c8;
  --text:    #e8d8b0;
  --accent:  #7a3b1e;
  --blue:    #1c3557;
  --radius:  18px;
  --shadow:  0 8px 40px rgba(0,0,0,.5);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--dark);
  color: var(--text);
  overflow-x: hidden;
}

h1,h2,h3 { font-family: 'Cinzel', serif; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ==============================
   HERO
============================== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(ellipse at 50% 30%, #2e1a00 0%, #0d0a06 70%),
              url('https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Loket_castle_01.jpg/1280px-Loket_castle_01.jpg') center/cover no-repeat;
  background-blend-mode: multiply;
  text-align: center;
  overflow: hidden;
}

.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,10,6,.2) 0%, rgba(13,10,6,.85) 100%);
  pointer-events: none;
}

.hero-particles {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--gold-lt);
  opacity: 0;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(0) scale(.5); }
  20%  { opacity: .8; }
  100% { opacity: 0; transform: translateY(-90vh) scale(1); }
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 40px 20px;
  max-width: 800px;
}

.castle-icon {
  font-size: 80px;
  display: block;
  animation: castlePulse 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px var(--gold));
}

@keyframes castlePulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.hero-title {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  color: var(--gold-lt);
  text-shadow: 0 0 40px rgba(201,162,39,.6), 0 4px 8px rgba(0,0,0,.8);
  letter-spacing: .08em;
  margin-top: 12px;
  animation: fadeDown .8s ease both;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--gold);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin: 8px 0 20px;
  animation: fadeDown .9s ease both;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--cream);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 32px;
  animation: fadeDown 1s ease both;
}

.hero-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 36px;
  animation: fadeDown 1.1s ease both;
}

.step-badge {
  background: rgba(201,162,39,.15);
  border: 1px solid var(--gold);
  color: var(--gold-lt);
  padding: 8px 22px;
  border-radius: 50px;
  font-weight: 700;
  font-size: .95rem;
  backdrop-filter: blur(8px);
}

.step-arrow { color: var(--gold); font-size: 1.4rem; }

@keyframes fadeDown {
  from { opacity:0; transform: translateY(-20px); }
  to   { opacity:1; transform: translateY(0); }
}

.scroll-indicator {
  position: absolute;
  bottom: 30px;
  color: var(--gold);
  font-size: 1.5rem;
  animation: bounce 2s ease-in-out infinite;
  cursor: pointer;
  z-index: 2;
}

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

/* ==============================
   BUTTONS
============================== */
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #fff;
  border: none;
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201,162,39,.4);
  transition: transform .2s, box-shadow .2s;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(201,162,39,.6);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--gold-lt);
  border: 2px solid var(--gold);
  padding: 12px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all .2s;
}

.btn-secondary:hover {
  background: rgba(201,162,39,.15);
  transform: translateY(-2px);
}

.btn-next {
  margin-top: 20px;
  display: inline-block;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(46,204,113,.4);
}

.btn-next:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(46,204,113,.5); }

/* ==============================
   SECTION COMMON
============================== */
.section-title {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--gold-lt);
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(201,162,39,.3);
}

.section-title.light { color: #fff; }

.section-sub {
  text-align: center;
  color: var(--cream);
  font-size: 1.05rem;
  margin-bottom: 48px;
  opacity: .85;
}

.section-sub.light { color: rgba(255,255,255,.8); }

/* ==============================
   LEARN SECTION
============================== */
.learn-section {
  padding: 100px 0 80px;
  background: linear-gradient(180deg, #0d0a06 0%, #1a1409 50%, #0d0a06 100%);
}

/* CARDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 80px;
}

.flip-card {
  height: 220px;
  perspective: 1000px;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform .6s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }

.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.flip-front {
  background: linear-gradient(135deg, var(--stone), var(--brown));
  border: 1px solid rgba(201,162,39,.3);
}

.flip-front .card-icon { font-size: 3rem; margin-bottom: 12px; }
.flip-front .card-title { font-family: 'Cinzel', serif; color: var(--gold-lt); font-size: 1.05rem; }
.flip-front .card-hint { font-size: .8rem; color: var(--gold); margin-top: 8px; opacity: .7; }

.flip-back {
  background: linear-gradient(135deg, #1c3557, #0e1f36);
  border: 1px solid rgba(100,160,255,.3);
  transform: rotateY(180deg);
}

.flip-back p {
  color: #ddeeff;
  font-size: .95rem;
  line-height: 1.6;
}

/* TIMELINE */
.timeline-wrap {
  margin-bottom: 80px;
}

.timeline-title {
  font-family: 'Cinzel', serif;
  color: var(--gold-lt);
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 40px;
}

.timeline {
  position: relative;
  max-width: 750px;
  margin: 0 auto;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), transparent);
  border-radius: 2px;
}

.tl-item {
  position: relative;
  margin-bottom: 36px;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity .5s, transform .5s;
}

.tl-item.visible { opacity: 1; transform: translateX(0); }

.tl-dot {
  position: absolute;
  left: -31px;
  top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.tl-year {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .1em;
}

.tl-text {
  color: var(--cream);
  font-size: .95rem;
  line-height: 1.6;
  margin-top: 4px;
}

/* MAP + FACTS */
.map-fact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 720px) {
  .map-fact { grid-template-columns: 1fr; }
}

.map-box { }

.map-label {
  font-family: 'Cinzel', serif;
  color: var(--gold-lt);
  font-size: 1rem;
  margin-bottom: 12px;
  font-weight: 600;
}

.map-note {
  font-size: .85rem;
  color: rgba(200,180,140,.7);
  margin-top: 10px;
  text-align: center;
}

.fun-facts-box {
  background: linear-gradient(135deg, var(--stone), var(--brown));
  border: 1px solid rgba(201,162,39,.25);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.fun-facts-box h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold-lt);
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.fun-list { list-style: none; }

.fun-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(201,162,39,.1);
  font-size: .93rem;
  color: var(--cream);
  line-height: 1.5;
  opacity: 0;
  transform: translateX(15px);
  transition: opacity .4s, transform .4s;
}

.fun-list li.visible { opacity: 1; transform: translateX(0); }
.fun-list li:last-child { border-bottom: none; }
.fun-list li .fi { font-size: 1.2rem; flex-shrink: 0; }

/* ==============================
   QUIZ SECTION
============================== */
.quiz-section {
  padding: 100px 0 80px;
  background: linear-gradient(135deg, #0a1628 0%, #0d1e3a 50%, #0a1628 100%);
  position: relative;
  overflow: hidden;
}

.quiz-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(100,160,255,.06) 0%, transparent 70%);
  pointer-events: none;
}

.quiz-card {
  max-width: 780px;
  margin: 0 auto;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(100,160,255,.2);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 8px 60px rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Quiz Start */
.quiz-start { text-align: center; }
.quiz-start-icon { font-size: 5rem; margin-bottom: 20px; }
.quiz-start h3 { font-size: 1.8rem; color: #fff; margin-bottom: 12px; }
.quiz-start p { color: rgba(255,255,255,.75); line-height: 1.7; margin-bottom: 32px; }

/* Quiz question */
.quiz-question-wrap { width: 100%; }

.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

#quizProgressFill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 3px;
  transition: width .4s ease;
  width: 5%;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  font-size: .9rem;
  color: rgba(255,255,255,.6);
  font-weight: 700;
}

#quizQuestionText {
  font-family: 'Nunito', sans-serif;
  font-size: 1.25rem;
  color: #fff;
  line-height: 1.5;
  margin-bottom: 28px;
  font-weight: 700;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .quiz-options { grid-template-columns: 1fr; }
}

.quiz-opt {
  background: rgba(255,255,255,.06);
  border: 2px solid rgba(100,160,255,.2);
  border-radius: 12px;
  padding: 14px 18px;
  color: #ddeeff;
  font-size: 1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all .2s;
  position: relative;
}

.quiz-opt:hover:not(:disabled) {
  background: rgba(100,160,255,.15);
  border-color: rgba(100,160,255,.6);
  transform: translateY(-2px);
}

.quiz-opt.correct {
  background: rgba(46,204,113,.2);
  border-color: #2ecc71;
  color: #a8f0c8;
}

.quiz-opt.wrong {
  background: rgba(231,76,60,.2);
  border-color: #e74c3c;
  color: #f4a9a2;
}

.quiz-feedback {
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  min-height: 20px;
  display: none;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: rgba(46,204,113,.15); border: 1px solid #2ecc71; color: #a8f0c8; }
.quiz-feedback.wrong-fb   { background: rgba(231,76,60,.15);  border: 1px solid #e74c3c; color: #f4a9a2; }

/* Quiz Result */
.quiz-result { text-align: center; width: 100%; }
.result-icon { font-size: 5rem; margin-bottom: 16px; }
.quiz-result h3 { font-size: 2rem; color: #fff; margin-bottom: 12px; }
.quiz-result p  { color: rgba(255,255,255,.75); font-size: 1.05rem; line-height: 1.6; margin-bottom: 24px; }

.result-score-wrap { margin-bottom: 36px; }

.result-score {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  color: var(--gold-lt);
  font-weight: 800;
  text-shadow: 0 0 20px rgba(201,162,39,.5);
}

.result-stars {
  font-size: 2rem;
  margin-top: 8px;
  letter-spacing: 4px;
}

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

/* ==============================
   DIPLOMA SECTION
============================== */
.diploma-section {
  padding: 100px 0;
  background: linear-gradient(180deg, #0d0a06 0%, #1a1409 100%);
  text-align: center;
}

.diploma-controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.diploma-input {
  padding: 14px 24px;
  border-radius: 50px;
  border: 2px solid var(--gold);
  background: rgba(255,255,255,.06);
  color: var(--cream);
  font-size: 1.05rem;
  font-family: 'Nunito', sans-serif;
  width: 340px;
  max-width: 100%;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.diploma-input::placeholder { color: rgba(200,180,140,.5); }
.diploma-input:focus { border-color: var(--gold-lt); box-shadow: 0 0 16px rgba(201,162,39,.3); }

.diploma-preview {
  display: inline-block;
}

#diplomaCanvas {
  border-radius: 12px;
  box-shadow: 0 16px 60px rgba(0,0,0,.7);
  max-width: 100%;
  height: auto;
}

.diploma-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ==============================
   FOOTER
============================== */
.site-footer {
  background: #070504;
  padding: 32px 24px;
  text-align: center;
  border-top: 1px solid rgba(201,162,39,.15);
}

.site-footer p { color: rgba(200,180,140,.6); font-size: .9rem; margin: 4px 0; }
.footer-small { font-size: .78rem !important; opacity: .7; }

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 768px) {
  .quiz-card { padding: 32px 20px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .hero-steps { gap: 8px; }
  .step-badge { padding: 6px 14px; font-size: .85rem; }
}
