/* DLKP Alumni Games. Yearbook style, matching the printed boards. */

@font-face { font-family: 'Caveat'; src: url(fonts/caveat-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Special Elite'; src: url(fonts/special-elite-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #f6efdf;
  --green: #1f5a35;
  --green-dark: #174529;
  --ink: #2b2622;
  --muted: #6d6455;
  --line: #b9ab8d;
  --tape: rgba(245, 205, 70, .72);
  --card: #fffdf8;
  --right: #1f5a35;
  --right-bg: #e3efdb;
  --wrong: #9a2f1f;
  --wrong-bg: #f8e4dc;
  --shadow: 0 2px 7px rgba(43, 38, 34, .24);
  --hand: 'Caveat', 'Segoe Print', cursive;
  --type: 'Special Elite', 'Courier New', monospace;
  --text: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }

html { background: var(--paper); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--text);
  font-size: 18px;
  line-height: 1.4;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(31, 90, 53, .2) 1.2px, transparent 1.5px);
  background-size: 22px 22px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
img { display: block; max-width: 100%; }
h1, h2, p, ol { margin: 0; padding: 0; }
ol { list-style: none; }
[hidden] { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }

.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px var(--gutter);
  background: rgba(246, 239, 223, .94);
  border-bottom: 2px dashed var(--line);
}

.brand { font: clamp(14px, 1.6vw, 21px)/1.2 var(--type); color: var(--green); }
.brand span { display: block; color: var(--muted); font-size: .84em; }

.home-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 20px 6px 14px;
  font: clamp(19px, 1.8vw, 24px)/1 var(--type);
  color: var(--paper);
  background: var(--green);
  border: 0;
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.home-btn:active { background: var(--green-dark); }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(14px, 2.4vh, 26px) var(--gutter) 20px;
}

/* Shared parts */

.title { font: 700 clamp(46px, 8.5vh, 76px)/1 var(--hand); color: var(--green); }
.sub { font: clamp(17px, 2.5vh, 23px)/1.3 var(--type); color: var(--ink); }

.tape {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 118px;
  height: 27px;
  margin-left: -59px;
  background: var(--tape);
  transform: rotate(-2deg);
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 10px 30px;
  font: 600 clamp(20px, 2vw, 25px)/1.2 var(--text);
  color: var(--green);
  background: var(--card);
  border: 3px solid var(--green);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.btn.primary { color: var(--paper); background: var(--green); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.polaroid {
  position: relative;
  background: #fff;
  padding: 10px 10px 8px;
  box-shadow: 0 3px 10px rgba(43, 38, 34, .3);
}
.polaroid img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.polaroid figcaption { padding-top: 6px; text-align: center; font: 700 clamp(22px, 3vh, 27px)/1.1 var(--hand); }
figure { margin: 0; }

/* Home */

.home { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: clamp(22px, 5vh, 48px); padding-bottom: 8px; }
.home-head { text-align: center; }
.home-head .title { font-size: clamp(56px, 12vh, 104px); }
.home-head .sub { margin-top: 2px; }

.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(22px, 3.4vw, 44px); }

.game-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  padding: 12px 12px 16px;
  text-align: center;
  background: #fff;
  border: 0;
  box-shadow: 0 3px 10px rgba(43, 38, 34, .3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.game-btn:nth-child(1) { transform: rotate(-1.3deg); }
.game-btn:nth-child(2) { transform: rotate(.8deg); }
.game-btn:nth-child(3) { transform: rotate(-.7deg); }
.game-btn:hover { transform: translateY(-3px); box-shadow: 0 7px 16px rgba(43, 38, 34, .3); }
.game-btn:active { transform: translateY(1px); box-shadow: var(--shadow); }
.game-btn img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.game-name { display: block; margin-top: 8px; font: 700 clamp(34px, 3.5vw, 62px)/1 var(--hand); color: var(--green); }
.game-note { display: block; margin-top: 4px; font: clamp(16px, 2.3vh, 20px)/1.25 var(--type); }

/* Level picker */

.levels-head { text-align: center; margin-bottom: clamp(18px, 4vh, 38px); }
.levels-screen { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.6vw, 32px); }

.level-btn {
  position: relative;
  min-height: 210px;
  padding: 30px 18px 22px;
  text-align: center;
  background: var(--card);
  border: 0;
  box-shadow: var(--shadow);
}
.level-btn:active { transform: translateY(1px); box-shadow: none; }
.level-name { display: block; font: 700 clamp(44px, 4.4vw, 62px)/1 var(--hand); color: var(--green); }
.level-who { display: block; margin-top: 12px; font: clamp(18px, 1.7vw, 22px)/1.3 var(--type); }

/* Quiz */

.quiz { flex: 1; display: flex; flex-direction: column; }

.quiz-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: clamp(16px, 1.7vw, 21px)/1.2 var(--type);
  color: var(--muted);
}
.quiz-meta b { font-weight: 400; color: var(--green); }

.progress { height: 8px; margin: 8px 0 clamp(12px, 2.4vh, 22px); background: rgba(185, 171, 141, .4); }
.progress i { display: block; height: 100%; background: var(--green); }

