/* THE DECK PAGE.
 *
 * The look is the printed album Jade liked on 2026-09-21: the whole page is
 * cards on the cream, white slots with the word under the picture, the ones
 * not yet earned greyed to near-white so the child can see the road ahead.
 * Same palette as binder.css. Nothing here moves when it is tapped: the open
 * card is a fixed layer over the grid, and earned is only a filter change.
 */
: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; min-height: 100%; }
body {
  background: var(--desk); color: var(--ink);
  font-family: Geist, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }

/* MARK: the top */

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 6px;
}
.title { flex: 1; min-width: 0; }
.title h1 {
  margin: 0; font-size: clamp(17px, 2.6vw, 24px); font-weight: 800; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.title .of { font-size: 12px; color: var(--soft); margin-top: 2px; }
.back, .who {
  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;
  max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who.none { color: var(--hot); border-color: rgba(255,106,77,.5); }
.fillgame { background: var(--gold); border-color: var(--gold); color: #24190a; font-weight: 800; }
/* the outline rectangle Jade drew: THEME, top right, cycles the sixteen faces */
.themebtn {
  flex: none; border: 2px solid var(--ink); border-radius: 6px; background: transparent;
  color: var(--ink); font-weight: 800; font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; padding: 7px 12px;
}
.themebtn:active { background: var(--ink); color: #fff; }

/* the road: how much of the deck is in colour */
.bar {
  height: 6px; margin: 4px 16px 10px; border-radius: 3px;
  background: rgba(0,0,0,.08); overflow: hidden;
}
.bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 3px;
         transition: width .4s ease; }

/* MARK: editions. The art is a layer over the deck; a pill per finished style. */
.editions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 12px; max-width: 1180px; margin: 0 auto; }
.editions[hidden] { display: none; }
.ed {
  border: 1px solid var(--edge); border-radius: 999px; padding: 7px 14px;
  background: var(--leaf); color: var(--soft); font-weight: 700; font-size: 12.5px;
}
.ed.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.ed.locked { color: var(--faint); }
.ed.locked::before { content: '\1F512  '; font-size: 11px; }

/* MARK: the cards */

.cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 0 16px 24px; max-width: 1180px; margin: 0 auto;
}
.card {
  background: var(--leaf); border: 1px solid var(--edge); border-radius: 12px;
  padding: 6px 6px 0; display: flex; flex-direction: column; text-align: left;
  box-shadow: 0 2px 4px -2px rgba(70,52,24,.3);
}
.card .im {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #fbf7ef;
}
.card .im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card b {
  padding: 6px 2px 8px; text-align: center; font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 700; color: var(--word);
}
/* a card wearing a FACE (deckface.css draws it): the wrapper gives up its own paper */
.card.faced { padding: 0; background: none; border: 0; box-shadow: none; overflow: hidden; border-radius: 12px; }
.card.faced .face { height: 100%; }
.card.road.faced .face { filter: grayscale(1) brightness(1.12) contrast(.85); opacity: .38; }
.card.road.faced .face img { filter: none; opacity: 1; }
/* not yet earned: the picture is there, faded to the paper, so the road ahead
   is visible without a single one of them being available to keep */
.card.road { box-shadow: none; }
.card.road .im img { filter: grayscale(1) brightness(1.16) contrast(.82); opacity: .28; }
.card.road b { color: var(--faint); }
.card.just .im img { animation: land .5s ease; }
/* HOLOGRAPHIC: a card said in a SENTENCE wears foil. No new art: a rainbow
   sheen over the same painting, moving on its own so it reads as foil on a
   still tablet, brighter under the finger. */
.card.holo .im { position: relative; }
.card.holo .im::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,0,128,.0) 20%, rgba(255,80,180,.45) 35%,
    rgba(255,230,80,.5) 45%, rgba(80,255,200,.5) 55%, rgba(80,140,255,.45) 65%, rgba(255,0,128,0) 80%);
  background-size: 300% 300%; mix-blend-mode: color-dodge; opacity: .55;
  animation: sheen 4s ease-in-out infinite alternate;
}
.card.holo:active .im::after, .card.holo:hover .im::after { opacity: .85; }
.card.holo { border-color: #d9c27a; box-shadow: 0 0 0 2px rgba(224,163,42,.35), 0 4px 10px -4px rgba(70,52,24,.5); }
@keyframes sheen { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@keyframes land { from { transform: scale(.85); opacity: .4; } to { transform: none; opacity: 1; } }

/* MARK: the therapist's strip */

.session {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(246,236,217,.94);
  border-top: 1px solid var(--edge); font-size: 13px; color: var(--soft);
  backdrop-filter: blur(6px);
}
.session[hidden] { display: none; }
.session span { flex: 1; min-width: 0; }
.pill {
  border: 1px solid rgba(0,0,0,.14); border-radius: 999px; padding: 7px 14px;
  background: var(--leaf); color: var(--ink); font-weight: 700; font-size: 13px;
}
.pill.hot { background: var(--hot); border-color: var(--hot); color: #fff; }

/* MARK: the open card */

.open {
  position: fixed; inset: 0; z-index: 10; background: rgba(43,38,32,.55);
  display: grid; place-items: center; padding: 16px;
}
.open[hidden] { display: none; }
.opencard {
  position: relative; width: min(100%, 440px); max-height: 100%;
  overflow: auto; background: var(--leaf); border-radius: 18px;
  padding: 18px 18px 16px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.7);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.opencard .im {
  width: min(100%, 300px); aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: #fbf7ef;
}
.opencard .im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opencard.road .im img { filter: grayscale(1) brightness(1.16) contrast(.82); opacity: .28; }
.word { font-size: clamp(28px, 8vw, 40px); font-weight: 900; line-height: 1; }
.x, .arrow {
  position: absolute; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12); background: rgba(255,253,249,.92);
  color: var(--soft); font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.x { right: 10px; }
.arrow { top: 50%; margin-top: -18px; }
.arrow.left { left: 6px; } .arrow.right { right: 6px; }
.say { display: flex; gap: 8px; }
.hear {
  border: 1px solid var(--edge); border-radius: 999px; padding: 8px 14px;
  background: #fff; color: var(--soft); font-weight: 700; font-size: 13px;
}
.hear.on { background: var(--gold); border-color: var(--gold); color: #24190a; }
.line { min-height: 2.6em; font-size: 15px; color: var(--soft); text-align: center; }
.sayit {
  width: 100%; border: 0; border-radius: 14px; padding: 16px; font-size: 20px;
  font-weight: 900; background: var(--gold); color: #24190a;
}
.sayit:active { filter: brightness(.95); }
.keys { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; width: 100%; }
.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); }
.cardtally { min-height: 1.2em; font-size: 12px; color: var(--soft); }

/* MARK: toast and sheet */

.toast {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 18px;
  font-weight: 700; font-size: 14px; box-shadow: 0 10px 24px -10px rgba(0,0,0,.6);
  white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast[hidden] { display: none; }
.sheet {
  position: fixed; inset: 0; z-index: 15; background: rgba(43,38,32,.55);
  display: grid; place-items: center; padding: 16px;
}
.sheet[hidden] { display: none; }
.sheetbox {
  position: relative; width: min(100%, 560px); max-height: 100%; overflow: auto;
  background: var(--leaf); border-radius: 18px; padding: 18px 18px 16px;
}
.sheetbox h2 { margin: 0 30px 10px 0; font-size: 16px; }
.sheetbox pre {
  white-space: pre-wrap; word-break: break-word; font: 13px/1.5 Geist, system-ui, sans-serif;
  background: #fff; border: 1px solid var(--edge); border-radius: 10px; padding: 12px; margin: 0 0 12px;
  user-select: all;
}
.sheetrow { display: flex; gap: 8px; flex-wrap: wrap; }

/* MARK: the who popover */
.kids { display: flex; flex-wrap: wrap; gap: 8px; }
.kid {
  border: 1px solid var(--edge); border-radius: 999px; padding: 8px 14px;
  background: #fff; font-weight: 700; font-size: 13px; color: var(--ink);
}
.kid.on { background: var(--gold); border-color: var(--gold); color: #24190a; }
.kid.add { color: var(--hot); }

/* MARK: media queries, last in the file, always */
@media (max-width: 860px) { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 12px 24px; }
  .topbar { padding: 10px 12px 4px; flex-wrap: wrap; }
  .title { order: -1; flex-basis: 100%; }      /* the title on its own line, the two pills under it */
  .title h1 { white-space: normal; font-size: 20px; }
  .title .theme { display: none; }
  .back, .who { max-width: none; }
  .themebtn { padding: 7px 10px; }
  .bar { margin: 4px 12px 10px; }
  .opencard { padding: 14px 12px 12px; }
  .arrow { display: none; }
  .key kbd { display: none; }
}
