/* Self-supervised learning lesson. All rules scoped under .selfsup-* */

.selfsup-sc { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.selfsup-note { font-size: 12px; color: var(--faint); text-align: center; }

/* 1. label six: one photo card, a clock, six dots */
.selfsup-label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.selfsup-label .clock { position: absolute; top: 0; right: 0; font-family: var(--mono); font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.selfsup-label .clock b { color: var(--gold); font-size: 16px; }
.selfsup-label.done .clock { border-color: var(--gold-deep); }
.selfsup-label .card { width: 170px; height: 170px; display: grid; place-items: center; border-radius: 20px; background: var(--surface); border: 2px solid var(--line); }
.selfsup-label .card.in { animation: selfsupIn .25s cubic-bezier(.2,.8,.2,1) both; }
@keyframes selfsupIn { from { transform: translateX(24px); opacity: 0; } }
.selfsup-label .card img { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 10px 16px rgba(0,0,0,.5)); }
.selfsup-label .dots { display: flex; gap: 6px; }
.selfsup-label .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--raised); }
.selfsup-label .dots i.ok { background: var(--mint); } .selfsup-label .dots i.no { background: var(--red); }
.selfsup-labelrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.selfsup-labelrow .choice { justify-content: center; text-align: center; padding: 10px 6px; font-size: 15px; }

/* the hidden-word tile: a card that flips from "?" to the word */
.selfsup-tile { display: inline-block; vertical-align: middle; position: relative; min-width: 76px; height: 38px; margin: 2px 0; padding: 0; perspective: 500px; font: inherit; color: inherit; }
button.selfsup-tile { min-height: 44px; height: 44px; cursor: pointer; }
.selfsup-tile .in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
.selfsup-tile .f, .selfsup-tile .b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 8px; border-radius: 9px; backface-visibility: hidden; -webkit-backface-visibility: hidden; font-weight: 700; }
.selfsup-tile .b { background: #2a2440; border: 2px solid var(--violet); color: var(--violet-bright); font-family: var(--sans); background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(169,155,255,.12) 5px 7px); }
button.selfsup-tile:not(:disabled) .b { animation: selfsupNudge 1.4s ease-in-out 3; }
@keyframes selfsupNudge { 50% { box-shadow: 0 0 0 4px rgba(169,155,255,.25); } }
.selfsup-tile .f { transform: rotateX(180deg); background: var(--surface); border: 2px solid var(--gold); color: var(--gold); }
.selfsup-tile.open .in { transform: rotateX(180deg); }
.selfsup-tile.match .f { border-color: var(--mint); color: var(--mint); background: rgba(63,214,154,.14); }
.selfsup-tile.miss .f { border-color: var(--gold); color: var(--gold); }

/* 2. the story */
.selfsup-story { display: flex; flex-direction: column; gap: 10px; }
.selfsup-story .txt { font-family: var(--serif); font-size: 19px; line-height: 1.75; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); min-height: 120px; }
.selfsup-story .tags { display: flex; flex-direction: column; gap: 6px; }
.selfsup-tag { font-size: 14px; color: var(--dim); padding: 6px 10px; border-radius: 10px; background: rgba(63,214,154,.08); border: 1px solid rgba(63,214,154,.3); animation: selfsupPop .25s cubic-bezier(.34,1.56,.64,1) both; }
.selfsup-tag b { color: var(--mint); }
.selfsup-tag.no { background: rgba(252,192,80,.07); border-color: rgba(252,192,80,.3); }
.selfsup-tag.no b { color: var(--gold); }
@keyframes selfsupPop { from { transform: scale(.85); opacity: 0; } }

