.student-board-comment-kind {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.student-board-comment-kind button {
  min-height: 42px;
  border: 1px solid #d9e1ee;
  border-radius: 12px;
  background: #f7f9fc;
  color: #536176;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.student-board-comment-kind button.is-active {
  border-color: #6d62e8;
  background: #efedff;
  color: #4439b8;
  box-shadow: inset 0 0 0 1px #6d62e8;
}

.student-board-emoticon-picker {
  padding: 14px;
  border: 1px solid #e0e3f2;
  border-radius: 16px;
  background: linear-gradient(145deg, #fbfaff, #f6f9ff);
}

.student-board-emoticon-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.student-board-emoticon-picker-head div {
  display: grid;
  gap: 2px;
}

.student-board-emoticon-picker-head span,
.student-board-emoticon-status {
  margin: 0;
  color: #6f7889;
  font-size: .78rem;
}

.student-board-emoticon-picker-head button {
  border: 0;
  background: transparent;
  color: #5549c8;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}

.student-board-emoticon-status {
  padding: 9px 0;
}

.student-board-emoticon-status[data-tone="bad"] { color: #b73345; }
.student-board-emoticon-status[data-tone="good"] { color: #287153; }

.student-board-emoticon-sets {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 10px;
}

.student-board-emoticon-sets button {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  max-width: 150px;
  padding: 6px 9px;
  border: 1px solid #d9ddeb;
  border-radius: 999px;
  background: #fff;
  color: #4b566a;
  font: inherit;
  font-size: .76rem;
  cursor: pointer;
}

.student-board-emoticon-sets button.is-active {
  border-color: #7266e5;
  background: #ece9ff;
  color: #4439b8;
  font-weight: 800;
}

.student-board-emoticon-sets img {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  object-fit: contain;
}

.student-board-emoticon-sets span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-board-emoticon-assets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.student-board-emoticon-assets button {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  padding: 6px 3px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #fff;
  color: #667085;
  font: inherit;
  font-size: .66rem;
  cursor: pointer;
}

.student-board-emoticon-assets button:hover,
.student-board-emoticon-assets button.is-selected {
  border-color: #6d62e8;
  background: #f0eeff;
}

.student-board-emoticon-assets img {
  width: min(64px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
}

.student-board-emoticon-assets span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-board-emoticon-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 8px;
  text-align: center;
  color: #778196;
}

.student-board-comment-emoticon {
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.student-board-comment-emoticon-placeholder {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 10px;
  background: #f1f3f6;
  color: #697386;
  font-size: .82rem;
}

body.board-page .board-comment-compose-modal {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

body.board-page .board-comment-compose-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

body.board-page .board-comment-compose-body > label,
body.board-page .student-board-comment-kind,
body.board-page .student-board-emoticon-picker-head,
body.board-page .student-board-emoticon-status,
body.board-page .student-board-emoticon-sets {
  flex: 0 0 auto;
}

body.board-page .student-board-emoticon-picker:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

body.board-page .student-board-emoticon-assets {
  align-content: start;
  flex: 1 1 176px;
  min-height: 132px;
  max-height: min(30dvh, 272px);
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

body.board-page .board-comment-compose-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--card-bg, #fff);
}

body.board-page .board-comment-compose-modal,
body.board-page .student-board-emoticon-assets {
  scrollbar-color: #9aa0aa transparent;
  scrollbar-width: thin;
}

body.board-page .board-comment-compose-modal::-webkit-scrollbar,
body.board-page .student-board-emoticon-assets::-webkit-scrollbar {
  width: 8px;
}

body.board-page .board-comment-compose-modal::-webkit-scrollbar-thumb,
body.board-page .student-board-emoticon-assets::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #9aa0aa;
}

/* Approved white/violet picker; the asset grid remains the vertical scroll owner. */
body.board-page #studentBoardCommentForm { background: #30264b66; backdrop-filter: blur(3px); }
body.board-page #studentBoardCommentForm .board-comment-compose-modal { width: min(616px, calc(100vw - 40px)); max-width: 616px; max-height: calc(100dvh - 64px); padding: 28px; border: 1px solid #e4dfed; border-radius: 20px; background: #fff; color: #292432; box-shadow: 0 24px 80px #24134333; }
body.board-page #studentBoardCommentForm .modal-header { flex: 0 0 auto; padding: 0; border: 0; }
body.board-page #studentBoardCommentForm h2 { font-size: 22px; line-height: 1.35; }
body.board-page #studentBoardCommentForm .board-comment-compose-meta { display: none; }
body.board-page #studentBoardCommentForm .close-btn { width: 44px; height: 44px; border: 0; background: #fff; color: #42394d; font-size: 28px; }
body.board-page #studentBoardCommentForm .board-comment-compose-context { flex: 0 0 auto; margin: 8px 0 0; padding: 0; border: 0; background: #fff; color: #756a80; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
body.board-page #studentBoardCommentForm .board-comment-compose-body { gap: 12px; margin-top: 14px; }
body.board-page #studentBoardCommentForm .board-comment-compose-body > label { gap: 5px; color: #61546f; font-size: 12px; }
body.board-page #studentBoardCommentForm select { min-height: 36px; padding: 6px 10px; border: 1px solid #e1dbe9; border-radius: 8px; background: #fff; color: #453b50; }
body.board-page #studentBoardCommentForm .student-board-comment-kind { display: flex; gap: 0; border-bottom: 1px solid #e6e0ee; }
body.board-page #studentBoardCommentForm .student-board-comment-kind button { min-width: 126px; padding: 9px 18px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: #fff; box-shadow: none; color: #877c92; }
body.board-page #studentBoardCommentForm .student-board-comment-kind button.is-active { border-bottom-color: #7149d6; color: #7149d6; }
body.board-page #studentBoardCommentForm .student-board-emoticon-picker { padding: 0; border: 0; border-radius: 0; background: #fff; }
body.board-page #studentBoardCommentForm .student-board-emoticon-picker-head strong { font-size: 15px; }
body.board-page #studentBoardCommentForm .student-board-emoticon-picker-head span { color: #81758b; font-size: 12px; }
body.board-page #studentBoardCommentForm .student-board-emoticon-status { padding: 7px 0; }
body.board-page #studentBoardCommentForm .student-board-emoticon-sets { padding-bottom: 10px; }
body.board-page #studentBoardCommentForm .student-board-emoticon-assets { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; flex-basis: 390px; min-height: 130px; max-height: min(48dvh, 420px); }
body.board-page #studentBoardCommentForm .student-board-emoticon-assets button { position: relative; min-height: 122px; padding: 8px 4px; border: 1px solid #e4deec; border-radius: 14px; font-size: 14px; color: #43384f; }
body.board-page #studentBoardCommentForm .student-board-emoticon-assets button.is-selected { border: 2px solid #7149d6; padding: 7px 3px; background: #faf8ff; }
body.board-page #studentBoardCommentForm .student-board-emoticon-assets button.is-selected::after { content: "✓"; position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #7149d6; color: #fff; }
body.board-page #studentBoardCommentForm .student-board-emoticon-assets img { width: min(82px, 100%); }
body.board-page #studentBoardCommentForm .board-comment-compose-footer { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 14px; padding: 10px 0 0; border: 0; background: #fff; }
body.board-page #studentBoardCommentForm .board-comment-compose-footer p { flex-basis: 100%; margin: 0 0 2px; color: #80758a; font-size: 12px; }
body.board-page #studentBoardCommentForm #studentBoardCommentClear { margin-right: auto; }
body.board-page #studentBoardCommentForm .board-comment-compose-footer button { min-height: 46px; padding: 8px 19px; border: 1px solid #ddd5e8; border-radius: 9px; background: #fff; color: #554760; font: inherit; font-weight: 700; }
body.board-page #studentBoardCommentForm #studentBoardCommentSave { border-color: #7149d6; background: #7149d6; color: #fff; }
body.board-page #studentBoardCommentForm button:focus-visible { outline: 3px solid #b9a2ed; outline-offset: 2px; }
@media (max-width: 560px) {
  body.board-page #studentBoardCommentForm .board-comment-compose-modal { padding: 16px; }
  body.board-page #studentBoardCommentForm .student-board-emoticon-assets { gap: 7px; }
  body.board-page #studentBoardCommentForm .student-board-emoticon-assets button { min-height: 85px; font-size: 10px; }
}

/* V4: keep comment actions outside the scrolling picker, including short viewports. */
body.board-page #studentBoardCommentForm {
  padding: 12px;
}
body.board-page #studentBoardCommentForm .board-comment-compose-modal {
  width: min(616px, 100%);
  max-height: calc(100dvh - 24px);
  padding: 16px;
  overflow: hidden;
}
body.board-page #studentBoardCommentForm .modal-header h2 {
  margin: 0;
  font-size: 18px;
}
body.board-page #studentBoardCommentForm .modal-header {
  align-items: center;
  margin: 0;
}
body.board-page #studentBoardCommentForm .close-btn {
  width: 36px;
  height: 36px;
}
body.board-page #studentBoardCommentForm .board-comment-compose-context {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 2px;
}
body.board-page #studentBoardCommentForm .board-comment-compose-context:empty {
  display: none;
}
body.board-page #studentBoardCommentForm .board-comment-compose-body {
  gap: 8px;
  margin-top: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.board-page #studentBoardCommentForm .board-comment-compose-body > label {
  margin-top: 0;
}
body.board-page #studentBoardCommentForm .student-board-emoticon-picker:not([hidden]) {
  min-height: 200px;
}
body.board-page #studentBoardCommentForm .student-board-emoticon-picker-head button {
  flex: 0 0 auto;
  white-space: nowrap;
}
body.board-page #studentBoardCommentForm .student-board-emoticon-status {
  padding: 4px 0;
}
body.board-page #studentBoardCommentForm .student-board-emoticon-sets {
  padding-bottom: 4px;
}
body.board-page #studentBoardCommentForm .student-board-emoticon-assets {
  flex-basis: 240px;
  min-height: 96px;
  max-height: min(42dvh, 360px);
}
body.board-page #studentBoardCommentForm .board-comment-compose-footer {
  position: static;
  flex: 0 0 auto;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e6e0ee;
}
body.board-page #studentBoardCommentForm .board-comment-compose-footer p {
  font-size: 11px;
  line-height: 1.4;
}
body.board-page #studentBoardCommentForm .board-comment-compose-footer button {
  min-height: 44px;
  padding: 8px 14px;
}
body.board-page #studentBoardCommentForm #studentBoardCommentSave {
  width: auto;
}
@media (max-width: 560px) {
  body.board-page #studentBoardCommentForm .board-comment-compose-modal {
    padding: 12px;
  }
}

@media (max-width: 760px) {
  .student-board-emoticon-assets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .student-board-comment-emoticon { width: 92px; height: 92px; }
}
