/* My Room kit: "pick your 4" (fr-four.js). The layout of every list station; each station's own CSS gives its picture
   (the .k4-card root) and frame (cfgs cellCls / deco) their look. --ar = the picture's height / width, --pad = the frame
   padding around it, --pmax = the widest a picture gets. */
.k4-wrap{position:relative;z-index:2;height:100%;display:flex;flex-direction:column}
.k-edit.k-benched .k4-wall{container-type:size}
.k4-wall{flex:1;min-height:0;position:relative}
.k4-wall.swap{animation:k4swap .35s ease-out}
@keyframes k4swap{from{opacity:0;transform:translateY(6px)}}
.k4-pg{position:absolute;left:0;right:0;top:0;bottom:4px;display:grid;grid-template-columns:repeat(var(--c),1fr);grid-template-rows:repeat(var(--r),1fr);padding:2px 6px 0;container-type:size}
.k4-cell{--pw:min(calc(((100cqh - 4px) / var(--r) - var(--pad,8px) * 2) / var(--ar,1)),calc((100cqw - 12px) / var(--c) - var(--pad,8px) * 2),var(--pmax,230px));
  position:relative;flex:none;width:calc(var(--pw) + var(--pad,8px) * 2);height:calc(var(--pw) * var(--ar,1) + var(--pad,8px) * 2);padding:var(--pad,8px);
  justify-self:center;align-self:center;transition:transform .25s,opacity .25s,filter .25s}
.k4-cell.mid{grid-column:1 / -1}
.k4-cell.puff{transform:scale(.6);opacity:0;filter:blur(6px)}
.k4-none{grid-column:1 / -1;align-self:center;justify-self:center;margin:0;font:italic 500 17px 'EB Garamond',Georgia,serif;color:rgba(243,234,214,.7)}
.k4-hit{position:relative;z-index:1;display:block;padding:0;border:0;background:none;width:var(--pw);height:calc(var(--pw) * var(--ar,1));text-align:left}
.k4-hit:active{transform:scale(.98)}
.k4-card{position:relative;display:block;width:var(--pw);aspect-ratio:1 / var(--ar,1)}
.k4-cell .k4-card.k-landed{animation:kland 1.25s ease-out}

