:root {
  --bg: var(--app-bg);
  --surface: var(--app-surface);
  --surface-soft: var(--app-surface-soft);
  --text: var(--app-text);
  --muted: var(--app-muted);
  --line: var(--app-border);
  --blue: var(--app-primary);
  --blue-hover: var(--app-primary-hover);
  --blue-soft: var(--app-primary-soft);
  --green: var(--app-success);
  --green-soft: var(--app-success-soft);
  --warning: var(--app-warning);
  --warning-soft: var(--app-warning-soft);
  --danger: var(--app-danger);
  --danger-soft: var(--app-danger-soft);
  --dark: var(--app-dark);
  --shadow: var(--shadow-md);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--app-shell); color: var(--text); font-family: var(--font-family-app); }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, textarea, select { color: var(--text); }

.phone { width: min(100%, 430px); height: 100vh; margin: 0 auto; background: var(--bg); position: relative; overflow: hidden; }
.status-bar { height: 30px; padding: 7px 20px 0; display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.app-screen { display: none; height: calc(100vh - 30px); overflow-y: auto; padding-bottom: 24px; }
.app-screen.active { display: block; }
.app-screen.main-tab { height: calc(100vh - 100px); }
.app-screen.immersive { position: absolute; inset: 0; z-index: 15; height: 100%; padding: 0; overflow: hidden; }
.page-content { padding: 0 16px 24px; }

.topbar, .pagebar { height: 58px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.topbar { height: 64px; padding-top: 4px; }
.profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--blue); box-shadow: 0 0 0 3px #fff; }
.profile-copy { color: var(--muted); font-size: 12px; }
.profile-copy strong { display: block; margin-top: 2px; color: var(--text); font-size: 16px; }
.pagebar-left { min-width: 0; display: flex; align-items: center; gap: 8px; }
.pagebar h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.pagebar-meta { color: var(--muted); font-size: 12px; }

.icon-btn, .back-btn { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: transparent; color: var(--text); font-size: 22px; }
.icon-btn:hover, .back-btn:hover { background: var(--surface-soft); }
.btn { min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 700; }
.btn.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.btn.primary:hover { border-color: var(--blue-hover); background: var(--blue-hover); }
.btn.danger { border-color: #fecaca; color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.text-btn { padding: 4px 0; background: transparent; color: var(--blue); font-size: 13px; }
.text-btn.danger { color: var(--danger); }

.hero { min-height: 150px; padding: 18px 20px; border-radius: 12px; color: #fff; background: var(--blue); box-shadow: 0 12px 24px rgba(37, 99, 235, .2); position: relative; overflow: hidden; }
.hero:after { content: ""; position: absolute; width: 150px; height: 150px; border: 22px solid rgba(255,255,255,.1); border-radius: 50%; right: -54px; bottom: -68px; }
.eyebrow { font-size: 12px; opacity: .8; }
.hero h1 { margin: 6px 0; font-size: 28px; line-height: 1.25; }
.hero p { max-width: 290px; margin: 0; font-size: 13px; line-height: 1.5; opacity: .86; }
.hero-actions { margin-top: 14px; position: relative; z-index: 1; }
.hero .btn { background: #fff; color: #173b9b; border-color: #fff; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 4px 8px; }
.section-head h2 { margin: 0; font-size: 19px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.mode-card { min-height: 64px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; color: var(--text); }
.mode-card.active { border-color: var(--blue); background: var(--blue-soft); }
.mode-card b { display: block; font-size: 13px; }
.mode-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tool { min-height: 76px; padding: 8px 4px; border-radius: 8px; background: var(--surface); box-shadow: 0 5px 16px rgba(24,24,27,.045); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--text); }
.tool-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-style: normal; font-size: 18px; }
.tool:nth-child(2) .tool-icon { color: #7c3aed; background: #f0eaff; }
.tool:nth-child(3) .tool-icon { color: #db2777; background: #fde7f3; }
.tool:nth-child(4) .tool-icon { color: #c2410c; background: #ffede3; }
.tool span { font-size: 12px; font-weight: 700; white-space: nowrap; }

.surface, .list { background: var(--surface); border: 1px solid rgba(228,228,231,.7); border-radius: 8px; box-shadow: 0 5px 16px rgba(24,24,27,.04); }
.surface { padding: 16px; }
.surface + .surface { margin-top: 12px; }
.list { padding: 0 16px; }
.list-row, .script-row { min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child, .script-row:last-child { border-bottom: 0; }
.row-main { min-width: 0; flex: 1; }
.row-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.row-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.row-action { min-height: 30px; padding: 0 10px; flex: none; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.chevron { width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--surface-soft); color: var(--text); font-size: 18px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 11px; font-style: normal; }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--blue-soft); color: var(--blue); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 8px; background: #e9eaee; }
.tabs.two { grid-template-columns: repeat(2, 1fr); }
.tabs.four { grid-template-columns: repeat(4, 1fr); }
.tab { min-height: 34px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; }
.tab.active { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 2px 7px rgba(24,24,27,.08); }
.search { height: 44px; margin-top: 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; gap: 8px; align-items: center; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; }
.filter-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 0 8px; }
.filter { min-width: 0; min-height: 32px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; white-space: nowrap; }
.filter.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.folder-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; }
.folder-panel { display: none; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.folder-panel.show { display: block; }
.folder-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 32px; padding: 0 10px; border-radius: 8px; background: var(--surface-soft); color: var(--text); font-size: 12px; }
.chip.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.result-summary { display: flex; align-items: center; justify-content: space-between; margin: 16px 4px 8px; }
.result-summary strong { font-size: 15px; }
.result-summary span { color: var(--muted); font-size: 12px; }
.empty-state { display: none; padding: 40px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state.show { display: block; }
.template-preview { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label, .field-label { color: var(--muted); font-size: 12px; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; }
.input, .select { height: 42px; padding: 0 12px; }
.textarea { min-height: 180px; padding: 12px; resize: vertical; line-height: 1.65; }
.textarea.tall { min-height: 300px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.helper { color: var(--muted); font-size: 12px; line-height: 1.55; }
.inline-error { display: none; margin: -4px 0 10px; color: var(--danger); font-size: 12px; }
.inline-error.show { display: block; }
.state-bar { min-height: 40px; padding: 10px 12px; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.state-bar.success { background: var(--green-soft); color: var(--green); }
.state-bar.warning { background: var(--warning-soft); color: var(--warning); }
.state-bar.error { background: var(--danger-soft); color: var(--danger); }
.sticky-actions { position: sticky; bottom: 0; margin: auto -16px -24px; padding: 12px 16px 16px; display: flex; gap: 8px; background: rgba(246,247,249,.97); border-top: 1px solid var(--line); }
.sticky-actions .btn { flex: 1; }
#editorScreen .page-content, #floatSetupScreen .page-content, #permissionScreen .page-content { min-height: calc(100% - 58px); display: flex; flex-direction: column; }
#editorScreen .editor-body-field { flex: 1; min-height: 220px; display: flex; flex-direction: column; }
#editorScreen .editor-body-field .textarea { flex: 1; height: auto; min-height: 220px; }
.import-panel { display: grid; gap: 8px; }
.import-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.import-action { min-width: 0; min-height: 42px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); display: flex; align-items: center; justify-content: center; gap: 6px; }
.import-action span { color: var(--muted); font-size: 17px; line-height: 1; }
.import-action b { font-size: 13px; }
.import-action.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.import-action.active span { color: var(--blue); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.link-import-panel { display: grid; gap: 4px; }
.link-import-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.link-import-row .input { min-height: 40px; }
.link-import-row .btn { min-height: 40px; padding: 0 14px; }
.import-selection { min-width: 0; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; align-items: center; gap: 10px; }
.import-preview { width: 34px; height: 34px; flex: none; border-radius: 6px; background: var(--surface-soft); display: flex; align-items: center; justify-content: center; color: var(--blue); font-size: 17px; overflow: hidden; }
.import-preview.image-stack { width: auto; max-width: 92px; background: transparent; justify-content: flex-start; gap: 3px; }
.import-preview img { width: 30px; height: 34px; border-radius: 4px; object-fit: cover; border: 1px solid var(--line); }
.import-thumb-more { min-width: 26px; height: 34px; padding: 0 4px; border-radius: 4px; background: var(--surface-soft); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 10px; }
.import-selection-copy { min-width: 0; flex: 1; }
.import-selection-copy strong, .import-selection-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-selection-copy strong { font-size: 12px; }
.import-selection-copy span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.import-selection .text-btn { flex: none; font-size: 12px; }
.import-conflict-actions { display: grid; gap: 8px; }
.import-conflict-actions .text-btn { min-height: 36px; }

.ai-layout { display: grid; gap: 12px; }
.ai-result { min-height: 220px; }
.feedback-strip { display: none; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.feedback-strip.show { display: block; }
.feedback-strip p { margin: 0 0 10px; font-size: 13px; }
.rating-row { display: flex; gap: 8px; }
.rating { min-height: 34px; padding: 0 12px; border-radius: 8px; background: var(--surface-soft); color: var(--text); }
.rating.active { background: var(--blue-soft); color: var(--blue); }

.mode-list { display: grid; gap: 10px; }
.mode-option { min-height: 82px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; align-items: center; gap: 12px; text-align: left; }
.mode-option.active { border-color: var(--blue); background: var(--blue-soft); }
.mode-symbol { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-soft); color: var(--blue); font-size: 20px; }
.mode-copy { flex: 1; }
.mode-copy b { display: block; font-size: 15px; }
.mode-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.float-setup-layout { gap: 10px; overflow: hidden; }
.float-script-preview { width: 100%; min-height: 152px; padding: 13px 14px; border: 1px solid #323846; border-radius: 8px; display: flex; flex-direction: column; background: rgba(17,19,24,.92); color: #fff; text-align: left; box-shadow: 0 8px 20px rgba(24,24,27,.1); }
.float-preview-head { display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.68); font-size: 11px; }
.float-change-script { width: 32px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; font-size: 18px; }
.float-script-preview > strong { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.float-script-preview p { flex: 1; margin: 6px 0; overflow: hidden; color: #fff; font-size: 22px; line-height: 1.6; font-weight: 750; }
.float-preview-meta { color: rgba(255,255,255,.56); font-size: 10px; }
.float-setup-section { padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.float-section-head { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.float-section-head h2 { margin: 0; font-size: 14px; }
.float-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.float-app-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 5px; margin-top: 6px; }
.float-app { min-width: 0; min-height: 58px; padding: 4px 0; border: 1px solid transparent; border-radius: 7px; display: grid; place-items: center; align-content: center; gap: 4px; background: transparent; color: var(--muted); }
.float-app.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.float-app small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.app-mark { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; background: #f4f4f5; color: #52525b; font-size: 12px; font-weight: 800; }
.app-mark.neutral { color: #a1a1aa; }
.app-mark.dark { background: #24262b; color: #fff; }
.app-mark.orange { background: #f97316; color: #fff; }
.app-mark.green { background: #22c55e; color: #fff; }
.app-mark.red { background: #ef476f; color: #fff; }
.app-mark.outline { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.float-quick-settings { display: grid; gap: 3px; }
.float-range-row { min-height: 34px; display: grid; grid-template-columns: 34px minmax(0,1fr) 34px; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.float-range-row input { width: 100%; accent-color: var(--blue); }
.float-range-row span { text-align: right; }
.float-color-row { min-height: 38px; display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.color-swatches.compact { gap: 10px; }
.color-swatches.compact .color-swatch { width: 26px; height: 26px; }
.float-setup-actions { position: static; margin-top: auto; margin-bottom: -24px; }
.float-setup-actions .btn { width: 100%; }
.mode-choice-list { display: grid; gap: 8px; }
.mode-choice-list > button { min-height: 76px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 42px minmax(0,1fr) 16px; align-items: center; gap: 12px; background: #fff; text-align: left; }
.mode-choice-list strong, .mode-choice-list small { display: block; }
.mode-choice-list strong { color: var(--text); font-size: 15px; }
.mode-choice-list small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.mode-choice-list b { color: var(--muted); font-size: 20px; }
.float-more-apps { display: grid; gap: 8px; }
.float-more-apps > button { min-height: 60px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: center; gap: 12px; background: #fff; text-align: left; }
.float-more-apps strong, .float-more-apps small { display: block; }
.float-more-apps strong { font-size: 14px; }
.float-more-apps small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.permission-visual { width: 88px; height: 88px; margin: 24px auto 16px; border-radius: 20px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-size: 36px; }
.permission-copy { text-align: center; }
.permission-copy h2 { margin: 0 0 8px; font-size: 22px; }
.permission-copy p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.step-list { margin: 20px 0; padding: 0; list-style: none; }
.step-list li { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.host-scene { height: 100%; background: #e5e7eb; position: relative; overflow: hidden; }
.host-header { height: 58px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; background: #fff; color: var(--text); }
.host-content { padding: 24px 16px; color: #52525b; }
.host-placeholder { height: 120px; margin-bottom: 16px; border-radius: 8px; background: #d4d4d8; }
.float-window { --float-opacity: .92; position: absolute; left: 24px; right: 24px; top: 150px; min-height: 250px; border-radius: 10px; overflow: hidden; background: rgba(17,19,24,var(--float-opacity)); color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.28); }
.float-head { height: 42px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.08); }
.float-body { min-height: 150px; padding: 18px; display: flex; align-items: center; font-size: 22px; line-height: 1.6; font-weight: 700; }
.float-controls { padding: 10px; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; background: rgba(0,0,0,.22); }
.float-controls button { min-height: 38px; border-radius: 8px; background: rgba(255,255,255,.12); color: #fff; }
.restore-float { display: none; position: absolute; right: 12px; top: 92px; min-height: 40px; padding: 0 12px; border-radius: 20px; background: var(--blue); color: #fff; }

.camera-scene { --overlay-alpha: .62; height: 100%; position: relative; overflow: hidden; background: #20242b url("../assets/camera-preview.jpg") center 44%/cover no-repeat; color: #fff; }
.camera-scene:after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg,rgba(0,0,0,.34),transparent 22%,transparent 68%,rgba(0,0,0,.58)); }
.camera-top { position: relative; z-index: 6; height: 64px; padding: 8px 12px; display: grid; grid-template-columns: 42px minmax(0,1fr) 42px; align-items: center; gap: 8px; }
.camera-icon-btn { width: 42px; height: 42px; border-radius: 50%; background: rgba(15,23,42,.58); color: #fff; font-size: 23px; backdrop-filter: blur(8px); }
.camera-icon-btn:active { background: rgba(15,23,42,.82); transform: scale(.96); }
.camera-script-chip { min-width: 0; height: 40px; padding: 0 12px; border-radius: 20px; display: flex; align-items: center; justify-content: center; gap: 7px; background: rgba(15,23,42,.58); color: #fff; backdrop-filter: blur(8px); }
.camera-script-chip b { min-width: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.camera-overlay { position: absolute; z-index: 5; left: 16px; right: 16px; top: 76px; height: min(38vh,320px); min-height: 230px; padding: 13px 14px 14px; border: 1px solid rgba(255,255,255,.24); border-radius: 8px; overflow: hidden; background: rgba(15,23,42,var(--overlay-alpha)); box-shadow: 0 12px 28px rgba(0,0,0,.2); color: #fff; touch-action: none; }
.camera-drag-handle { position: absolute; z-index: 2; top: 1px; left: 50%; width: 52px; height: 20px; transform: translateX(-50%); background: transparent; color: rgba(255,255,255,.8); font-size: 16px; line-height: 1; cursor: move; touch-action: none; }
.camera-overlay-head { height: 32px; margin-top: 6px; display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 8px; color: rgba(255,255,255,.76); font-size: 11px; text-align: center; }
.camera-overlay-action { width: 34px; height: 30px; border-radius: 6px; background: rgba(255,255,255,.1); color: #fff; font-size: 19px; }
.camera-overlay-action.text-style { font-size: 14px; font-weight: 800; }
.camera-overlay-action:active { background: rgba(255,255,255,.22); }
.camera-text-viewport { height: calc(100% - 40px); overflow: hidden; }
.camera-overlay-text { padding: 8px 2px 28px; color: #fff; font-size: 28px; line-height: 1.6; font-weight: 750; text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: pre-wrap; }
.camera-resize-handle { position: absolute; right: 4px; bottom: 4px; width: 32px; height: 32px; border-radius: 6px; background: rgba(255,255,255,.1); color: #fff; font-size: 18px; cursor: nwse-resize; touch-action: none; }
.camera-record-state { position: absolute; z-index: 5; left: 50%; bottom: 174px; min-height: 28px; padding: 0 12px; border-radius: 14px; display: flex; align-items: center; gap: 7px; transform: translateX(-50%); background: rgba(15,23,42,.58); color: #fff; font-size: 11px; white-space: nowrap; backdrop-filter: blur(8px); }
.camera-record-state i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.camera-record-state.recording i { background: #ef4444; animation: recordPulse 1s infinite; }
.camera-zoom { position: absolute; z-index: 5; left: 50%; bottom: 130px; padding: 4px; border-radius: 18px; display: flex; gap: 2px; transform: translateX(-50%); background: rgba(15,23,42,.58); backdrop-filter: blur(8px); }
.camera-zoom button { min-width: 44px; height: 30px; border-radius: 15px; background: transparent; color: rgba(255,255,255,.76); font-size: 12px; }
.camera-zoom button.active { background: rgba(255,255,255,.16); color: #fde047; font-weight: 800; }
.camera-controls { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 112px; padding: 12px 22px calc(18px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 68px 74px 68px; align-items: center; justify-content: space-between; background: rgba(10,13,19,.86); }
.camera-control-btn { min-width: 68px; min-height: 54px; display: grid; place-items: center; align-content: center; gap: 2px; background: transparent; color: #fff; }
.camera-control-btn span { font-size: 19px; line-height: 1; }
.camera-control-btn small { color: rgba(255,255,255,.68); font-size: 10px; }
.record-btn { width: 70px; height: 70px; padding: 5px; border: 3px solid #fff; border-radius: 50%; background: transparent; }
.record-btn i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #ef4444; transition: .18s ease; }
.record-btn.recording i { width: 28px; height: 28px; margin: auto; border-radius: 6px; }
.record-btn.counting i { background: #f59e0b; }
.camera-grid { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.camera-grid i { position: absolute; background: rgba(255,255,255,.32); }
.camera-grid i:nth-child(1), .camera-grid i:nth-child(2) { top: 0; bottom: 112px; width: 1px; }
.camera-grid i:nth-child(1) { left: 33.333%; }
.camera-grid i:nth-child(2) { left: 66.666%; }
.camera-grid i:nth-child(3), .camera-grid i:nth-child(4) { left: 0; right: 0; height: 1px; }
.camera-grid i:nth-child(3) { top: 33.333%; }
.camera-grid i:nth-child(4) { top: 66.666%; }
.camera-drawer, .camera-settings-drawer { max-height: 78%; }
.camera-setting-tabs { margin-bottom: 16px; }
.camera-settings-panel { display: grid; gap: 0; }
.setting-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row.compact { display: grid; gap: 10px; }
.setting-row.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.setting-label strong { font-size: 14px; }
.setting-label span { color: var(--muted); font-size: 12px; }
.setting-row.toggle-row .setting-label { display: grid; justify-content: start; gap: 4px; margin: 0; }
.setting-row input[type="range"] { width: 100%; accent-color: var(--blue); }
.color-swatches { display: flex; align-items: center; gap: 12px; }
.color-swatch { width: 32px; height: 32px; border: 3px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line); }
.color-swatch.active { box-shadow: 0 0 0 2px var(--blue); }
.segmented { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; }
.segmented.compact { grid-template-columns: repeat(3,1fr); }
.segmented button { min-height: 38px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.segmented button.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.camera-script-list, .camera-outline-list { display: grid; gap: 8px; }
.camera-drawer-row { width: 100%; min-height: 62px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; background: #fff; text-align: left; }
.camera-drawer-row strong, .camera-drawer-row span { display: block; }
.camera-drawer-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.camera-drawer-row span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.camera-drawer-row.active { border-color: var(--blue); background: var(--blue-soft); }
.camera-drawer-row em { color: var(--blue); font-size: 12px; font-style: normal; }
@keyframes recordPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.qr-box { width: 164px; height: 164px; margin: 18px auto; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.qr-box i { background: #18181b; }
.qr-box i.light { background: #fff; }
.scan-frame { width: 220px; height: 220px; margin: 18px auto; border: 2px solid var(--blue); border-radius: 12px; display: grid; place-items: center; background: #eceef2; color: var(--blue); font-size: 46px; position: relative; overflow: hidden; }
.scan-frame:after { content: ""; position: absolute; left: 18px; right: 18px; top: 50%; height: 2px; background: var(--blue); box-shadow: 0 0 12px rgba(37,99,235,.6); }
.connection-code { margin: 8px 0; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 6px; }
.connection-state { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 13px; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.remote-pad { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 12px; }
.remote-pad button { min-height: 64px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 700; }
.remote-pad .primary { background: var(--blue); color: #fff; border-color: var(--blue); }

.account-card { display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff; border-radius: 8px; }
.account-card .avatar { width: 48px; height: 48px; box-shadow: none; }
.account-card div:nth-child(2) { flex: 1; }
.account-card strong { display: block; }
.account-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.member-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.usage-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.usage-item { padding: 12px; border-radius: 8px; background: var(--surface-soft); }
.usage-item strong { display: block; font-size: 18px; }
.usage-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.toggle { width: 42px; height: 24px; padding: 2px; border-radius: 12px; background: #d4d4d8; }
.toggle:after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle.on { background: var(--blue); }
.toggle.on:after { transform: translateX(18px); }

.bottom-nav { position: absolute; z-index: 10; bottom: 0; left: 0; right: 0; height: calc(70px + env(safe-area-inset-bottom)); padding: 8px 12px env(safe-area-inset-bottom); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4,1fr); }
.bottom-nav.hidden { display: none; }
.nav-item { background: transparent; color: #a1a1aa; font-size: 11px; display: grid; place-items: center; gap: 2px; }
.nav-item b { font-size: 20px; line-height: 1; font-weight: 500; }
.nav-item.active { color: var(--blue); font-weight: 800; }

.modal-mask { position: absolute; inset: 0; z-index: 30; display: none; align-items: flex-end; background: rgba(24,24,27,.42); }
.modal-mask.show { display: flex; }
.modal { width: 100%; max-height: 86%; overflow-y: auto; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: #fff; box-shadow: 0 -12px 30px rgba(24,24,27,.18); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.end-save-option { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); cursor: pointer; }
.end-save-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.end-save-option span { display: grid; gap: 2px; }
.end-save-option strong { font-size: 14px; }
.end-save-option small { color: var(--muted); font-size: 12px; }
.toast { position: absolute; z-index: 40; left: 24px; right: 24px; bottom: 88px; padding: 12px 14px; border-radius: 8px; background: #18181b; color: #fff; text-align: center; font-size: 13px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
.loading-dot:after { content: "..."; animation: dots 1s infinite; }
@keyframes dots { 0% { content: "."; } 50% { content: ".."; } 100% { content: "..."; } }
.hidden { display: none !important; }

@media (min-width: 431px) {
  .phone { height: 844px; margin: 24px auto; border-radius: 24px; box-shadow: 0 24px 60px rgba(24,24,27,.18); }
  .app-screen { height: 814px; }
  .app-screen.main-tab { height: 744px; }
}

@media (max-height: 820px) {
  #editorScreen .editor-body-field,
  #editorScreen .editor-body-field .textarea { min-height: 210px; }
  #homeScreen .topbar { height: 56px; }
  #homeScreen .hero { min-height: 136px; padding: 14px 18px; }
  #homeScreen .hero h1 { font-size: 25px; }
  #homeScreen .hero-actions { margin-top: 10px; }
  #homeScreen .mode-grid { margin-top: 8px; }
  #homeScreen .mode-card { min-height: 58px; padding: 7px; }
  #homeScreen .section-head { margin-top: 12px; margin-bottom: 6px; }
  #homeScreen .tool { min-height: 68px; }
  #homeScreen .tool-icon { width: 32px; height: 32px; }
  #homeScreen .script-row { min-height: 52px; padding: 7px 0; }
}

/* APP high-fidelity polish V1. */
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { overflow: hidden; }
button, input, textarea, select { letter-spacing: 0; }
button, .btn, .tab, .chip, .filter, .nav-item, .tool, .mode-card, .script-row, .list-row {
  transition: background-color var(--duration-fast) var(--easing-standard),
    border-color var(--duration-fast) var(--easing-standard),
    color var(--duration-fast) var(--easing-standard),
    box-shadow var(--duration-fast) var(--easing-standard),
    transform var(--duration-fast) var(--easing-standard);
}
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--app-ring);
  outline-offset: 2px;
}

.phone {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, .03), transparent 180px),
    var(--bg);
  color: var(--text);
}

.status-bar {
  background: rgba(246, 248, 251, .94);
  color: var(--app-text);
  letter-spacing: 0;
}

.app-screen {
  scrollbar-width: thin;
  scrollbar-color: var(--app-border-strong) transparent;
}
.app-screen::-webkit-scrollbar { width: 4px; }
.app-screen::-webkit-scrollbar-thumb { background: var(--app-border-strong); border-radius: var(--radius-pill); }
.app-screen.immersive { scrollbar-width: none; }
.app-screen.immersive::-webkit-scrollbar { display: none; }

.page-content { padding: 0 var(--space-4) var(--space-5); }
.topbar, .pagebar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(246, 248, 251, .92);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
}
.pagebar { min-height: 58px; }
.pagebar h1 {
  font-size: var(--font-size-page-title);
  font-weight: var(--font-weight-heavy);
  line-height: var(--line-height-tight);
}
.pagebar-meta { color: var(--app-muted); font-size: var(--font-size-helper); }
.profile-copy { color: var(--app-muted); }
.profile-copy strong { color: var(--app-text); font-weight: var(--font-weight-heavy); }
.avatar {
  background: linear-gradient(145deg, #2563eb, #0f172a);
  box-shadow: 0 0 0 3px #fff, var(--shadow-sm);
}

.icon-btn, .back-btn {
  border-radius: var(--radius-md);
  color: var(--app-text-soft);
}
.icon-btn:hover, .back-btn:hover,
.icon-btn:active, .back-btn:active {
  background: var(--app-surface-muted);
  color: var(--app-text);
}

.btn {
  min-height: 40px;
  border-radius: var(--radius-md);
  border-color: var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-bold);
  box-shadow: var(--shadow-xs);
}
.btn:hover { border-color: var(--app-border-strong); background: var(--app-surface-soft); }
.btn.primary {
  border-color: var(--app-primary);
  background: var(--app-primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
}
.btn.primary:hover, .btn.primary:active {
  border-color: var(--app-primary-hover);
  background: var(--app-primary-hover);
  color: #fff;
}
.btn.danger {
  border-color: #fecaca;
  background: var(--app-danger-soft);
  color: var(--app-danger);
}
.btn.danger:hover { background: #fee2e2; color: var(--app-danger); }
.text-btn {
  color: var(--app-primary);
  font-weight: var(--font-weight-medium);
}
.text-btn:hover { color: var(--app-primary-hover); }

.hero {
  min-height: 138px;
  padding: var(--space-5);
  border-radius: var(--radius-md);
  background: #1d4ed8;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .22);
}
.hero:after { display: none; }
.eyebrow {
  color: rgba(255, 255, 255, .72);
  font-size: var(--font-size-helper);
  font-weight: var(--font-weight-medium);
}
.hero h1 {
  margin: var(--space-1) 0;
  font-size: var(--font-size-hero);
  font-weight: var(--font-weight-heavy);
  letter-spacing: 0;
}
.hero p {
  color: rgba(255, 255, 255, .82);
  font-size: var(--font-size-helper);
}
.hero .btn {
  min-height: 36px;
  background: #fff;
  color: #1d4ed8;
  border-color: #fff;
  box-shadow: none;
}

#homeScreen .topbar { height: 60px; }
#homeScreen .hero {
  min-height: 136px;
  padding: 18px var(--space-4);
}
#homeScreen .hero-actions { margin-top: var(--space-3); }
#homeScreen .mode-grid { margin-top: 20px; }
#homeScreen .mode-card {
  min-height: 64px;
  padding: 10px var(--space-3);
}
#homeScreen .section-head {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}
#homeScreen .tool { min-height: 70px; }
#homeScreen .script-row {
  min-height: 52px;
  padding: var(--space-2) 0;
}
#homeScreen .page-content { padding-bottom: var(--space-3); }

.section-head { margin: var(--space-5) var(--space-1) var(--space-2); }
.section-head h2 {
  color: var(--app-text);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-heavy);
}
.section-head p { color: var(--app-muted); }

.mode-grid { gap: var(--space-2); margin-top: var(--space-3); }
.mode-card {
  min-height: 66px;
  padding: var(--space-3);
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  box-shadow: var(--shadow-xs);
}
.mode-card:hover, .mode-card:active {
  border-color: var(--app-primary-subtle);
  background: var(--app-primary-soft);
}
.mode-card b { font-size: var(--font-size-body); font-weight: var(--font-weight-bold); }
.mode-card span { color: var(--app-muted); font-size: var(--font-size-helper); }

.tool-grid { gap: var(--space-2); }
.tool {
  min-height: 74px;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  box-shadow: var(--shadow-xs);
}
.tool:hover, .tool:active {
  border-color: var(--app-primary-subtle);
  background: var(--app-primary-soft);
}
.tool-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--app-surface-muted);
  color: var(--app-primary);
  font-size: 17px;
}
.tool:nth-child(2) .tool-icon,
.tool:nth-child(3) .tool-icon,
.tool:nth-child(4) .tool-icon {
  background: var(--app-surface-muted);
  color: var(--app-primary);
}
.tool span {
  color: var(--app-text-soft);
  font-size: var(--font-size-helper);
  font-weight: var(--font-weight-bold);
}

.surface, .list {
  border-color: rgba(226, 232, 240, .9);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  box-shadow: var(--shadow-xs);
}
.surface { padding: var(--space-4); }
.surface + .surface { margin-top: var(--space-3); }
.list { padding: 0 var(--space-4); }
.list-row, .script-row {
  min-height: 60px;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom-color: var(--app-border);
}
button.list-row:hover, button.list-row:active,
.script-row:hover {
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, .035), transparent);
}
.row-main strong {
  color: var(--app-text);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-bold);
}
.row-main span, .row-main p {
  color: var(--app-muted);
  font-size: var(--font-size-helper);
}
.row-action {
  min-height: 32px;
  border: 1px solid var(--app-primary-subtle);
  border-radius: var(--radius-md);
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-weight: var(--font-weight-bold);
}
.row-action:hover, .row-action:active {
  background: var(--app-primary);
  color: #fff;
}
.chevron {
  border: 1px solid var(--app-border);
  background: var(--app-surface-soft);
  color: var(--app-muted);
}
.chevron:hover, .chevron:active {
  border-color: var(--app-primary-subtle);
  color: var(--app-primary);
}
.badge {
  border-radius: var(--radius-sm);
  background: var(--app-success-soft);
  color: var(--app-success);
  font-weight: var(--font-weight-bold);
}
.badge.info { background: var(--app-primary-soft); color: var(--app-primary); }
.badge.warning { background: var(--app-warning-soft); color: var(--app-warning); }
.badge.error { background: var(--app-danger-soft); color: var(--app-danger); }

.tabs {
  padding: var(--space-1);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface-muted);
}
.tab {
  min-height: 34px;
  border-radius: var(--radius-sm);
  color: var(--app-muted);
  font-size: var(--font-size-helper);
  font-weight: var(--font-weight-medium);
}
.tab.active {
  background: var(--app-surface);
  color: var(--app-text);
  box-shadow: var(--shadow-xs);
}

.search {
  height: 42px;
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  box-shadow: var(--shadow-xs);
}
.search span { color: var(--app-placeholder); }
.search input::placeholder,
.input::placeholder,
.textarea::placeholder { color: var(--app-placeholder); }
.filter-row { gap: var(--space-2); padding: var(--space-3) 0 var(--space-2); }
.filter, .chip {
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
}
.filter {
  min-height: 32px;
  border-color: var(--app-border);
  color: var(--app-muted);
}
.filter.active {
  border-color: var(--app-primary);
  background: var(--app-primary);
  color: #fff;
}
.folder-panel {
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.chip {
  min-height: 32px;
  background: var(--app-surface-muted);
  color: var(--app-text-soft);
}
.chip.active {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.result-summary { margin: var(--space-5) var(--space-1) var(--space-2); }
.result-summary strong { font-weight: var(--font-weight-heavy); }

.field { gap: var(--space-2); margin-bottom: var(--space-3); }
.field label, .field-label {
  color: var(--app-text-soft);
  font-size: var(--font-size-helper);
  font-weight: var(--font-weight-bold);
}
.input, .textarea, .select {
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  color: var(--app-text);
  box-shadow: var(--shadow-xs);
}
.input, .select { height: 42px; }
.textarea {
  line-height: var(--line-height-body);
  resize: none;
}
.textarea.tall { min-height: 320px; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px var(--app-ring);
}
.helper { color: var(--app-muted); }
.inline-error.show {
  margin-top: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--app-danger-soft);
}

.state-bar {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--app-surface-muted);
  color: var(--app-muted);
  font-weight: var(--font-weight-medium);
}
.state-bar.success {
  border-color: #bbf7d0;
  background: var(--app-success-soft);
  color: var(--app-success);
}
.state-bar.warning {
  border-color: #fde68a;
  background: var(--app-warning-soft);
  color: var(--app-warning);
}
.state-bar.error {
  border-color: #fecaca;
  background: var(--app-danger-soft);
  color: var(--app-danger);
}
.sticky-actions {
  border-top-color: var(--app-border);
  background: rgba(246, 248, 251, .94);
  backdrop-filter: blur(14px);
}

#editorScreen .page-content,
#floatSetupScreen .page-content,
#permissionScreen .page-content {
  min-height: calc(100% - 58px);
}
#editorScreen .editor-body-field .textarea {
  min-height: 280px;
  font-size: var(--font-size-body);
}
#importPanel:not(.hidden) ~ .editor-body-field,
#importPanel:not(.hidden) ~ .editor-body-field .textarea {
  min-height: 220px;
}
#complianceBar { margin-top: var(--space-1); }
.import-actions { gap: var(--space-2); }
.import-action {
  min-height: 42px;
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.import-action.active {
  border-color: var(--app-primary-subtle);
  background: var(--app-primary-soft);
}
.import-selection {
  border-radius: var(--radius-md);
  border-color: var(--app-border);
  box-shadow: var(--shadow-xs);
}

.ai-layout { gap: var(--space-3); }
#aiScreen .surface { padding: var(--space-4); }
#aiScreen .field { margin-bottom: var(--space-3); }
#aiInput.textarea { min-height: 128px; }
.ai-result { min-height: 168px; }
.feedback-strip {
  border-radius: var(--radius-md);
  border-color: var(--app-border);
  background: var(--app-surface);
  box-shadow: var(--shadow-xs);
}
.rating {
  border: 1px solid var(--app-border);
  background: var(--app-surface-muted);
}
.rating.active {
  border-color: var(--app-primary-subtle);
  background: var(--app-primary-soft);
}

.float-setup-layout { gap: var(--space-3); }
.float-script-preview {
  min-height: 162px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-md);
  background: rgba(17, 24, 39, .92);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .22);
}
.float-change-script {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .12);
}
.float-script-preview > strong { font-weight: var(--font-weight-bold); }
.float-script-preview p {
  font-weight: var(--font-weight-heavy);
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.float-setup-section {
  padding: var(--space-2) 0 var(--space-3);
  border-bottom-color: var(--app-border);
}
.float-app {
  border-radius: var(--radius-md);
}
.float-app.active {
  border-color: var(--app-primary);
  background: var(--app-primary-soft);
}
.app-mark { border-radius: var(--radius-md); }
.float-range-row input,
.setting-row input[type="range"] { accent-color: var(--app-primary); }
.float-setup-actions { margin-bottom: calc(-1 * var(--space-5)); }

.permission-visual {
  border-radius: var(--radius-lg);
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.permission-copy h2 { color: var(--app-text); font-weight: var(--font-weight-heavy); }
.step-list li { border-bottom-color: var(--app-border); }

.host-scene {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .05), transparent 160px),
    #e5e7eb;
}
.host-header {
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--app-border);
  backdrop-filter: blur(12px);
}
.host-placeholder {
  border: 1px solid #cbd5e1;
  background: linear-gradient(135deg, #f8fafc, #dbe4ef);
}
.float-window {
  border-radius: var(--radius-lg);
  background: rgba(17, 24, 39, var(--float-opacity));
  box-shadow: 0 24px 56px rgba(0,0,0,.30);
}
.float-controls button {
  border: 1px solid rgba(255,255,255,.08);
}
.float-controls button:hover,
.float-controls button:active {
  background: rgba(255,255,255,.20);
}

.camera-scene:after {
  background: linear-gradient(180deg,rgba(0,0,0,.42),transparent 24%,transparent 66%,rgba(0,0,0,.64));
}
.camera-icon-btn,
.camera-script-chip,
.camera-record-state,
.camera-zoom {
  background: rgba(15, 23, 42, .64);
  box-shadow: 0 8px 20px rgba(0,0,0,.14);
}
.camera-overlay {
  border-radius: var(--radius-lg);
  border-color: rgba(255,255,255,.20);
  background: rgba(15, 23, 42, var(--overlay-alpha));
  box-shadow: 0 18px 38px rgba(0,0,0,.24);
}
.camera-overlay-action,
.camera-resize-handle {
  border: 1px solid rgba(255,255,255,.08);
}
.camera-overlay-text {
  font-weight: var(--font-weight-heavy);
}
.camera-controls {
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(10, 13, 19, .90);
  backdrop-filter: blur(16px);
}
.record-btn { box-shadow: 0 12px 28px rgba(239, 68, 68, .20); }
.record-btn i { background: #ef4444; }
.camera-drawer-row {
  border-radius: var(--radius-md);
  border-color: var(--app-border);
}
.camera-drawer-row.active {
  border-color: var(--app-primary-subtle);
  background: var(--app-primary-soft);
}
.segmented button {
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface-muted);
}
.segmented button.active {
  border-color: var(--app-primary);
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.color-swatch { border-color: #fff; }
.color-swatch.active { box-shadow: 0 0 0 2px var(--app-primary); }

.qr-box, .scan-frame {
  border-radius: var(--radius-md);
  border-color: var(--app-primary);
}
.scan-frame {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.remote-pad { gap: var(--space-2); }
.remote-pad button {
  border-color: var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  box-shadow: var(--shadow-xs);
}
.remote-pad .primary {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
}

.account-card {
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.usage-grid { margin-top: var(--space-4); }
.usage-item {
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface-soft);
}
.usage-item strong {
  color: var(--app-text);
  font-weight: var(--font-weight-heavy);
}
.member-avatar {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}

.toggle { background: #cbd5e1; }
.toggle.on { background: var(--app-primary); }
.toggle:after { box-shadow: var(--shadow-xs); }

.bottom-nav {
  height: calc(68px + env(safe-area-inset-bottom));
  padding: var(--space-2) var(--space-3) env(safe-area-inset-bottom);
  border-top-color: var(--app-border);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(16px);
}
.nav-item {
  border-radius: var(--radius-md);
  color: var(--app-placeholder);
}
.nav-item b { font-size: 19px; }
.nav-item.active {
  color: var(--app-primary);
  background: var(--app-primary-soft);
}

.modal-mask { background: var(--app-overlay); }
.modal {
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--app-surface);
  box-shadow: var(--shadow-lg);
}
.modal-head h2 {
  color: var(--app-text);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-heavy);
}
.mode-choice-list > button,
.float-more-apps > button {
  border-radius: var(--radius-md);
  border-color: var(--app-border);
  box-shadow: var(--shadow-xs);
}
.mode-choice-list > button:hover,
.float-more-apps > button:hover {
  border-color: var(--app-primary-subtle);
  background: var(--app-primary-soft);
}
.mode-symbol {
  border-radius: var(--radius-md);
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.end-save-option {
  border-radius: var(--radius-md);
  background: var(--app-surface-soft);
}
.toast {
  border-radius: var(--radius-md);
  background: var(--app-dark);
  box-shadow: var(--shadow-md);
}
.toast.error { background: #991b1b; }

@media (min-width: 431px) {
  .phone {
    border: 1px solid rgba(255,255,255,.64);
    border-radius: 24px;
    box-shadow: 0 28px 72px rgba(15, 23, 42, .22);
  }
}

@media (max-height: 820px) {
  .page-content { padding-left: var(--space-4); padding-right: var(--space-4); }
  #homeScreen .hero { min-height: 132px; padding: 16px var(--space-4); }
  #homeScreen .hero h1 { font-size: 24px; }
  #homeScreen .mode-grid { margin-top: var(--space-4); }
  #homeScreen .mode-card { min-height: 60px; }
  #homeScreen .tool { min-height: 66px; }
  #homeScreen .tool-icon { width: 32px; height: 32px; }
  #homeScreen .section-head { margin-top: var(--space-4); }
  #homeScreen .script-row { min-height: 48px; padding: 7px 0; }
  #homeScreen .page-content { padding-bottom: var(--space-2); }
  #editorScreen .editor-body-field,
  #editorScreen .editor-body-field .textarea { min-height: 228px; }
  #importPanel:not(.hidden) ~ .editor-body-field,
  #importPanel:not(.hidden) ~ .editor-body-field .textarea { min-height: 180px; }
  .float-script-preview { min-height: 148px; }
  .float-script-preview p { font-size: 21px; }
}

@media (min-width: 431px) {
  body {
    overflow: auto;
    min-height: 100vh;
    padding: 16px 0;
  }

  .phone {
    height: min(844px, calc(100vh - 32px));
    margin: 0 auto;
  }

  .app-screen {
    height: calc(100% - 30px);
  }

  .app-screen.main-tab {
    height: calc(100% - 98px);
  }

  .app-screen.immersive {
    height: 100%;
  }
}
