/* Mobile post editor. Theme colors come from the application's existing palette. */
@media (max-width: 767px) {
  .nx-post-launcher:empty { display: none; }
  .nx-post-launcher { display: inline-flex; flex: 0 0 auto; align-items: center; }
  html:root .nx-post-launcher__button {
    display: grid !important; place-items: center; width: 38px; height: 38px;
    min-width: 38px; min-height: 38px; padding: 8px !important; margin: 0 2px;
    background: var(--mobile-theme-surface-alt, #e9f0f8) !important;
    color: var(--mobile-theme-accent, #08738d) !important;
    border: 1px solid var(--mobile-theme-line, #cbd5e1) !important;
    border-radius: 13px !important; box-shadow: none !important;
  }
  .nx-post-launcher__button svg { width: 21px; height: 21px; }
}
.nx-post {
  --post-bg: var(--mobile-theme-background, #070d18);
  --post-surface: var(--mobile-theme-surface, #101d30);
  --post-soft: var(--mobile-theme-surface-alt, #162941);
  --post-ink: var(--mobile-theme-text, #edf5ff);
  --post-muted: var(--mobile-theme-component-muted, var(--mobile-theme-muted, #b0c1d6));
  --post-border: var(--mobile-theme-line, #263a51);
  --post-accent: var(--mobile-theme-component-accent, var(--mobile-theme-accent, #00d7e8));
  --post-accent-ink: var(--mobile-theme-on-control, var(--mobile-theme-on-accent, #000));
  position: fixed; left: 0; right: 0; z-index: 25000; width: 100%;
  display: flex; flex-direction: column; box-sizing: border-box;
  background: var(--post-bg); color: var(--post-ink); font: 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  isolation: isolate; overflow: hidden; outline: none;
  padding-top: env(safe-area-inset-top, 0px);
  -webkit-text-size-adjust: 100%;
}
.nx-post *, .nx-post *::before, .nx-post *::after { box-sizing: border-box; }
.nx-post [hidden] { display: none !important; }
html:root .nx-post button, html:root .nx-post input, html:root .nx-post select, html:root .nx-post textarea {
  font: inherit; color: var(--post-ink); letter-spacing: normal; text-transform: none;
  opacity: 1; filter: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  background-image: none; text-shadow: none;
}
html:root .nx-post .nx-post__button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 9px 12px; border-radius: 14px !important;
  border: 1px solid var(--post-border); background: var(--post-surface);
  color: var(--post-ink); box-shadow: none; font-size: 14px; font-weight: 600;
  line-height: 1.3; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.nx-post button svg { width: 21px; height: 21px; flex: 0 0 auto; }
html:root .nx-post button:disabled { opacity: .46; cursor: default; }
html:root .nx-post .nx-post__icon-button { width: 44px; height: 44px; padding: 10px; flex: 0 0 auto; }
.nx-post__header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--post-surface); border-bottom: 1px solid var(--post-border); flex: 0 0 auto; }
.nx-post__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nx-post__title strong { font-size: 17px; line-height: 1.3; }
.nx-post__title small { color: var(--post-muted); font-size: 11px; line-height: 1.35; margin-top: 3px; }
.nx-post__toolbar { display: flex; flex: 0 0 auto; gap: 5px; overflow-x: auto; overscroll-behavior-x: contain; padding: 8px 10px; scrollbar-width: none; background: var(--post-surface); border-bottom: 1px solid var(--post-border); }
.nx-post__toolbar::-webkit-scrollbar { display: none; }
html:root .nx-post .nx-post__tool { flex: 0 0 44px; width: 44px; padding: 8px 4px; font-size: 16px; }
html:root .nx-post .nx-post__button.is-active { color: var(--post-accent-ink); background: var(--post-accent); border-color: var(--post-accent); }
.nx-post__scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scroll-padding-block: 20px; }
html:root .nx-post .nx-post__editor {
  display: block; min-height: min(45vh, 320px); width: 100%; margin-top: 10px; padding: 18px 16px 28px;
  color: var(--post-ink); background: var(--post-surface); border: 1px solid var(--post-border);
  border-radius: 20px !important; box-shadow: none; outline: none; overflow-wrap: anywhere;
  font-size: 16px; caret-color: var(--post-accent); -webkit-user-select: text; user-select: text;
}
html:root .nx-post .nx-post__editor:focus { border-color: var(--post-accent); }
.nx-post__editor:empty::before { content: attr(data-placeholder); color: var(--post-muted); pointer-events: none; }
.nx-post__rich { color: var(--post-ink); overflow-wrap: anywhere; word-break: normal; }
.nx-post__rich p, .nx-post__rich div { margin-block: 0 9px; }
.nx-post__rich h1, .nx-post__rich h2, .nx-post__rich h3 { line-height: 1.3; margin: 12px 0 10px; font-weight: 700; }
.nx-post__rich h1 { font-size: 28px; } .nx-post__rich h2 { font-size: 24px; } .nx-post__rich h3 { font-size: 20px; }
.nx-post__rich a { color: var(--post-accent); text-decoration: underline; text-underline-offset: 3px; }
.nx-post__rich blockquote { margin: 12px 0; padding: 10px 12px; border-left: 3px solid var(--post-accent); border-radius: 0 12px 12px 0; background: var(--post-soft); }
.nx-post__rich pre { white-space: pre-wrap; font-family: ui-monospace, monospace; margin: 12px 0; padding: 12px; border: 1px solid var(--post-border); border-radius: 12px; background: var(--post-soft); }
.nx-post__rich ul, .nx-post__rich ol { padding-left: 24px; margin-block: 10px; }
.nx-post__rich li { margin-block: 4px; }
html:root .nx-post .nx-post__chip {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 12px;
  margin: 10px 0; border: 1px solid var(--post-border); border-radius: 14px !important;
  background: var(--post-soft); color: var(--post-ink); font-size: 14px; line-height: 1.3; user-select: none;
}
.nx-post__chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nx-post__chip > small { flex-shrink: 0; color: var(--post-muted); font-size: 11px; }
.nx-post__panel { margin-bottom: 10px; padding: 12px; border: 1px solid var(--post-border); border-radius: 18px; background: var(--post-surface); }
.nx-post__panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nx-post__panel-head strong { font-size: 15px; }
.nx-post__field { display: flex; flex-direction: column; min-width: 0; gap: 5px; font-size: 13px; font-weight: 600; }
.nx-post__field span { color: var(--post-muted); }
html:root .nx-post input:not([type=checkbox]):not([type=color]), html:root .nx-post select, html:root .nx-post textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--post-border); border-radius: 12px !important;
  background: var(--post-soft); color: var(--post-ink); box-shadow: none;
  outline: none; font-size: 16px;
}
html:root .nx-post input::placeholder, html:root .nx-post textarea::placeholder { color: var(--post-muted); opacity: 1; }
html:root .nx-post input:focus, html:root .nx-post select:focus, html:root .nx-post textarea:focus { border-color: var(--post-accent); }
.nx-post__format, .nx-post__link-panel, .nx-post__ai { display: flex; flex-direction: column; gap: 12px; }
.nx-post__tools { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-post__colors { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; }
.nx-post__colors label { display: flex; align-items: center; gap: 7px; }
html:root .nx-post input[type=color] { width: 44px; height: 44px; padding: 3px; border: 1px solid var(--post-border); border-radius: 12px; background: var(--post-soft); }
.nx-post__emoji-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 5px; margin-top: 12px; max-height: 210px; overflow: auto; }
html:root .nx-post .nx-post__emoji-grid button { font-size: 26px; font-weight: 400; padding: 7px; border-color: transparent; background: var(--post-soft); }
.nx-post__attachment-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nx-post__attachment-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding: 8px; border-radius: 14px; background: var(--post-soft); }
.nx-post__attachment-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nx-post__attachment-row strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-post__attachment-row small { color: var(--post-muted); font-size: 11px; }
html:root .nx-post .nx-post__attachment-row button { flex: 0 0 36px; min-width: 36px; padding: 7px; }
.nx-post__hint { color: var(--post-muted); font-size: 12px; line-height: 1.5; margin: 10px 0 0; }
.nx-post__ai-settings { display: grid; grid-template-columns: 1fr; gap: 9px; }
.nx-post__check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.nx-post__check input { width: 20px; height: 20px; accent-color: var(--post-accent); }
.nx-post__ai-result { padding: 12px; margin-top: 6px; border-radius: 14px; border: 1px solid var(--post-border); background: var(--post-soft); max-height: 260px; overflow: auto; }
.nx-post__preview { padding-top: 6px; }
.nx-post__preview-card { padding: 16px; border: 1px solid var(--post-border); border-radius: 20px; background: var(--post-surface); }
.nx-post__preview-author { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.nx-post__preview-author > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--post-accent-ink); background: var(--post-accent); }
.nx-post__preview-author > div { display: flex; flex-direction: column; }
.nx-post__preview-author small { color: var(--post-muted); font-size: 11px; }
.nx-post__preview-attachment { margin: 12px 0; padding: 0; border: 1px solid var(--post-border); border-radius: 14px; overflow: hidden; background: var(--post-soft); }
.nx-post__preview-attachment img, .nx-post__preview-attachment video { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.nx-post__preview-attachment audio { display: block; width: 100%; padding: 6px; }
.nx-post__preview-attachment figcaption { display: flex; flex-direction: column; padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; }
.nx-post__preview-attachment figcaption small { color: var(--post-muted); font-size: 11px; }
.nx-post__file-preview { display: flex; align-items: center; gap: 10px; padding: 14px; }
.nx-post__file-preview svg { width: 26px; height: 26px; flex: 0 0 auto; color: var(--post-accent); }
.nx-post__footer { display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--post-border); background: var(--post-surface); flex: 0 0 auto; }
.nx-post__count { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--post-muted); font-size: 12px; }
.nx-post__count small { font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
html:root .nx-post .nx-post__primary { background: var(--post-accent); border-color: var(--post-accent); color: var(--post-accent-ink); font-weight: 700; }
html:root .nx-post .nx-post__publish { padding: 12px 16px; min-height: 46px; max-width: 62%; }
.nx-post__error, .nx-post__notice { margin-bottom: 10px; padding: 12px; border-radius: 14px; background: var(--post-soft); color: var(--post-ink); font-size: 13px; border: 1px solid var(--post-border); }
.nx-post__error { border-left: 3px solid #cd536f; }
.nx-post__notice { border-left: 3px solid var(--post-accent); }
.nx-post__reply { position: relative; display: flex; flex-direction: column; padding: 10px 55px 10px 12px; border-left: 3px solid var(--post-accent); background: var(--post-soft); border-radius: 12px; font-size: 13px; margin-bottom: 10px; }
.nx-post__reply-clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 40px; padding: 8px !important; }
.nx-post__reply strong { color: var(--post-accent); }
.nx-post__reply span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nx-post__draft-actions { margin-top: 18px; padding-bottom: 12px; text-align: center; font-size: 13px; }
.nx-post__draft-actions button { margin: 3px; }
html:root .nx-post .nx-post__quiet { color: var(--post-muted); border-color: transparent; background: transparent; }
html:root .nx-post .nx-post__danger { color: #c34063; }
html:root .nx-post .is-recording { border-color: #cd536f; }
.nx-post__recording { color: var(--post-ink); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border: 1px solid #cd536f; border-radius: 14px; margin-bottom: 10px; background: var(--post-surface); font-size: 13px; }
.nx-post :focus-visible { outline: 2px solid var(--post-accent); outline-offset: 2px; }
@media (min-width: 768px) { .nx-post-launcher { display: none; } }
@media (max-width: 350px) {
  .nx-post__header, .nx-post__footer { gap: 7px; padding-inline: 9px; }
  .nx-post__scroll { padding: 9px; }
  .nx-post__title strong { font-size: 16px; }
  html:root .nx-post .nx-post__publish { padding-inline: 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .nx-post * { scroll-behavior: auto !important; transition: none !important; } }
