:root {
  --purple-dark: #250a52;
  --purple: #51158b;
  --purple-light: #7a2fc2;
  --yellow: #ffd33d;
  --orange: #ff7a00;
  --pink: #e94479;
  --teal: #00a9a1;
  --cream: #fff9e9;
  --ink: #241344;
  --cube-size: clamp(176px, 20vw, 250px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 211, 61, 0.24) 0 4px, transparent 5px),
    radial-gradient(circle at 90% 80%, rgba(0, 169, 161, 0.22) 0 5px, transparent 6px),
    linear-gradient(135deg, #24064e 0%, #4c1483 48%, #28105c 100%);
  font-family: "Montserrat", system-ui, sans-serif;
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  width: 250px;
  height: 250px;
  content: "";
  opacity: 0.24;
  pointer-events: none;
  background: repeating-conic-gradient(from 22deg, var(--yellow) 0 8deg, transparent 8deg 24deg);
  mask: radial-gradient(circle, transparent 0 32%, #000 33% 51%, transparent 52%);
}

body::before {
  top: -80px;
  left: -75px;
}

body::after {
  right: -90px;
  bottom: -75px;
  background: repeating-conic-gradient(from 10deg, var(--teal) 0 8deg, transparent 8deg 24deg);
}

button {
  font: inherit;
}

.page-glow {
  position: fixed;
  z-index: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}

.page-glow--one {
  top: 12%;
  left: -180px;
  background: var(--pink);
}

.page-glow--two {
  right: -150px;
  bottom: 2%;
  background: var(--yellow);
}

.game {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 34px));
  margin: 0 auto;
  padding: 28px 0 38px;
}

.game__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
  color: white;
  text-align: left;
}

.brand-logo {
  display: block;
  width: clamp(230px, 32vw, 360px);
  height: auto;
  padding: 8px 13px;
  transform: rotate(-1deg);
  border-radius: 22px 9px 22px 9px;
  background: rgba(255, 249, 233, 0.94);
  box-shadow: 7px 7px 0 var(--pink), 0 18px 34px rgba(12, 1, 34, 0.24);
}

.brand-copy {
  min-width: 180px;
}

.game__header h1 {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.eyebrow,
.section-kicker,
.tagline {
  margin: 0;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 900;
}

.eyebrow {
  color: var(--yellow);
}

h1 {
  margin: -8px 0 -10px;
  color: white;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(2.8rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 4px 4px 0 var(--pink), -2px -2px 0 var(--purple-dark);
}

.tagline {
  color: #eadcff;
  letter-spacing: 0.08em;
}

.teacher-guide {
  margin: 0 0 20px;
}

.teacher-guide__bar {
  display: grid;
  padding: 14px 16px;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 2.15fr) auto;
  grid-template-areas: "intro steps toggle";
  gap: 16px;
  align-items: center;
  border: 3px solid rgba(255, 211, 61, 0.82);
  border-radius: 24px 9px 24px 9px;
  background: rgba(35, 7, 76, 0.82);
  box-shadow: 0 14px 30px rgba(14, 2, 35, 0.28);
  backdrop-filter: blur(12px);
}

.teacher-guide.is-collapsed .teacher-guide__bar {
  width: min(560px, 100%);
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "intro toggle";
}

.teacher-guide__intro {
  grid-area: intro;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: white;
}

.teacher-guide__info {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  transform: rotate(-5deg);
  border: 3px solid var(--purple-dark);
  border-radius: 14px 6px 14px 6px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-family: Georgia, serif;
  font-size: 1.55rem;
  font-weight: 900;
  font-style: italic;
  box-shadow: 4px 4px 0 var(--pink);
}

.teacher-guide__intro p {
  margin: 0;
  color: var(--yellow);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.teacher-guide__intro h2 {
  margin-top: 2px;
  color: white;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
}

.teacher-guide__steps {
  grid-area: steps;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  animation: guideControlsIn 180ms ease-out both;
}

.teacher-guide__steps[hidden] {
  display: none;
}

.teacher-guide__toggle {
  grid-area: toggle;
  display: inline-flex;
  min-width: 82px;
  padding: 9px 10px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 150ms ease, color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  border: 2px solid var(--yellow);
  border-radius: 13px 5px 13px 5px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--pink);
}

.teacher-guide__toggle:hover {
  transform: translateY(-2px);
  background: #ffe678;
}

.teacher-guide__chevron {
  display: inline-block;
  font-size: 1.1rem;
  line-height: 0.7;
  transition: transform 180ms ease;
}

.teacher-guide:not(.is-collapsed) .teacher-guide__chevron {
  transform: rotate(180deg);
}

.guide-trigger {
  display: flex;
  min-width: 0;
  padding: 8px 7px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 150ms ease, color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 13px 5px 13px 5px;
  color: white;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.guide-trigger:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.18);
}

.guide-trigger.is-active {
  color: var(--purple-dark);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--pink);
}

.guide-trigger__icon {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--purple-dark);
  background: var(--yellow);
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 900;
  font-style: italic;
}

.teacher-guide__bubble {
  position: relative;
  display: grid;
  width: min(820px, calc(100% - 28px));
  margin: 13px auto 2px;
  padding: 16px 54px 16px 18px;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: center;
  border: 4px solid var(--purple-dark);
  border-radius: 22px 8px 22px 8px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 7px 7px 0 var(--pink), 0 18px 34px rgba(14, 2, 35, 0.3);
  animation: guideBubbleIn 180ms ease-out both;
}

.teacher-guide__bubble.has-resources {
  width: min(1080px, calc(100% - 18px));
  align-items: start;
}

.teacher-guide__bubble::before {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 18px;
  height: 18px;
  content: "";
  transform: translateX(-50%) rotate(45deg);
  border-top: 4px solid var(--purple-dark);
  border-left: 4px solid var(--purple-dark);
  background: var(--cream);
}

.teacher-guide__bubble[hidden] {
  display: none;
}

.teacher-guide__step {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  transform: rotate(-4deg);
  border-radius: 13px 5px 13px 5px;
  color: white;
  background: var(--purple);
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--yellow);
}

