/* Shared warm Tiny Home surfaces; the settings panel fills the phone host. */
.thos-root {
    --thos-paper: var(--thg-surface, #fbf8f2); --thos-surface: var(--thg-selection, #fffdf9);
    --thos-ink: var(--thg-text, #54483f); --thos-muted: var(--thg-text-muted, #786b61);
    --thos-line: var(--thg-border, #e6dcd1); --thos-accent: var(--thg-text-muted, #786659);
    --thos-focus: var(--thg-focus, #8b513b); --thos-radius: 18px; --thos-space: 20px;
    --thos-motion: 280ms;
    position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
    min-width: 0; min-height: 0; overflow: hidden; isolation: isolate;
    background: var(--thos-paper); color: var(--thos-ink);
    font-family: var(--app-font-family, sans-serif); font-size: 14px; line-height: 1.6;
    touch-action: pan-y; transform: translateX(0); transition: transform var(--thos-motion) cubic-bezier(.22,.68,.2,1), opacity var(--thos-motion) ease;
}
@starting-style { .thos-root { transform: translateX(100%); opacity: .6; } }
.thos-root[data-closing="true"] { transform: translateX(100%); opacity: .6; pointer-events: none; }
.thos-root *, .thos-root *::before, .thos-root *::after { box-sizing: border-box; }
.thos-root, .thos-root * { scrollbar-width: none; -ms-overflow-style: none; scrollbar-gutter: auto; }
.thos-root::-webkit-scrollbar, .thos-root *::-webkit-scrollbar { display: none; width: 0; height: 0; }
.thos-root [hidden] { display: none !important; }
.thos-header {
    display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 8px;
    flex: 0 0 auto; padding: calc(12px + max(var(--thg-safe-area-top, env(safe-area-inset-top,0px)),var(--thg-viewport-inset-top,0px))) var(--thos-space) 12px;
    border-bottom: 1px solid var(--thos-line);
}
.thos-title { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: .04em; text-align: center; overflow-wrap: anywhere; }
.thos-back { width: 44px; height: 44px; border: 0; border-radius: 50%; padding: 0 0 4px; background: var(--thos-surface); color: var(--thos-ink); font: 32px/1 sans-serif; }
.thos-content { flex: 1 1 0; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 24px max(var(--thos-space),var(--thg-safe-area-right,0px)) calc(24px + max(var(--thg-safe-area-bottom,env(safe-area-inset-bottom,0px)),var(--thg-viewport-inset-bottom,0px))) max(var(--thos-space),var(--thg-safe-area-left,0px)); }
.thos-intro { margin: 0 0 28px; color: var(--thos-muted); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.thos-menu { display: grid; gap: 0; overflow: hidden; border: 1px solid var(--thos-line); border-radius: var(--thos-radius); background: var(--thos-surface); }
.thos-menu-item { display: flex; width: 100%; min-height: 90px; gap: 20px; align-items: center; justify-content: space-between; padding: 20px; border: 0; background: transparent; color: var(--thos-ink); text-align: left; font: inherit; }
.thos-menu-item + .thos-menu-item { border-top: 1px solid var(--thos-line); }
.thos-menu-text { display: grid; gap: 6px; min-width: 0; }
.thos-menu-title { font-size: 17px; font-weight: 600; }
.thos-menu-note { color: var(--thos-muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.thos-chevron { flex: 0 0 auto; color: var(--thos-muted); font-size: 24px; }
.thos-choices { min-width: 0; margin: 0 0 28px; padding: 0; border: 0; }
.thos-legend { width: 100%; margin-bottom: 12px; padding: 0; color: var(--thos-ink); font-size: 17px; font-weight: 600; }
.thos-choice { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 16px 4px; border-bottom: 1px solid var(--thos-line); cursor: pointer; }
.thos-checkbox { flex: 0 0 22px; width: 22px; height: 22px; margin: 0; accent-color: var(--thos-accent); cursor: pointer; }
.thos-choice-text { display: grid; gap: 4px; min-width: 0; }
.thos-choice-name { font-size: 15px; font-weight: 500; }
.thos-choice-group { border-bottom: 1px solid var(--thos-line); }
.thos-choice-group > .thos-choice { border-bottom: 0; }
.thos-suboptions { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,136px),1fr)); gap: 8px; padding: 0 4px 16px 40px; }
.thos-suboption { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--thos-line); border-radius: 10px; background: var(--thos-surface); cursor: pointer; }
.thos-radio { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--thos-accent); cursor: pointer; }
.thos-suboption-name { min-width: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.thos-suboption:has(input:checked) { border-color: var(--thos-accent); background: var(--thg-tool-selected,#e7d9c7); }
/* Keep both action groups at the top, leaving the lower workspace for future frames and previews. */
.thos-root[data-page="motion"] .thos-intro { margin-bottom: 20px; }
.thos-choices--actions { margin-bottom: 20px; }
.thos-choices--actions .thos-legend { margin-bottom: 10px; font-size: 15px; }
.thos-choice-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.thos-choice-grid .thos-choice { min-width: 0; min-height: 64px; flex-direction: column; justify-content: center; gap: 7px; padding: 8px 2px; border: 1px solid var(--thos-line); border-radius: 10px; text-align: center; }
.thos-choice-grid .thos-checkbox { flex: 0 0 18px; width: 18px; height: 18px; }
.thos-choice-grid .thos-choice-text { width: 100%; }
.thos-choice-grid .thos-choice-name { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.thos-choice-grid .thos-choice:has(input:checked) { border-color: var(--thos-accent); background: var(--thg-tool-selected,#e7d9c7); }
.thos-choice-grid .thos-choice:has(input:focus-visible) { outline: 2px solid var(--thos-focus); outline-offset: 2px; }
.thos-pair-styles { min-width: 0; }
.thos-pair-style { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.thos-pair-legend { margin: 0 0 8px; padding: 0; font-size: 12px; color: var(--thos-muted); }
.thos-pair-options { display: flex; flex-wrap: wrap; gap: 7px; }
.thos-pair-options .thos-suboption { flex: 1 1 68px; justify-content: center; gap: 6px; padding: 8px; }
.thos-pair-options .thos-suboption-name { font-size: 12px; }
.thos-pair-style > .thos-choice-note { margin: 8px 0 0; }
.thos-root[data-page="motion"] .thos-footnote { padding-top: 0; }
.thos-choice-note, .thos-footnote { color: var(--thos-muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.thos-footnote { margin: 0; padding-top: 4px; }
.thos-mixer { min-width: 0; margin: 0 0 28px; }
.thos-mixer > .thos-choice-note { margin: 0 0 16px; }
.thos-volume { display: grid; gap: 4px; min-width: 0; margin-top: 12px; }
.thos-volume-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.thos-volume-value { min-width: 4ch; color: var(--thos-muted); text-align: right; font-variant-numeric: tabular-nums; }
.thos-volume-input { display: block; width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--thos-accent); cursor: pointer; touch-action: pan-y; }
.thos-audio-status { margin-top: 12px; }
.thos-footer { flex: 0 0 auto; padding: 12px var(--thos-space) calc(12px + max(var(--thg-safe-area-bottom,env(safe-area-inset-bottom,0px)),var(--thg-viewport-inset-bottom,0px))); border-top: 1px solid var(--thos-line); background: var(--thos-paper); }
.thos-status { min-height: 22px; margin: 0; font-size: 12px; color: var(--thos-muted); overflow-wrap: anywhere; }
.thos-status[data-state="error"], .tho-api-status[data-state="error"] { color: var(--thg-danger, #a23d30); }
.thos-retry { min-height: 44px; margin-top: 8px; padding: 8px 16px; border: 1px solid var(--thos-line); border-radius: 12px; background: var(--thos-surface); color: var(--thos-ink); font: inherit; }
.thos-root button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.thos-root :is(button,input,select,textarea):focus-visible { outline: 2px solid var(--thos-focus); outline-offset: 3px; }
.thos-content:focus-visible { outline: 2px solid var(--thos-focus); outline-offset: -3px; }
.thos-root button:active { opacity: .75; }
.thos-root :disabled { cursor: default; opacity: .55; }
.thos-choice:has(input:checked) .thos-choice-name { color: var(--thos-accent); }
.tho-api-settings { min-width: 0; }
.tho-api-settings [hidden] { display: none !important; }
.tho-api-note { color: var(--thos-muted); margin: 0 0 24px; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.tho-api-section { min-width: 0; padding: 0 0 28px; margin: 0 0 24px; border: 0; border-bottom: 1px solid var(--thos-line); }
.tho-api-section:last-of-type { margin-bottom: 12px; border-bottom: 0; }
.tho-api-title { font-size: 17px; font-weight: 600; margin: 0 0 16px; }
.tho-api-field { display: grid; gap: 8px; min-width: 0; margin-bottom: 16px; }
.tho-api-label { font-size: 13px; color: var(--thos-muted); }
.tho-api-select { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 48px; border: 1px solid var(--thos-line); border-radius: 12px; background: var(--thos-surface); color: var(--thos-ink); padding: 10px 12px; font: inherit; text-overflow: ellipsis; }
.tho-api-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; min-width: 0; margin-bottom: 16px; }
.tho-api-row .tho-api-field { margin: 0; }
.thos-root .tho-api-row .tho-api-select, .thos-root .tho-api-row .tho-api-button { height: 48px; min-height: 48px; margin: 0; padding-block: 8px; line-height: 1.4; }
.thos-root .tho-api-row .tho-api-button { min-width: 88px; padding-inline: 12px; white-space: nowrap; }
.tho-api-button { min-height: 46px; max-width: 100%; border: 1px solid var(--thos-line); border-radius: 12px; padding: 10px 16px; background: var(--thos-surface); color: var(--thos-ink); font: inherit; overflow-wrap: anywhere; }
.thos-root .tho-api-button--primary { width: 100%; color: var(--thg-action-text,#fffdf9); background: var(--thos-accent); border-color: var(--thos-accent); font-weight: 600; }
.tho-api-status { min-height: 24px; margin: 16px 0 0; color: var(--thos-muted); font-size: 12px; overflow-wrap: anywhere; }
@media (hover:hover) { .thos-menu-item:hover,.thos-back:hover,.thos-retry:hover,.tho-api-button:not(:disabled):hover { background: var(--thg-hover,#f0e8df); } .thos-root .tho-api-button--primary:not(:disabled):hover { background: var(--thg-action-hover,#7e513f); } .thos-choice-grid .thos-choice:has(input:not(:disabled)):hover { border-color: var(--thos-accent); } .thos-suboption:has(input:not(:disabled)):hover { border-color: var(--thos-accent); } }
@media (max-width:320px) { .thos-root { --thos-space: 14px; } .thos-menu-item { padding: 16px; gap: 12px; } }
@media (max-height:420px) { .thos-header { padding-top: 6px; padding-bottom: 6px; } .thos-content { padding-top: 16px; } .thos-footer { padding-top: 6px; padding-bottom: 6px; } }
@media (prefers-reduced-motion:reduce) { .thos-root { transition: none; } }
