/* Lane 80: controls screen, play-mode choice and first-session tip polish. Original styling; no input is ever blocked by tips. */
.msh-controls-screen { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; gap: 8px; padding: 0 0 12px; box-sizing: border-box; background: rgba(var(--msh-info-bg-rgb), 0.95); color: var(--msh-text-hi); border: 1px solid var(--msh-info-border); border-radius: 8px; font: 13px/1.4 system-ui, sans-serif; z-index: 10500; }
.msh-controls-screen[hidden] { display: none; }
.msh-controls-intro, .msh-controls-tips { margin: 0 14px; }
.msh-controls-scroll { margin: 0 14px; overflow: auto; min-height: 0; flex: 1 1 auto; border-top: 1px solid rgba(var(--msh-white-rgb), 0.13); }
.msh-controls-table { width: 100%; border-collapse: collapse; }
.msh-controls-table th { text-align: left; white-space: nowrap; padding: 3px 12px 3px 0; color: var(--msh-text-gold); font-weight: 700; vertical-align: top; }
.msh-controls-table td { padding: 3px 0; color: var(--msh-text-hi); }
.msh-controls-table tr:nth-child(even) { background: rgba(var(--msh-white-rgb), 0.04); }
.msh-controls-close { align-self: flex-end; margin: 0 14px; min-width: 88px; min-height: 36px; border-radius: 6px; border: 1px solid var(--msh-text-dim); background: linear-gradient(var(--msh-border-dim), var(--msh-bg-2)); color: var(--msh-text-hi); font: 700 13px system-ui; cursor: pointer; }
.msh-controls-more { margin-top: 6px; min-height: 28px; border-radius: 6px; border: 1px solid var(--msh-text-dim); background: linear-gradient(var(--msh-border-dim), var(--msh-bg-2)); color: var(--msh-text-hi); font: 700 12px system-ui; cursor: pointer; }
@media (pointer: coarse) { .msh-controls-close, .msh-controls-more { min-height: 44px; } }
/* Play solo / play online choice on the hero-create screen. */
.msh-playmode { display: flex; gap: 8px; flex-wrap: wrap; }
.msh-playmode-btn { flex: 1 1 120px; min-height: 44px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--msh-text-dim); background: linear-gradient(var(--msh-border-dim), var(--msh-bg-2)); color: var(--msh-text-hi); font: 700 13px system-ui; cursor: pointer; }
.msh-playmode-btn.msh-selected { border-color: var(--msh-text-gold); box-shadow: 0 0 0 2px rgba(var(--msh-text-gold-rgb), 0.4) inset; }
.msh-playmode-note { margin: 4px 0 0; font-size: 12px; color: var(--msh-slate-lt); }
/* First-session tip: readable, never in the way of clicks outside its Dismiss button. */
#tutorial-hint { max-width: min(320px, calc(100vw - 32px)); padding: 8px 10px; background: rgba(var(--msh-info-bg-rgb), 0.94); color: var(--msh-text-hi); border: 1px solid var(--msh-text-gold); border-radius: 8px; font: 600 13px/1.4 system-ui, sans-serif; z-index: 44; }
#tutorial-hint button { margin-left: 8px; min-height: 24px; }
#msh-load-tip { max-width: 100%; }
/* Lane 116: "what next" line under the quest tracker, skippable intro card, quick help. Nothing here blocks the world; only buttons take clicks. */
#ftue-next { position: fixed; top: 260px; right: 8px; width: 280px; box-sizing: border-box; z-index: 44; pointer-events: none; display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; background: rgba(var(--msh-info-bg-rgb), 0.85); color: var(--msh-text-hi); border: 1px solid var(--msh-parchment-2); border-radius: 8px; font: 600 12px/1.35 system-ui, sans-serif; text-shadow: 0 1px 2px var(--msh-black); }
#ftue-next[hidden] { display: none; }
#ftue-next .ftue-next-body { flex: 1 1 auto; }
#ftue-next .ftue-next-quest { display: block; margin-bottom: 3px; color: var(--msh-text-gold); }
#ftue-next .ftue-next-quest[hidden], #ftue-next .ftue-next-text[hidden] { display: none; }
#ftue-next button { pointer-events: auto; flex: 0 0 auto; min-width: 24px; min-height: 24px; border-radius: 4px; border: 1px solid var(--msh-text-dim); background: linear-gradient(var(--msh-border-dim), var(--msh-bg-2)); color: var(--msh-text-hi); font: 700 11px system-ui; cursor: pointer; }
#ftue-next #ftue-skip-btn[hidden] { display: none; }
#tutorial-hint { margin-top: 74px; }
#ftue-intro { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(360px, calc(100vw - 24px)); box-sizing: border-box; z-index: 44; pointer-events: none; padding: 10px 12px; background: rgba(var(--msh-info-bg-rgb), 0.95); color: var(--msh-text-hi); border: 1px solid var(--msh-text-gold); border-radius: 10px; font: 13px/1.4 system-ui, sans-serif; }
#ftue-intro[hidden] { display: none; }
#ftue-intro p { margin: 4px 0 8px; }
#ftue-intro button { pointer-events: auto; min-height: 32px; margin-right: 8px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--msh-text-dim); background: linear-gradient(var(--msh-border-dim), var(--msh-bg-2)); color: var(--msh-text-hi); font: 700 13px system-ui; cursor: pointer; }
.ftue-help { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; box-sizing: border-box; padding: 10px 14px 14px; background: rgba(var(--msh-info-bg-rgb), 0.95); color: var(--msh-text-hi); border: 1px solid var(--msh-info-border); border-radius: 8px; font: 13px/1.4 system-ui, sans-serif; z-index: 10400; }
.ftue-help[hidden] { display: none; }
.ftue-help h3 { margin: 10px 0 4px; color: var(--msh-text-gold); font-size: 13px; }
.ftue-help-table { width: 100%; border-collapse: collapse; }
.ftue-help-table th { text-align: left; white-space: nowrap; padding: 2px 12px 2px 0; color: var(--msh-text-gold); vertical-align: top; }
.ftue-help-table td { padding: 2px 0; color: var(--msh-text-hi); }
.ftue-help button { margin: 10px 8px 0 0; min-height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--msh-text-dim); background: linear-gradient(var(--msh-border-dim), var(--msh-bg-2)); color: var(--msh-text-hi); font: 700 12px system-ui; cursor: pointer; }
@media (max-width: 700px), (pointer: coarse) { #ftue-next { font-size: 10px; padding: 3px 5px; } #ftue-next button, #ftue-intro button, .ftue-help button { min-height: 40px; } #tutorial-hint { margin-top: 56px; } #ftue-intro { bottom: 150px; } }

/* Lane 226: on phones and tablets the first-run intro and the "what next" line sit at the bottom of the free area (above the zoom row / joystick, measured by js/ui-kit.js measureSheet),
   never over the joystick, micro menu or context buttons; while the intro shows it replaces the next line. Buttons are 44 px. */
@media (pointer: coarse), (max-width: 767px) {
  html body #ftue-intro, html body #ftue-next { top: auto !important; bottom: var(--msh-sheet-bottom, 96px) !important; left: var(--msh-sheet-left, 8px) !important; right: auto !important; transform: none !important;
    width: min(300px, calc(100vw - var(--msh-sheet-left, 8px) - 150px)) !important; max-height: 40vh; overflow-y: auto; }
  html body:has(#ftue-intro) #ftue-next { display: none !important; }
  html body #ftue-intro button, html body #ftue-next button, html body .ftue-help button { min-height: 44px !important; min-width: 44px !important; }
}
@media (orientation: landscape) and (max-height: 520px) { html body #ftue-intro, html body #ftue-next { left: max(var(--msh-sheet-left, 8px), 124px) !important; } } /* right of the joystick even before the first measure */
/* Lane 226: on desktops the intro clears the action bar at any screen size (the measured bar height, js/ui-kit.js measureBar) instead of a fixed 96 px. */
@media (pointer: fine) and (min-width: 768px) { html body #ftue-intro { bottom: max(calc(var(--msh-bar-clear, 96px) + 8px), calc(96px + 6vh)) !important; } }
/* Lane 259 (on lane 226's placement): the free-area bottom the Next line anchors to still holds the chat box on a portrait phone and the touch action row on a tablet,
   so the line sits above them (chat panel 80 px, action row 56 px + gap) instead of over the chat input / action buttons. */
@media (pointer: coarse) and (orientation: portrait) and (max-width: 767px) { html body #ftue-next { bottom: calc(var(--msh-sheet-bottom, 96px) + 84px) !important; width: calc(100vw - 212px) !important; } }   /* left of the 188 px phone tracker */
@media (pointer: coarse) and (min-width: 768px) { html body #ftue-next { bottom: calc(var(--msh-sheet-bottom, 96px) + 64px) !important; } }

/* Lane 295: touch first-session placement. The hint toast leaves the joystick / action buttons for the free band under the minimap row and its Dismiss button is 44 px;
   the intro card and the Next line sit above the chat panel (measured by js/onboarding.js into --ftue-lift) instead of over its input. */
@media (pointer: coarse) {
  html body #tutorial-hint { position: fixed !important; left: 8px !important; right: auto !important; top: 128px !important; margin-top: 0 !important; width: min(260px, calc(100vw - 150px)) !important; max-width: none; box-sizing: border-box; }
  html body #tutorial-hint button { min-height: 44px; min-width: 44px; margin: 4px 0 0; display: block; }
}
@media (pointer: coarse) and (orientation: portrait) and (max-width: 767px) { html body #ftue-intro { bottom: var(--ftue-lift, calc(var(--msh-sheet-bottom, 96px) + 84px)) !important; width: calc(100vw - 212px) !important; } html body #ftue-next { bottom: var(--ftue-lift, calc(var(--msh-sheet-bottom, 96px) + 84px)) !important; } }
/* Phone portrait: the hint toast stacks directly above the intro card / Next line (their height measured into --ftue-card-h), left of the tracker, so none of the three overlap. */
@media (pointer: coarse) and (orientation: portrait) and (max-width: 767px) { html body #tutorial-hint { top: auto !important; bottom: calc(var(--ftue-lift, calc(var(--msh-sheet-bottom, 96px) + 84px)) + var(--ftue-card-h, 0px) + 8px) !important; width: calc(100vw - 212px) !important; } }
@media (pointer: coarse) and (min-width: 768px) { html body #ftue-next, html body #ftue-intro { bottom: var(--ftue-lift, calc(var(--msh-sheet-bottom, 96px) + 64px)) !important; } }

/* Lane 438: landscape phone (844x390). The welcome/tip card is a compact strip under the player frame (text left, 44 px Dismiss on its right edge) instead of a 260x120 box
   that covered a third of the free screen; the Next line and the touch action row (css/touchcontrols.css) no longer sit under it. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body #tutorial-hint { top: 76px !important; width: min(300px, calc(100vw - 316px)) !important; min-height: 52px; padding: 4px 56px 4px 8px; font-size: 11px; line-height: 1.3; max-height: 64px; overflow: hidden; }
  html body #tutorial-hint button { position: absolute; right: 4px; top: 4px; margin: 0 !important; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body #ftue-intro { display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "text go skip"; align-items: center; column-gap: 8px; width: min(430px, calc(100vw - 340px)) !important; padding: 5px 8px !important; font-size: 11px; line-height: 1.3; max-height: none; overflow: visible; }
  html body #ftue-intro[hidden] { display: none !important; }
  html body #ftue-intro strong { display: none; } /* the card keeps its aria-label; the text line carries the message */
  html body #ftue-intro p { grid-area: text; margin: 0 !important; }
  html body #ftue-intro .ftue-intro-go { grid-area: go; margin: 0 !important; padding: 0 10px !important; }
  html body #ftue-intro .ftue-intro-skip { grid-area: skip; margin: 0 !important; padding: 0 10px !important; }
}
