/* tough-bot.css — Tough Bot: the 3D lab fills the screen under the site
   header, with a slim bar floating over it (who you're testing, his
   toughness, bolts, and the buttons) and the toolbox underneath. The page
   never scrolls. Phones get icon-only buttons and one row of tools; a phone
   on its side gets the tools in a column beside the lab. An installed app
   may draw under the phone's bars, so it keeps clear of them. */

/* the header keeps clear of the phone's top bar (--sat); the toolbox keeps
   clear of the bottom (--sab: on Android's installed app, the button bar too) */
body.tb-page{height:100vh;height:100dvh;overflow:hidden;display:flex;flex-direction:column;overscroll-behavior:none;box-sizing:border-box}
.tb{flex:1;min-height:0;display:flex;flex-direction:column;gap:8px;width:100%;max-width:1280px;margin:0 auto;box-sizing:border-box;
  padding:4px max(10px,var(--sar)) max(10px,var(--sab)) max(10px,var(--sal))}
.tb:fullscreen{max-width:none;padding:max(8px,env(safe-area-inset-top,0px)) max(10px,env(safe-area-inset-right,0px)) max(10px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));background:#070D1F}

.tb-stage{position:relative;flex:1;min-height:0;border-radius:24px;overflow:hidden;background:#0A1230;box-shadow:inset 0 0 0 1px rgba(255,255,255,.12),0 24px 60px -30px rgba(0,0,0,.9)}
.tb-stage canvas{display:block;width:100%;height:100%;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;cursor:crosshair}

/* ---- the bar over the lab ---- */
.tb-hud{position:absolute;left:10px;right:10px;top:10px;z-index:2;display:flex;justify-content:space-between;align-items:flex-start;gap:8px;pointer-events:none}
.tb-hud>*{pointer-events:auto}
.tb-who{display:grid;gap:5px;min-width:170px;max-width:46%;padding:8px 12px 9px;border:0;border-radius:16px;text-align:left;cursor:pointer;color:var(--snow);font:inherit}
/* the panels over the lab are solid, so the lab's light strips never show through them */
.tb-hud .glass{background:rgba(9,15,38,.94);box-shadow:inset 0 0 0 1px rgba(255,255,255,.13),0 10px 26px -14px rgba(0,0,0,.9)}
.tb-who__row{display:flex;align-items:center;gap:6px;min-width:0}
.tb-who__row b{font:800 17px/1.1 var(--font-display);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tb-who__row svg{flex:none;width:14px;height:14px;color:var(--mist)}
.tb-hp{display:block;height:8px;border-radius:99px;background:rgba(255,255,255,.1);overflow:hidden}
.tb-hp em{display:block;height:100%;width:100%;border-radius:99px;background:var(--mint);transition:width .25s,background-color .3s}
.tb-who__meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font:700 11px/1 var(--font-body);color:var(--mist);letter-spacing:.05em;text-transform:uppercase}
.tb-who__bolts{display:inline-flex;align-items:center;gap:4px;letter-spacing:0;text-transform:none}
.tb-who__bolts svg{width:14px;height:14px;color:var(--gold)}
.tb-who__bolts b{font:800 13px/1 var(--font-display);color:var(--snow);font-variant-numeric:tabular-nums}

.tb-acts{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.tb-ib{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:44px;height:44px;padding:0 13px;border:0;border-radius:14px;cursor:pointer;color:var(--snow);font:800 14px/1 var(--font-display);
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:transform .12s,background-color .15s}
.tb-ib:active{transform:scale(.94)}
.tb-ib svg{flex:none;width:19px;height:19px}
.tb-ib[hidden]{display:none}
#stickers svg{color:var(--gold);width:17px;height:17px}
#stickers b{font:800 13px/1 var(--font-display)}
.tb-ib--go{color:#06122A;background:var(--mint);box-shadow:0 8px 22px -10px rgba(92,242,176,.8)}

/* ---- what he says: a white bubble with a tail, above his head ---- */
.tb-bubble{position:absolute;left:0;top:0;z-index:1;max-width:min(270px,64%);padding:10px 14px;border-radius:18px;font:800 15px/1.3 var(--font-display);color:#0B1330;background:#F3F8FF;box-shadow:0 12px 30px -10px rgba(0,0,0,.7);
  opacity:0;pointer-events:none;transition:opacity .2s;text-align:center;text-wrap:balance}
.tb-bubble::after{content:"";position:absolute;left:50%;bottom:-7px;width:14px;height:14px;margin-left:-7px;background:#F3F8FF;transform:rotate(45deg);border-radius:3px}
.tb-bubble.is-in{opacity:1;animation:tb-say .35s cubic-bezier(.34,1.56,.64,1)}
@keyframes tb-say{from{scale:.6}to{scale:1}}

.tb-pops{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.tb-pop{position:absolute;transform:translate(-50%,-50%);font:800 30px/1 var(--font-display);letter-spacing:.02em;-webkit-text-stroke:1.5px #0B1330;paint-order:stroke;text-shadow:0 4px 0 #0B1330;animation:tb-pop .9s ease-out forwards;white-space:nowrap}
@keyframes tb-pop{0%{opacity:0;scale:.4;translate:0 0}20%{opacity:1;scale:1.15}100%{opacity:0;scale:1;translate:0 -50px}}

.tb-hint{position:absolute;left:50%;bottom:12px;z-index:1;margin:0;padding:8px 14px;border-radius:99px;font:700 14px/1.3 var(--font-body);color:var(--snow);background:rgba(10,18,48,.82);box-shadow:inset 0 0 0 1px rgba(255,255,255,.14);
  transform:translateX(-50%);opacity:0;transition:opacity .25s;pointer-events:none;text-align:center;width:max-content;max-width:calc(100% - 24px)}
.tb-hint b{color:var(--mint)}
.tb-hint.is-in{opacity:1}

/* where a held tool is aiming, on a touch screen (just above the finger) */
.tb-aim{position:absolute;left:0;top:0;z-index:1;width:34px;height:34px;margin:-17px 0 0 -17px;border-radius:50%;pointer-events:none;opacity:0;
  box-shadow:0 0 0 2.5px var(--mint),0 0 14px rgba(92,242,176,.7),inset 0 0 0 2.5px rgba(6,10,28,.5);transition:opacity .15s,scale .15s;scale:.6}
.tb-aim::after{content:"";position:absolute;left:50%;top:50%;width:6px;height:6px;margin:-3px 0 0 -3px;border-radius:50%;background:#F3F8FF}
.tb-aim.is-on{opacity:1;scale:1}

/* ---- the toolbox ---- */
.tb-tools{display:flex;gap:6px;padding:2px}
.tb-tool{flex:1 1 0;min-width:0;display:grid;justify-items:center;align-content:center;gap:5px;min-height:66px;padding:8px 4px;border:0;border-radius:18px;cursor:pointer;
  font:700 12px/1.1 var(--font-body);color:var(--mist);background:rgba(255,255,255,.06);box-shadow:inset 0 0 0 1px rgba(255,255,255,.12);
  transition:transform .15s,background-color .15s,color .15s;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.tb-tool svg{width:28px;height:28px}
.tb-tool span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tb-tool:active{transform:scale(.94)}
.tb-tool[aria-pressed="true"]{color:#06122A;background:var(--mint);box-shadow:0 0 22px -6px rgba(92,242,176,.8)}
@media (hover:hover){.tb-tool:hover:not([aria-pressed="true"]){color:var(--snow);background:rgba(255,255,255,.1)}}

/* ---- picking a robot, and the ending card: both cover the lab ---- */
.tb-pick,.tb-end{position:absolute;inset:0;z-index:5;display:grid;place-items:center;padding:12px;background:rgba(6,10,28,.6);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);opacity:0;transition:opacity .25s;overflow:auto}
.tb-pick.is-in,.tb-end.is-in{opacity:1}
.tb-pick__card,.tb-end__card{width:min(760px,100%);padding:clamp(14px,3vw,26px);border-radius:24px;box-sizing:border-box}
.tb-pick__card h2,.tb-end__title{margin:0 0 6px;font:800 clamp(22px,4vw,32px)/1.1 var(--font-display);letter-spacing:-.01em}
.tb-pick__card>p{margin:0 0 14px;color:var(--mist);line-height:1.5}
.tb-pick__list{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px}
.tb-robot{display:grid;justify-items:start;gap:6px;padding:14px;border:0;border-radius:18px;text-align:left;cursor:pointer;color:var(--snow);font:inherit;background:rgba(255,255,255,.06);box-shadow:inset 0 0 0 1px rgba(255,255,255,.12);transition:transform .15s,box-shadow .15s}
.tb-robot:hover{transform:translateY(-2px);box-shadow:inset 0 0 0 2px var(--a)}
.tb-robot[aria-pressed="true"]{box-shadow:inset 0 0 0 2px var(--mint)}
.tb-robot b{font:800 18px/1.1 var(--font-display)}
.tb-robot small{font:600 13px/1.35 var(--font-body);color:var(--mist)}
.tb-robot__face{position:relative;display:flex;align-items:center;justify-content:center;gap:12px;width:74px;height:56px;border-radius:14px;background:var(--c);box-shadow:inset 0 -6px 0 rgba(0,0,0,.12)}
.tb-robot__face::before{content:"";position:absolute;inset:9px 10px;border-radius:9px;background:#060B1C}
.tb-robot__face i{position:relative;width:10px;height:14px;border-radius:4px;background:var(--a);box-shadow:0 0 8px var(--a)}
.tb-robot__face.is-wide{width:92px;height:50px}
.tb-robot__face.is-round{width:62px;height:62px;border-radius:50%}
.tb-robot__face.is-round::before{border-radius:50%;inset:10px}
.tb-robot__face.is-round i{border-radius:50%;width:12px;height:12px}
.tb-robot__face.is-tall{width:60px;height:66px}
.tb-robot__stats{display:flex;align-items:center;gap:8px;width:100%;font:700 11.5px/1 var(--font-body);color:var(--mist)}
.tb-robot__bar{flex:1;height:6px;border-radius:99px;background:rgba(255,255,255,.1);overflow:hidden}
.tb-robot__bar em{display:block;height:100%;background:var(--a);border-radius:99px}
.tb-robot__ends{font:700 12px/1 var(--font-body);color:var(--gold)}
.tb-end__kicker{margin:0 0 4px;font:800 12px/1 var(--font-body);letter-spacing:.14em;text-transform:uppercase;color:var(--gold)}
.tb-end__quote{margin:4px 0 12px;font:700 17px/1.4 var(--font-display);color:var(--snow)}
.tb-end__count{margin:0 0 8px;font:700 14px/1.3 var(--font-body);color:var(--mist)}
.tb-end__list{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.tb-end__chip{padding:6px 10px;border-radius:99px;font:700 12.5px/1 var(--font-body);color:var(--dim);background:rgba(255,255,255,.05);box-shadow:inset 0 0 0 1px rgba(255,255,255,.1)}
.tb-end__chip.is-got{color:#0B1330;background:var(--gold);box-shadow:none}
.tb-end__hint{margin:0 0 14px;color:var(--mist);font-size:14.5px}
.tb-end__acts{display:flex;flex-wrap:wrap;gap:10px}

.tb-stickers{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.tb-sticker{display:grid;justify-items:center;gap:4px;padding:14px 10px;border-radius:16px;text-align:center;background:rgba(255,255,255,.05);box-shadow:inset 0 0 0 1px rgba(255,255,255,.1);opacity:.6}
.tb-sticker.is-got{opacity:1;background:rgba(255,203,107,.1);box-shadow:inset 0 0 0 1px rgba(255,203,107,.4)}
.tb-sticker__badge{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;font:800 24px/1 var(--font-display);color:#0B1330;background:var(--dim)}
.tb-sticker.is-got .tb-sticker__badge{background:var(--gold)}
.tb-sticker b{font:800 15px/1.2 var(--font-display);color:var(--snow)}
.tb-sticker small{font:600 12.5px/1.3 var(--font-body);color:var(--mist)}

/* ================================================================ phones */
@media (max-width:640px){
  .tb{gap:6px;padding:2px max(6px,var(--sar)) max(6px,var(--sab)) max(6px,var(--sal))}
  .tb-stage{border-radius:18px}
  .tb-hud{left:6px;right:6px;top:6px;gap:6px}
  .tb-who{min-width:0;flex:1 1 auto;max-width:none;padding:7px 10px 8px;gap:4px;border-radius:14px}
  .tb-who__row b{font-size:15px}
  .tb-acts{flex-wrap:nowrap;gap:5px}
  .tb-ib{min-width:42px;width:42px;height:42px;padding:0;border-radius:13px}
  .tb-ib span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  #stickers{width:auto;padding:0 9px}
  .tb-bubble{font-size:14px;padding:8px 12px;max-width:72%}
  .tb-pop{font-size:24px}
  .tb-hint{font-size:13px;bottom:8px}
  /* one row of tools, icons only: the hint says which is which */
  .tb-tools{gap:4px;padding:0}
  .tb-tool{min-height:52px;padding:6px 0;gap:0;border-radius:14px}
  .tb-tool span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .tb-tool svg{width:25px;height:25px}
  .tb-pick,.tb-end{padding:8px;place-items:start center}
  .tb-pick__list{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .tb-robot{padding:10px;gap:5px}
  .tb-robot b{font-size:16px}
  .tb-robot small{font-size:12px}
  .tb-robot__face{transform:scale(.85);transform-origin:left center;margin-bottom:-4px}
  .tb-stickers{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:360px){
  .tb-ib{min-width:38px;width:38px;height:38px}
  #stickers b{display:none}
  .tb-who__meta>span:first-child{display:none}
}

/* a phone on its side: the tools go in a column beside the lab */
@media (max-height:520px) and (orientation:landscape){
  .tb{flex-direction:row;padding:2px max(6px,var(--sar)) max(6px,var(--sab)) max(6px,var(--sal));gap:6px}
  .tb-tools{display:grid;grid-template-columns:repeat(2,52px);grid-auto-rows:minmax(0,1fr);align-content:stretch;gap:4px;padding:0}
  .tb-tool{min-height:0;padding:4px 0;gap:0;border-radius:12px}
  .tb-tool span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .tb-tool svg{width:22px;height:22px}
  .tb-hud{left:6px;right:6px;top:6px}
  .tb-who{min-width:0;max-width:40%;padding:6px 10px;gap:3px}
  .tb-who__row b{font-size:14px}
  .tb-ib{min-width:38px;width:38px;height:38px;padding:0}
  .tb-ib span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  #stickers{width:auto;padding:0 8px}
  .tb-bubble{font-size:13px;padding:7px 11px}
  .tb-pick__list{grid-template-columns:repeat(4,minmax(0,1fr))}
  .tb-robot small{display:none}
  /* the picker fits without scrolling: a smaller heading and words, slimmer cards */
  .tb-pick,.tb-end{padding:8px;place-items:start center}
  .tb-pick__card,.tb-end__card{padding:12px 16px}
  .tb-pick__card h2,.tb-end__title{font-size:20px;margin-bottom:4px}
  .tb-pick__card>p{font-size:13px;line-height:1.4;margin-bottom:10px}
  .tb-robot{padding:8px 10px;gap:4px}
  .tb-robot__face{transform:scale(.72);transform-origin:left center;margin:-8px 0 -10px}
  .tb-end__quote{font-size:15px;margin-bottom:8px}
}
