/* WHITEOUT feel: touch controls, tips, dialogue polish, reduce motion.
   html.touchy = a touch screen (js/game.js). html.reduce-motion = settings or OS. */

/* ---------- action buttons ---------- */
#btn-use { transition: opacity 0.15s, background 0.15s; }
#btn-use.idle { opacity: 0.78; color: #555; }
#btn-use:not(.idle) { background: #F2C94C; }
#btn-use:not(.idle):active { background: #34A1E5; }

/* on touch: two big round thumb buttons, use the biggest, log tucked above spark.
   Everything sits in the right half so the left half is all joystick. */
.touchy .keys { display: none; }
.touchy .acts {
  display: grid;
  grid-template-columns: 66px 88px;
  grid-template-areas: "log ." "spark use";
  align-items: end;
  justify-items: center;
  gap: 8px 12px;
}
.touchy .acts button { min-width: 0; padding: 0; touch-action: none; }
.touchy #btn-use { grid-area: use; width: 88px; height: 88px; border-radius: 50%; font-size: 19px; box-shadow: 0 4px 0 #000; }
.touchy #btn-use:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.touchy #btn-spark { grid-area: spark; width: 66px; height: 66px; border-radius: 50%; font-size: 15px; box-shadow: 0 3px 0 #000; }
.touchy #btn-log { grid-area: log; width: 54px; height: 38px; border-radius: 12px; font-size: 13px; }
.touchy #hint { bottom: calc(150px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); font-size: 13px; }
.touchy #menu button b { display: none; }

/* phone portrait: the line chip lives above the buttons and clear of the menu rail */
@media (max-width: 760px) {
  #line {
    left: 10px; right: 70px; transform: none; margin: 0 auto;
    width: max-content; max-width: calc(100vw - 80px);
    bottom: calc(196px + env(safe-area-inset-bottom));
    font-size: 14px; line-height: 1.32; padding: 7px 11px;
  }
}

/* phones on their side: rail goes two-wide, chips shrink, nothing runs off the bottom */
@media (max-height: 500px) {
  .brand h1, #score, .chitbox #chits { font-size: 17px; }
  #place { font-size: 11px; margin-top: 2px; }
  .chip { padding: 5px 9px; border-radius: 12px; }
  #hud { padding-top: calc(8px + env(safe-area-inset-top)); }
  #quest { top: calc(58px + env(safe-area-inset-top)); font-size: 11px; padding: 4px 10px; }
  .netchip { top: calc(58px + env(safe-area-inset-top)); right: 8px; padding: 3px 9px; font-size: 12px; }
  #menu {
    top: calc(98px + env(safe-area-inset-top)); right: 8px;
    display: grid; grid-template-columns: repeat(2, 50px); gap: 5px;
  }
  #menu button { width: 50px; height: 34px; font-size: 11px; border-radius: 11px; }
  #menu button b { display: none; }
  .keys { display: none; }
  /* the line sits right of the left chip/tip column and left of the rail */
  #line {
    top: auto; left: 40vw; right: 124px; transform: none; margin: 0 auto;
    width: max-content; max-width: calc(60vw - 124px);
    bottom: calc(138px + env(safe-area-inset-bottom));
    font-size: 13px; padding: 6px 10px;
  }
  #hint { bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 50vw; }
  .touchy #hint { bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 46vw; }
  /* one row (log, spark, use): nothing stacks up into the two-wide rail */
  .touchy .acts { grid-template-columns: 50px 58px 76px; grid-template-areas: "log spark use"; gap: 8px; }
  .touchy #btn-use { width: 76px; height: 76px; font-size: 17px; }
  .touchy #btn-spark { width: 58px; height: 58px; }
  .touchy #btn-log { width: 50px; height: 32px; }
  #pad { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .overlay.bottom .card { margin-bottom: calc(96px + env(safe-area-inset-bottom)); padding: 12px 16px; }
  #dlg-text { min-height: 0; font-size: 15px; }
}

/* ---------- dialogue: tap anywhere to go on ---------- */
#dlg { pointer-events: auto; cursor: pointer; }
#dlg .card { user-select: none; -webkit-user-select: none; }
.dlg-next { opacity: 0.3; transition: opacity 0.12s; }
#dlg.dlg-done .dlg-next { opacity: 1; animation: dlg-nudge 0.9s ease-in-out infinite; }
@keyframes dlg-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
.touchy #dlg .dlg-next { font-size: 0 !important; }
.touchy #dlg .dlg-next::after { content: "tap ▸"; font-size: 13px; }
.touchy .overlay.bottom .card { margin-bottom: calc(126px + env(safe-area-inset-bottom)); }

/* ---------- tips ---------- */
.feel-tip {
  position: fixed; left: 14px; top: calc(168px + env(safe-area-inset-top)); /* under the quest + task chips */
  max-width: min(340px, calc(100vw - 92px));
  display: flex; gap: 8px; align-items: flex-start;
  background: #FFFFFF; border: 3px solid #000; border-radius: 14px;
  padding: 8px 10px 8px 8px; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
  z-index: 6; cursor: pointer; touch-action: none;
  transform: translateX(-120%); opacity: 0;
  transition: transform 0.35s cubic-bezier(.2, 1.3, .4, 1), opacity 0.2s;
  pointer-events: none;
}
.feel-tip.show { transform: translateX(0); opacity: 1; pointer-events: auto; }
.feel-tip b { flex: none; font: 700 10px "Cooper Hewitt", sans-serif; background: #34A1E5; color: #000; border: 2px solid #000; border-radius: 999px; padding: 1px 7px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 1px; }
.feel-tip span { font-size: 13px; line-height: 1.35; }
.feel-tip i { flex: none; font-style: normal; font: 700 16px "Cooper Hewitt", sans-serif; line-height: 1; color: #003FBA; padding: 0 2px; }
@media (max-width: 760px) {
  .feel-tip { top: calc(184px + env(safe-area-inset-top)); left: 8px; max-width: calc(100vw - 76px); }
}
@media (max-height: 500px) {
  .feel-tip { top: calc(156px + env(safe-area-inset-top)); max-width: min(320px, calc(40vw - 22px)); }
}
body.titled .feel-tip, body.in-arcade .feel-tip { visibility: hidden; }

/* ---------- reduce motion ---------- */
.reduce-motion .logo,
.reduce-motion .chitbox.bump,
.reduce-motion #menu .phone-btn.ringing,
.reduce-motion #dlg.dlg-done .dlg-next { animation: none !important; }
.reduce-motion .stamp-toast,
.reduce-motion .feel-tip,
.reduce-motion .title-screen { transition: none !important; }
