/* Both editors keep feedback and controls in flow below the editable area. */
#comment-dialog .compose-card, #detail .detail-memo-card {
  display: flex; flex-direction: column; min-height: 0; gap: 9px; padding: 12px;
  background: linear-gradient(145deg,#1d2434,#111624);
}
#comment-dialog .compose-card { height: 300px; max-height: 100%; }
#comment-dialog .compose-form { height: 300px; max-height: 100%; }
#comment-dialog .compose-card-head, .memo-heading {
  flex: none; display: flex; justify-content: flex-start; align-items: center; gap: 10px;
  padding: 0; min-height: 32px;
}
.compose-card-head .compose-close { margin-left: auto; }
#comment-dialog[data-mode="note"] .mode-badge, #detail .mode-badge { background: #26354b; color: #c1d6ee; }
#detail .memo-heading { font-weight: 600; }
#comment-dialog .compose-card #comment-text, #detail .detail-memo-card #memo {
  flex: 1 1 auto; width: 100%; min-width: 0; min-height: 56px; max-height: none; margin: 0;
  padding: 10px 12px; overflow-y: auto; resize: none; box-sizing: border-box;
  border: 1px solid #596478; border-radius: 11px; background: #0c1120; color: #f4f6ff;
  font-family: inherit; font-size: 16px; line-height: 1.5;
}
#comment-dialog .compose-card #comment-text:focus, #detail .detail-memo-card #memo:focus {
  border-color: #a3b9ff; outline: 2px solid #869eee40; outline-offset: 0;
}
#detail .detail-memo-card #memo { height: 126px; }
#comment-dialog .compose-footer, #detail .detail-memo-footer {
  flex: none; display: flex; align-items: center; gap: 8px; margin: 0; padding: 0;
}
.compose-status { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; column-gap: 7px; }
.compose-status .compose-count { flex: 0 0 auto; height: auto; color: #afbad0; font-size: 12px; }
.compose-status .voice-hint, #detail .detail-memo-footer .voice-hint {
  position: static; flex: 1 1 auto; margin: 0; min-width: 0; max-width: 100%; white-space: normal;
  color: #c6d4ed; font-size: 12px; line-height: 1.3; overflow: auto; max-height: 2.6em;
}
html:not([data-voice-enabled="1"]) .compose-voice-wrap, html:not([data-voice-enabled="1"]) .voice-hint { display: none !important; }
#comment-dialog .compose-send, #detail .detail-memo-footer .save-memo {
  flex: none; width: auto; min-width: 66px; height: 42px; min-height: 0; padding: 0 14px;
  border-radius: 11px; color: #10121c; background: #f3c7ab; font-size: 15px; font-weight: 650;
}
#comment-dialog[data-mode="note"] .compose-send, #detail .detail-memo-footer .save-memo { background: #bdcff1; }
#comment-dialog .compose-send:disabled, #detail .save-memo:disabled { opacity: .5; }
/* WebViews can round the visual viewport height up to a layout pixel. Keep
   the editing surface just inside its measured lower edge. */
#comment-dialog.is-keyboard-open, #detail.is-keyboard-open {
  --editor-height: calc(var(--vv-height) - 2px);
  height: var(--editor-height);
}
#comment-dialog.is-keyboard-open .compose-shell { padding: 4px 8px; }
#comment-dialog.is-keyboard-open .compose-card { padding: 6px 10px; gap: 4px; }
#comment-dialog.is-keyboard-open .compose-card-head { min-height: 0; }
#comment-dialog.is-keyboard-open .compose-close { height: 28px; }
#comment-dialog.is-keyboard-open .compose-card #comment-text { min-height: 0; max-height: calc(var(--vv-height) - 60px); }
#comment-dialog.is-keyboard-open .compose-send, #comment-dialog.is-keyboard-open .voice-toggle { height: 36px; min-height: 0; }
#detail.is-keyboard-open { padding: 4px 8px; }
#detail.is-keyboard-open .dialog-top { margin: 0; }
#detail.is-keyboard-open .detail-memo-card { margin: 0; padding: 5px 8px; gap: 3px; }
#detail.is-keyboard-open .detail-memo-card #memo { height: 70px; min-height: 0; }
#detail.is-keyboard-open:focus-within #detail-body { padding: 0; }
#detail.is-keyboard-open .detail-memo-card:focus-within { position: fixed; bottom: auto; top: var(--vv-top); left: 0; right: 0; height: var(--editor-height); max-height: 260px; margin: 0 auto; max-width: 680px; z-index: 2; }
#detail.is-keyboard-open .detail-memo-card:focus-within .memo-heading { min-height: 24px; }
#detail.is-keyboard-open .detail-memo-card:focus-within .save-memo, #detail.is-keyboard-open .voice-toggle { height: 36px; min-height: 0; }
#detail.is-keyboard-open .dialog-top .close {
  position: fixed; z-index: 3; top: calc(var(--vv-top) + 4px);
  right: max(8px, calc((100% - 664px) / 2)); width: 32px; height: 30px;
}
@media (max-width:420px) and (max-height:440px) {
  #detail:not(.is-keyboard-open) .detail-memo-card { padding: 8px; gap: 5px; }
  #detail:not(.is-keyboard-open) .detail-memo-card #memo { height: 22vh; }
}
