/* Talking to an NPC on a phone: the same box along the foot of the screen as on a computer (js/talk_box.js,
   css/style.css #dialogWindow.talk-box), laid out for a small screen. Owner 2026-11-16: "เรื่องคุยกับเอ็นพีซีแบบ
   ใหม่ด้วยนะ" -> "ทำให้มือถือด้วย".

   Lengths are in HUD px: on a phone #hud is scaled (js/mobile.js setUiScale) and spans the whole screen, so
   per-cent of it is per-cent of the screen. js/ui_window_safety.js places every phone window with an inline
   `inset` and `transform: none`; the box beats those with !important, as the computer's rules already do. */
body.touch #dialogWindow.talk-box {
  left: 50% !important; right: auto !important; top: auto !important; bottom: 8px !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 16px) !important; max-width: 900px !important;
  /* while they talk the rest of the HUD steps aside (body.talking), so the box may take most of the screen */
  height: auto !important; max-height: 82% !important;
  display: flex; flex-direction: column;
}
body.touch.talking #dialogWindow.talk-box { bottom: 8px !important; }
body.touch #dialogWindow.talk-box .win-body {
  grid-template-columns: 92px 1fr !important; grid-template-rows: minmax(0, 1fr) auto;
  gap: 4px 12px; padding: 10px 12px 10px 10px; min-height: 0; flex: 1 1 auto; overflow: hidden;
}
body.touch #dialogWindow.talk-box .tb-face { width: 92px; height: 92px; align-self: end; }
/* the words take what is left of the box and scroll there (the box's grid puts its items at the top, which
   let a long speech run on under the buttons) */
body.touch #dialogWindow.talk-box .dialog-lines {
  align-self: stretch; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
body.touch #dialogWindow.talk-box .tb-name { font-size: 16px; }
body.touch #dialogWindow.talk-box .tb-who { font-size: 12px; }
body.touch #dialogWindow.talk-box .dialog-lines p { font-size: 15px; line-height: 1.5; margin-top: 4px; }
body.touch #dialogWindow.talk-box .dialog-actions { margin-top: 6px; gap: 8px; }
body.touch #dialogWindow.talk-box .dialog-actions button {
  min-height: var(--ui-window-touch-target, 44px); padding: 6px 14px; font-size: 14px;
}
/* standing up: the portrait goes above the words, small, so the text keeps the width */
@media (orientation: portrait) {
  body.touch #dialogWindow.talk-box { max-height: 58% !important; }
  body.touch #dialogWindow.talk-box .win-body {
    grid-template-columns: 64px 1fr !important; grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px 10px;
  }
  body.touch #dialogWindow.talk-box .win-body > .tb-face { grid-column: 1; grid-row: 1 / span 2; width: 64px; height: 64px; align-self: start; border-right: 0; }
  body.touch #dialogWindow.talk-box .win-body > .dialog-lines { grid-column: 2; grid-row: 1 / span 2; }
  body.touch #dialogWindow.talk-box .win-body > .dialog-actions { grid-column: 1 / span 2; grid-row: 3; justify-content: stretch; }
  body.touch #dialogWindow.talk-box .dialog-actions button { flex: 1 1 auto; }
}
