/* YA Studio Games look: deep pine green, warm gold, cream. Fonts are bundled (SIL OFL, see /fonts/OFL.txt). */
@font-face{font-family:"YA Serif";src:url(../fonts/crimsonpro.woff2) format("woff2");font-weight:200 900;font-style:normal;font-display:swap}
@font-face{font-family:"YA Serif";src:url(../fonts/crimsonpro-italic.woff2) format("woff2");font-weight:200 900;font-style:italic;font-display:swap}
@font-face{font-family:"YA Sans";src:url(../fonts/nunito.woff2) format("woff2");font-weight:200 1000;font-style:normal;font-display:swap}
:root{--pine:#0f3324;--deep:#081a12;--gold:#e2be68;--gold2:#c99a3e;--cream:#f7efdc;--ink:#2b1d12;--brown:#6b4a1d;--red:#9c2a26;--muted:#d6caa9;--radius:18px;
--serif:"YA Serif",Georgia,"Times New Roman",serif;--sans:"YA Sans",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
*{box-sizing:border-box}
html{font-size:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;font-family:var(--sans);font-size:1.125rem;line-height:1.5;color:var(--cream);background:var(--deep) radial-gradient(120% 70% at 50% 0%,#1d5a3f 0%,var(--pine) 45%,var(--deep) 100%) no-repeat;min-height:100vh}
.wrap{max-width:30rem;margin:0 auto;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));min-height:100vh;display:flex;flex-direction:column}
main{flex:1}
h1,h2,h3{font-family:var(--serif);font-weight:700;color:var(--gold);margin:.2em 0 .4em;line-height:1.2}
h1{font-size:2rem;text-align:center}
h2{font-size:1.75rem}
h1:focus,h2:focus{outline:none}
a{color:var(--gold)}
.brand{text-align:center;font-family:var(--serif);letter-spacing:.16em;text-transform:uppercase;font-size:.875rem;color:var(--gold)}
.lead{text-align:center;color:#efe4c7;margin:0 0 .8rem}
.panel{background:rgba(8,26,18,.6);border:1px solid rgba(226,190,104,.4);border-radius:var(--radius);padding:1rem;margin:1rem 0}
.step{display:inline-flex;align-items:center;justify-content:center;min-width:1.9rem;height:1.9rem;border-radius:50%;background:var(--gold);color:var(--pine);font-family:var(--sans);font-weight:800;margin-right:.5rem;font-size:1rem;vertical-align:.15em}
label,.label{display:block;font-weight:700;margin:1rem 0 .35rem;color:#f6ecd2}
.opt{font-weight:400;color:var(--muted);font-size:.9rem}
input[type=text],textarea,select{width:100%;font-family:inherit;font-size:1.0625rem;min-height:48px;padding:.7rem .8rem;border-radius:12px;border:2px solid rgba(226,190,104,.55);background:var(--cream);color:var(--ink)}
textarea{min-height:7.5rem;resize:vertical;line-height:1.4}
select{appearance:auto}
:focus-visible{outline:3px solid #ffe3a0;outline-offset:2px}
.count{text-align:right;font-size:.875rem;color:var(--muted);margin-top:.2rem}
.count.over{color:#ffc2b6;font-weight:700}
.field-error{color:#ffd0c6;background:#5a1714;border-left:4px solid #ff9b8a;border-radius:8px;padding:.4rem .6rem;margin:.4rem 0 0;font-size:.95rem}
.field-error:empty{display:none}
.btn{display:flex;align-items:center;justify-content:center;width:100%;min-height:52px;font-family:inherit;font-weight:800;font-size:1.125rem;padding:.75rem 1rem;margin:.6rem 0;border-radius:14px;border:0;cursor:pointer;text-align:center;text-decoration:none;
background:linear-gradient(180deg,#f2d488,var(--gold2));color:#2a1a08;box-shadow:0 4px 0 #8a6420,0 8px 18px rgba(0,0,0,.3)}
.btn:active{transform:translateY(2px);box-shadow:0 2px 0 #8a6420}
.btn.secondary{background:transparent;color:var(--gold);border:2px solid var(--gold);box-shadow:none}
.btn.small{min-height:44px;font-size:1rem;width:auto;padding:.5rem 1rem;margin:0}
.btn[disabled]{opacity:.55;cursor:not-allowed}
.row{display:flex;gap:.6rem;align-items:flex-end}.row>*{flex:1}
.hidden{display:none!important}
.small{font-size:.9375rem;color:var(--muted)}
/* progress */
.progress-steps{position:sticky;top:0;z-index:5;background:rgba(8,26,18,.92);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);margin:0 -16px;padding:.5rem 16px;border-bottom:1px solid rgba(226,190,104,.25)}
.progress-steps .bar{height:8px;border-radius:5px;background:rgba(255,255,255,.15);overflow:hidden}
.progress-steps .bar>div{height:100%;width:0;background:var(--gold);transition:width .3s}
.progress-steps p{margin:.25rem 0 0;font-size:.875rem;color:var(--muted);text-align:center}
/* gallery */
/* QA D7: thumbnails >=140px wide on a 320px phone: always 2 columns, gallery uses the panel padding too */
.gallery{display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem;margin-inline:-1rem}
.pic{position:relative;display:block;border:3px solid rgba(226,190,104,.25);border-radius:14px;padding:0;background:#0b2318;cursor:pointer;overflow:hidden;color:var(--cream);font:inherit;text-align:left}
.pic img{width:100%;height:auto;aspect-ratio:4/5;object-fit:cover;display:block} /* height:auto: the img's width/height attributes (432x540) must not fix its height (Oct 23) */
.pic .lbl{display:block;padding:.4rem .5rem;overflow-wrap:anywhere;-webkit-hyphens:none;hyphens:none;font-size:.9375rem;font-weight:700;line-height:1.25;min-height:2.6em}
.pic[aria-checked=true]{border-color:var(--gold);box-shadow:0 0 0 3px #fff3cf}
.pic .tick{display:none;position:absolute;top:.4rem;right:.4rem;background:var(--gold);color:var(--pine);font-weight:900;border-radius:999px;padding:.15rem .55rem;font-size:.9rem;border:2px solid #fff3cf}
.pic[aria-checked=true] .tick{display:block}
.tabs{display:flex;gap:6px;background:rgba(0,0,0,.3);padding:4px;border-radius:12px;margin-bottom:.5rem}
.tabs button{flex:1;min-height:44px;font:inherit;font-size:1rem;font-weight:700;border:0;border-radius:9px;background:transparent;color:#efe4c7;cursor:pointer}
.tabs button[aria-pressed=true]{background:var(--gold);color:var(--pine)}
.preset-text{font-family:var(--serif);font-size:1.25rem;background:rgba(0,0,0,.25);border-radius:12px;padding:.7rem .9rem;margin:.6rem 0 0}
.switch{display:flex;gap:.7rem;align-items:center;min-height:48px;margin-top:.6rem}
.switch input{width:44px;height:44px;margin:0;accent-color:var(--gold);flex:none}
.switch label{margin:0}
/* result */
.meter{border-radius:10px;padding:.45rem .7rem;font-weight:700;font-size:.95rem;margin:.5rem 0}
.meter.green{background:#1f5a36;color:#e3ffe9}.meter.amber{background:#6b4d0f;color:#fff2cf}.meter.red{background:#6e1a15;color:#ffe1dc}
.linkbox{word-break:break-all;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.875rem;background:rgba(0,0,0,.4);border-radius:10px;padding:.6rem;max-height:7.5rem;overflow:auto;color:#efe3c4;user-select:all;-webkit-user-select:all}
.ok{background:#1d4b2f;border:1px solid #9ad9a8;border-radius:12px;padding:.6rem .8rem;margin:.6rem 0}
.notice{background:rgba(226,190,104,.12);border:1px solid rgba(226,190,104,.4);border-radius:12px;padding:.6rem .8rem;font-size:1rem}
footer{text-align:center;font-size:.875rem;color:#cdbf9d;margin-top:1.5rem;padding-top:.8rem;border-top:1px solid rgba(226,190,104,.25)}
footer p{margin:.2rem 0}
/* ---- recipient card ---- */
.card{position:relative;border-radius:22px;overflow:hidden;background:var(--cream);color:var(--ink);box-shadow:0 14px 40px rgba(0,0,0,.45);border:4px solid var(--gold);
  /* imgfix3 (Oct 23): the CARD is as wide as its 4:5 picture, so the picture fills it edge to edge (no cream strips).
     41.6vh = 52vh x 4/5 keeps the picture within about half the screen height; on very short screens (landscape phones)
     a 16rem floor keeps the riddle, field and buttons usable; the picture is then a bit taller than 52vh but still whole. +8px = the 2 borders. */
  width:min(100%,calc(max(41.6vh,16rem) + 8px));margin-inline:auto}
/* imgfix2/3 (Oct 23): show the WHOLE picture: a 4:5 frame as wide as the card (the card itself is capped, above); the picture is contained, never cropped. */
.art{position:relative;aspect-ratio:4/5;width:100%;overflow:hidden;background:#123}
.art img{width:100%;height:100%;object-fit:contain;display:block;transition:filter 1.2s ease,transform 1.6s ease}
.cover .art img{filter:blur(7px) saturate(1.1);transform:scale(1.08)}
/* QA D4: the tag panel sits in normal flow under the picture (overlapping its bottom edge), so long names or 200% text make the card taller instead of pushing the panel off the top. */
.tagpanel{container-type:inline-size;position:relative;z-index:1;margin:-4.5rem auto 1rem;width:90%;overflow-wrap:break-word;hyphens:manual;background:rgba(247,239,220,.92);border:2px solid var(--gold2);border-radius:14px;padding:12px 14px;text-align:center;color:var(--ink);box-shadow:0 8px 20px rgba(0,0,0,.35)}
.tagpanel::before{content:"";position:absolute;top:-11px;left:50%;width:18px;height:18px;margin-left:-9px;border-radius:50%;background:var(--cream);border:2px solid var(--gold2)}
/* QA retest 2 (R5): the title is sized to the tag panel (container query units), not the viewport. It grows with the
   user's text size up to 1.75rem, but never past 15cqi, so a 13-letter word ("Grandchildren") fits on one line with margin (16cqi is the measured limit)
   of the panel. Only a single word longer than that (e.g. a 24-letter name) wraps. Fallback: plain 1.75rem. */
.tagpanel h1{color:#5a3b10;font-size:1.75rem;font-size:min(1.75rem,15cqi);margin:.1rem 0}
.tagpanel p{margin:.1rem 0;font-family:var(--serif);font-style:italic;font-size:1.25rem;font-size:min(1.25rem,11cqi);color:var(--brown)}
.cbody{padding:1rem 1.1rem 1.1rem}
.riddle{font-family:var(--serif);font-size:1.5rem;line-height:1.3;margin:.2rem 0 1rem;color:#23160b}
.cbody h2{color:#7a5312;font-size:1.75rem;line-height:1.2;margin:.1rem 0 .3rem}
/* QA fix round 2 (4): the reveal title is fitted like the cover title (R5): sized to its box (container query units),
   grows with the user's text size up to 1.75rem but never past 15cqi, so "Christmas," and a 13-letter name fit on a
   line at 320 px + 200% text. Only a single longer word wraps. Fallback: plain 1.75rem + wrapping. */
#vReveal{container-type:inline-size}
#revealTitle{font-size:min(1.75rem,15cqi);overflow-wrap:break-word;hyphens:manual}
.cbody input[type=text]{border-color:#b98f43;background:#fffaf0}
.cbody .btn.secondary{color:#7a5312;border-color:#b98f43}
.feedback{min-height:1.5em;margin:.4rem 0 0;font-weight:700;color:var(--red)}
.hints{list-style:none;padding:0;margin:.5rem 0 0}
.hints li{background:#f1e0b6;border-radius:10px;padding:.5rem .75rem;margin:.4rem 0;color:#3e2a10;font-size:1.0625rem}
.answer-was{background:#f1e0b6;border-radius:10px;padding:.6rem .8rem;color:#3e2a10;font-size:1.125rem}
.shake{animation:shake .45s}
@keyframes shake{20%{transform:translateX(-9px)}40%{transform:translateX(8px)}60%{transform:translateX(-6px)}80%{transform:translateX(4px)}}
.msg-line{opacity:0;transform:translateY(8px);transition:opacity .7s ease,transform .7s ease;font-family:var(--serif);font-size:1.375rem;line-height:1.4;text-align:center;margin:.15rem 0;color:#1f140a;overflow-wrap:anywhere;white-space:pre-wrap;min-height:.6em}
.msg-line.in{opacity:1;transform:none}
.signoff{text-align:right;font-family:var(--serif);font-style:italic;font-size:1.25rem;color:var(--brown);margin:.6rem 0 0}
.giftbox{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;min-height:150px;margin:1rem 0 .4rem;border:0;background:none;cursor:pointer;font:inherit;color:#7a5312;font-weight:800;font-size:1.125rem}
.giftbox svg{width:110px;height:110px;animation:wiggle 1.6s ease-in-out infinite}
/* imgfix4 (Oct 23): the opened lid swings open on a hinge at the box's top-left corner (its overhang tucks behind the box) and stays there, whole, tilted on
   the box (it used to jump 38 px up inside the clipped 100x100 icon, leaving a lone green sliver above a flat box).
   overflow:visible so the raised bow isn't clipped; the idle wiggle stops once the gift is open. */
.giftbox svg{overflow:visible}
.giftbox svg .lid{transform-box:view-box;transform-origin:26px 49px}
.giftbox.open svg{animation:none}
.giftbox.open svg .lid{transform:rotate(-22deg);transition:transform .6s cubic-bezier(.3,1.6,.5,1)}
@keyframes wiggle{0%,70%,100%{transform:rotate(0)}76%{transform:rotate(-6deg)}84%{transform:rotate(6deg)}92%{transform:rotate(-3deg)}}
.giftline{font-family:var(--serif);font-size:1.5rem;font-weight:700;text-align:center;color:var(--red);margin:.4rem 0;opacity:0;transform:scale(.9);transition:opacity .7s,transform .7s}
.giftline.in{opacity:1;transform:none}
.giftline:focus{outline:2px dashed var(--gold2);outline-offset:4px;border-radius:8px}
.endnote{text-align:center;font-size:.875rem;color:#5d4a2d;margin-top:1rem}
.endnote a{color:#7a5312}
/* QA D7: text links used as buttons get a 44px tap area */
a.tap{display:inline-flex;align-items:center;min-height:44px;padding:0 .5rem}
/* imgfix3: snow and confetti draw BEHIND the content (negative z-index under the page's in-flow boxes): flakes show on the page
   background but never over the card, its title box, buttons or any panel. */
canvas.fx{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:-1}
/* ---- video maker ---- */
.stage{position:relative;width:100%;max-width:300px;margin:0 auto;border-radius:16px;overflow:hidden;border:3px solid var(--gold);background:#000}
.stage canvas,.stage video{width:100%;height:auto;aspect-ratio:9/16;display:block;background:#000} /* sized from the width (the 3px border made height:100% of a 9:16 border-box 1-2.4% off; WebKit also overflowed) (Oct 23) */
.vprogress{height:10px;border-radius:5px;background:rgba(255,255,255,.15);overflow:hidden;margin:.6rem 0}
.vprogress>div{height:100%;width:0;background:var(--gold);transition:width .15s linear}
.vstatus{display:flex;justify-content:space-between;gap:.75rem;font-weight:700;margin:.2rem 0}
#vpct{font-variant-numeric:tabular-nums}
#make.ready{background:#2f7d4f;color:#fff}
@media (prefers-reduced-motion:reduce){.vprogress>div{transition:none}}
.styles{display:flex;flex-wrap:wrap;gap:.5rem}
.styles button{flex:1 1 auto;min-width:0;padding:0 .6rem;min-height:48px;font:inherit;font-size:.95rem;font-weight:700;border-radius:12px;border:2px solid rgba(226,190,104,.5);background:transparent;color:#efe4c7;cursor:pointer}
.styles button[aria-checked=true]{background:var(--gold);color:var(--pine);border-color:#fff3cf}
.photo-preview{display:flex;gap:.7rem;align-items:center;margin-top:.5rem}
.photo-preview img{width:64px;height:64px;object-fit:cover;border-radius:10px;border:2px solid var(--gold)}
.filebtn{position:relative;overflow:hidden}
.filebtn input{position:absolute;inset:0;opacity:0;cursor:pointer;font-size:0}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition-duration:.25s!important}
  .msg-line{transform:none}
}
/* small phones (320-359px): slimmer page + panel padding and thinner thumb borders keep each thumbnail image >=140px */
@media (max-width:359px){.wrap{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}.progress-steps{margin:0 -10px;padding-left:10px;padding-right:10px}.tagpanel{width:92%;padding:10px}.panel{padding:.75rem}.panel .gallery{margin-inline:-.75rem;gap:6px}.pic{border-width:2px}}
.hero{width:100%;height:auto;border-radius:12px;display:block}
.cbody .label{color:#5a3b10;margin-top:.2rem}
/* ---- video maker: look picker + photo fit ---- */
.looktabs{display:flex;gap:.4rem;overflow-x:auto;overscroll-behavior-x:contain;padding:.15rem .1rem .45rem;margin:0 -.1rem;scrollbar-width:thin}
.looktab{flex:0 0 auto;max-width:85%;min-height:44px;padding:.3rem .85rem;font:inherit;font-size:.95rem;font-weight:700;white-space:normal;text-align:center;line-height:1.15;border-radius:999px;border:2px solid rgba(226,190,104,.5);background:transparent;color:#efe4c7;cursor:pointer}
.looktab[aria-selected=true]{background:var(--gold);color:var(--pine);border-color:#fff3cf}
.styles.lookgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(max(96px,7em),1fr));gap:.5rem}
.styles.lookgrid button.look{display:flex;flex-direction:column;align-items:stretch;gap:.3rem;padding:.3rem;min-height:48px;font-size:.85rem;line-height:1.2;text-align:center}
.styles.lookgrid button.look[aria-checked=true]{outline:3px solid #fff3cf;outline-offset:1px}
.styles.lookgrid button.look:focus-visible{outline:3px solid #ffe3a0;outline-offset:2px}
.lookthumb{display:block;width:100%;max-width:150px;margin:0 auto;height:auto;aspect-ratio:9/16;border-radius:8px;background:#0b2318}
.look span{overflow-wrap:anywhere;word-break:normal;hyphens:none;-webkit-hyphens:none}
/* Labels only break at their soft hyphens (long words only) when the tile is really narrow, e.g. 320 px with big text;
   at normal sizes words stay whole. overflow-wrap:anywhere is only the safety net (QA round 4). */
.pic,.styles.lookgrid button.look{container-type:inline-size}
@container (max-width:9em){.pic .lbl{-webkit-hyphens:manual;hyphens:manual}} @container (max-width:7.5em){.look span{-webkit-hyphens:manual;hyphens:manual}}
/* With very big text (about 200%) two gallery tiles are too narrow for 7-letter words, which have no soft hyphen: one
   column then (the panel is measured in its own em, so this never happens at normal text sizes). */
#s1{container-type:inline-size}
@container (max-width:9.1em){.gallery{grid-template-columns:1fr}}
.fitbox{margin-top:.8rem}
.fitbox h3{font-size:1.15rem}
.fitstage{width:100%;max-width:260px;margin:.4rem auto .6rem;border-radius:14px;overflow:hidden;border:3px solid var(--gold);background:#000}
.fitstage canvas{display:block;width:100%;height:auto;aspect-ratio:9/16;touch-action:none;cursor:grab;-webkit-user-select:none;user-select:none}
.fitstage canvas.dragging{cursor:grabbing}
.fitstage canvas:focus-visible{outline:4px solid #ffe3a0;outline-offset:-4px}
.seg{display:flex;flex-wrap:wrap;gap:.5rem}
.seg button{flex:1 1 auto;min-width:0;padding:0 .6rem;min-height:48px;font:inherit;font-size:.95rem;font-weight:700;border-radius:12px;border:2px solid rgba(226,190,104,.5);background:transparent;color:#efe4c7;cursor:pointer}
.seg button[aria-checked=true]{background:var(--gold);color:var(--pine);border-color:#fff3cf}
.seg button[disabled]{opacity:.55;cursor:not-allowed}
input[type=range]{width:100%;min-height:44px;accent-color:var(--gold)}
#zoomVal{font-weight:400;color:var(--muted);font-variant-numeric:tabular-nums}
.vh{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.fitnote{margin:.5rem 0 0}.fitnote:empty{margin:0}
/* Access-code screen (maker + video maker only). html.gated is static in the page; js/gate.js adds .unlocked
   (before the page is drawn when this device already has the current code). */
html.gated:not(.unlocked) main{display:none}
html.unlocked #gate{display:none}
.gate{padding-top:1rem}
.gate form{max-width:32rem;margin:1rem auto}
.gate input{width:100%;box-sizing:border-box;font-size:1.25rem;letter-spacing:.04em}
.gate .btn{margin-top:.75rem}