/* 3. the pile */
.selfsup-line { font-family: var(--serif); font-size: 20px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.selfsup-pile { display: flex; gap: 8px; }
.selfsup-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
/* Narrow solid bars on one baseline: full-width outlined boxes with a word
   under each read as five answer buttons, and a playtester tapped them. */
.selfsup-col .bw { height: 110px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1.5px solid var(--line-strong); }
.selfsup-col .bw i { display: block; width: 55%; border-radius: 4px 4px 0 0; background: rgba(169,155,255,.55); transition: height .55s cubic-bezier(.2,.8,.2,1), background .2s; }
.selfsup-col span { font-size: 14px; font-weight: 700; text-align: center; color: var(--dim); white-space: nowrap; }
.selfsup-col.up .bw i { background: var(--mint); }
.selfsup-col.win .bw i { background: var(--gold); box-shadow: 0 0 12px rgba(252,192,80,.45); }
.selfsup-col.win2 .bw i { background: rgba(252,192,80,.6); }
.selfsup-col.win span, .selfsup-col.win2 span { color: var(--gold); }
.selfsup-log, .selfsup-cnt { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; min-height: 28px; font-size: 13px; color: var(--dim); }
.selfsup-log b { padding: 2px 8px; border-radius: 999px; background: rgba(63,214,154,.14); color: var(--mint); font-size: 13px; animation: selfsupPop .25s both; }
.selfsup-cnt b { font-family: var(--mono); color: var(--gold); font-variant-numeric: tabular-nums; }
.selfsup-mini { display: block; width: 100%; height: auto; }
.selfsup-mini line { stroke: var(--line-strong); stroke-width: 1.5; }
.selfsup-mini rect { fill: var(--violet-bright); }

/* 4. the next word: words seen, the one answer, the rest masked */
.selfsup-next { display: flex; flex-direction: column; gap: 10px; }
.selfsup-next .txt { display: flex; flex-wrap: wrap; gap: 6px 5px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.selfsup-next .w { padding: 1px 5px; border-radius: 7px; transition: background .2s, color .2s; }
.selfsup-next .w.seen { color: var(--text); }
.selfsup-next .w.ans { color: #2A1B00; background: var(--gold); font-weight: 700; }
.selfsup-next .w.mask { color: transparent; background: #2a2440; background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(169,155,255,.12) 4px 6px); }
.selfsup-next .key { display: flex; gap: 14px; justify-content: center; font-size: 12px; font-weight: 700; color: var(--dim); }
.selfsup-next .key span { display: inline-flex; align-items: center; gap: 5px; }
.selfsup-next .key i { width: 12px; height: 12px; border-radius: 3px; }
.selfsup-next .key .s { background: var(--surface); border: 1px solid var(--line-strong); } .selfsup-next .key .a { background: var(--gold); } .selfsup-next .key .m { background: #2a2440; border: 1px solid var(--violet-deep); }
.selfsup-next .ctr { text-align: center; font-size: 14px; color: var(--dim); }
.selfsup-next .ctr b { font-family: var(--mono); color: var(--gold); font-size: 16px; }

/* 6. two photos as patches that flip over */
.selfsup-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.selfsup-side { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); text-align: center; transition: border-color .3s; }
.selfsup-side > b { font-size: 14px; color: var(--text); }
.selfsup-side.easy { border-color: var(--line-strong); } .selfsup-side.easy > b { color: var(--dim); }
.selfsup-side.hard { border-color: var(--gold); } .selfsup-side.hard > b { color: var(--gold); }
.selfsup-grid { width: 100%; aspect-ratio: 3 / 2; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(5, 1fr); gap: 1px; perspective: 700px; }
.selfsup-p { position: relative; }
.selfsup-p .in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.selfsup-p .f, .selfsup-p .b { position: absolute; inset: 0; border-radius: 2px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.selfsup-p .f { background-size: 800% 500%; background-repeat: no-repeat; }
.selfsup-p .b { transform: rotateY(180deg); background: #2a2440; border: 1px solid rgba(169,155,255,.25); }
.selfsup-p.hide .in { transform: rotateY(180deg); }
.selfsup-p.rebuilt .f { filter: blur(1.5px) saturate(.75) brightness(.92); }
.selfsup-p.rebuilt::after { content: ""; position: absolute; inset: 0; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(252,192,80,.5); pointer-events: none; }

/* 7. the ball and the covered second */
.selfsup-ballwrap { display: grid; place-items: center; }
.selfsup-ball { width: min(100%, 340px); height: auto; display: block; overflow: visible; }
.selfsup-ball .floor { stroke: var(--line-strong); stroke-width: 2; }
.selfsup-ball .table { fill: #c9b79c; } .selfsup-ball .leg { fill: #8d7b62; }
.selfsup-ball .ball { fill: var(--gold); stroke: var(--gold-deep); stroke-width: 2; }
.selfsup-ball .mask rect { fill: #2a2440; transition: opacity .5s; }
.selfsup-ball .mask .pt { fill: rgba(169,155,255,.10); }
.selfsup-ball .mask .edge { fill: none; stroke: rgba(234,227,215,.35); stroke-dasharray: 4 3; stroke-width: 1.5; }
.selfsup-ball .mask.lift rect { opacity: 0; }
.selfsup-ball .ghost { cursor: pointer; transition: opacity .3s; }
.selfsup-ball .ghost .hit { fill: transparent; }
.selfsup-ball .ghost .ring { fill: rgba(252,192,80,.08); stroke: var(--gold); stroke-width: 2; stroke-dasharray: 4 3; animation: selfsupGhost 1.6s ease-in-out 4; transform-box: fill-box; transform-origin: center; }
@keyframes selfsupGhost { 50% { transform: scale(1.15); } }
.selfsup-ball .ghost text { fill: var(--gold); font: 800 14px var(--sans); text-anchor: middle; pointer-events: none; }
.selfsup-ball .ghost.right .ring { stroke: var(--mint); fill: rgba(63,214,154,.2); animation: none; } .selfsup-ball .ghost.right text { fill: var(--mint); }
.selfsup-ball .ghost.wrong .ring { stroke: var(--red); fill: rgba(216,85,85,.2); animation: none; } .selfsup-ball .ghost.wrong text { fill: var(--red); }
.selfsup-ball .ghost.off { opacity: .3; pointer-events: none; } .selfsup-ball .ghost.right.off { opacity: .8; }
.selfsup-ball .mask.lift ~ .ghost { opacity: 0; }

@media (max-height: 700px) {
  .selfsup-label .card { width: 130px; height: 130px; }
  .selfsup-story .txt { font-size: 17px; line-height: 1.65; padding: 8px 12px; min-height: 0; }
  .selfsup-tag { padding: 4px 9px; font-size: 13px; }
  .selfsup-col .bw { height: 80px; }
  .selfsup-line { font-size: 18px; padding: 6px 12px; }
  .selfsup-next .txt { font-size: 17px; padding: 10px 12px; }
  .selfsup-ball { width: min(100%, 300px); }
}
