/* memory: spillregler flyttet ut av styles.css 11. oktober 2026, i samme rekkefølge.
   Lastes rett etter styles.min.css på universet.html. */
.memory-section {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 18%, rgba(246, 196, 83, 0.34) 0 150px, transparent 152px),
    radial-gradient(circle at 92% 82%, rgba(229, 111, 93, 0.24) 0 190px, transparent 192px),
    linear-gradient(145deg, #0e5878 0%, var(--fjord-deep) 54%, #402b50 100%);
}
.memory-section::before,
.memory-section::after {
  content: "";
  position: absolute;
  border: 24px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}
.memory-section::before {
  top: -110px;
  right: 12%;
  width: 270px;
  height: 190px;
}
.memory-section::after {
  bottom: -140px;
  left: 18%;
  width: 340px;
  height: 250px;
}
.memory-section--school {
  scroll-margin-top: 118px;
  margin-top: clamp(34px, 6vw, 64px);
  padding: clamp(26px, 5vw, 56px) 0;
  border-radius: 38px;
  background:
    linear-gradient(145deg, rgba(8, 73, 104, 0.9), rgba(18, 59, 83, 0.94) 56%, rgba(64, 43, 80, 0.9)),
    url("../images/generated/places/skoleveien-rita-sunniva-sm.jpg") center 38% / cover;
  box-shadow: 0 20px 46px rgba(18, 59, 83, 0.23);
}
.memory-section--school > .container {
  width: min(calc(100% - 30px), 1120px);
}
.memory-game__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  margin-bottom: 24px;
}
.memory-game__head h2 {
  margin: 10px 0 6px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
}
.memory-game__head p {
  max-width: 760px;
  margin: 0;
}
.memory-game__score strong,
.memory-game__score span {
  padding: 10px 15px;
  font-family: var(--font-title);
}
.memory-game__score strong {
  color: #ffe17a;
  font-size: 1.15rem;
}
.memory-game__score span {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 700;
}
.memory-game__toolbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 12px;
  border: 3px solid rgba(17, 106, 141, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 20px rgba(18, 59, 83, 0.1);
}
.memory-game__sizes {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.memory-game__sizes > span {
  padding: 0 5px;
  font-family: var(--font-title);
  font-weight: 800;
}
.memory-game__sizes button {
  min-height: var(--tap);
  padding: 8px 15px;
  border: 2px solid rgba(17, 106, 141, 0.24);
  border-radius: 999px;
  background: var(--white);
  color: var(--fjord-deep);
  font-family: var(--font-title);
  font-weight: 800;
  cursor: pointer;
}
.memory-game__sizes button[aria-pressed="true"] {
  border-color: var(--fjord);
  background: var(--fjord);
  color: var(--white);
  box-shadow: 0 6px 0 rgba(18, 59, 83, 0.18);
}
.memory-game__sizes button:focus-visible,
.memory-card:focus-visible {
  outline: 4px solid var(--fjord-deep);
  outline-offset: 4px;
}
.memory-board {
  display: grid;
  gap: clamp(9px, 1.5vw, 16px);
  padding: clamp(12px, 2vw, 20px);
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 22%, rgba(255, 255, 255, 0.28) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 66%, rgba(255, 255, 255, 0.2) 0 6px, transparent 7px),
    linear-gradient(145deg, #2c91aa, #176887 58%, #15536e);
  background-size: 120px 100px, 170px 150px, auto;
  box-shadow: inset 0 0 40px rgba(18, 59, 83, 0.28), 0 16px 35px rgba(18, 59, 83, 0.18);
  transition: box-shadow 220ms ease;
}
.memory-board[data-memory-count="8"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.memory-board[data-memory-count="12"],
.memory-board[data-memory-count="24"] {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.memory-card {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 19px;
  background: transparent;
  aspect-ratio: 4 / 5;
  cursor: pointer;
  perspective: 900px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.memory-card__inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  pointer-events: none;
  transition: transform 420ms cubic-bezier(0.2, 0.72, 0.24, 1);
}
.memory-card.is-flipped .memory-card__inner,
.memory-card.is-matched .memory-card__inner {
  transform: rotateY(180deg);
}
.memory-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border: 4px solid var(--white);
  border-radius: 19px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 9px 0 rgba(18, 59, 83, 0.18), 0 14px 22px rgba(18, 59, 83, 0.28);
}
.memory-card__front {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.08) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.08) 75%),
    linear-gradient(135deg, var(--plum), #395376 58%, var(--fjord));
  background-size: 26px 26px, auto;
}
.memory-card__front img {
  width: 58%;
  height: auto;
  filter: drop-shadow(0 6px 8px rgba(18, 59, 83, 0.32));
}
.memory-card__front span {
  display: grid;
  width: 36px;
  height: 36px;
  margin-top: 8px;
  place-items: center;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--sun);
  color: var(--fjord-deep);
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 900;
}
.memory-card__back {
  align-items: stretch;
  flex-direction: column;
  background: var(--white);
  transform: rotateY(180deg);
}
.memory-card__back img {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  object-fit: cover;
  object-position: var(--memory-position, center);
  filter: saturate(1.18) contrast(1.04);
}
.memory-card__back strong {
  display: grid;
  min-height: 46px;
  padding: 6px 8px;
  place-items: center;
  background: var(--white);
  color: var(--fjord-deep);
  font-family: var(--font-title);
  font-size: clamp(0.78rem, 1.5vw, 1rem);
  line-height: 1.05;
  text-align: center;
}
.memory-card:hover .memory-card__inner {
  transform: translateY(-5px) rotate(-1deg);
}
.memory-card.is-flipped:hover .memory-card__inner,
.memory-card.is-matched:hover .memory-card__inner {
  transform: translateY(-3px) rotateY(180deg);
}
.memory-card.is-matched .memory-card__face {
  border-color: #ffe06a;
  box-shadow: 0 0 0 5px #65b878, 0 12px 24px rgba(18, 59, 83, 0.28);
}
.memory-card:disabled {
  opacity: 1;
  cursor: default;
}
.memory-game.is-complete .memory-board {
  box-shadow: 0 0 0 7px var(--sun), inset 0 0 40px rgba(18, 59, 83, 0.22), 0 20px 45px rgba(18, 59, 83, 0.3);
}
.memory-game__finish .game-finish-card__lead h3 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.35rem); }
.memory-game__daily {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 30px);
  align-items: center;
  margin-top: 20px;
  padding: clamp(13px, 2vw, 20px);
  border: 3px solid rgba(18, 61, 84, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 0 rgba(18, 61, 84, 0.12);
}
.memory-game__daily img {
  display: block;
  width: 100%;
  height: clamp(180px, 24vw, 240px);
  object-fit: cover;
  object-position: var(--memory-daily-position, center);
  border: 5px solid var(--white);
  border-radius: 20px;
  box-shadow: 0 10px 22px rgba(18, 61, 84, 0.22);
  filter: saturate(1.15) contrast(1.03);
}
.memory-game__daily h4 { margin: 7px 0 8px; font-size: clamp(1.65rem, 4vw, 2.8rem); }
.memory-game__daily p { margin: 0; color: #365c6d; font-size: 1.02rem; font-weight: 760; line-height: 1.55; }
.memory-game__footer {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}
.memory-game__footer p {
  margin: 0;
  font-weight: 800;
}
.memory-game__footer > span {
  color: var(--muted);
  font-weight: 700;
}
[data-calm="true"] .memory-card__inner,
[data-calm="true"] .memory-board {
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .memory-card__inner,
  .memory-board {
    transition: none !important;
  }
}
@media (max-width: 900px) {
  .memory-game__head {
    grid-template-columns: 1fr;
  }
  .memory-game__score {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .memory-game__score span {
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
  }
  .memory-board[data-memory-count="12"],
  .memory-board[data-memory-count="24"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  .memory-section--school {
    scroll-margin-top: 96px;
    margin-inline: -8px;
    padding-block: 22px;
    border-radius: 28px;
  }
  .memory-section--school > .container {
    width: calc(100% - 16px);
  }
  .memory-game__toolbar,
  .memory-game__footer {
    align-items: stretch;
    flex-direction: column;
  }
  .memory-game__daily { grid-template-columns: 1fr; }
  .memory-game__daily img { height: min(68vw, 300px); }
  .memory-game__toolbar .button {
    width: 100%;
  }
  .memory-game__sizes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .memory-game__sizes > span {
    grid-column: 1 / -1;
  }
  .memory-game__sizes button {
    min-width: 0;
    padding-inline: 7px;
  }
  .memory-board {
    gap: 8px;
    padding: 9px;
    border-width: 3px;
    border-radius: 22px;
  }
  .memory-board[data-memory-count="12"],
  .memory-board[data-memory-count="24"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .memory-card,
  .memory-card__face {
    border-radius: 14px;
  }
  .memory-card__face {
    border-width: 3px;
  }
  .memory-card__front span {
    width: 28px;
    height: 28px;
    margin-top: 4px;
    font-size: 1rem;
  }
  .memory-card__back strong {
    min-height: 38px;
    padding: 4px;
    font-size: 0.72rem;
  }
}
.memory-game {
  border-width: 3px;
  background:
    linear-gradient(145deg, rgba(238, 248, 244, 0.96), rgba(255, 247, 220, 0.94)),
    url("../images/canonical/oya-maram-sm.jpg") center / cover;
  box-shadow: 0 26px 62px rgba(6, 34, 51, 0.3);
}
.memory-board {
  border-width: 3px;
  background:
    linear-gradient(145deg, rgba(10, 91, 117, 0.86), rgba(12, 59, 82, 0.9)),
    url("../images/generated/games/krabbejakten-dam-v01-sm.jpg") center / cover;
  box-shadow: inset 0 0 44px rgba(4, 37, 53, 0.26), 0 16px 36px rgba(18, 59, 83, 0.19);
}
.memory-card__face {
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 0 rgba(18, 59, 83, 0.16), 0 13px 21px rgba(18, 59, 83, 0.25);
}
.memory-card__front {
  background:
    linear-gradient(145deg, rgba(57, 43, 80, 0.82), rgba(15, 89, 120, 0.84)),
    url("../images/canonical/oya-maram-sm.jpg") center / cover;
}
.memory-card__back img {
  filter: saturate(1.11) contrast(1.035) brightness(1.03);
}
.memory-game__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.memory-game__actions [data-memory-sound][aria-pressed="true"] {
  color: var(--white);
  background: var(--fjord);
}
.memory-card__front {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.2), transparent 31%),
    linear-gradient(145deg, #285f80, #342d59 72%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.memory-card:hover .memory-card__face,
.memory-card:focus-visible .memory-card__face {
  filter: saturate(1.12) brightness(1.04);
}
@media (max-width: 760px) {
  .memory-game__toolbar,
  .memory-game__actions {
    align-items: stretch;
  }
  .memory-game__actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .memory-game__actions .button {
    width: 100%;
  }
}
