/* Plank Pals sits on the WonderLinks stage (sticklings.css); these are only the plank-specific pieces. */
:root{--sw:clamp(60px,min(8.6vw,(100vh - 300px) / 5.6),108px)}
.brand .title{height:clamp(46px,7.2vw,86px)}
.brand .tagline{margin-top:-2px;font-size:clamp(12px,1.5vw,17px);color:var(--ink);letter-spacing:.02em;white-space:nowrap}
.brand .tagline.over-board{color:#fff8e7;-webkit-text-stroke:1.5px #432b18;paint-order:stroke fill;text-shadow:0 1px 2px #2c190de6}
.mascot{width:58px;left:52px;top:34px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* the box: three planks and the table turn in the four wells; in play, breeze, ball, shake or push */
.tray .well{touch-action:none}
.well img{top:4%;height:66%;max-width:96%;object-fit:contain}
.well.turn-well img{top:-8%;height:80%;max-width:100%}
.play-well{display:none!important}
.playing .play-well:not([hidden]){display:flex!important}
.playing .plank-well{display:none}
.well.wanted{border-color:#ffd27a;box-shadow:0 0 0 3px #ffd88a88,0 0 18px #ffbf4daa;animation:glow 1.6s ease-in-out infinite}
.well.lifting{transform:scale(.94);border-color:#e9b55e}

/* Undo and Play bookend the box, one under each thumb */
.bookend{position:absolute;top:50%;width:clamp(70px,8.4vw,100px);aspect-ratio:1;border:0;padding:0;border-radius:50%;background:url(assets/sticklings/ui/button-base.webp) center/contain no-repeat;filter:drop-shadow(0 6px 8px #3b251640);display:grid;place-items:center;transition:transform .15s}
#undo.bookend{left:0;transform:translate(calc(-100% - 12px),-58%)}
#play.bookend{right:0;transform:translate(calc(100% + 12px),-58%)}
.bookend img{width:66%;height:66%;object-fit:contain;filter:drop-shadow(0 3px 2px #2b190e44)}
.bookend span{position:absolute;bottom:-14px;padding:2px 12px;border-radius:999px;background:linear-gradient(#fff8ea,#f1dfbf);box-shadow:0 2px 0 #c49a64;font-size:clamp(13px,1.5vw,16px);white-space:nowrap}
.bookend:active{filter:drop-shadow(0 2px 3px #3b251640) brightness(.97)}
.bookend:disabled{opacity:.5}
#play .ico-build{display:none}
.playing #play .ico-play{display:none}
.playing #play .ico-build{display:block}
.playing #play{animation:glow 1.8s ease-in-out infinite;border-radius:50%}
.playing #undo{opacity:.35;pointer-events:none}

/* the trays at the sides, for the plank that is chosen: what to do with it on the left, paint on the right */
.side-tray{position:fixed;z-index:5;top:calc(50% - 46px);transform:translateY(-50%);width:var(--sw);filter:drop-shadow(0 8px 12px #3b251633);animation:slideIn .25s ease-out}
.edit-tray{left:max(10px,env(safe-area-inset-left));display:grid;gap:calc(var(--sw) * .07)}
.edit-tray,.paint-tray{border-style:solid;border-width:calc(var(--sw) * .46) calc(var(--sw) * .2);border-image:url(assets/planks/ui/paint-tray.webp) 245 170 245 190 fill / calc(var(--sw) * .46) calc(var(--sw) * .2) stretch;width:calc(var(--sw) * 1.12)}
/* Leave a little wood visible on both sides of the edit buttons. */
.edit-tray{width:calc(var(--sw) * 1.36)}
.side-well{position:relative;width:calc(var(--sw) * .86);aspect-ratio:.92;margin:0 auto;border:2px solid #ead7b3;border-radius:16px;background:radial-gradient(circle at 50% 38%,#fffdf6,#f6e8cf);box-shadow:inset 0 -3px 0 #e2c99f;padding:0 0 5%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;transition:transform .12s,border-color .2s}
.side-well img{position:absolute;top:4%;left:50%;transform:translateX(-50%);width:104%;height:66%;object-fit:contain;filter:drop-shadow(0 3px 3px #2b190e44);pointer-events:none}
.side-well span{position:relative;padding:2px 8px;border-radius:999px;background:linear-gradient(#fff8ea,#f1dfbf);box-shadow:0 2px 0 #c49a64;font-size:clamp(11px,calc(var(--sw) * .14),15px);white-space:nowrap}
.side-well:active{transform:scale(.93)}
.side-well:hover{border-color:#e2bf83}
.paint-tray{right:max(10px,env(safe-area-inset-right))}
.pot{width:calc(var(--sw) * .84);margin:0 auto}
.pots{display:grid;grid-template-columns:1fr;gap:calc(var(--sw) * .03);margin:calc(var(--sw) * -.1) calc(var(--sw) * -.06)}
.pot{position:relative;border:0;background:none;padding:0;aspect-ratio:1.12;display:grid;place-items:center;border-radius:50%}
.pot img{width:100%;height:100%;object-fit:contain;transition:transform .18s;filter:drop-shadow(0 3px 2px #6f523544)}
.pot[aria-pressed=true] img{transform:translateY(-6px) scale(1.06)}
.pot[aria-pressed=true]::after{content:'✓';position:absolute;bottom:-2px;left:50%;transform:translateX(-50%);width:22px;height:22px;border-radius:50%;background:#7d9a6a;color:#fff;border:2px solid #f8efd9;font:14px/18px system-ui;text-align:center}
.pot:active img{transform:scale(.92)}
@keyframes slideIn{from{opacity:0;translate:0 10px}to{opacity:1;translate:0 0}}
/* a chosen plank needs the sides: the picture guide steps aside until it is done */
.editing .guide,.editing .guide-back{display:none}

/* what the carried plank will do when it lands */
.drop-chip{position:fixed;left:0;top:0;z-index:7;display:flex;align-items:center;gap:6px;padding:5px 12px 5px 8px;border-radius:999px;background:#fff8ecf0;box-shadow:var(--shadow);font-size:15px;pointer-events:none;white-space:nowrap}
.drop-chip i{width:12px;height:12px;border-radius:50%;background:#7cc46a}
.drop-chip[data-state=fit] i{background:#f2b02e}
.drop-chip[data-state=wobbly] i{background:#eaa13a}
.drop-chip[data-state=tips] i,.drop-chip[data-state=falls] i{background:#e0714f}
.drop-chip[data-state=tray] i{background:#b98b5b}
.carrying .tray.drop-here{filter:drop-shadow(0 0 10px #ffd27a) drop-shadow(0 8px 12px #3b251633)}

/* empty table: a finger lifts a plank up out of the box */
.carry-demo .demo-line{stroke-dasharray:150;stroke-dashoffset:150}
.carry-demo .finger{offset-path:path('M100 104 C 100 70, 120 40, 150 24')}

/* the ideas sheet: guides, then masterpieces */
.masters-head{display:flex;align-items:baseline;gap:8px;margin:22px 0 10px;font-size:22px;font-weight:500}
.masters-head span{color:#d99a2b}
.masters-head small{font-size:14px;color:var(--ink-soft)}
.choices.masters .choice{border-color:#efcf8d;background:linear-gradient(#fffdf6,#fff4dc)}
.choices.masters .choice.done{border-color:#b9d1a6}

@media (max-width:759px){
  :root{--tray-w:min(calc(100vw - 24px),520px)}
  .mascot{width:40px;left:auto;right:-46px;top:2px}
  .brand .tagline{display:none}
  /* no room beside the box on a phone: the bookends sit on top of its two ends */
  .bookend{top:auto;bottom:calc(100% - 6px);width:62px}
  #undo.bookend{left:4px;transform:none}
  #play.bookend{right:4px;transform:none}
  .bookend span{font-size:12px;bottom:-10px;padding:1px 9px}
  .side-tray{top:calc(50% - 30px)}
  .pot[aria-pressed=true]::after{width:18px;height:18px;font-size:11px;line-height:14px}
}
@media (max-width:479px){.mascot{display:none}}
/* short landscape screens (phones on their side): a smaller box and board so the table stays in view */
@media (max-height:560px){
  :root{--tray-w:min(70vw,600px,100vh);--sw:58px}
  .wood-btn{width:44px;height:44px}.wood-btn svg{width:20px;height:20px}
  .pill{min-height:40px;padding:0 12px;font-size:14px}
  .fresh{height:42px;font-size:14px;padding:0 12px 0 5px}.fresh-ico{width:32px;height:32px}
  .brand .title{height:38px}.brand .tagline{display:none}
  .mascot{display:none}
  .hint{top:calc(max(6px,env(safe-area-inset-top)) + 50px);font-size:13px}
  .guide,.guide-back{top:64px}
  .guide{width:clamp(170px,24vw,230px);left:max(10px,env(safe-area-inset-left));transform:none}
  .guide-title{display:none}
  .guide-actions .chip{min-height:36px;padding:0 10px;font-size:13px}
  .well span{font-size:12px;padding:2px 9px}
  .bookend{width:60px}
  .bookend span{font-size:12px;bottom:-10px}
  .side-tray{top:calc(50% - 34px)}
  .side-well span{display:none}
  .pots{grid-template-columns:1fr 1fr;margin:calc(var(--sw) * -.2) calc(var(--sw) * -.3)}
  .paint-tray{width:calc(var(--sw) * 1.7)}
  .edit-tray{grid-template-columns:1fr 1fr;width:calc(var(--sw) * 2.12)}
  .side-well{width:calc(var(--sw) * .78);margin:0}
  .toast{font-size:15px}
}

/* Isolated illustrations share the existing wooden buttons and cream labels. */
.tray{grid-template-columns:repeat(4,minmax(0,1fr))}
.picture-button img{pointer-events:none;filter:saturate(.65) drop-shadow(0 3px 2px #2b190e33)}
.picture-button:focus-visible{outline:3px solid #3d7ea6;outline-offset:4px}
.header-picture{position:relative;width:64px;height:64px;flex:0 0 64px;padding:0}
.header-picture img{width:76%;height:76%;object-fit:contain;filter:saturate(.65) drop-shadow(0 2px 2px #5b35192b)}
.header-picture span{position:absolute;bottom:-15px;padding:2px 10px;border-radius:999px;background:linear-gradient(#fff8ea,#f1dfbf);box-shadow:0 2px 0 #c49a64;font-size:15px;white-space:nowrap}
.header-picture:disabled{opacity:.5}
.top-left{gap:18px;align-items:flex-start}
.top-left #home{flex-shrink:0}
.top-right{gap:14px;align-items:flex-start}
.mascot{position:static;order:2;align-self:flex-start;width:46px;flex-shrink:0}
.bookend.picture-button img{width:76%;height:76%}
@media (min-width:760px) and (max-width:1000px){:root{--tray-w:min(calc(100vw - 220px),100vh)}}
@media (max-width:759px){
  .top{grid-template-columns:64px minmax(0,1fr) 100px}
  .brand .title{max-width:100%;object-fit:contain}
  .top-left{gap:14px}
  .top-right{display:grid;grid-template-columns:48px 48px;gap:14px 4px;max-width:none;justify-self:end}
  #clear{grid-column:1 / -1;grid-row:2;justify-self:end}
  .mascot{display:none}
  .header-picture{width:56px;height:56px;flex-basis:56px}
  .header-picture span{font-size:12px;padding:2px 7px;bottom:-14px}
  .bookend.picture-button{width:70px;bottom:calc(100% + 8px)}
  .hint{top:calc(max(10px,env(safe-area-inset-top)) + 140px)}
  .guide,.guide-back{top:calc(max(10px,env(safe-area-inset-top)) + 140px)}
}
@media (max-height:560px){
  .top{grid-template-columns:1fr auto 1fr}
  .top-left{flex-direction:row;gap:16px}
  .top-right{display:flex;flex-wrap:nowrap;gap:10px}
  .header-picture{width:48px;height:48px;flex-basis:48px}
  .header-picture span{font-size:12px;padding:1px 6px;bottom:-12px}
  .mascot{display:none}
  .bookend.picture-button{width:60px}
  .hint{top:calc(max(6px,env(safe-area-inset-top)) + 68px)}
  .guide,.guide-back{top:84px}
}
@media (max-width:359px){
  .tray .well span{font-size:11px;padding:2px 6px}
}

/* A landscape phone has room beside its short tray. Keep these buttons there
   so they do not consume the height needed for the opening build. */
@media (min-width:600px) and (max-height:560px){
  .bookend.picture-button{top:50%;bottom:auto}
  #undo.bookend{left:0;transform:translate(calc(-100% - 12px),-58%)}
  #play.bookend{right:0;transform:translate(calc(100% + 12px),-58%)}
}

/* A quiet invitation to edit the resting selection: light follows both tray rims. */
.side-tray::after{
  content:'';position:absolute;inset:calc(var(--sw) * -.3) calc(var(--sw) * -.09);
  border:2px solid #ffe8a7;border-radius:14px;pointer-events:none;
  box-shadow:0 0 9px 2px #f6c75c99,inset 0 0 8px #ffe9b699;
  opacity:0;
}
.editing:not(.carrying):not(.playing) .side-tray:not([hidden])::after{
  opacity:.38;animation:editTrayLight 2.6s ease-in-out 2;
}
@keyframes editTrayLight{
  0%,100%{opacity:.38}
  45%{opacity:.95}
}
.less-motion .side-tray::after{animation:none!important}
@media (prefers-reduced-motion:reduce){.side-tray::after{animation:none!important}}


/* The tray art has transparent space below its wood. Use that space now that
   gameplay has no footer, while keeping every button above the device inset. */
.tray{bottom:calc(env(safe-area-inset-bottom) - 16px)}
.side-tray{top:calc(50% - 22px)}
@media (max-width:759px){.side-tray{top:calc(50% - 12px)}}
@media (max-height:560px){.side-tray{top:calc(50% - 16px)}.tray{bottom:env(safe-area-inset-bottom)}}
/* Drag-through turn handles belong to the preview; pointer events keep reaching the canvas. */
#turnChoices { position: fixed; inset: 0; z-index: 24; pointer-events: none; }
.turn-choice { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #164c51; font: 700 12px/1.1 system-ui, sans-serif; text-shadow: 0 1px 2px #fff; }
.turn-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2px dashed #27838b; background: #f3fffcf0; box-shadow: 0 2px 8px #123d3226; font: 700 27px/1 system-ui, sans-serif; transition: background .12s, scale .12s; }
.turn-choice.chosen .turn-icon { background: #d4edb9; border: 2px solid #4a853c; color: #315e29; scale: 1.1; }
.less-motion .turn-icon { transition: none; }
.action-symbol{pointer-events:none;filter:drop-shadow(0 3px 2px #55351d38)}
#undo .undo-symbol{width:64%;height:64%;overflow:visible}
.side-well .delete-symbol{position:absolute;top:4%;width:70%;height:65%;left:15%}
.delete-plank{border-color:#dfbfa5;background:radial-gradient(circle at 50% 35%,#fff9ee,#f2dac5)}
.delete-plank span{color:#883b2b}
.delete-plank:focus-visible{outline:3px solid #ac4935;outline-offset:3px}
/* Wide monitors must not squeeze the plank pictures with viewport-sized padding. */
@media (min-width:1001px) and (min-height:561px){
  .tray{padding:calc(var(--tray-w) * .08) calc(var(--tray-w) * .065) calc(var(--tray-w) * .095) calc(var(--tray-w) * .08)}
}
