/* Mobile form & layout pass (site-wide, loaded after hotspoken.css).
   Goals at 360-414px: labels and help text stack cleanly, checkbox/radio
   labels use a hanging indent so wrapped text lines up with the first line
   (never slides under the box), no horizontal page overflow, >=44px taps. */

/* Checkbox / radio + text in one label: hanging indent keeps every wrapped
   line aligned after the box, works with inline links/strong inside. */
label:has(> input[type=checkbox]:first-child),label:has(> input[type=radio]:first-child){display:block;padding-inline-start:1.9em;text-indent:-1.9em;margin-block:.35rem}
label:has(> input[type=checkbox]:first-child) > input,label:has(> input[type=radio]:first-child) > input{margin:0 .6em 0 0;margin-inline:0 .6em;text-indent:0}
label:has(> input[type=checkbox]:first-child) > *:not(input),label:has(> input[type=radio]:first-child) > *:not(input){text-indent:0}
/* chips and toggles keep their own compact layout */
.chip:has(input),.radio-chips label,.sens-switch label{padding-inline-start:revert;text-indent:0}

/* Nothing may push the page sideways. */
html,body{overflow-x:clip}
img,video,canvas,svg,iframe,audio{max-width:100%}
pre,code{overflow-wrap:anywhere}


@media (max-width:640px){
 /* Text inputs fill the row; the help text that follows starts on its own line. */
 input[type=text],input[type=email],input[type=password],input[type=number]:not([size]),input[type=url],input[type=search],input[type=tel],input:not([type]),select,textarea{width:100%;min-height:44px;font-size:16px}
 label > input[type=text],label > input[type=email],label > input[type=url],label > input[type=password],label > select,label > textarea{display:block;margin-top:.25rem}
 input:not([type=checkbox]):not([type=radio]):not([type=range]) + small,select + small,textarea + small,input + .help,select + .help,.helptext{display:block;margin-top:.25rem;line-height:1.45}
 /* Tap targets */
 button,.btn,input[type=submit]{min-height:44px}
 button.plain,.btn.plain,button.linklike{min-height:44px;padding-inline:var(--s1)}
 input[type=checkbox],input[type=radio]{width:22px;height:22px}
 label:has(> input[type=checkbox]:first-child),label:has(> input[type=radio]:first-child){padding-block:.55rem;padding-inline-start:2.1em;text-indent:-2.1em}
 /* Forms: one column, actions wrap with a gap instead of orphan fragments */
 form p{overflow-wrap:anywhere}
 form .row,form .actions,.form-actions{display:flex;flex-wrap:wrap;gap:var(--s1)}
 /* Data tables scroll inside themselves instead of widening the page */
 main table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
 main th.num,main td.num,main td code{white-space:nowrap}
 main th,main td{min-width:6em}
 .builder{display:flex!important;flex-direction:column}.builder>*{width:100%;min-width:0}
 details,summary{max-width:100%}
 summary{overflow-wrap:anywhere}
 .flame-picker,.fp-sliders{max-width:100%}
 .fp-sliders label{display:flex;align-items:center;gap:.5rem}.fp-sliders input[type=range]{flex:1;min-width:0}
}
/* Hashtag chips + small self-explaining bits (tag_chips.js, ux_bits.js) */
.chipbox{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem;width:100%;box-sizing:border-box;min-height:44px;padding:.3rem .45rem;border:1px solid var(--line,#ccc);border-radius:10px;background:var(--bg,#fff);cursor:text}
.chipbox:focus-within{outline:2px solid var(--accent,#e4572e);outline-offset:1px}
.chiplist{display:contents}
.tagchip{display:inline-flex;align-items:center;gap:.15rem;padding:.15rem .2rem .15rem .6rem;border-radius:999px;background:var(--accent,#e4572e);color:#fff;font-size:var(--t-sm,.9rem);line-height:1.6;animation:chipin .15s ease-out}
.tagchip.auto{background:var(--tint0,#fde6de);color:var(--ink,#222);border:1px dashed var(--accent,#e4572e)}
.tagchip-x{border:0;background:none;color:inherit;min-height:28px;min-width:28px;padding:0;font-size:.8rem;cursor:pointer;opacity:.8}
.chipbox.armed .tagchip:last-of-type{outline:2px solid var(--err-ink,#b00020);opacity:.75}
.chip-typer{flex:1 1 6rem;min-width:6rem;border:0!important;outline:0;background:transparent!important;padding:.3rem 0!important;margin:0;width:auto!important;box-shadow:none!important}
.chipbox.full .chip-typer{display:none}
.chipbox.shake{animation:chipshake .3s}
.char-count{display:block;text-align:end}.char-count.over{color:var(--err-ink,#b00020);font-weight:600}
textarea{field-sizing:content;min-height:4.5em;max-height:70vh}
@keyframes chipin{from{transform:scale(.6);opacity:0}}
@keyframes chipshake{25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
@media (prefers-reduced-motion:reduce){.tagchip,.chipbox.shake{animation:none}}
.chip-typer:focus,.chip-typer:focus-visible{outline:none!important;box-shadow:none!important}.chipbox.has-tags .chip-typer::placeholder{color:transparent}
.state-line{display:block;font-size:var(--t-sm,.9rem);color:var(--ink-2,#555);margin:.15rem 0 .4rem}.state-line.on{color:var(--accent,#e4572e);font-weight:600}
