
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;700;800&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --pink: #ff72b6;
  --purple: #a77bf3;
  --gold: #f6c95b;
  --ink: #65447d;
  --white: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, #fff8c5 0, transparent 22%),
    radial-gradient(circle at 85% 12%, #ffd0eb 0, transparent 27%),
    radial-gradient(circle at 50% 85%, #d6c5ff 0, transparent 40%),
    linear-gradient(135deg, #fff2fa, #e9dcff, #ffe7f4);
  overflow-x: hidden;
}

body::before {
  content: "✦  ✧  ✦  ✧  ✦  ✧  ✦";
  position: fixed;
  top: 25px;
  width: 100%;
  text-align: center;
  font-size: 24px;
  letter-spacing: 45px;
  color: #d8a84b;
  opacity: .5;
  pointer-events: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

.game {
  position: relative;
  max-width: 1100px;
  margin: 24px auto;
  padding: 26px;
  background: rgba(255,255,255,.72);
  border: 4px solid white;
  border-radius: 38px;
  box-shadow: 0 20px 65px #9c6db03b;
}

.hero {
  text-align: center;
  padding: 20px 10px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #a16bc3;
}

.castle {
  font-size: 90px;
  margin: 12px 0 0;
  animation: float 3s ease-in-out infinite;
}

h1, h2 {
  font-family: 'Baloo 2', cursive;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 59px);
  color: #a05ac4;
  text-shadow: 3px 4px 0 #ffe0a6;
  line-height: 1.3;
}

.subtitle {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
  color: #e47da9;
}

.topic {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 24px;
  border-radius: 50px;
  background: #fff7d9;
  border: 2px solid #f4d78a;
  font-weight: 900;
  color: #9466ae;
}

.welcome, .result {
  text-align: center;
  padding: 35px 25px;
  margin: 22px auto;
  max-width: 850px;
  background: linear-gradient(145deg, #fff, #fff3fc);
  border: 3px solid #f8d4e9;
  border-radius: 32px;
  box-shadow: 0 10px 30px #d19cb12a;
}

.princesses {
  font-size: 49px;
  letter-spacing: 9px;
}

.welcome h2 {
  font-size: 34px;
  color: #9a65c4;
  margin: 12px 0;
}

.welcome p {
  font-size: 18px;
  line-height: 1.7;
  max-width: 620px;
  margin: 10px auto;
}

.arabic {
  direction: rtl;
  background: #f4e9ff;
  border-radius: 18px;
  padding: 17px;
  margin: 24px auto;
  max-width: 650px;
  line-height: 2;
  font-weight: 700;
}

.rules {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 25px 0;
}

.rules span {
  padding: 10px 15px;
  background: #fff0f8;
  border: 2px solid #fbd4e8;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 900;
}

.primary, .gold, .next {
  padding: 16px 30px;
  border-radius: 50px;
  font-weight: 900;
  font-size: 17px;
  transition: transform .2s, box-shadow .2s;
}

.primary {
  color: white;
  background: linear-gradient(135deg, #ff79b7, #a779ee);
  box-shadow: 0 7px 0 #b974b7;
}

.gold {
  color: #79501c;
  background: linear-gradient(135deg, #ffe89c, #f3b94b);
  box-shadow: 0 7px 0 #d79e3c;
}

.primary:hover, .gold:hover, .next:hover {
  transform: translateY(-3px);
}

.primary:active, .gold:active, .next:active {
  transform: translateY(3px);
  box-shadow: none;
}

.hidden {
  display: none !important;
}

.teams {
  display: grid;
  grid-template-columns: 1fr 185px 1fr;
  gap: 14px;
  align-items: stretch;
  margin: 25px 0;
}

.team {
  border-radius: 28px;
  padding: 20px 10px;
  text-align: center;
  border: 4px solid transparent;
  transition: transform .25s, box-shadow .25s;
}

.rose {
  background: linear-gradient(160deg, #ffe6f1, #ffc6df);
  border-color: #f8a9cf;
}

.lavender {
  background: linear-gradient(160deg, #eee4ff, #d4baff);
  border-color: #b69af4;
}

.team.active {
  transform: scale(1.025);
  box-shadow: 0 0 0 4px #ffe09b, 0 10px 25px #b08dbb50;
}

.team-icon {
  font-size: 62px;
  animation: float 3s ease-in-out infinite;
}

.team h2 {
  margin: 4px 0;
  font-size: 25px;
}

.rose h2 {
  color: #e66a9d;
}

.lavender h2 {
  color: #8d6bdf;
}

.score {
  font-family: 'Baloo 2', cursive;
  font-size: 62px;
  font-weight: 800;
  line-height: 1;
  color: #8d58b7;
}

.score-label {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 900;
}

.gem-count {
  margin-top: 12px;
  font-weight: 900;
}

.gem-shelf {
  margin-top: 12px;
  min-height: 35px;
  font-size: 22px;
  letter-spacing: 4px;
  word-break: break-word;
}

.middle {
  align-self: center;
  text-align: center;
}

.round-label {
  font-weight: 900;
  font-size: 14px;
  color: #9866ba;
}

.timer-ring {
  width: 112px;
  height: 112px;
  margin: 12px auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 9px solid #f6c95b;
  background: white;
  box-shadow: 0 5px 18px #d5b76e66;
}

.timer-ring span {
  font-family: 'Baloo 2', cursive;
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
}

.timer-ring.urgent {
  border-color: #ff657f;
  color: #f04e6b;
  animation: pulse .6s infinite alternate;
}

.turn {
  font-size: 13px;
  font-weight: 900;
  color: #9c62c1;
}

.little-crown {
  margin-top: 8px;
  font-size: 35px;
}

.question-card {
  background: linear-gradient(160deg, #fff, #fff6fc);
  border: 3px solid #e7cbfa;
  border-radius: 32px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 12px 30px #9d6aaf20;
}

.question-top {
  font-size: 36px;
}

.question-number {
  margin-top: 10px;
  font-weight: 900;
  color: #d67aa8;
  letter-spacing: 2px;
}

.question-card h2 {
  font-size: 27px;
  margin: 12px 0;
}

.question-text {
  font-size: clamp(20px, 3vw, 29px);
  font-weight: 900;
  color: #765092;
  line-height: 1.6;
  margin: 25px auto;
  max-width: 850px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  max-width: 730px;
  margin: 20px auto;
}

.answer {
  padding: 18px;
  border-radius: 20px;
  border: 3px solid #e4cef6;
  background: #f8f1ff;
  font-size: 23px;
  font-weight: 900;
  color: #8a5bad;
  transition: .2s;
}

.answer:nth-child(2n) {
  background: #fff0f7;
  border-color: #f9c7e1;
}

.answer:hover:not(:disabled) {
  transform: scale(1.035);
  background: #fff5d6;
  border-color: #f2ca70;
}

.answer:disabled {
  cursor: default;
}

.answer.correct {
  background: #dcfae6 !important;
  border-color: #57c985 !important;
  color: #218f52;
}

.answer.wrong {
  background: #ffe1e8 !important;
  border-color: #ef7894 !important;
  color: #d34869;
}

.feedback {
  min-height: 35px;
  margin: 18px auto;
  font-size: 20px;
  font-weight: 900;
}

.next {
  background: linear-gradient(135deg, #e9c5ff, #caa5ff);
  color: #6c4397;
}

.progress {
  height: 16px;
  margin: 28px auto 10px;
  background: #eadcf4;
  border-radius: 30px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff8cbe, #f6d178, #a882ef);
  transition: width .4s;
}

.progress-text {
  text-align: center;
  font-weight: 800;
}

.result {
  padding: 45px 20px;
}

.trophy {
  font-size: 100px;
  animation: float 2s infinite ease-in-out;
}

.result h2 {
  font-size: 43px;
  color: #a05ac4;
}

.result p {
  font-size: 20px;
  font-weight: 800;
}

.final-scores {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin: 28px 0;
}

.final-scores div {
  padding: 18px 25px;
  border-radius: 20px;
  background: #f8eafa;
  font-weight: 900;
}

.final-scores strong {
  display: block;
  font-size: 35px;
  color: #b06ac9;
}

.reward {
  font-size: 38px;
  margin: 20px 0;
}

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

footer {
  text-align: center;
  padding: 20px;
  color: #a57cb2;
  font-size: 13px;
  font-weight: 800;
}

.certificate {
  display: none;
}

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

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

@media (max-width: 650px) {
  .game {
    padding: 12px;
    margin: 8px;
    border-radius: 25px;
  }

  .teams {
    grid-template-columns: 1fr 95px 1fr;
    gap: 6px;
  }

  .team {
    padding: 13px 4px;
    border-radius: 18px;
  }

  .team-icon {
    font-size: 38px;
  }

  .team h2 {
    font-size: 16px;
  }

  .score {
    font-size: 43px;
  }

  .gem-shelf {
    font-size: 14px;
    letter-spacing: 1px;
  }

  .timer-ring {
    width: 75px;
    height: 75px;
    border-width: 6px;
  }

  .timer-ring span {
    font-size: 36px;
  }

  .round-label, .turn {
    font-size: 10px;
  }

  .question-card {
    padding: 20px 12px;
  }

  .answers {
    gap: 9px;
  }

  .answer {
    padding: 14px 8px;
  }

  .princesses {
    font-size: 32px;
    letter-spacing: 2px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: white !important;
  }

  body::before,
  .game {
    display: none !important;
  }

  .certificate {
    display: block !important;
    width: 100%;
    padding: 10px;
    color: #77518f;
  }

  .cert-border {
    border: 12px double #d4a74e;
    outline: 3px solid #e9c7e6;
    padding: 25px;
    min-height: 165mm;
    text-align: center;
    background: #fff9fd;
  }

  .cert-crown {
    font-size: 55px;
  }

  .certificate h1 {
    font-size: 35px;
    color: #a05ac4;
  }

  .certificate h2 {
    font-size: 42px;
    color: #bb8a38;
  }

  .certificate p {
    font-size: 19px;
  }

  .cert-winner {
    font-size: 43px;
    font-weight: 900;
    color: #df75a7;
    margin: 20px;
  }

  .cert-gems {
    font-size: 35px;
    margin: 20px;
  }

  .cert-bottom {
    display: flex;
    justify-content: space-around;
    margin-top: 35px;
    font-weight: 800;
  }
}
