/* Shared journey utilities, deliberately scoped to the train. */
/* A non-scrolling overflow:auto body traps sticky controls; clip keeps the page scroll root. */
body.hx-immersive-page{overflow-x:clip;overflow-y:visible}
.hx-reader-tools,.hx-reader,.hx-draft,.hx-editor-toggle,.hx-guide-page{font-family:var(--theme-font-body,Vazirmatn),sans-serif;direction:rtl;box-sizing:border-box}
.hx-reader-tools{position:sticky;top:var(--hx-header-height,0px);z-index:35;display:flex;align-items:center;flex-wrap:wrap;gap:8px;max-width:1180px;margin:12px auto;padding:8px 12px;border:1px solid var(--theme-color-border,#655782);border-radius:16px;background:var(--theme-color-surface,#201a31);color:var(--theme-color-text,#eee8f5)}
.hx-reader-tools>.hx-help{margin-inline-start:auto}
.hx-reader-tools a,.hx-reader-tools .hx-help__fab,.hx-draft button,.hx-editor-toggle{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 14px;border:1px solid var(--theme-color-border,#655782);border-radius:12px;background:var(--theme-color-surface,#201a31);color:var(--theme-color-text,#eee8f5);font:inherit;font-size:.88rem;cursor:pointer;text-decoration:none}
.hx-reader-tools .hx-help__fab{position:static;inset:auto;box-shadow:none;margin-inline-start:auto;transform:none;width:auto;height:auto}
.hx-reader-tools .hx-reader-open{font-weight:700;background:var(--theme-color-surface-2,#352841)}
.hx-reader{position:fixed;inset:0;margin:auto;width:min(990px,calc(100% - 32px));max-width:none;height:min(760px,calc(100dvh - 40px));max-height:calc(100dvh - 40px);padding:0;border:1px solid var(--theme-color-border,#655782);border-radius:22px;background:var(--theme-color-surface,#201a31);color:var(--theme-color-text,#eee8f5);overflow:hidden;box-shadow:0 24px 80px #0008}
.hx-reader[open]{display:flex;flex-direction:column}.hx-reader::backdrop{background:#100b20c9;backdrop-filter:blur(5px)}
.hx-reader__header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;border-bottom:1px solid var(--theme-color-border,#655782);flex-shrink:0}
.hx-reader__header span,.hx-reader>footer{color:var(--theme-color-muted,#c7bdd7);font-size:.8rem}.hx-reader__header h2{font-size:1.3rem;margin:4px 0 0;color:inherit}.hx-reader__close{width:44px;height:44px;flex-shrink:0;border:1px solid var(--theme-color-border,#655782);border-radius:12px;background:transparent;color:inherit;font-size:28px;cursor:pointer}
.hx-reader__layout{display:grid;grid-template-columns:220px minmax(0,1fr);min-height:0;flex:1}.hx-reader nav{padding:14px;border-inline-end:1px solid var(--theme-color-border,#655782);overflow:auto}.hx-reader nav a,.hx-guide-page nav a{display:block;min-height:44px;padding:10px 12px;border-radius:10px;color:inherit;text-decoration:none;font-size:.9rem;line-height:1.8}.hx-reader nav a[aria-current],.hx-guide-page nav a[aria-current]{background:var(--theme-color-surface-2,#352841);box-shadow:inset -3px 0 var(--theme-color-accent,#e4bc73);font-weight:700}
.hx-reader__scroll{overflow:auto;overscroll-behavior:contain;padding:24px 30px;min-width:0}.hx-reader article,.hx-guide-page article{font-size:1rem;line-height:2.1;overflow-wrap:anywhere}.hx-reader article h2{font-size:1.5rem;margin:0 0 20px;color:inherit}.hx-reader article h3,.hx-guide-page article h3{font-size:1.12rem;margin:24px 0 8px;color:inherit}.hx-reader article p,.hx-guide-page article p{margin:0 0 16px}.hx-reader li,.hx-guide-page li{margin-bottom:8px}.hx-reader>footer{padding:12px 24px;border-top:1px solid var(--theme-color-border,#655782);line-height:1.9;flex-shrink:0}.hx-reader-visible{overflow:hidden}
.hx-draft{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 20px;padding:14px 18px;margin:16px 0;border:1px solid var(--theme-color-border);border-radius:14px;background:var(--theme-color-surface);line-height:1.8}.hx-draft strong{font-size:.85rem}.hx-draft p{margin:3px 0;font-size:.8rem;color:var(--theme-color-muted)}.hx-draft [data-state=offline],.hx-draft [data-state=conflict]{color:var(--theme-color-accent)}.hx-draft__actions{display:flex;gap:6px;flex-wrap:wrap}.hx-draft button{font-size:.78rem;padding:7px 10px}.hx-draft__conflict{flex-basis:100%;padding:12px 0 0;border-top:1px solid var(--theme-color-border)}
.hx-editor-toggle{margin:10px 0;font-size:.82rem}.hx-editor-simple .pv2-ed__bar,.hx-editor-simple .pv2-ed__hint,.hx-editor-simple .xoops-editor-toolbar,.hx-editor-simple .tox-editor-header,.hx-editor-simple .mce-toolbar-grp{display:none!important}.hx-story-editor textarea,.hx-profile-free-editor textarea{min-height:320px;line-height:2;resize:vertical}.hx .hx-writing-guide--full{padding:14px 18px}.hx-writing-guide--full summary{min-height:32px;cursor:pointer}
.hx-guide-page{line-height:2}.hx-guide-page>nav{display:flex;flex-wrap:wrap;gap:8px;margin:24px 0}.hx-guide-page>article{max-width:760px;margin:0 auto 32px}
.hx-draft__conflict details{margin-top:16px}.hx-draft__conflict summary{min-height:44px;cursor:pointer;font-size:.86rem}.hx-draft__conflict h3{font-size:.9rem;margin:12px 0 6px}.hx-draft__conflict pre{max-height:220px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:.85rem;padding:12px;border:1px solid var(--theme-color-border);border-radius:10px;color:var(--theme-color-text);background:var(--theme-color-surface)}
.hx-editor-simple .pv2-ed__foot{display:none!important}
.hx-story-editor.hx-editor-simple textarea{height:clamp(300px,45dvh,420px)}
.hx :is(input,textarea,select){scroll-margin-block:100px 160px}.hx :is(a,button,input,textarea,select,summary):focus-visible,.hx-reader :is(a,button):focus-visible,.hx-reader-tools :is(a,button):focus-visible{outline:3px solid var(--theme-color-accent,#e4bc73);outline-offset:3px}
.hx [hidden],.hx-reader [hidden],.hx-draft [hidden]{display:none!important}
@media(max-width:760px){
 .hx-reader-tools{margin:8px 10px;border-radius:12px;padding:6px;gap:5px}.hx-reader-tools a,.hx-reader-tools .hx-help__fab{font-size:.77rem;padding:8px 10px;min-height:44px}
 .hx-reader{width:100%;height:100dvh;max-height:100dvh;max-width:100%;margin:0;border-radius:0;border:0}.hx-reader__header{padding:12px 16px;padding-top:max(12px,env(safe-area-inset-top))}.hx-reader__header h2{font-size:1.12rem}.hx-reader__layout{display:flex;flex-direction:column}.hx-reader nav{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;padding:8px;border-inline:0;border-bottom:1px solid var(--theme-color-border,#655782)}.hx-reader nav a{white-space:nowrap;font-size:.8rem;min-height:44px}.hx-reader__scroll{padding:20px 18px;flex:1;min-height:0}.hx-reader article{font-size:1rem;line-height:2}.hx-reader article h2{font-size:1.3rem}.hx-reader>footer{padding:10px 16px max(10px,env(safe-area-inset-bottom))}
.hx-draft{padding:12px}.hx-draft__actions{width:100%;justify-content:flex-start}
 .hx .hx-form-footer{position:sticky;bottom:calc(var(--hx-cookie-height,0px) + env(safe-area-inset-bottom,0px));z-index:20;background:var(--theme-color-surface);border:1px solid var(--theme-color-border);border-radius:12px;padding:12px;box-shadow:0 -8px 24px #0002;gap:10px;display:flex;flex-wrap:wrap}.hx .hx-form-footer .hx-button{min-height:48px;flex:1;justify-content:center}
 .hx :is(textarea,input[type=text],input[type=search],select){font-size:16px!important;min-width:0;max-width:100%}.hx .hx-story-editor textarea,.hx .hx-profile-free-editor textarea{min-height:300px}.hx-profile-fields{grid-template-columns:1fr!important}.hx .hx-character-row{flex-wrap:wrap;gap:12px}.hx .hx-character-row__main{min-width:0}.hx .hx-char-toolbar{gap:12px}.hx .hx-char-toolbar>*{min-width:0;max-width:100%}.hx .hx-char-toolbar__field select{min-height:44px}.hx .hx-dialog__actions button{min-height:48px}.hx .hx-profile-mode__button{min-height:48px}
}
@media(prefers-reduced-motion:reduce){.hx *,.hx-reader *{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}
body[data-hx-ceremony]>.hx-reader-tools{position:fixed;top:8px;inset-inline:12px;z-index:1200;width:max-content;max-width:calc(100% - 24px);margin:0 auto;font-family:Vazirmatn,sans-serif}
body[data-hx-ceremony] :is(.hx-reader-tools,.hx-reader){font-family:var(--hx-type)}
body[data-hx-ceremony] .hx-start-form{max-height:calc(100dvh - 108px);overflow:auto;margin-top:24px}
@media(max-width:760px){body[data-hx-ceremony] .form-modal{max-height:calc(100dvh - 100px);overflow:auto}body[data-hx-ceremony] .hx-start-form{top:55%;width:calc(100% - 32px)}body[data-hx-ceremony] #studentInput{font-size:16px}body[data-hx-ceremony] #send-btn{min-height:44px}}
.hx-result-instruction{max-width:760px;margin:8px 0 0;color:var(--hx-muted);font-size:.9rem;line-height:1.95}

.hx-final-copy{white-space:pre-line}