.question { font: 600 clamp(25px, 3.3vw, 46px)/1.22 var(--text); margin-bottom: clamp(14px, 2.6vh, 24px); }

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 18px); }

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: clamp(72px, 13vh, 112px);
  padding: 10px 16px;
  text-align: left;
  font: 400 clamp(21px, 2.3vw, 32px)/1.2 var(--text);
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.option:active:not(:disabled) { border-color: var(--green); }
.option:disabled { color: var(--ink); cursor: default; box-shadow: none; opacity: 1; }
.option .key { flex: none; width: 1.5em; font-family: var(--type); color: var(--green); }
.option .label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.option .mark { flex: none; width: 34px; height: 34px; }
.option.is-right { font-weight: 600; background: var(--right-bg); border-color: var(--right); }
.option.is-wrong { background: var(--wrong-bg); border-color: var(--wrong); }
.option.is-right .mark { color: var(--right); }
.option.is-wrong .mark { color: var(--wrong); }
.option.is-faded { color: var(--muted); }

.feedback {
  position: sticky;
  bottom: 8px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: clamp(12px, 2.4vh, 22px);
  padding: 16px 20px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(43, 38, 34, .32);
}
.feedback-text { flex: 1; min-width: 0; }
.feedback-title { font: 700 clamp(36px, 3.6vw, 46px)/1 var(--hand); color: var(--right); }
.feedback.is-wrong .feedback-title { color: var(--wrong); }
.feedback-fact { margin-top: 2px; font: 400 clamp(19px, 1.9vw, 26px)/1.3 var(--text); }
.feedback .btn { flex: none; }

/* Timeline and memory share one layout: a side panel on wide screens, stacked on phones. */