.teacher-guide__bubble h3 {
  margin: 0 0 3px;
  color: var(--purple-dark);
  font-family: "Baloo 2", sans-serif;
  font-size: 1.2rem;
  line-height: 1.1;
}

.teacher-guide__bubble p {
  margin: 0;
  color: #5c477a;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}

.teacher-guide__copy {
  min-width: 0;
}

.prepare-resources {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 2px dashed rgba(81, 21, 139, 0.23);
}

.prepare-resources[hidden],
.prepare-resource-viewer[hidden] {
  display: none;
}

.prepare-resources .prepare-resources__label {
  margin: 0 0 10px;
  color: var(--purple-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prepare-resources__buttons {
  display: grid;
  grid-template-columns: 0.8fr 1.1fr 1.1fr;
  gap: 10px;
}

.prepare-resource-button {
  display: flex;
  min-height: 52px;
  padding: 10px 13px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
  border: 3px solid var(--purple-dark);
  border-radius: 15px 6px 15px 6px;
  color: var(--purple-dark);
  background: white;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.2;
  box-shadow: 4px 4px 0 rgba(81, 21, 139, 0.2);
}

.prepare-resource-button span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px 4px 9px 4px;
  color: white;
  background: var(--purple);
  font-size: 0.8rem;
}

.prepare-resource-button--three {
  border-color: #e7ae00;
}

.prepare-resource-button--three span {
  color: var(--purple-dark);
  background: var(--yellow);
}

.prepare-resource-button--four {
  border-color: #18994f;
}

.prepare-resource-button--four span {
  background: #27ae60;
}

.prepare-resource-button:hover {
  transform: translateY(-2px);
  box-shadow: 5px 6px 0 rgba(81, 21, 139, 0.25);
}

.prepare-resource-button.is-selected {
  color: white;
  background: var(--purple);
  box-shadow: 4px 4px 0 var(--yellow);
}

.prepare-resource-button--three.is-selected {
  color: var(--purple-dark);
  background: var(--yellow);
  box-shadow: 4px 4px 0 #e7ae00;
}

.prepare-resource-button--four.is-selected {
  background: #218c4b;
  box-shadow: 4px 4px 0 #61d98e;
}

.prepare-resources .prepare-resources__hint {
  margin: 10px 0 0;
  color: #765f91;
  font-size: 0.72rem;
  text-align: center;
}

.prepare-resource-viewer {
  margin: 16px 0 0;
  padding: 10px;
  border: 4px solid var(--purple);
  border-radius: 19px 7px 19px 7px;
  background: white;
  box-shadow: 6px 6px 0 rgba(81, 21, 139, 0.18);
}

.prepare-resource-viewer.is-board-three {
  border-color: var(--yellow);
  box-shadow: 7px 7px 0 #e7ae00;
}

.prepare-resource-viewer.is-board-four {
  border-color: #2dc96b;
  box-shadow: 7px 7px 0 #15743b;
}

.prepare-resource-viewer img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  border-radius: 12px 4px 12px 4px;
  object-fit: contain;
  background: white;
}

.prepare-resource-viewer figcaption {
  margin-top: 9px;
  color: var(--purple-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.teacher-guide__close {
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--pink);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

@keyframes guideBubbleIn {
  from { transform: translateY(-7px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

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

.playboard {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  overflow: hidden;
  min-height: 650px;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 42px 14px 42px 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.97), rgba(255,249,233,0.97)),
    var(--cream);
  box-shadow:
    0 24px 60px rgba(19, 3, 47, 0.45),
    0 0 0 7px rgba(255, 211, 61, 0.3);
}

.playboard::before,
.playboard::after {
  position: absolute;
  z-index: 0;
  width: 180px;
  height: 20px;
  content: "";
  background: repeating-linear-gradient(90deg, var(--pink) 0 15px, var(--orange) 15px 30px, var(--yellow) 30px 45px, var(--teal) 45px 60px);
}

.playboard::before {
  top: 0;
  left: 0;
}

.playboard::after {
  right: 0;
  bottom: 0;
}

.panel {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  padding: 42px 34px 32px;
  align-items: center;
  flex-direction: column;
}

.section-heading {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
}

.section-number {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  transform: rotate(-3deg);
  border-radius: 14px 6px 14px 6px;
  color: white;
  background: var(--purple);
  font-size: 0.85rem;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--yellow);
}

.section-kicker {
  color: var(--pink);
  font-size: 0.64rem;
}

h2 {
  margin: 0;
  color: var(--purple-dark);
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.1;
}

.dice-mode {
  display: grid;
  width: min(330px, 100%);
  margin: 19px auto 0;
  padding: 5px;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  border: 3px solid var(--purple-dark);
  border-radius: 15px 7px 15px 7px;
  background: #eadffc;
  box-shadow: 4px 4px 0 rgba(81, 21, 139, 0.2);
}

.dice-mode__button {
  padding: 9px 8px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
  border: 0;
  border-radius: 10px 4px 10px 4px;
  color: #654b83;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.dice-mode__button span {
  margin-right: 4px;
  color: var(--pink);
}

.dice-mode__button:hover {
  color: var(--purple-dark);
  background: rgba(255,255,255,0.7);
}

.dice-mode__button.is-selected {
  transform: translateY(-1px);
  color: white;
  background: linear-gradient(105deg, var(--purple), var(--purple-light));
  box-shadow: 3px 3px 0 var(--yellow);
}

.dice-mode__button.is-selected span {
  color: var(--yellow);
}

.board-divider {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.board-divider::before {
  position: absolute;
  width: 3px;
  height: 78%;
  content: "";
  background: repeating-linear-gradient(to bottom, var(--purple-light) 0 11px, transparent 11px 20px);
  opacity: 0.26;
}

.board-divider span {
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  transform: rotate(45deg);
  border: 4px solid var(--cream);
  border-radius: 9px;
  color: var(--yellow);
  background: var(--purple);
  box-shadow: 0 0 0 3px var(--purple);
}

.board-divider span::first-letter {
  transform: rotate(-45deg);
}

.dice-stage {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 312px;
  place-items: center;
  perspective: 900px;
}

.dice-scene {
  width: var(--cube-size);
  height: var(--cube-size);
  perspective: 900px;
}

.dice {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotateX(-8deg) rotateY(18deg);
  transform-style: preserve-3d;
  will-change: transform;
}

.dice__face {
  position: absolute;
  display: grid;
  width: var(--cube-size);
  height: var(--cube-size);
  overflow: hidden;
  place-items: center;
  border: 5px solid #32116e;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.98), rgba(255,242,183,0.93));
  box-shadow:
    inset 10px 10px 22px rgba(255,255,255,0.85),
    inset -13px -13px 25px rgba(81,21,139,0.14),
    0 0 18px rgba(255,211,61,0.22);
  backface-visibility: hidden;
}

.dice__face::after {
  position: absolute;
  top: 10px;
  left: 13px;
  width: 60%;
  height: 28%;
  content: "";
  transform: rotate(-18deg);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.75), transparent);
  pointer-events: none;
}

.dice__face img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: contrast(1.1);
  transition: opacity 150ms ease, transform 220ms ease;
}

.dice.is-3d .dice__face {
  border-color: #4a2317;
  background: linear-gradient(145deg, #fffdf8, #f2dfc1);
  box-shadow:
    inset 10px 10px 22px rgba(255,255,255,0.92),
    inset -16px -16px 28px rgba(104,55,27,0.18),
    0 0 18px rgba(154,84,42,0.22);
}

.dice.is-3d .dice__face img {
  width: 88%;
  height: 88%;
  filter: contrast(1.05) saturate(1.04);
}

.dice__face--front  { transform: rotateY(0deg) translateZ(calc(var(--cube-size) / 2)); }
.dice__face--back   { transform: rotateY(180deg) translateZ(calc(var(--cube-size) / 2)); }
.dice__face--right  { transform: rotateY(90deg) translateZ(calc(var(--cube-size) / 2)); }
.dice__face--left   { transform: rotateY(-90deg) translateZ(calc(var(--cube-size) / 2)); }
.dice__face--top    { transform: rotateX(90deg) translateZ(calc(var(--cube-size) / 2)); }
.dice__face--bottom { transform: rotateX(-90deg) translateZ(calc(var(--cube-size) / 2)); }

.dice-shadow {
  position: absolute;
  bottom: 35px;
  left: 50%;
  width: min(270px, 70%);
  height: 48px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(49, 14, 87, 0.3);
  filter: blur(14px);
}

.sparkle {
  position: absolute;
  z-index: 3;
  width: 30px;
  height: 30px;
  animation: twinkle 1.8s ease-in-out infinite;
  background: var(--yellow);
  clip-path: polygon(50% 0, 60% 38%, 100% 50%, 60% 62%, 50% 100%, 40% 62%, 0 50%, 40% 38%);
  filter: drop-shadow(0 0 9px rgba(255, 211, 61, 0.9));
}

.sparkle--one { top: 56px; right: 14%; }
.sparkle--two { top: 154px; left: 10%; width: 19px; height: 19px; animation-delay: -0.7s; }
.sparkle--three { right: 11%; bottom: 54px; width: 16px; height: 16px; animation-delay: -1.1s; }

@keyframes twinkle {
  0%, 100% { transform: scale(0.62) rotate(0); opacity: 0.45; }
  50% { transform: scale(1.18) rotate(45deg); opacity: 1; }
}

.result {
  min-height: 25px;
  margin: -4px 0 14px;
  color: var(--purple-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.result span {
  color: var(--pink);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.roll-button {
  position: relative;
  width: min(310px, 100%);
  padding: 16px 32px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  border: 3px solid var(--purple-dark);
  border-radius: 18px 7px 18px 7px;
  color: white;
  background: linear-gradient(105deg, var(--pink), var(--orange) 48%, #f6bb00);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  box-shadow: 7px 7px 0 var(--purple-dark), 0 13px 24px rgba(77, 20, 127, 0.22);
}

.roll-button:hover {
  transform: translateY(-3px);
  box-shadow: 8px 10px 0 var(--purple-dark), 0 16px 28px rgba(77, 20, 127, 0.28);
}

.roll-button:active {
  transform: translate(4px, 5px);
  box-shadow: 3px 3px 0 var(--purple-dark);
}

.roll-button:disabled {
  cursor: wait;
  filter: saturate(0.75);
}

.button-diamond {
  margin-right: 9px;
  color: var(--yellow);
}

.timer-display {
  margin: 22px 0 -4px;
  color: var(--purple-dark);
  font-family: "Baloo 2", monospace;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.hourglass-wrap {
  position: relative;
  display: grid;
  width: 100%;
  height: 347px;
  place-items: center;
  transform-origin: 50% 70%;
}

.hourglass {
  width: min(236px, 70%);
  overflow: visible;
  filter: drop-shadow(0 16px 14px rgba(45, 12, 86, 0.22));
}

.glass-fill {
  fill: rgba(225, 244, 255, 0.37);
}

.glass-outline {
  fill: none;
  stroke: var(--purple-dark);
  stroke-width: 11;
  stroke-linejoin: round;
}

.glass-shine {
  fill: none;
  stroke: white;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.9;
}

.hourglass-bar {
  fill: url(#frameGradient);
  stroke: var(--purple-dark);
  stroke-width: 8;
}

.bar-highlight {
  fill: rgba(255,255,255,0.45);
}

.sand-top,
.sand-bottom {
  transform-box: fill-box;
  transform-origin: center bottom;
}

.sand-bottom {
  transform: scaleY(0.06);
}

.sand-stream {
  fill: none;
  stroke: #ffb000;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(255,157,0,0.7));
}

.hourglass-wrap.is-running .sand-stream {
  opacity: 1;
  animation: streamPulse 0.24s linear infinite alternate;
}

@keyframes streamPulse {
  from { stroke-width: 4; }
  to { stroke-width: 8; }
}

.hourglass-wrap.is-finished {
  animation: finishShake 0.78s cubic-bezier(.36,.07,.19,.97) both 3;
}

@keyframes finishShake {
  10%, 90% { transform: translateX(-4px) rotate(-2deg); }
  20%, 80% { transform: translateX(7px) rotate(3deg); }
  30%, 50%, 70% { transform: translateX(-10px) rotate(-4deg); }
  40%, 60% { transform: translateX(10px) rotate(4deg); }
}

.time-up {
  position: absolute;
  z-index: 4;
  top: 46%;
  left: 50%;
  padding: 10px 20px;
  transform: translate(-50%, -50%) rotate(-6deg) scale(0);
  transition: transform 260ms cubic-bezier(.2,1.5,.5,1);
  border: 4px solid var(--purple-dark);
  border-radius: 13px 4px 13px 4px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-family: "Baloo 2", sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: 6px 6px 0 var(--pink);
}

.time-up.is-visible {
  transform: translate(-50%, -50%) rotate(-6deg) scale(1);
}

.time-options {
  display: grid;
  width: 100%;
  max-width: 470px;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

.time-button {
  display: flex;
  padding: 10px 6px 9px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
  border: 3px solid var(--purple-dark);
  border-radius: 14px 6px 14px 6px;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  color: var(--purple-dark);
  background: white;
  box-shadow: 4px 4px 0 var(--purple-dark);
}

.time-button:nth-child(2) { color: #0b716f; }
.time-button:nth-child(3) { color: #b1265c; }
.time-button:nth-child(4) { color: #a34800; }

.time-button strong {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.65rem;
  line-height: 1;
}

.time-button span {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.time-button:hover {
  transform: translateY(-2px);
}

.time-button:active {
  transform: translate(2px, 3px);
  box-shadow: 2px 2px 0 var(--purple-dark);
}

.time-button.is-selected {
  color: white;
  background: var(--purple);
  box-shadow: 4px 4px 0 var(--yellow);
}

.time-button:nth-child(2).is-selected { background: var(--teal); }
.time-button:nth-child(3).is-selected { background: var(--pink); }
.time-button:nth-child(4).is-selected { background: var(--orange); }

.timer-hint {
  margin: 13px 0 0;
  color: #765f91;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
}

.class-game {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 30px;
  padding: clamp(22px, 3.4vw, 38px);
  border: 5px solid var(--yellow);
  border-radius: 38px 13px 38px 13px;
  color: white;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 211, 61, 0.16), transparent 24%),
    radial-gradient(circle at 88% 76%, rgba(0, 169, 161, 0.18), transparent 25%),
    linear-gradient(135deg, #220747 0%, #441078 52%, #26105e 100%);
  box-shadow: 0 25px 58px rgba(16, 2, 40, 0.48), 0 0 0 7px rgba(233, 68, 121, 0.25);
}

.class-game::before,
.class-game::after {
  position: absolute;
  z-index: -1;
  width: 290px;
  height: 290px;
  content: "";
  pointer-events: none;
  opacity: 0.105;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: grayscale(1) brightness(2.4) contrast(1.2);
}

.class-game::before {
  top: -68px;
  right: -52px;
  transform: rotate(9deg);
  background-image: url("assets/3d-maska.png");
}

.class-game::after {
  bottom: -92px;
  left: -68px;
  transform: rotate(-12deg);
  background-image: url("assets/3d-antylopa.png");
}

.class-game__heading {
  position: relative;
  z-index: 1;
  display: flex;
  max-width: 820px;
  align-items: center;
  gap: 14px;
}

.class-game__heading .section-number {
  color: var(--purple-dark);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--pink);
}

.class-game__heading .section-kicker {
  color: var(--yellow);
}

.class-game__heading h2 {
  color: white;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.class-game__heading p:last-child {
  margin: 5px 0 0;
  color: #eadcff;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.class-game__setup {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  padding: clamp(18px, 2.6vw, 28px);
  border: 4px solid white;
  border-radius: 27px 9px 27px 9px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 249, 233, 0.96)),
    var(--cream);
  box-shadow: 7px 7px 0 var(--pink), inset 0 0 0 3px rgba(255, 211, 61, 0.32);
}

.class-game__setup[hidden],
.class-game__workspace[hidden] {
  display: none;
}

.class-game__settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr)) minmax(190px, 0.9fr);
  gap: 16px;
  align-items: end;
}

.class-game__field {
  display: grid;
  gap: 7px;
  color: var(--purple-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.class-game__field select {
  width: 100%;
  min-height: 52px;
  padding: 10px 42px 10px 14px;
  appearance: none;
  border: 3px solid var(--purple-dark);
  border-radius: 15px 6px 15px 6px;
  color: var(--purple-dark);
  background:
    linear-gradient(45deg, transparent 50%, var(--purple-dark) 50%) calc(100% - 18px) 21px / 7px 7px no-repeat,
    linear-gradient(135deg, var(--purple-dark) 50%, transparent 50%) calc(100% - 11px) 21px / 7px 7px no-repeat,
    white;
  font: 800 1rem "Montserrat", sans-serif;
  box-shadow: 4px 4px 0 rgba(81, 21, 139, 0.16);
}

.class-game__create {
  display: inline-flex;
  min-height: 54px;
  padding: 12px 20px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  border: 3px solid var(--purple-dark);
  border-radius: 17px 7px 17px 7px;
  color: white;
  background: linear-gradient(105deg, var(--pink), var(--orange));
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  box-shadow: 6px 6px 0 var(--purple-dark);
}

.class-game__create span {
  color: var(--yellow);
}

.class-game__create:hover {
  transform: translateY(-2px);
  box-shadow: 7px 8px 0 var(--purple-dark);
}

.score-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed rgba(81, 21, 139, 0.2);
}

.score-rules span {
  padding: 8px 11px;
  border: 2px solid var(--purple-dark);
  border-radius: 999px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(81, 21, 139, 0.17);
}

.score-rules span:nth-child(2) { color: white; background: var(--teal); }
.score-rules span:nth-child(3) { color: white; background: var(--pink); }
.score-rules span:nth-child(4) { color: white; background: var(--purple-light); }
.score-rules span:nth-child(5) { color: white; background: var(--orange); }

.class-game__save-note {
  margin: 14px 0 0;
  color: #65507f;
  font-size: 0.76rem;
  font-weight: 700;
}

.class-game__save-note span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 5px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--teal);
  font-weight: 900;
}

.class-game__workspace {
  position: relative;
  z-index: 1;
  margin-top: 24px;
}

.class-game__toolbar {
  display: grid;
  padding: 12px 14px;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px 7px 18px 7px;
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(9px);
}

.round-navigation {
  display: inline-grid;
  grid-template-columns: 42px minmax(140px, auto) 42px;
  align-items: center;
  overflow: hidden;
  border: 3px solid var(--yellow);
  border-radius: 14px 5px 14px 5px;
  color: var(--purple-dark);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--pink);
}

.round-navigation button {
  height: 42px;
  padding: 0;
  cursor: pointer;
  border: 0;
  color: white;
  background: var(--purple);
  font-size: 1.3rem;
  font-weight: 900;
}

.round-navigation button:disabled {
  cursor: not-allowed;
  color: #9586aa;
  background: #ded5e8;
}

.round-navigation strong {
  padding-inline: 12px;
  text-align: center;
  font-size: 0.84rem;
  white-space: nowrap;
}

.class-game__toolbar > p {
  margin: 0;
  color: #e9ddfa;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.save-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #55e096;
  box-shadow: 0 0 0 4px rgba(85, 224, 150, 0.16);
}

.class-game__new {
  padding: 10px 12px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 12px 5px 12px 5px;
  color: white;
  background: transparent;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.class-game__new:hover {
  color: var(--purple-dark);
  background: white;
}

.class-game__layout {
  display: grid;
  margin-top: 18px;
  grid-template-columns: minmax(0, 1fr) 265px;
  gap: 18px;
  align-items: start;
}

.classroom-wrap {
  min-width: 0;
}

.classroom-label {
  display: flex;
  width: fit-content;
  margin: 0 0 -14px 18px;
  padding: 9px 14px;
  align-items: center;
  gap: 9px;
  transform: rotate(-1deg);
  border: 3px solid var(--purple-dark);
  border-radius: 13px 5px 13px 5px;
  color: var(--purple-dark);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--pink);
}

.classroom-label > span {
  font-size: 1.25rem;
}

.classroom-label strong,
.classroom-label small {
  display: block;
}

.classroom-label strong {
  font-size: 0.78rem;
  text-transform: uppercase;
}

.classroom-label small {
  margin-top: 1px;
  font-size: 0.58rem;
  font-weight: 800;
}

.classroom {
  position: relative;
  overflow: hidden;
  min-height: 610px;
  border: 6px solid #37135f;
  border-radius: 30px 10px 30px 10px;
  background:
    linear-gradient(rgba(255, 249, 233, 0.88), rgba(255, 249, 233, 0.88)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(81, 21, 139, 0.14) 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(81, 21, 139, 0.14) 40px),
    linear-gradient(135deg, #ffd33d, #ff7a00 38%, #e94479 68%, #00a9a1);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.85), 7px 7px 0 rgba(233, 68, 121, 0.8);
}

.classroom::before,
.classroom::after {
  position: absolute;
  z-index: 0;
  content: "";
  pointer-events: none;
  opacity: 0.055;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.classroom::before {
  right: -20px;
  bottom: 8%;
  width: 210px;
  height: 210px;
  background-image: url("assets/tarcza.png");
}

.classroom::after {
  bottom: 2%;
  left: -28px;
  width: 190px;
  height: 190px;
  background-image: url("assets/dlon.png");
}

.teacher-desk {
  position: absolute;
  z-index: 2;
  top: 15px;
  left: 50%;
  width: min(310px, 58%);
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 3px solid var(--purple-dark);
  border-radius: 10px 4px 10px 4px;
  color: white;
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
  box-shadow: 4px 4px 0 var(--yellow);
}

.classroom-desk {
  position: absolute;
  z-index: 3;
  width: min(282px, 43%);
  min-height: 286px;
  padding: 38px 13px 12px;
  transform: translateX(-50%);
  border: 4px solid var(--purple-dark);
  border-top: 9px solid var(--team-color);
  border-radius: 19px 7px 19px 7px;
  color: var(--ink);
  background: linear-gradient(145deg, #fffefa, #fff3ce);
  box-shadow: 7px 8px 0 rgba(37, 10, 82, 0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.desk-chair {
  position: absolute;
  z-index: -1;
  width: 38px;
  height: 23px;
  border: 3px solid var(--purple-dark);
  border-radius: 12px 12px 6px 6px;
  background: var(--team-color);
}

.desk-chair--one,
.desk-chair--two { top: 55px; }
.desk-chair--three,
.desk-chair--four { bottom: 45px; }
.desk-chair--one,
.desk-chair--three { left: -28px; transform: rotate(-90deg); }
.desk-chair--two,
.desk-chair--four { right: -28px; transform: rotate(90deg); }

.desk-drag-handle {
  position: absolute;
  top: 5px;
  left: 50%;
  display: inline-flex;
  padding: 6px 12px;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  cursor: grab;
  touch-action: none;
  border: 2px solid var(--purple-dark);
  border-radius: 999px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--purple-dark);
}

.desk-drag-handle.is-dragging {
  cursor: grabbing;
  color: white;
  background: var(--pink);
}

.team-name-label {
  display: grid;
  gap: 3px;
  text-align: center;
}

.team-name-label > span {
  color: #755d90;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.team-name-input {
  width: 100%;
  padding: 3px 7px 5px;
  border: 0;
  border-bottom: 3px solid var(--team-color);
  border-radius: 6px 6px 0 0;
  outline: 0;
  color: var(--purple-dark);
  background: rgba(255, 255, 255, 0.76);
  font: 900 1.08rem "Baloo 2", sans-serif;
  line-height: 1.2;
  text-align: center;
}

.team-name-input:focus {
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 211, 61, 0.55);
}

.desk-round-label {
  margin: 8px 0 5px;
  color: #6b557f;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.desk-score-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.desk-score-options button,
.desk-bonuses button {
  cursor: pointer;
  transition: transform 120ms ease, color 120ms ease, background 120ms ease, box-shadow 120ms ease;
  border: 2px solid var(--purple-dark);
  color: var(--purple-dark);
  background: white;
  font-weight: 900;
}

.desk-score-options button {
  display: flex;
  min-height: 34px;
  padding: 4px 6px;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  border-radius: 9px 3px 9px 3px;
  font-size: 0.54rem;
}

.desk-score-options button strong {
  font-size: 0.7rem;
}

.desk-score-options button:hover,
.desk-bonuses button:hover {
  transform: translateY(-1px);
  box-shadow: 2px 3px 0 rgba(37, 10, 82, 0.3);
}

.desk-score-options button.is-selected {
  color: white;
  background: var(--purple);
  box-shadow: 2px 2px 0 var(--team-color);
}

.desk-score-options button[data-score="3"].is-selected { color: var(--purple-dark); background: var(--yellow); }
.desk-score-options button[data-score="2"].is-selected { background: var(--teal); }
.desk-score-options button[data-score="1"].is-selected { background: var(--pink); }
.desk-score-options button[data-score="0"].is-selected { background: #6d6378; }

.desk-bonuses {
  display: grid;
  margin-top: 7px;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.desk-bonuses button {
  min-height: 32px;
  padding: 4px 5px;
  border-radius: 999px;
  font-size: 0.54rem;
}

.desk-bonuses button.is-selected {
  color: white;
  background: linear-gradient(105deg, var(--orange), var(--pink));
  box-shadow: 2px 2px 0 var(--purple-dark);
}

.desk-total {
  display: flex;
  margin-top: 8px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #6b557f;
  font-size: 0.57rem;
  font-weight: 900;
  text-transform: uppercase;
}

.desk-total span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.desk-total strong {
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding-inline: 5px;
  place-items: center;
  border-radius: 8px 3px 8px 3px;
  color: white;
  background: var(--purple);
  font-size: 0.7rem;
}

.class-ranking {
  position: sticky;
  top: 18px;
  overflow: hidden;
  padding: 15px;
  border: 4px solid var(--yellow);
  border-radius: 24px 8px 24px 8px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 7px 7px 0 var(--pink);
}

.class-ranking::after {
  display: block;
  height: 8px;
  margin: 13px -15px -15px;
  content: "";
  background: repeating-linear-gradient(90deg, var(--pink) 0 20px, var(--orange) 20px 40px, var(--yellow) 40px 60px, var(--teal) 60px 80px, var(--purple-light) 80px 100px);
}

.class-ranking__title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.class-ranking__title > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  transform: rotate(-6deg);
  border-radius: 12px 5px 12px 5px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-size: 1.1rem;
  box-shadow: 3px 3px 0 var(--pink);
}

.class-ranking__title p {
  margin: 0;
  color: var(--pink);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.class-ranking h3 {
  margin: 0;
  color: var(--purple-dark);
  font: 900 1.35rem/1 "Baloo 2", sans-serif;
}

.class-ranking ol {
  display: grid;
  margin: 16px 0 0;
  padding: 0;
  gap: 7px;
  list-style: none;
}

.class-ranking li {
  display: grid;
  min-width: 0;
  padding: 8px;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 2px solid rgba(81, 21, 139, 0.18);
  border-radius: 12px 5px 12px 5px;
  background: white;
}

.class-ranking li:first-child {
  border-color: #e7ae00;
  background: #fff8cf;
}

.class-ranking__place {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 10px 4px 10px 4px;
  color: white;
  background: var(--purple);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--yellow);
}

.class-ranking li:first-child .class-ranking__place {
  color: var(--purple-dark);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--pink);
}

.class-ranking li div {
  min-width: 0;
}

.class-ranking li strong,
.class-ranking li small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-ranking li strong {
  color: var(--purple-dark);
  font-size: 0.7rem;
}

.class-ranking li small {
  margin-top: 2px;
  color: #7b6990;
  font-size: 0.52rem;
  font-weight: 800;
}

.class-ranking li > b {
  color: var(--pink);
  font: 900 0.78rem "Baloo 2", sans-serif;
  white-space: nowrap;
}

.class-ranking__hint {
  margin: 12px 2px 0;
  color: #77658b;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.method-card {
  display: grid;
  margin-top: 28px;
  padding: clamp(22px, 3vw, 34px);
  grid-template-columns: minmax(180px, 300px) 1fr;
  gap: clamp(22px, 4vw, 42px);
  align-items: center;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 34px 12px 34px 12px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.97), rgba(255,249,233,0.96)),
    var(--cream);
  box-shadow:
    0 20px 46px rgba(19, 3, 47, 0.34),
    0 0 0 7px rgba(0, 169, 161, 0.18);
}

.method-card__visual {
  position: relative;
  display: grid;
  place-items: center;
}

.method-card__visual::before {
  position: absolute;
  inset: 13% 5% 6%;
  content: "";
  border-radius: 30px;
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  filter: blur(22px);
  opacity: 0.35;
}

.method-card__visual img {
  position: relative;
  display: block;
  width: min(100%, 270px);
  height: auto;
  filter: drop-shadow(0 18px 18px rgba(35, 9, 74, 0.28));
}

.method-card__content .eyebrow {
  color: var(--pink);
}

.method-intro {
  max-width: 700px;
  margin: 10px 0 16px;
  color: #5c477a;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.65;
}

.method-steps {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 10px;
  list-style: none;
  counter-reset: method-step;
}

.method-steps li {
  position: relative;
  min-height: 42px;
  padding: 9px 12px 9px 54px;
  border: 2px solid rgba(81, 21, 139, 0.18);
  border-radius: 16px 6px 16px 6px;
  background: rgba(255,255,255,0.72);
  color: #3d2a5c;
  font-size: 0.86rem;
  line-height: 1.45;
  counter-increment: method-step;
}

.method-steps li::before {
  position: absolute;
  top: 8px;
  left: 10px;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  transform: rotate(-5deg);
  border-radius: 10px 4px 10px 4px;
  color: white;
  background: var(--purple);
  font-weight: 900;
  content: counter(method-step);
  box-shadow: 3px 3px 0 var(--yellow);
}

.method-steps strong {
  color: var(--purple-dark);
}

.method-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.method-variants span {
  padding: 7px 10px;
  border: 2px solid var(--purple-dark);
  border-radius: 999px;
  color: white;
  background: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  box-shadow: 3px 3px 0 var(--purple-dark);
}

.method-variants span:nth-child(2) { background: var(--orange); }
.method-variants span:nth-child(3) { background: var(--pink); }
.method-variants span:nth-child(4) { background: var(--purple); }

.resource-button {
  display: inline-flex;
  margin-top: 18px;
  padding: 13px 18px;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease, box-shadow 150ms ease;
  border: 3px solid var(--purple-dark);
  border-radius: 16px 6px 16px 6px;
  color: white;
  background: linear-gradient(105deg, var(--purple), var(--purple-light));
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 5px 5px 0 var(--yellow);
}

.resource-button:hover {
  transform: translateY(-2px);
  box-shadow: 6px 7px 0 var(--yellow);
}

.seo-guide {
  margin-top: 28px;
  padding: clamp(24px, 4vw, 42px);
  border: 4px solid rgba(255, 211, 61, 0.9);
  border-radius: 34px 12px 34px 12px;
  color: white;
  background: rgba(35, 7, 76, 0.86);
  box-shadow: 0 20px 46px rgba(19, 3, 47, 0.34);
  backdrop-filter: blur(12px);
}

.seo-guide__heading {
  max-width: 790px;
}

.seo-guide__heading h2 {
  color: white;
}

.seo-guide__heading > p:last-child {
  margin: 10px 0 0;
  color: #eadcff;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.65;
}

.seo-guide__grid {
  display: grid;
  margin-top: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.seo-guide article {
  padding: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px 7px 18px 7px;
  background: rgba(255, 255, 255, 0.08);
}

.seo-guide article:nth-child(2),
.seo-guide article:nth-child(3) {
  border-color: rgba(0, 169, 161, 0.62);
}

.seo-guide h3 {
  margin: 0 0 7px;
  color: var(--yellow);
  font-family: "Baloo 2", sans-serif;
  font-size: 1.15rem;
  line-height: 1.2;
}

.seo-guide article p {
  margin: 0;
  color: #f2eaff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.6;
}

.version-history {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 3px dashed rgba(255, 211, 61, 0.5);
}

.version-history__heading {
  display: flex;
  align-items: center;
  gap: 13px;
}

.version-history__icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  transform: rotate(-5deg);
  border: 3px solid var(--purple-dark);
  border-radius: 14px 6px 14px 6px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-size: 1rem;
  box-shadow: 4px 4px 0 var(--pink);
}

.version-history__heading p {
  margin: 0;
  color: var(--pink);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.version-history__heading h3 {
  margin: 1px 0 0;
  color: white;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1;
}

.version-history__timeline {
  position: relative;
  display: grid;
  margin-top: 20px;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 16px;
}

.seo-guide .version-card {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 2.7vw, 28px);
  border-width: 4px;
  box-shadow: 7px 7px 0 rgba(12, 2, 35, 0.35);
}

.seo-guide .version-card::after {
  position: absolute;
  right: -37px;
  bottom: -42px;
  width: 150px;
  height: 150px;
  content: "";
  transform: rotate(-12deg);
  opacity: 0.07;
  pointer-events: none;
  background: url("assets/tarcza.png") center / contain no-repeat;
}

.seo-guide .version-card--current {
  border-color: var(--yellow);
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 249, 233, 0.97)),
    var(--cream);
  box-shadow: 7px 7px 0 var(--pink);
}

.seo-guide .version-card--first {
  border-color: rgba(0, 169, 161, 0.72);
  background: linear-gradient(145deg, rgba(122, 47, 194, 0.25), rgba(0, 169, 161, 0.09));
}

.seo-guide .version-card--first::after {
  background-image: url("assets/dlon.png");
  filter: invert(1);
}

.version-card__topline {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.version-card__number,
.version-card__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 0.055em;
}

.version-card__number {
  padding: 9px 13px;
  transform: rotate(-1.5deg);
  border: 3px solid var(--purple-dark);
  border-radius: 13px 5px 13px 5px;
  color: var(--purple-dark);
  background: var(--yellow);
  font-size: 0.88rem;
  box-shadow: 3px 3px 0 var(--pink);
}

.version-card--first .version-card__number {
  color: white;
  background: var(--purple-light);
  box-shadow: 3px 3px 0 var(--teal);
}

.version-card__status {
  padding: 6px 9px;
  border-radius: 999px;
  color: white;
  background: var(--pink);
  font-size: 0.55rem;
}

.version-card--first .version-card__status {
  border: 2px solid rgba(255, 255, 255, 0.42);
  color: #e9ddfa;
  background: rgba(255, 255, 255, 0.09);
}

.seo-guide .version-card .version-card__date {
  position: relative;
  z-index: 1;
  margin: 14px 0 4px;
  color: var(--pink);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.seo-guide .version-card--first .version-card__date {
  color: var(--teal);
}

.version-card h4 {
  position: relative;
  z-index: 1;
  margin: 0 0 15px;
  color: var(--purple-dark);
  font-family: "Baloo 2", sans-serif;
  font-size: 1.22rem;
  line-height: 1.2;
}

.version-card--first h4 {
  color: var(--yellow);
}

.version-card ul {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style: none;
}

.version-card li {
  position: relative;
  padding: 8px 10px 8px 39px;
  border: 2px solid rgba(81, 21, 139, 0.14);
  border-radius: 13px 5px 13px 5px;
  color: #55406f;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.45;
}

.version-card li::before {
  position: absolute;
  top: 50%;
  left: 10px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  transform: translateY(-50%) rotate(-4deg);
  border-radius: 7px 3px 7px 3px;
  color: white;
  background: var(--purple);
  font-size: 0.6rem;
  font-weight: 900;
  content: "✓";
  box-shadow: 2px 2px 0 var(--yellow);
}

.version-card li strong {
  color: var(--purple-dark);
}

.version-card--first li {
  border-color: rgba(255, 255, 255, 0.22);
  color: #eee5fb;
  background: rgba(255, 255, 255, 0.075);
}

.version-card--first li::before {
  background: var(--teal);
  box-shadow: 2px 2px 0 var(--purple-dark);
}

.version-card--first li strong {
  color: white;
}

button:focus-visible,
.resource-button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 4px;
}

@media (max-width: 820px) {
  .game { width: min(620px, calc(100% - 24px)); }
  .game__header { flex-direction: column; gap: 12px; text-align: center; }
  .brand-logo { width: min(330px, 86vw); }
  .brand-copy { min-width: 0; }
  .teacher-guide__bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "intro toggle"
      "steps steps";
  }
  .teacher-guide.is-collapsed .teacher-guide__bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "intro toggle";
  }
  .teacher-guide__intro { justify-content: center; text-align: left; }
  .teacher-guide__steps { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
  .prepare-resources__buttons { grid-template-columns: 1fr; }
  .playboard { grid-template-columns: 1fr; }
  .board-divider { height: 58px; }
  .board-divider::before { width: 78%; height: 3px; background: repeating-linear-gradient(to right, var(--purple-light) 0 11px, transparent 11px 20px); }
  .dice-stage { min-height: 304px; }
  .panel { padding-inline: 28px; }
  .timer-panel { padding-top: 8px; }
  .class-game__settings { grid-template-columns: 1fr 1fr; }
  .class-game__create { grid-column: 1 / -1; }
  .class-game__toolbar { grid-template-columns: auto 1fr; }
  .class-game__toolbar > p { text-align: right; }
  .class-game__new { grid-column: 1 / -1; }
  .class-game__layout { grid-template-columns: 1fr; }
  .class-ranking { position: static; }
  .class-ranking ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-card { grid-template-columns: 1fr; text-align: center; }
  .method-intro { margin-inline: auto; }
  .method-steps { text-align: left; }
  .method-variants { justify-content: center; }
  .seo-guide__heading { margin-inline: auto; text-align: center; }
  .version-history__timeline { grid-template-columns: 1fr; }
}

@media (max-width: 470px) {
  :root { --cube-size: 176px; }
  .game { width: calc(100% - 18px); padding-top: 18px; }
  .game__header { margin: -2px 0 12px; }
  .brand-logo { width: min(286px, 88vw); }
  .teacher-guide { margin-bottom: 14px; }
  .teacher-guide__bar { padding: 13px 10px; }
  .teacher-guide__intro h2 { font-size: 1.05rem; }
  .teacher-guide__intro p { font-size: 0.52rem; }
  .teacher-guide__info { width: 38px; height: 38px; }
  .teacher-guide__toggle { min-width: 72px; padding-inline: 7px; font-size: 0.61rem; }
  .teacher-guide__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-trigger { white-space: normal; }
  .teacher-guide__bubble,
  .teacher-guide__bubble.has-resources { width: calc(100% - 8px); padding: 16px 44px 16px 13px; grid-template-columns: 38px 1fr; }
  .teacher-guide__step { width: 36px; height: 36px; }
  .teacher-guide__bubble p { font-size: 0.76rem; }
  .prepare-resource-button { min-height: 48px; }
  .prepare-resource-viewer { margin-left: -49px; padding: 6px; }
  .playboard { border-width: 3px; border-radius: 28px 10px 28px 10px; }
  .panel { padding: 34px 18px 28px; }
  .dice-stage { min-height: 272px; }
  .dice-mode { margin-top: 16px; }
  .dice-mode__button { padding-inline: 5px; font-size: 0.7rem; }
  .dice-shadow { bottom: 28px; }
  .hourglass-wrap { height: 320px; }
  .time-button strong { font-size: 1.4rem; }
  .time-options { grid-template-columns: repeat(2, 1fr); }
  .class-game { padding: 20px 11px; border-width: 3px; }
  .class-game__heading { padding-inline: 7px; }
  .class-game__heading p:last-child { font-size: 0.76rem; }
  .class-game__setup { padding: 17px 12px; border-width: 3px; }
  .class-game__settings { grid-template-columns: 1fr; }
  .class-game__create { grid-column: auto; }
  .score-rules { justify-content: center; }
  .score-rules span { padding: 7px 9px; font-size: 0.64rem; }
  .class-game__save-note { font-size: 0.68rem; text-align: center; }
  .class-game__toolbar { grid-template-columns: 1fr; }
  .round-navigation { width: 100%; grid-template-columns: 42px 1fr 42px; }
  .class-game__toolbar > p { text-align: center; }
  .classroom-label { margin-left: 9px; }
  .classroom { border-width: 4px; }
  .classroom-desk { width: min(244px, calc(100% - 58px)); min-height: 286px; padding-inline: 10px; }
  .desk-score-options button { font-size: 0.51rem; }
  .desk-bonuses button { font-size: 0.51rem; }
  .class-ranking ol { grid-template-columns: 1fr; }
  .method-card { padding: 20px 14px; border-width: 3px; }
  .method-steps li { padding-right: 10px; font-size: 0.8rem; }
  .resource-button { width: 100%; }
  .seo-guide { padding: 22px 14px; border-width: 3px; }
  .seo-guide__grid { grid-template-columns: 1fr; }
  .seo-guide article { padding: 16px; }
  .version-history { margin-top: 28px; padding-top: 22px; }
  .version-history__heading { justify-content: center; text-align: left; }
  .seo-guide .version-card { padding: 18px 13px; }
  .version-card__topline { align-items: flex-start; flex-direction: column; }
  .version-card li { padding-left: 37px; font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Public identity and contact details help schools verify the application. */
.trust-footer {
  margin: 28px auto 8px;
  padding: 22px 24px;
  max-width: 920px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  background: rgba(29, 9, 66, 0.58);
}

.trust-footer p {
  margin: 0 0 7px;
}

.trust-footer a {
  color: #fff38a;
  font-weight: 800;
}
