/* Klockan – only what is special to this game: the target words over the clock, the digital boxes, the sun/moon switch,
   the row of small clocks, the duration task's two clocks + time line, and the "Lek med klockan" screen. The game box,
   menu, number pad, result, effects, red-pen rings, the hologram and the clock itself are every school game's:
   css/skolspel.css (+ js/skol-clock.js). */

.kl-holo {
  min-width: min(22rem, 100%);
  padding: 0.6rem 1rem 0.8rem;
}

/* The target: "halv fyra" / "15.30" in big hologram letters over the clock */
.kl-target {
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 900;
  font-style: italic;
  line-height: 1.2;
  color: #f2feff;
  text-shadow: 0 0 1px currentColor, 0 0 0.45em rgba(94, 240, 255, 0.5);
}

.kl-target.is-digital {
  font-style: normal;
  letter-spacing: 0.06em;
  color: var(--yellow);
  text-shadow: 0 0 1px currentColor, 0 0 0.45em rgba(255, 233, 77, 0.5);
}

.kl-target[hidden], .kl-digital[hidden], .kl-half[hidden], .kl-duration-wrap[hidden], .kl-timeline[hidden], #clock-box[hidden], #clocks[hidden] {
  display: none;
}

#clock-box {
  display: grid;
  place-items: center;
}

/* The digital boxes HH.MM (typed with the number pad; a tap picks a box) */
.kl-digital {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin-top: 0.5rem;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  color: #f2feff;
}

.kl-box {
  display: inline-grid;
  place-items: center;
  min-width: 2.3ch;
  padding: 0 0.15em;
  font: inherit;
  color: var(--yellow);
  background: none;
  border: 3px solid rgba(94, 240, 255, 0.45);
  cursor: pointer;
}

.kl-box.is-empty { color: rgba(242, 254, 255, 0.35); }
.kl-box.is-active { border-color: var(--yellow); box-shadow: 0 0 14px rgba(255, 233, 77, 0.6); }
.kl-box.is-active.is-empty { animation: kl-breathe 1.1s ease-in-out infinite; }

@keyframes kl-breathe {
  50% { box-shadow: 0 0 24px rgba(255, 233, 77, 1); }
}

.kl-between { color: #f2feff; }

.kl-unit {
  margin: 0 0.6rem 0 0.3rem;
  font-size: 0.45em;
  font-weight: 700;
  color: var(--text-muted);
}

/* The sun/moon switch (Dygnet's set tasks): which half of the day the clock is in */
.kl-half {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem auto 0;
  padding: 0.3rem 0.9rem;
  font: inherit;
  font-weight: 800;
  color: var(--text);
  background: var(--bg-raised);
  border: 2px solid rgba(94, 240, 255, 0.5);
  cursor: pointer;
}

.kl-half:hover, .kl-half:focus-visible { border-color: var(--yellow); }
.kl-half-sun, .kl-half-moon { display: inline-block; width: 1.4rem; height: 1.4rem; border-radius: 50%; }
.kl-half-sun { background: var(--yellow); box-shadow: 0 0 10px rgba(255, 233, 77, 0.9); }
.kl-half-moon { display: none; background: #f4f1dc; box-shadow: inset -0.45rem 0 0 0 #0e0a24, 0 0 8px rgba(244, 241, 220, 0.7); }
.kl-half.is-afternoon .kl-half-sun { display: none; }
.kl-half.is-afternoon .kl-half-moon { display: inline-block; }

/* "Which clock?": the small clocks as buttons (skol-choices.is-clocks) */
.kl-small-clock { display: block; }

/* A landscape box (owner, 2026-10-17: off-centre on an iPad held sideways) */
@media (orientation: landscape) {
  /* A reading task's word cards: beside the clock, level with its middle – in the normal box too, like in fullscreen
     (css/skolspel.css; they sat at the top right) */
  .skol-stage .skol-play > .skol-choices { grid-column: 2; grid-row: 2; align-self: center; }
  /* Nothing sits beside a "which" task (its clocks are inside the hologram, no number pad, no cards), so the hologram
     takes the whole width in the MIDDLE of the box instead of the play grid's left column. The feedback stays under
     it in the middle and "Vidare" (after a wrong answer) comes to its right, so nothing moves when it shows.
     klockan.js puts kl-centred on #play. */
  .skol-stage .skol-play.kl-centred:not([hidden]) { grid-template-columns: 1fr minmax(20rem, auto) 1fr; }
  .skol-stage .skol-play.kl-centred > .skol-holo { grid-column: 1 / -1; }
  .skol-stage .skol-play.kl-centred > .skol-feedback { grid-column: 2; }
  .skol-stage .skol-play.kl-centred > .skol-actions { grid-column: 3; justify-self: start; }
}

/* How long? Two clocks with their digital times and an arrow between, the time line under them */
.kl-duration {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  --clock: clamp(6.5rem, 20vw, 9rem);
}

.kl-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.kl-end-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--yellow);
}