.play { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.play-side { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; }
.play-side .title { font-size: 48px; }
.play-main { min-width: 0; }
.game-stats { font: clamp(17px, 1.7vw, 22px)/1.25 var(--type); color: var(--muted); white-space: pre-wrap; }
.hint { flex: 0 0 100%; min-height: 2.6em; margin: 4px 0 8px; font: 400 clamp(18px, 1.8vw, 24px)/1.3 var(--text); }

.tl-end { font: clamp(15px, 1.4vw, 19px)/1.2 var(--type); color: var(--muted); }
.tl-list { display: flex; flex-direction: column; gap: clamp(7px, 1.1vh, 11px); margin: 4px 0; }

.tl-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: clamp(62px, 9.6vh, 86px);
  padding: 7px 14px;
  text-align: left;
  font: 400 clamp(19px, 1.95vw, 27px)/1.18 var(--text);
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tl-num { flex: none; width: 1.3em; font-family: var(--type); color: var(--green); }
.tl-text { flex: 1; min-width: 0; }
.tl-date { flex: none; max-width: 32%; text-align: right; font: 600 clamp(15px, 1.5vw, 20px)/1.15 var(--text); color: var(--green); }
.tl-card.is-selected { border-color: var(--green); background: #fbf0c4; transform: translateX(6px); }
.tl-card.is-target { border-color: var(--green); border-style: dashed; background: #fbf0c4; }
.tl-card.is-source { opacity: .45; }
.tl-card.is-locked { cursor: default; background: var(--right-bg); border-color: var(--right); box-shadow: none; touch-action: auto; }
.tl-card.just-swapped { animation: swap-in .28s ease; }

.ghost {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  margin: 0;
  background: #fbf0c4;
  border-color: var(--green);
  box-shadow: 0 8px 18px rgba(43, 38, 34, .35);
  transform: rotate(-1deg);
}

@keyframes swap-in { from { background: #fbf0c4; } to { background: var(--card); } }

.check-bar {
  position: sticky;
  bottom: 8px;
  z-index: 10;
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.check-bar .btn { min-width: min(100%, 340px); }

/* Memory */

.m-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; margin: 0 auto; }
.m-grid.is-small { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.m-card {
  display: block;
  width: 100%;
  aspect-ratio: 1.55;
  padding: 0;
  background: none;
  border: 0;
  perspective: 900px;
}
.m-grid.is-small .m-card { aspect-ratio: 1.08; }

.m-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform .34s ease;
  transform-style: preserve-3d;
}
.m-card.is-up .m-inner { transform: rotateY(180deg); }

.m-back, .m-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.m-back {
  color: var(--paper);
  background-color: var(--green);
  background-image: radial-gradient(rgba(246, 239, 223, .16) 1.2px, transparent 1.5px);
  background-size: 14px 14px;
  font: 700 clamp(30px, 5vh, 44px)/1 var(--hand);
}
.m-face {
  padding: clamp(6px, 1.2vh, 12px);
  overflow: hidden;
  text-align: center;
  background: #fff;
  border: 3px solid var(--line);
  transform: rotateY(180deg);
}
.m-name { font: clamp(16px, 2.2vw, 30px)/1.1 var(--type); color: var(--green); overflow-wrap: anywhere; }
.m-face img { display: none; width: 100%; height: 100%; object-fit: contain; }
.m-face.has-logo img { display: block; }
.m-face.is-dark.has-logo { background: var(--green); }
.m-face.has-logo .m-name { display: none; }
.m-card.is-matched .m-face { border-color: var(--right); border-width: 5px; }
.m-card.is-matched { cursor: default; }

.fine { margin-top: 10px; text-align: center; font: 400 clamp(13px, 1.1vw, 15px)/1.3 var(--text); color: var(--muted); }

/* End screens */

.end { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 3.6vw, 48px); align-items: center; }
.end-kicker { font: clamp(17px, 1.8vw, 22px)/1.25 var(--type); color: var(--muted); }
.score { font: clamp(76px, 15vh, 118px)/1 var(--type); color: var(--green); }
.score small { font-size: .5em; }
.score-note { font: clamp(17px, 1.8vw, 22px)/1.25 var(--type); }
.friendly { margin-top: 10px; font: 400 clamp(20px, 2vw, 25px)/1.3 var(--text); }

.souvenir {
  position: relative;
  margin-top: 22px;
  padding: 20px 18px 16px;
  text-align: center;
  font: clamp(21px, 2.2vw, 28px)/1.25 var(--type);
  color: var(--green);
  background: #fff;
  box-shadow: var(--shadow);
  transform: rotate(-.6deg);
}

.end-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.end-actions .btn { flex: 1 1 170px; }

.end-side .polaroid { max-width: 500px; margin: 0 auto; transform: rotate(1.6deg); }

.end-list { padding: 18px 20px; background: #fff; box-shadow: var(--shadow); }
.end-list li { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 2px dashed var(--line); }
.end-list li:last-child { border-bottom: 0; }
.end-list b { font: 400 clamp(15px, 1.5vw, 18px)/1.2 var(--type); color: var(--green); }
.end-list span { font: 400 clamp(17px, 1.6vw, 20px)/1.25 var(--text); }

/* Idle note */

.idle-note {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 50;
  width: min(92vw, 640px);
  padding: 13px 18px;
  text-align: center;
  font: clamp(18px, 1.8vw, 22px)/1.25 var(--type);
  color: var(--paper);
  background: var(--green);
  box-shadow: 0 4px 14px rgba(43, 38, 34, .4);
  transform: translateX(-50%);
}

/* Wide screens: the kiosk laptop or a landscape tablet */

@media (min-width: 1000px) and (orientation: landscape) {
  .play { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: clamp(24px, 3vw, 44px); }
  .play-side { display: block; }
  .play-side .title { font-size: clamp(56px, 5.4vw, 76px); }
  .game-stats { display: block; margin-top: 12px; }
  .hint { margin-top: 12px; }
  .timeline .play-main { width: 100%; max-width: 940px; }
  .memory .play-main { width: 100%; max-width: calc((100vh - 200px) * 1.55 + 30px); }
}

/* Portrait tablets and phones */

@media (max-width: 860px) {
  .games { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .game-btn { display: grid; grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: 1fr 1fr; column-gap: 14px; padding: 10px; text-align: left; }
  .game-btn img { grid-row: 1 / span 2; aspect-ratio: 1; }
  .game-name { align-self: end; margin: 0; font-size: 42px; }
  .game-note { align-self: start; font-size: 17px; }

  .levels { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .level-btn { min-height: 120px; padding: 22px 16px 16px; }

  .options { grid-template-columns: minmax(0, 1fr); }
  .option { min-height: 66px; }

  .feedback { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .feedback .btn { width: 100%; min-height: 60px; }

  .end { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .end-side { order: 2; }
  .end-side .polaroid { max-width: 340px; }
  .score { font-size: 84px; }
}

@media (min-width: 600px) and (max-width: 860px) {
  .game-btn { grid-template-columns: 200px minmax(0, 1fr); column-gap: 24px; }
  .game-name { font-size: 58px; }
  .game-note { font-size: 22px; }
}

@media (max-width: 480px) {
  .topbar { padding-top: 6px; padding-bottom: 6px; }
  .home-btn { min-height: 52px; padding: 4px 14px 4px 10px; }
  .brand span { display: none; }
  .home { gap: 26px; }
  .home-head .title { font-size: 64px; }
  .play-side .title { font-size: 46px; }
  .question { font-size: 24px; }
  .option { min-height: 62px; padding: 8px 12px; font-size: 20px; gap: 10px; }
  .option .mark { width: 28px; height: 28px; }
  .tl-card { gap: 8px; padding: 5px 10px; font-size: 18px; min-height: 66px; }
  .tl-date { max-width: 34%; font-size: 14px; }
  .m-name { font-size: 18px; }
}

/* Short phones: cards let the page scroll, so dragging gives way to tap-to-swap. */

@media (max-width: 860px) and (max-height: 740px) {
  .tl-card { touch-action: pan-y; }
  .check-bar { position: static; }
}

/* Short screens */

@media (max-height: 700px) {
  .home-head .title { font-size: 52px; }
  .game-btn img { aspect-ratio: 2.4; }
  .tl-card { min-height: 54px; }
  .option { min-height: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .game-btn:hover { transform: none; }
}
