.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected,.hn-mobile-editor-header,.hn-mobile-settings-close {display:none}
.hn-mobile-sheet {width:min(520px,100%);max-width:100%;max-height:min(80dvh,var(--hn-vh,80dvh));margin:auto auto 0;padding:18px 16px calc(18px + env(safe-area-inset-bottom));border:1px solid var(--ui-border,#d8dedb);border-radius:20px 20px 0 0;background:var(--ui-surface,#fffefa);color:var(--ui-ink,#253d35);font:15px/1.6 var(--ui-font,Arial);direction:rtl;box-sizing:border-box}
.hn-mobile-sheet::backdrop {background:#15231e66}
.hn-mobile-sheet {position:fixed;top:auto;bottom:max(0px,calc(100dvh - var(--hn-vh,100dvh) - var(--hn-vtop,0px)))}
.hn-mobile-sheet[open] {display:flex;flex-direction:column;overflow:hidden}
.hn-mobile .hn-mobile-settings-close {display:block;width:auto!important;min-height:44px;margin:0 0 6px;margin-inline-start:auto;padding:8px 16px;border:1px solid #ccd7ca;border-radius:10px;background:#fff;color:#253d35}
.hn-mobile-sheet header {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.hn-mobile-sheet h2 {margin:0;font-size:18px}
.hn-mobile-sheet button,.hn-mobile-sheet input {font:inherit;color:inherit;min-height:44px;border:1px solid #ccd7ca;border-radius:10px;background:#fff;padding:10px 14px;box-sizing:border-box}
.hn-mobile-sheet button {cursor:pointer;text-align:start}
.hn-mobile-sheet button:hover,.hn-mobile-sheet .is-current {background:#edf3e8}
.hn-mobile-sheet button:disabled {opacity:.4;cursor:default}
.hn-mobile-sheet-body,.hn-mobile-results {display:grid;gap:8px}
/* Add sheet: icon tiles instead of a long text list; other sheets: icon + label rows. */
.hn-mobile-add-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:8px}
.hn-mobile-sheet button.has-icon {display:flex;align-items:center;gap:12px}
/* Lists in sheets are plain rows; the Add tiles sit on a soft panel. */
body .hn-mobile-sheet :is(.hn-mobile-sheet-body>button.has-icon,.hn-mobile-results>button) {border-color:transparent!important}
.hn-mobile-sheet .hn-mobile-sheet-body:not(.hn-mobile-add-grid)>button.has-icon {min-height:48px}
.hn-mobile-sheet .hn-mobile-add-grid>button.has-icon {background:var(--theme-raised,#f3f5f0)}
:is(.hn-mobile-sheet,.hn-mobile-drawer) header .hn-mobile-sheet-close {display:grid;place-items:center;flex:none;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:22px;background:transparent}
:is(.hn-mobile-sheet,.hn-mobile-drawer) .hn-mobile-sheet-close .hn-mobile-icon {color:inherit}
.hn-mobile-add-grid button.has-icon {flex-direction:column;justify-content:center;gap:6px;min-height:84px;padding:10px 6px;text-align:center;font-size:13px;line-height:1.3;overflow-wrap:anywhere}
.hn-mobile-icon {display:inline-grid;place-items:center;flex:none}
.hn-mobile-sheet .hn-mobile-icon {color:var(--theme-accent,#4c6686)}
.hn-mobile-sheet .hn-mobile-icon .ui-icon {width:24px;height:24px}
.hn-mobile-sheet-body {flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
.hn-mobile-sheet input {width:100%;font-size:16px}
.hn-mobile-colors {display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px}
.hn-mobile-sheet .hn-mobile-colors button {width:100%;aspect-ratio:1;min-height:44px;padding:0;border:1px solid var(--theme-border,#b9c8ba)}
.hn-mobile-results small {display:block;font-size:12px;color:#617264}
/* Delete stays recognisable in both themes; theme.css paints sheet text with the ink colour. */
:is(.hn-mobile-sheet,.hn-mobile-drawer,.hn-mobile-selected) button.hn-mobile-danger,body.hn-themed :is(.hn-mobile-sheet,.hn-mobile-drawer,.hn-mobile-selected) button.hn-mobile-danger {color:var(--theme-danger,#b3261e)!important}
:is(.hn-mobile-sheet,.hn-mobile-drawer) .hn-mobile-danger .hn-mobile-icon {color:inherit}
.hn-mobile button:focus-visible,:is(.hn-mobile-sheet,.hn-mobile-drawer) :is(button,input):focus-visible {outline:3px solid #638b6e;outline-offset:2px}
/* The menu: a full-height panel from the reading start (right in Arabic, left in English). */
.hn-mobile-drawer {position:fixed;top:0;bottom:0;right:0;left:auto;width:min(340px,88vw);max-width:none;height:auto;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:var(--ui-surface,#fffefa);color:var(--ui-ink,#253d35);font:15px/1.5 var(--ui-font,Arial);direction:rtl;box-sizing:border-box;box-shadow:0 0 32px #13271b38}
html[lang=en] .hn-mobile-drawer {right:auto;left:0;direction:ltr}
.hn-mobile-drawer[open] {display:flex;flex-direction:column;animation:hn-drawer-in .18s ease-out}
html[lang=en] .hn-mobile-drawer[open] {animation-name:hn-drawer-in-left}
@keyframes hn-drawer-in {from {transform:translateX(100%)}}
@keyframes hn-drawer-in-left {from {transform:translateX(-100%)}}
@media (prefers-reduced-motion:reduce) {.hn-mobile-drawer[open] {animation:none}}
.hn-mobile-drawer::backdrop {background:#15231e66}
.hn-mobile-drawer>header {display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:calc(56px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 8px 0;padding-inline-start:18px;border-bottom:1px solid var(--theme-border,#e1e5df);box-sizing:border-box}
.hn-mobile-drawer h2 {margin:0;font-size:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hn-mobile-drawer-body {flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 10px calc(16px + env(safe-area-inset-bottom))}
.hn-mobile-menu-section {padding:10px 0;border-bottom:1px solid var(--theme-border,#e1e5df)}
.hn-mobile-menu-section:last-child {border-bottom:0}
.hn-mobile-menu-section h3 {margin:2px 8px 6px;font-size:12px;font-weight:600;color:var(--theme-muted,#677870)!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hn-mobile-drawer button {display:flex;align-items:center;gap:14px;width:100%;min-height:48px;padding:8px 10px;border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;text-align:start;box-sizing:border-box;cursor:pointer}
.hn-mobile-drawer button:disabled {opacity:.4;cursor:default}
.hn-mobile-drawer .hn-mobile-icon {color:var(--theme-accent,#4c6686)}
.hn-mobile-drawer .hn-mobile-icon .ui-icon {width:22px;height:22px}
.hn-mobile-drawer .hn-mobile-add-grid {grid-template-columns:repeat(4,minmax(0,1fr));gap:2px}
.hn-mobile-drawer .hn-mobile-add-grid button {flex-direction:column;justify-content:flex-start;gap:4px;min-height:72px;padding:8px 2px;font-size:12px;line-height:1.25;text-align:center;overflow-wrap:anywhere}
/* Light and Dark side by side; the current one is outlined. */
.hn-mobile-segmented {display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0 4px 6px}
.hn-mobile-drawer .hn-mobile-segmented button {justify-content:center;gap:8px;min-height:44px;box-shadow:inset 0 0 0 1px var(--theme-border,#d8dedb)}
.hn-mobile-drawer .hn-mobile-segmented button[aria-checked=true] {box-shadow:inset 0 0 0 2px var(--theme-accent,#4c6686);font-weight:600}
.hn-mobile-drawer .hn-mobile-segmented .hn-mobile-background-swatch {margin:0}
.hn-mobile .topbar {display:none!important}
/* Project settings: a bottom sheet above the dock. scene-ui.css pins the top bar at
   z-index 100 and 64px with !important, so this override needs both as well. */
.hn-mobile #project-settings[open] {display:block!important;position:fixed;inset:0;z-index:160}
.hn-mobile .topbar:has(#project-settings[open]) {display:block!important;position:fixed!important;z-index:160!important;inset:0!important;height:auto!important;min-height:0!important;padding:0!important;border:0!important;box-shadow:none!important;background:#15231e66!important}
.hn-mobile .topbar:has(#project-settings[open])> :not(.topbar-actions),.hn-mobile #project-settings>summary {display:none!important}
.hn-mobile #project-settings .project-settings-menu {position:fixed!important;top:auto!important;bottom:0!important;left:0!important;right:0!important;width:100%!important;max-width:none!important;max-height:min(85dvh,var(--hn-vh,85dvh))!important;overflow:auto;box-sizing:border-box;padding:14px 16px calc(16px + env(safe-area-inset-bottom))!important;border-radius:20px 20px 0 0!important}
.hn-mobile .app-shell,.hn-mobile .workspace {height:100dvh;min-height:0}
.hn-mobile .workspace {padding-top:calc(56px + env(safe-area-inset-top));padding-bottom:calc(102px + env(safe-area-inset-bottom))}
.hn-mobile .hn-mobile-header,.hn-mobile .hn-mobile-dock,.hn-mobile .hn-mobile-selected,.hn-mobile .hn-mobile-editor-header {position:fixed;z-index:100;align-items:center;gap:5px;box-sizing:border-box;font:14px var(--ui-font,Arial);direction:rtl}
.hn-mobile .hn-mobile-header {display:flex;top:0;left:0;right:0;height:calc(56px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 8px 0;background:var(--hn-mobile-bg,#fffefa);color:var(--hn-mobile-ink,#253d35);border-bottom:1px solid var(--hn-mobile-border,#d8dedb)}
.hn-mobile-title {flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font-size:15px}
.hn-mobile-header button,.hn-mobile-dock button,.hn-mobile-selected button,.hn-mobile-editor-header button {min-height:44px;min-width:44px;padding:8px;border:0;border-radius:10px;background:transparent;color:inherit;cursor:pointer;font:inherit}
.hn-mobile-header button:disabled,.hn-mobile-dock button:disabled,.hn-mobile-editor-header button:disabled {opacity:.4}
.hn-mobile :is(.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected) .ui-icon {width:22px;height:22px}
/* Back names the board it returns to; its arrow points toward the reading start. */
.hn-mobile-header .hn-mobile-back {display:flex;align-items:center;gap:2px;flex:0 1 auto;max-width:36%;padding-inline:2px 8px}
.hn-mobile-back .hn-mobile-label {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html[dir=rtl] .hn-mobile-back .ui-icon {transform:scaleX(-1)}
.hn-mobile-header :is(.hn-mobile-fit,.hn-mobile-menu-button) {display:grid;place-items:center;flex:none;width:44px}
.hn-mobile-header .hn-mobile-back[hidden] {display:none}
.hn-mobile .hn-mobile-dock {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));left:0;right:0;bottom:0;padding:8px 6px calc(8px + env(safe-area-inset-bottom));background:#fffefa;color:#253d35;border-top:1px solid #d8dedb}
.hn-mobile-dock button.has-icon {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:48px;padding:3px 2px;font-size:12px;line-height:1.25}
.hn-mobile-dock .hn-mobile-add {background:#356346;color:#fff}
.hn-mobile .hn-mobile-selected {display:flex;left:0;right:0;bottom:0;gap:0;padding:8px 4px calc(8px + env(safe-area-inset-bottom));background:#fffefa;color:#253d35;border-top:1px solid #d8dedb}
.hn-mobile.hn-mobile-selecting .hn-mobile-dock {display:none}
.hn-mobile-selected button.has-icon {display:flex;flex:1 1 0;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:0;min-height:48px;padding:3px 1px;font-size:12px;line-height:1.25}
.hn-mobile-selected .hn-mobile-label {max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hn-mobile .hn-mobile-selected button[hidden] {display:none}
.hn-mobile .hn-mobile-selected[hidden] {display:none}
.hn-mobile .web-status-dock {bottom:calc(68px + env(safe-area-inset-bottom));left:8px;max-width:calc(100vw - 16px);font-size:10px;z-index:102}
.hn-mobile .web-save-badge {padding:5px 8px;max-width:calc(100vw - 105px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hn-mobile #canvas-hint,.hn-mobile .tool-dock,.hn-mobile .resize-handle,.hn-mobile .connection-handle {display:none!important}
.hn-mobile:not(.hn-mobile-editing) .card-body {pointer-events:none}
/* A held finger selects; keep the browser's text selection and callout out of it. */
.hn-mobile:not(.hn-mobile-editing) .canvas-area {-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.hn-mobile:not(.hn-mobile-editing) .card>.drag-handle {visibility:hidden}
.hn-mobile:not(.hn-mobile-editing) .drag-handle>* {display:none!important}
/* No move tab: drag a selected card, or hold any card and drag. The lift shows it is moving. */
.hn-mobile:not(.hn-mobile-editing) .card.dragging {box-shadow:0 14px 34px #13271b40}
.hn-mobile.hn-mobile-editing .hn-mobile-header,.hn-mobile.hn-mobile-editing .hn-mobile-dock,.hn-mobile.hn-mobile-editing .hn-mobile-selected {display:none}
.hn-mobile.hn-mobile-editing .hn-mobile-editor-header {display:flex;top:var(--hn-vtop,0px);left:0;right:0;height:calc(56px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 8px 0;background:#fffefa;color:#253d35;border-bottom:1px solid #d8dedb;z-index:142}
.hn-mobile-editor-header strong {flex:1;font-size:14px;text-align:center}
.hn-mobile-editor-header .hn-mobile-done {background:#356346;color:white}
/* The board clips its canvas (styles.css, V15 backgrounds) and pans the camera instead; the editor scrolls a card taller than the screen. */
.hn-mobile.hn-mobile-editing .canvas-area {position:fixed!important;z-index:140;left:0;right:0;top:calc(var(--hn-vtop,0px) + 56px + env(safe-area-inset-top));height:calc(var(--hn-vh,100dvh) - 90px - env(safe-area-inset-top))!important;overflow:auto!important;touch-action:pan-y pinch-zoom;background:#fffefa!important;overscroll-behavior:contain}
/* The edited card fills the editor, so its colour runs to the bottom of the screen. */
.hn-mobile.hn-mobile-editing .world {transform:none!important;width:100%!important;min-height:100%;height:auto!important;position:relative;display:flex!important;flex-direction:column}
.hn-mobile.hn-mobile-editing .world> :not(.hn-editing-card) {display:none!important}
body.hn-mobile.hn-mobile-editing #world>.card.hn-editing-card {position:relative!important;inset:auto!important;left:0!important;top:0!important;width:100%!important;height:auto!important;min-height:100%;flex:1 0 auto;max-height:none!important;border:0!important;outline:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important;margin:0!important}
body.hn-mobile.hn-mobile-editing #world>.card.hn-editing-card>.drag-handle,.hn-mobile.hn-mobile-editing .scene-read-more {display:none!important}
body.hn-mobile.hn-mobile-editing #world>.card.hn-editing-card>.card-body {max-height:none!important;height:auto!important;min-height:220px;overflow:visible!important;padding:20px 18px 36px;pointer-events:auto!important}
.hn-mobile.hn-mobile-editing .rich-text-editor {min-height:180px;font-size:17px;line-height:1.9;overflow:visible;touch-action:pan-y pinch-zoom}
.hn-mobile.hn-mobile-editing :is(input,textarea,select) {font-size:16px!important;min-height:44px}
/* Editor controls sized for a finger. Checkboxes keep a 24px box inside a 44px row. */
body.hn-mobile.hn-mobile-editing .hn-editing-card input[type=checkbox] {width:24px!important;height:24px!important;min-width:24px;min-height:24px!important;margin-block:10px!important;flex:none}
body.hn-mobile.hn-mobile-editing .hn-editing-card :is(.hn-task-due,.collapse-column,.column-add-note) {min-width:44px!important;min-height:44px!important;display:inline-flex!important;align-items:center;justify-content:center;flex:none}
body.hn-mobile.hn-mobile-editing .hn-editing-card .open-link {display:inline-flex!important;align-items:center;min-height:44px;padding-inline:6px;font-size:15px!important}
body.hn-mobile.hn-mobile-editing .hn-editing-card .hn-link-preview-edit {min-height:44px!important;padding-inline:12px!important;font-size:14px!important}
body.hn-mobile.hn-mobile-editing .hn-editing-card .add-check-item {display:flex!important;align-items:center;justify-content:center;gap:8px;width:100%!important;height:auto!important;min-height:44px;margin-top:12px;font-size:15px;color:inherit}
body.hn-mobile.hn-mobile-editing .hn-editing-card .add-check-item::after {content:attr(aria-label)}
.hn-mobile.hn-mobile-editing .web-status-dock {top:calc(var(--hn-vtop,0px) + var(--hn-vh,100dvh) - 32px);bottom:auto;z-index:142}
.hn-mobile.hn-mobile-editing .collaboration-cursors,.hn-mobile.hn-mobile-editing .collaboration-selections {display:none}
.hn-mobile .text-format-toolbar {position:fixed!important;left:8px!important;right:8px!important;top:calc(58px + env(safe-area-inset-top))!important;max-width:calc(100vw - 16px)!important;z-index:143;overflow-x:auto}
/* mobile.js marks the toolbar edges that still hide buttons. */
.hn-mobile.hn-mobile-editing #text-format-toolbar.hn-more-right {-webkit-mask-image:linear-gradient(to left,transparent,#000 40px);mask-image:linear-gradient(to left,transparent,#000 40px)}
.hn-mobile.hn-mobile-editing #text-format-toolbar.hn-more-left {-webkit-mask-image:linear-gradient(to right,transparent,#000 40px);mask-image:linear-gradient(to right,transparent,#000 40px)}
.hn-mobile.hn-mobile-editing #text-format-toolbar.hn-more-left.hn-more-right {-webkit-mask-image:linear-gradient(to right,transparent,#000 40px,#000 calc(100% - 40px),transparent);mask-image:linear-gradient(to right,transparent,#000 40px,#000 calc(100% - 40px),transparent)}
.hn-mobile .modal {width:calc(100vw - 24px);max-height:var(--hn-vh,90dvh);overflow:auto;box-sizing:border-box}
.hn-mobile .modal-backdrop {z-index:180}
/* Dialogs with text fields open at the top, where the phone keyboard cannot cover them. */
body.hn-mobile .modal-backdrop {place-items:start center;padding-top:calc(var(--hn-vtop,0px) + 12px + env(safe-area-inset-top));box-sizing:border-box}
body.hn-mobile .modal {max-height:calc(var(--hn-vh,100dvh) - 24px - env(safe-area-inset-top))}
body.hn-mobile dialog:is(.hn-workspace-dialog,.scene-dialog,.web-dialog)[open] {margin:calc(var(--hn-vtop,0px) + 12px + env(safe-area-inset-top)) auto auto;max-height:calc(var(--hn-vh,100dvh) - 24px - env(safe-area-inset-top))}
/* iOS zooms the page into any field under 16px; board cards stay at their saved size. */
body.hn-mobile :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file]),select,textarea):not(#world *) {font-size:max(16px,1em)}
.hn-mobile.no-project :is(.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected),.hn-mobile.web-starting :is(.hn-mobile-header,.hn-mobile-dock,.hn-mobile-selected) {display:none}

.hn-mobile .topbar:has(#project-settings[open]) .topbar-actions> :not(#project-settings) {display:none!important}

/* In the phone editor, only the table grid scrolls sideways. Its title and
   actions remain in view while extra columns can still be reached by touch. */
