/* input.css - what keyboard and controller players see: a focus ring that is always there, a question highlight that
   pops, and the "controller connected" toast. Purely additive: nothing here renames or removes an existing class.
   Load after css/adventure.css. js/input.js sets html[data-input="kbd"|"pad"|"pointer"] from the last device used. */

:root{--mq-ring:#17B0A6;--mq-ring-in:#fff}

/* ---------- focus ring ----------
   :focus-visible is unreliable for focus that script moves after a mouse click (a pad never produces a key event),
   so the ring keys off the last device used instead. The white inner ring keeps it readable on teal and green
   buttons. It is drawn with box-shadow so it stays rounded in every Safari; the outline is the 4px teal ring
   (and what forced-colors mode shows). #app is excluded: the game container takes focus after a pause. */
html[data-input="kbd"] :focus:not(#app),
html[data-input="pad"] :focus:not(#app){
  outline:4px solid var(--mq-ring);
  outline-offset:3px;
  box-shadow:0 0 0 3px var(--mq-ring-in),var(--mq-lip,0 0 0 0 transparent);
}

/* Each button family keeps its 3D lip while focused. Keep these in step with css/adventure.css. */
.btn{--mq-lip:0 4px 0 var(--action-dk)}
.btn.play{--mq-lip:0 4px 0 var(--green-dk)}
.btn.ghost{--mq-lip:0 4px 0 #d3dcc3}
.adventure-button{--mq-lip:0 4px 0 #cd9a36,0 7px 15px #a8873130}
.play-button{--mq-lip:0 9px 0 #C97C00,0 20px 34px #0a4f7a44}
.pill-button{--mq-lip:0 4px 0 #9fd0e6,0 8px 18px #0a4f7a30}
.welcome .round-button{--mq-lip:0 4px 0 #9fd0e6,0 8px 18px #0a4f7a30}
.choice:nth-child(1){--mq-lip:0 5px 0 #2d6986}
.choice:nth-child(2){--mq-lip:0 5px 0 #447e57}
.choice:nth-child(3){--mq-lip:0 5px 0 #745b90}
#gobtn{--mq-lip:0 6px 0 var(--action-dk)}
#hudright .iconbtn{--mq-lip:0 4px 15px #20453912}

/* a small lift on the big buttons */
html[data-input="kbd"] .btn:focus:not(#app):not(:active),
html[data-input="pad"] .btn:focus:not(#app):not(:active),
html[data-input="kbd"] .adventure-button:focus:not(#app):not(:active),
html[data-input="pad"] .adventure-button:focus:not(#app):not(:active),
html[data-input="kbd"] .play-button:focus:not(#app):not(:active),
html[data-input="pad"] .play-button:focus:not(#app):not(:active),
html[data-input="kbd"] .pill-button:focus:not(#app):not(:active),
html[data-input="pad"] .pill-button:focus:not(#app):not(:active){
  transform:translateY(-2px) scale(1.03);
}

/* ---------- the highlighted answer ----------
   nav.js puts .kbd-focus (plus real focus) on one answer; it follows Left / Right. Hidden for touch and mouse players. */
html[data-input="kbd"] .kbd-focus:not(#app),
html[data-input="pad"] .kbd-focus:not(#app){
  position:relative;
  z-index:1;
  outline:4px solid var(--mq-ring);
  outline-offset:3px;
  box-shadow:0 0 0 3px var(--mq-ring-in),var(--mq-lip,0 0 0 0 transparent),0 0 26px 10px rgba(23,176,166,.55);
}
html[data-input="kbd"] .kbd-focus:not(#app):not(:active),
html[data-input="pad"] .kbd-focus:not(#app):not(:active){
  transform:translateY(-3px) scale(1.07);
}

/* ---------- controller toast (created by nav.js) ---------- */
.mq-toast{
  position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom));z-index:60;
  box-sizing:border-box;max-width:min(92vw,460px);padding:11px 20px;
  border-radius:99px;border:2px solid #17B0A6;background:#173A43;color:#fff;
  box-shadow:0 10px 28px rgba(23,58,67,.35);
  font:800 15px/1.3 var(--display,system-ui,sans-serif);text-align:center;
  opacity:0;pointer-events:none;                   /* not visibility:hidden: that would drop the aria-live region */
  transform:translate(-50%,10px);
  transition:opacity .25s,transform .25s;
}
.mq-toast.show{opacity:1;transform:translate(-50%,0)}
@media (max-width:600px){.mq-toast{bottom:calc(84px + env(safe-area-inset-bottom))}}   /* clear of the phone tab bar */

@media (prefers-reduced-motion:reduce){
  html[data-input] .btn:focus:not(#app),
  html[data-input] .adventure-button:focus:not(#app),
  html[data-input] .play-button:focus:not(#app),
  html[data-input] .pill-button:focus:not(#app),
  html[data-input] .kbd-focus:not(#app):not(:active){transform:none}
  .mq-toast{transition:none;transform:translate(-50%,0)}
}

@media (forced-colors:active){
  html[data-input="kbd"] :focus:not(#app),
  html[data-input="pad"] :focus:not(#app),
  html[data-input="kbd"] .kbd-focus:not(#app),
  html[data-input="pad"] .kbd-focus:not(#app){outline-color:Highlight}
}