.kl-arrow {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(94, 240, 255, 0.8);
}

.kl-timeline {
  display: block;
  width: min(26rem, 100%);
  height: auto;
  margin: 0.4rem auto 0;
  overflow: visible;
}

.kl-line { stroke: var(--cyan); stroke-width: 2.5; }
.kl-hour-mark { stroke: var(--cyan); stroke-width: 3; }
.kl-five-mark { stroke: rgba(94, 240, 255, 0.5); stroke-width: 1.5; }
.kl-hour-text { font-size: 11px; font-weight: 800; fill: #f2feff; }
.kl-point { fill: var(--yellow); filter: drop-shadow(0 0 5px rgba(255, 233, 77, 0.9)); }
.kl-point-to { fill: var(--magenta); filter: drop-shadow(0 0 5px rgba(255, 63, 180, 0.9)); }

/* The hops after a right answer: drawn one after another (the book's number line, an arc with the minutes above) */
.kl-hop {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 2.5;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  filter: drop-shadow(0 0 4px rgba(255, 233, 77, 0.9));
  animation: kl-hop 0.5s ease-out forwards;
  animation-delay: calc(var(--i, 1) * 0.35s - 0.35s);
}

@keyframes kl-hop {
  to { stroke-dashoffset: 0; }
}

.kl-hop-text {
  font-size: 10px;
  font-weight: 900;
  fill: var(--yellow);
  opacity: 0;
  animation: kl-hop-text 0.3s ease-out forwards;
  animation-delay: calc(var(--i, 1) * 0.35s);
}

@keyframes kl-hop-text {
  to { opacity: 1; }
}

/* The red pen on the time line: the hour marks (100 minutes an hour) or the whole line (only the minutes counted) */
.kl-timeline .is-ringed-mark { stroke: var(--red-pen); stroke-width: 5; filter: drop-shadow(0 0 5px rgba(255, 59, 59, 0.9)); }

.kl-duration-boxes {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.4rem;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
}

/* Fånga tiden: the big "Stopp!" button pulses while the hands run */
.kl-stop {
  font-size: 1.4rem;
  animation: kl-stop 0.8s ease-in-out infinite;
}

@keyframes kl-stop {
  50% { box-shadow: 0 0 20px rgba(255, 63, 180, 0.9); }
}

/* "Lek med klockan": a free clock, the words and digital times under it */
.kl-sandbox-clock {
  --clock: clamp(15rem, 50vw, 22rem);
  display: grid;
  place-items: center;
  margin: 0.5rem auto;
}

.kl-sandbox-words {
  min-height: 1.3em;
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 900;
  font-style: italic;
  color: #f2feff;
  text-shadow: 0 0 0.4em rgba(94, 240, 255, 0.5);
}

.kl-sandbox-digital {
  margin: 0.2rem 0 0.8rem;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--yellow);
}

.skol-menu-extra {
  margin-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .kl-box.is-active.is-empty, .kl-stop { animation: none; }
  .kl-hop { stroke-dashoffset: 0; animation: none; }
  .kl-hop-text { opacity: 1; animation: none; }
}
