/* FILL: the card is the screen.
 *
 * Jade, 2026-09-21: "this game should fill the whole screen with the card and
 * the one button that says the word." So: the topbar, the card as big as the
 * viewport allows, one button, nothing else. Same cream as the deck page.
 * Nothing moves when it is tapped: the fill is a clip-path over a picture
 * that is already there, and the button never changes size.
 */
:root {
  --desk: #f6ecd9; --leaf: #fffdf9; --edge: #e6dac4;
  --ink: #2b2620; --soft: #6d6158; --word: #6f8f83; --faint: #cabfa9;
  --gold: #e0a32a; --hot: #ff6a4d; --green: #2f7a48; --amber: #c08a1e; --red: #b4483a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--desk); color: var(--ink); display: flex; flex-direction: column;
  font-family: Geist, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }

.topbar { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.back {
  flex: none; font-size: 12.5px; color: var(--soft); text-decoration: none;
  border: 1px solid rgba(0,0,0,.12); border-radius: 999px; padding: 7px 13px;
  background: rgba(255,253,249,.7); font-weight: 600;
}
.title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.title b { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title span { font-size: 12px; color: var(--soft); white-space: nowrap; }
/* the therapist's setting: how many says fill a card */
.target { flex: none; display: flex; align-items: center; gap: 4px; }
.target[hidden] { display: none; }
.target span { font-size: 11px; color: var(--soft); margin-right: 4px; }
.target button {
  width: 34px; height: 30px; border: 1px solid var(--edge); border-radius: 8px;
  background: var(--leaf); color: var(--soft); font-weight: 700; font-size: 13px;
}
.target button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* MARK: the stage */

.stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 6px 12px;
}
.arrow {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12); background: rgba(255,253,249,.92);
  color: var(--soft); font-size: 24px; line-height: 1; display: grid; place-items: center;
}
.cardbox {
  flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center;
}
/* the plain card, when no face is chosen: the album look */
.bigcard {
  background: var(--leaf); border: 1px solid var(--edge); border-radius: 18px;
  padding: 10px 10px 0; display: flex; flex-direction: column; box-shadow: 0 10px 24px -16px rgba(70,52,24,.5);
  max-height: 100%; aspect-ratio: 3 / 4; max-width: 100%;
}
.bigcard .im { flex: 1; min-height: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #fbf7ef; }
.bigcard b { flex: none; padding: 10px 4px 12px; text-align: center; font-size: clamp(24px, 6vw, 44px); font-weight: 900; color: var(--word); }
/* a chosen face, drawn by deckface.js, held to the screen */
.cardbox .face { max-height: 100%; max-width: 100%; width: auto; aspect-ratio: 3 / 4; overflow: hidden; }

/* THE FILL. Every .im holds the greyed picture and, over it, a color copy
   clipped from the bottom by how far the child has got. */
.im { position: relative; }
.im img { display: block; width: 100%; height: 100%; object-fit: cover; }
.im img.grey { filter: grayscale(1) brightness(1.16) contrast(.82); opacity: .28; }
.im img.fill {
  position: absolute; inset: 0; clip-path: inset(100% 0 0 0);
  transition: clip-path .45s cubic-bezier(.2,.8,.2,1);
}
.im .line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed rgba(224,163,42,.9); pointer-events: none; }
.im.full img.fill { clip-path: inset(0 0 0 0); }
.im.full { box-shadow: inset 0 0 0 4px var(--gold); }

/* MARK: the foot */

.foot { flex: none; padding: 6px 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.of { font-size: 13px; color: var(--soft); min-height: 1.2em; }
.sayit {
  width: min(100%, 520px); border: 0; border-radius: 16px; padding: 18px; font-size: clamp(20px, 5vw, 28px);
  font-weight: 900; background: var(--gold); color: #24190a; box-shadow: 0 6px 0 #b8801c;
}
.sayit:active { transform: translateY(3px); box-shadow: 0 3px 0 #b8801c; }
.keys { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; width: min(100%, 520px); }
.keys[hidden] { display: none; }
.key {
  border: 1px solid var(--edge); border-radius: 12px; padding: 10px 6px;
  background: #fff; font-weight: 700; font-size: 13px; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.key kbd { font: 600 10px Geist, system-ui, sans-serif; color: var(--faint); text-transform: uppercase; }
.key.ok { color: var(--green); } .key.ap { color: var(--amber); } .key.no { color: var(--red); }

.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 18px;
  font-weight: 700; font-size: 14px; white-space: nowrap; max-width: calc(100vw - 32px);
  overflow: hidden; text-overflow: ellipsis;
}
.toast[hidden] { display: none; }

/* MARK: media queries, last in the file, always */
@media (max-width: 520px) {
  .arrow { display: none; }
  .key kbd { display: none; }
  .target span { display: none; }
  .title b { font-size: 14px; }
}