/* the empty places: a "+" on your wall; while choosing, the first one lit for the next pick, the rest quiet */
.k4-plus{display:grid;place-items:center;background:rgba(10,8,6,.55)!important;border:0;box-shadow:inset 0 0 0 2px rgba(255,214,138,.55),inset 0 0 24px rgba(0,0,0,.6)!important}
.k4-plus::after,.k4-plus::before{display:none!important}
.k4-plus .k-plus{font:400 clamp(40px,14cqw,64px)/1 var(--display);font-style:normal;color:#ffd98a;text-shadow:0 0 12px rgba(255,190,90,.7)}
.k4-cell.addslot{cursor:pointer}
.k4-cell.addslot:active .k4-card{transform:scale(.97)}
.k4-cell.empty .k4-plus{background:rgba(10,8,6,.45)!important;box-shadow:inset 0 0 0 1.5px rgba(255,214,138,.3)!important}
.k4-cell.land .k4-plus{background:radial-gradient(ellipse at 50% 45%,rgba(255,217,138,.22),rgba(10,20,36,.6) 70%)!important;border:2px dashed rgba(216,178,92,.75);animation:k4wait 3.4s ease-in-out infinite}
@keyframes k4wait{0%,100%{box-shadow:0 0 0 rgba(255,210,90,0)}50%{box-shadow:0 0 18px rgba(255,210,90,.45)}}

/* the gold x on each of your picks */
.k4-x{position:absolute;right:-6px;top:-6px;z-index:3;width:44px;height:44px;display:grid;place-items:center;padding:0;border:0;background:none}
.k4-x::before{content:"";position:absolute;width:28px;height:28px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff3c4,#e0b858 55%,#9a6e22);border:1.5px solid #3a2408;box-shadow:0 2px 5px rgba(0,0,0,.6)}
.k4-x svg{position:relative;color:#2a1608}

/* a fifth pick: your four wait to be chosen for the swap */
.k-swapping .k4-cell:not(.land):not(.empty){animation:k-wiggle .9s ease-in-out infinite}
.k-swapping .k4-cell:not(.land):not(.empty):nth-child(2n){animation-delay:-.45s}
@keyframes k-wiggle{0%,100%{transform:rotate(-1.6deg)}50%{transform:rotate(1.6deg)}}

/* NEOES's list: every pick the office made, three across, most picked first, scrolling down to the ones picked once */
.k4-wall.vlist{overflow:hidden}
.k4-pg.k4-all{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:auto;align-content:start;gap:4px 0;
  padding:8px 4px 34px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
.k4-all .k4-cell{--pw:calc((100cqw - 8px) / 3 - var(--pad,8px) * 2 - 2px);margin-bottom:12px}
/* one plain movie ticket on each picture's bottom edge, the number of people (a CSS stand-in: cream card, red print,
   notched ends; Codex paints the real one later) */
.k4-ticket{position:absolute;z-index:5;left:50%;bottom:0;transform:translate(-50%,42%) rotate(-3deg);display:flex;align-items:center;justify-content:center;
  min-width:44px;height:26px;padding:0 13px;font-style:normal;color:#9b1b1b;background:linear-gradient(#fffaf0,#f3e4c4);border-radius:3px;
  box-shadow:inset 0 0 0 1.5px #c23a2e,inset 0 0 0 3px #fffaf0,inset 0 0 0 4px rgba(194,58,46,.55),0 3px 7px rgba(0,0,0,.6);
  -webkit-mask:radial-gradient(circle 5px at 0 50%,transparent 97%,#000) left/51% 100% no-repeat,radial-gradient(circle 5px at 100% 50%,transparent 97%,#000) right/51% 100% no-repeat;
  mask:radial-gradient(circle 5px at 0 50%,transparent 97%,#000) left/51% 100% no-repeat,radial-gradient(circle 5px at 100% 50%,transparent 97%,#000) right/51% 100% no-repeat}
.k4-ticket b{font:800 16px/1 Georgia,'Times New Roman',serif;font-variant-numeric:tabular-nums;letter-spacing:.02em}

/* the chooser: the station's own small pictures, all bright, the same size (fr-bench.js flat) */
.kb-flat .kb-card .k4-card{width:auto;height:100%}
/* a station with no keyboard key and no letters (Music): no key row at all */
.k-bench.kb-nowrite.noletters .kb-keysw{display:none}
/* while writing a name, the stage keeps its pictures above the bar */
.k-typing .k4-wrap{height:var(--free,100%)}
/* the swap panel on a pick's page shows your four at a fixed height */
.k-dswapb .k4-card{width:auto;height:min(150px,22svh,calc((100vw - 64px) / 4 * var(--ar,1)))}

/* everything that moves stops while the phone is put away */
.k-asleep .k4-wrap,.k-asleep .k4-wrap *,.k-asleep .k4-wrap *::before,.k-asleep .k4-wrap *::after{animation-play-state:paused!important}

/* ---------- each station's own small card (K.fourCard): a frame in its material, the picture area, the name band ----------
   Drawn in CSS until Codex batch 72 paints frame-tv / frame-book / frame-menu / frame-hobby / frame-record.png at the same
   proportions (--ar here = the painting's height / width); the boxes below are where those paintings' empty areas go. */
.k4-fc{container-type:inline-size;isolation:isolate}
.k4-fframe{position:absolute;inset:0;z-index:0;pointer-events:none}
.k4-fpic{position:absolute;z-index:1;overflow:hidden}
.k4-fimg,.kb-card .k4-fc .k-pic.k4-fimg{position:absolute;inset:0;width:auto;height:auto;border-radius:inherit}
.k4-fimg .k-img{inset:5%;width:90%;height:90%}
.k4-fname{position:absolute;z-index:2;display:flex;align-items:center;justify-content:center;text-align:center;padding:0 4%;overflow:hidden}
.k4-fname b{display:block;max-width:100%;font-family:var(--display);font-weight:700;line-height:1.02;letter-spacing:.02em;text-transform:uppercase;text-wrap:balance;overflow-wrap:normal;word-break:keep-all}
/* the sheen: one card at a time, every 24 s, seconds apart (as on the movie posters) */
.k4-fc::after{content:"";position:absolute;inset:0;z-index:3;pointer-events:none;background:linear-gradient(115deg,transparent 44%,rgba(255,240,200,.1) 50%,transparent 56%) -150% 0/250% 100% no-repeat;
  animation:k4sheen 24s ease-in-out infinite;animation-delay:var(--gd,0s)}
@keyframes k4sheen{0%,91%{background-position:-150% 0}100%{background-position:150% 0}}
.k4-cell.gold .k4-fc{filter:drop-shadow(0 0 7px rgba(255,210,90,.95)) drop-shadow(0 0 2px #ffd25a)}

/* The cards follow Marc's rule of 2 Dec 2026: the picture as big as its place allows, in a holder that is interesting in
   itself (Codex may paint these later at the same proportions).
   TV shows: a thin black modern TV on a little stand; the painting fills the whole screen (nothing brown around it); the
   show's name under the stand (--ar 1.16: the 5:4 painting edge to edge, the stand, two lines of name) */
.k4-tv .k4-fframe::before{content:"";position:absolute;left:0;right:0;top:0;height:73.3%;border-radius:3.2%/3.8%;
  background:linear-gradient(#2c2d31,#0d0e11 40%,#16171a);box-shadow:inset 0 0 0 1px rgba(255,255,255,.13),inset 0 1px 0 rgba(255,255,255,.22),0 9px 16px rgba(0,0,0,.65)}
.k4-tv .k4-fframe::after{content:"";position:absolute;left:30%;right:30%;top:73%;height:8.6%;border-radius:0 0 5px 5px;filter:drop-shadow(0 3px 3px rgba(0,0,0,.7));
  background:linear-gradient(90deg,transparent 41%,#18191c 41%,#3d3e44 50%,#18191c 59%,transparent 59%) top/100% 70% no-repeat,linear-gradient(#5a5b62,#2a2b30 60%,#141518) bottom/100% 32% no-repeat}
.k4-tv .k4-fpic{left:2.6%;width:94.8%;top:2.24%;height:65.4%;border-radius:1.4%/1.8%;background:#000}
.k4-tv .k4-fimg{border-radius:inherit}
.k4-tv .k4-fimg .k-img{inset:0;width:100%;height:100%}
.k4-tv .k4-fpic::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;
  background:linear-gradient(118deg,rgba(255,255,255,.09),rgba(255,255,255,.02) 38%,transparent 39%),radial-gradient(ellipse at 22% 10%,rgba(255,255,255,.1),transparent 40%)}
.k4-tv .k4-fname{left:0;right:0;top:82%;height:18%}
.k4-tv .k4-fname b{color:#f6e6bc;text-shadow:0 1px 2px #000,0 0 8px rgba(0,0,0,.85)}

/* Books: a page of an open book (Marc: "that curved book page look and just writing on a book page, very much like it
   was before"): cream paper bending into the spine, the genre at the top, the painting printed on the page, the title in
   italics and the author under it. The two books of a row are the two pages of one open book, meeting at the spine; the
   leather cover shows at the outer edges and the bottom (--ar 1.38) */
.k4-page .k4-fframe{border-radius:3% 3% 2% 2%/2% 2% 1.5% 1.5%;box-shadow:0 7px 12px rgba(0,0,0,.5);
  background:repeating-linear-gradient(90deg,rgba(150,118,66,.32) 0 1px,transparent 1px 3px) left/3% 100% no-repeat,repeating-linear-gradient(90deg,transparent 0 2px,rgba(150,118,66,.32) 2px 3px) right/3% 100% no-repeat,
    radial-gradient(ellipse at 50% 38%,#fcf5e1,#f1e3c2 72%,#e3cfa0)}
.k4-page .k4-ghead{position:absolute;z-index:2;left:6%;right:6%;top:4.5%;height:6%;display:flex;align-items:center;justify-content:center;
  font:700 max(12.5px,5cqw)/1 var(--display);letter-spacing:.18em;text-indent:.18em;text-transform:uppercase;color:rgba(112,52,36,.78);white-space:nowrap;overflow:hidden}
.k4-page .k4-fpic{left:8%;width:84%;top:11.5%;height:50%}
.k4-page .k4-fimg{--bg:none!important;background:none}
.k4-page .k4-fimg .k-img{inset:0;width:100%;height:100%;filter:none;mix-blend-mode:multiply}
.k4-page .k4-fname{left:6%;right:6%;top:62.5%;height:24%;padding:0}
.k4-page .k4-fname b{font-family:'EB Garamond',Georgia,serif;font-style:italic;font-weight:600;text-transform:none;letter-spacing:0;line-height:1.04;color:#3a2410}
.k4-page .k4-auth{position:absolute;z-index:2;left:6%;right:6%;top:87%;height:8%;display:flex;align-items:center;justify-content:center;
  font:700 max(12.5px,4.4cqw)/1 var(--display);letter-spacing:.1em;text-transform:uppercase;color:rgba(96,62,20,.82);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* the left page of a row bends down into the spine on its right; the right page mirrors it; they meet in the middle */
.k4-four > .k4-pagecell:nth-child(odd):not(.mid){justify-self:end}
.k4-four > .k4-pagecell:nth-child(even){justify-self:start}
.k4-four > .k4-pagecell:nth-child(odd):not(.mid) .k4-page .k4-fframe{border-radius:3% 30% 3% 2%/2% 3.4% 2.2% 1.5%;
  background:linear-gradient(90deg,transparent 74%,rgba(130,88,34,.16) 88%,rgba(70,40,12,.5) 100%),repeating-linear-gradient(90deg,rgba(150,118,66,.32) 0 1px,transparent 1px 3px) left/3% 100% no-repeat,
    radial-gradient(ellipse at 46% 38%,#fcf5e1,#f1e3c2 72%,#e3cfa0)}
.k4-four > .k4-pagecell:nth-child(even) .k4-page .k4-fframe{border-radius:30% 3% 2% 3%/3.4% 2% 1.5% 2.2%;
  background:linear-gradient(270deg,transparent 74%,rgba(130,88,34,.16) 88%,rgba(70,40,12,.5) 100%),repeating-linear-gradient(90deg,transparent 0 2px,rgba(150,118,66,.32) 2px 3px) right/3% 100% no-repeat,
    radial-gradient(ellipse at 54% 38%,#fcf5e1,#f1e3c2 72%,#e3cfa0)}
/* the leather cover under the pages */
.k4-pagecell:has(.k4-page)::before{content:"";position:absolute;z-index:0;inset:-1.5% -3% -3.2% -3%;border-radius:4px;pointer-events:none;
  background:linear-gradient(160deg,#6e2620,#3e120f 60%,#2a0b09);box-shadow:inset 0 0 0 1px rgba(255,214,150,.18),0 8px 14px rgba(0,0,0,.55)}
.k4-four > .k4-pagecell:nth-child(odd):not(.mid)::before{right:0;border-radius:4px 0 0 4px}
.k4-four > .k4-pagecell:nth-child(even)::before{left:0;border-radius:0 4px 4px 0}
/* the x of a left page sits on its outer corner (not at the spine, over the other page) */
.k4-four > .k4-pagecell:nth-child(odd):not(.mid) .k4-x{right:auto;left:-6px}

/* Food: the dish on a square china plate with a gold line round its well (round would make the picture smaller), its
   name on a little place card in front (--ar 1.2: the plate as wide as its place, the card under it) */
.k4-plate .k4-fframe::before{content:"";position:absolute;left:0;right:0;top:0;height:83.3%;border-radius:17%;
  background:linear-gradient(145deg,#fffdf8,#f1ebdf 55%,#e2d9c8);box-shadow:inset 0 2px 0 rgba(255,255,255,.95),inset 0 -4px 7px rgba(0,0,0,.14),0 9px 15px rgba(0,0,0,.6)}
.k4-plate .k4-fframe::after{content:"";position:absolute;left:9.5%;right:9.5%;top:7.9%;height:67.5%;border-radius:13%;
  background:radial-gradient(ellipse at 44% 38%,#ffffff,#f5f0e6 64%,#e9e2d3);box-shadow:inset 0 3px 7px rgba(70,50,20,.2),0 0 0 1.5px rgba(200,162,74,.75),0 0 0 4px rgba(255,255,255,.7)}
.k4-plate .k4-fpic{left:5%;width:90%;top:3.5%;height:76%;overflow:visible}
.k4-plate .k4-fimg{--bg:none!important;background:none;overflow:visible}
.k4-plate .k4-fimg .k-img{inset:2%;width:96%;height:96%}
.k4-plate .k4-fname{left:11%;right:11%;top:85.6%;height:14.4%;border-radius:2px;background:linear-gradient(#fffaf0,#f0e2c2);
  box-shadow:inset 0 0 0 1px rgba(200,162,74,.85),inset 0 0 0 3px #fffaf0,inset 0 0 0 3.6px rgba(122,30,36,.35),0 4px 7px rgba(0,0,0,.55)}
.k4-plate .k4-fname b{color:#7a1e24;font-family:'EB Garamond',Georgia,serif;text-transform:none;letter-spacing:.01em}

/* Hobbies: a walnut and brass shadow box, a linen back, the name on a brass plate (frame-hobby 600 x 640) */
.k4-hobby .k4-fframe{border-radius:4px;background:linear-gradient(160deg,#6a3e1c,#3e220c 60%,#2a1606);box-shadow:inset 0 0 0 2px rgba(255,214,150,.3),0 7px 14px rgba(0,0,0,.6)}
.k4-hobby .k4-fpic{left:9%;top:7%;width:82%;height:62%;background:radial-gradient(ellipse at 50% 35%,#efe6d2,#d6c6a6);box-shadow:inset 0 0 0 2px #c79a4a,inset 0 0 0 4px #2a1606,inset 0 4px 14px rgba(0,0,0,.45)}
.k4-hobby .k4-fimg{--bg:none!important;background:none}
.k4-hobby .k4-fname{left:14%;right:14%;top:74%;height:18%;border-radius:3px;background:linear-gradient(#f6dfa4,#c79a4a 55%,#a7782a);box-shadow:inset 0 0 0 1px #6b4a12,0 2px 3px rgba(0,0,0,.5)}
.k4-hobby .k4-fname b{color:#3a2408;text-shadow:0 1px 0 rgba(255,240,200,.6)}

/* Music: a record sleeve, the record sliding out on the right, the genre's picture printed on the front (frame-record 760 x 640) */
.k4-record .k4-fframe{background:radial-gradient(circle at 83.5% 50%,#f3e4c4 0 4.6%,#1a1a1a 4.9% 5.4%,#0c0c0c 5.6%,#222 9%,#0c0c0c 10%,#1c1c1c 13%,#0a0a0a 14.6%,transparent 15%) no-repeat}
.k4-record .k4-fframe::before{content:"";position:absolute;left:0;top:0;width:84.2%;height:100%;border-radius:2px;background:radial-gradient(ellipse at 30% 20%,#f0e2c2,#d9c49a 60%,#bfa676);
  box-shadow:inset 0 0 0 1.5px rgba(90,60,20,.35),inset -3px 0 6px rgba(0,0,0,.25),0 7px 14px rgba(0,0,0,.6)}
.k4-record .k4-fpic{left:9%;top:8%;width:66%;height:62%;box-shadow:0 0 0 2px #2a1a0a,0 0 0 3.5px #d9c49a,0 0 0 4.5px rgba(90,60,20,.5)}
.k4-record .k4-fname{left:9%;width:66%;top:73%;height:19%;padding:0 2%;background:#2a1a0a}
.k4-record .k4-fname b{color:#f6dc8e}

/* a picture's words wait for its picture (QUALITY-BAR 1: the name never before its picture): the year and title of a
   poster, and a card's name, show once the picture is in, or after 1.2 s if it never comes */
.mv2-pz:has(.k-img[data-fav]:not(.fav-on):not(.fav-none)) :is(.mv2-tt,.mv2-yr),
.k4-fc:has(.k-img[data-fav]:not(.fav-on):not(.fav-none),.k-img.ok-wait:not(.ok)) .k4-fname{visibility:hidden;animation:k4late 0s 1.2s forwards}
@keyframes k4late{to{visibility:visible}}
/* a small card (NEOES's list, three across): at the 12 px floor a very long word may break rather than be cut */
@container (max-width: 130px){ .k4-fname b{overflow-wrap:anywhere;word-break:normal;line-height:.98;letter-spacing:0} }
/* the small cards of NEOES's list: the name gets a taller band (two lines at 12 px) and the picture gives it the room;
   the tag hangs below the card so it never covers the name */
@container (max-width: 130px){
  .k4-tv .k4-fframe::before{height:62%}
  .k4-tv .k4-fframe::after{top:61.7%;height:7%}
  .k4-tv .k4-fpic{top:2.2%;height:55%}
  .k4-tv .k4-fname{left:0;right:0;top:70%;height:30%}
  .k4-hobby .k4-fpic{height:55%}
  .k4-hobby .k4-fname{left:8%;right:8%;top:66%;height:30%}
  .k4-record .k4-fpic{height:54%}
  .k4-record .k4-fname{top:66%;height:28%}
  .k4-plate .k4-fname{left:4%;right:4%;top:80%;height:20%}
  .k4-page .k4-ghead,.k4-page .k4-auth{display:none}
  .k4-page .k4-fpic{top:5%;height:58%}
  .k4-page .k4-fname{top:65%;height:32%}
  .k4-fname b{font-size:12px!important}
}
.k4-all .k4-cell:has(.k4-fc){margin-bottom:22px}
.k4-all .k4-cell:has(.k4-fc) .k4-ticket{transform:translate(-50%,78%) rotate(-3deg)}
/* small cards: the name in ordinary capitals (narrower than all-caps), so a long word fits whole at 12 px */
@container (max-width: 130px){ .k4-fname b{text-transform:none;letter-spacing:0} }
/* (the display lettering is small capitals and stays wide, so on the small cards the name is the plain sans) */
@container (max-width: 130px){ .k4-fname b{font-family:var(--sans);font-weight:700;letter-spacing:-.01em;line-height:1.05;font-size:12.5px!important} }
/* a book page keeps its italic title on a small card */
@container (max-width: 130px){ .k4-page .k4-fname b{font-family:'EB Garamond',Georgia,serif;font-style:italic;font-weight:600;font-size:13px!important;letter-spacing:0} }
/* while the swap panel is up on a pick's page, the faces behind it rest (nothing shows through under its cards) */
.k-dive:has(.k-dswap.on) .k-dgrid{visibility:hidden}
/* a chooser with no letter row (Music): just the row of pictures, shorter, about three in view */
.k-slim .k-edit.k-benched .k-bench.kb-inline.noletters.kb-nowrite{height:clamp(178px,25cqh,214px)}
/* a single word too long for a small card breaks with a hyphen (Medi-terranean), never a raw cut */
@container (max-width: 130px){ .k4-fname b{-webkit-hyphens:auto;hyphens:auto} }
/* a book with no painting is a title page: its title large in the middle of the page */
.k4-page.k4-tp .k4-fname{top:20%;height:50%}
