:root {
  color-scheme: light;
  --bg: #f8faf7;
  --panel: #ffffff;
  --ink: #24131b;
  --muted: #746a70;
  --line: #e5dfde;
  --general: #0f766e;
  --general-strong: #115e59;
  --general-soft: #e7f4f1;
  --adult: #a61955;
  --adult-strong: #7f123f;
  --adult-soft: #f7e8ef;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(44, 24, 32, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Malgun Gothic", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #eef7f4 0%, #fff5f8 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--general), var(--adult));
  color: white;
  font-weight: 800;
}

.brand h1,
.brand p,
.toolbar h2,
.toolbar p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab,
.ghost-button,
.segment,
.card-button,
.composer button,
.primary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.nav-tab {
  position: relative;
  padding: 0 10px;
  text-align: left;
  font-weight: 700;
}

.nav-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  place-items: center;
  border-radius: 999px;
  background: #e11d48;
  color: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.nav-tab.active,
.primary-button,
.composer button {
  border-color: var(--adult);
  background: var(--adult);
  color: white;
}

.safety-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.safety-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.main-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.notification-button {
  font-weight: 800;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.notification-panel strong {
  display: block;
  margin-bottom: 10px;
}

.notification-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.notification-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafa;
}

.notification-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.notification-help {
  padding: 10px;
  border: 1px solid #f3c7d8;
  border-radius: 8px;
  background: #fff3f7;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.notification-help strong {
  margin-bottom: 4px;
}

.view {
  display: none;
  padding: 30px 32px;
}

.view.active {
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.toolbar h2,
.topbar h2 {
  font-size: 26px;
}

.filter-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segment {
  min-width: 72px;
  border-color: transparent;
  background: transparent;
}

.segment.active {
  border-color: #2f2f2f;
  background: #2f2f2f;
  color: white;
}

.segment.general.active {
  border-color: var(--general);
  background: var(--general);
}

.segment.adult.active {
  border-color: var(--adult);
  background: var(--adult);
}

.segment.admin.active {
  border-color: #202020;
  background: #202020;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.profile-card,
.request-item,
.board-form,
.board-item,
.conversation-list,
.conversation-detail,
.profile-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-top-width: 4px;
}

.profile-card.general,
.request-item.general {
  border-top-color: var(--general);
}

.profile-card.adult,
.request-item.adult {
  border-top-color: var(--adult);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 {
  margin: 0;
  font-size: 20px;
}

.profile-link {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.profile-link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.badge.general {
  background: var(--general-soft);
  color: var(--general-strong);
}

.badge.adult {
  background: var(--adult-soft);
  color: var(--adult-strong);
}

.traits,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trait {
  padding: 7px 9px;
  border-radius: 8px;
  background: #f7f5f4;
  color: #453d41;
  font-size: 13px;
}

.profile-card.general .trait {
  background: #f1f8f6;
}

.profile-card.adult .trait {
  background: #fff6f9;
}

.bio {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card-button {
  padding: 0 12px;
  font-weight: 700;
}

.card-button.primary {
  border-color: var(--adult);
  background: var(--adult);
  color: white;
}

.profile-card.general .card-button.primary,
.conversation-title.general + .message-thread + .composer button {
  border-color: var(--general);
  background: var(--general);
}

.card-button.danger {
  color: var(--danger);
}

.own-profile-note {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #faf8f8;
  color: var(--muted);
  font-weight: 800;
}

.split-panel {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}

.conversation-list {
  overflow: auto;
}

.conversation-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  cursor: pointer;
  text-align: left;
}

.conversation-row.active.general {
  background: var(--general-soft);
}

.conversation-row.active.adult {
  background: var(--adult-soft);
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.avatar.general {
  background: var(--general);
}

.avatar.adult {
  background: var(--adult);
}

.conversation-copy {
  min-width: 0;
}

.conversation-copy strong {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
}

.conversation-copy span:last-child {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-detail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.empty-state,
.conversation-title {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.conversation-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.title-link {
  font-size: 16px;
}

.delete-conversation {
  margin-left: auto;
  min-height: 34px;
  border: 1px solid #f1c5c0;
  border-radius: 8px;
  background: #fff7f6;
  color: var(--danger);
  font-weight: 800;
  padding: 0 10px;
}

.conversation-title.general {
  border-left: 4px solid var(--general);
}

.conversation-title.adult {
  border-left: 4px solid var(--adult);
}

.message-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow: auto;
  background: #f3eee7;
}

.bubble {
  max-width: min(520px, 86%);
  padding: 11px 13px;
  border-radius: 8px;
  background: white;
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.bubble.me {
  align-self: flex-end;
  background: #fee500;
}

.thread-hint {
  align-self: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: white;
}

.composer input,
.profile-form input,
.profile-form select,
.profile-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

.profile-form textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

.request-list {
  display: grid;
  gap: 12px;
}

.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-top-width: 4px;
}

.request-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.clear-request {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
}

.clear-request:hover {
  color: var(--danger);
}

.board-form {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 110px;
  gap: 10px;
  margin-bottom: 16px;
  padding: 16px;
}

.board-form textarea {
  grid-column: 1 / -1;
  min-height: 110px;
  resize: vertical;
}

.board-form select,
.board-form input,
.board-form textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.board-form select,
.board-form input {
  min-height: 42px;
}

.board-list {
  display: grid;
  gap: 12px;
}

.board-item {
  padding: 16px;
  border-top-width: 4px;
}

.board-item.general {
  border-top-color: var(--general);
}

.board-item.adult {
  border-top-color: var(--adult);
}

.board-item.notice {
  border-color: #e3c76f;
  border-top-color: #c99a16;
  background: #fffdf3;
}

.board-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.board-title {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.board-title:hover {
  text-decoration: underline;
}

.board-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-item h3 {
  margin: 0;
  font-size: 18px;
}

.board-item p {
  margin: 10px 0;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
}

.board-meta {
  color: var(--muted);
  font-size: 13px;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 980px;
  padding: 18px;
}

.profile-form label {
  display: grid;
  gap: 8px;
  color: #4f4449;
  font-weight: 700;
}

.form-section-title {
  margin: 4px 0 -4px;
  font-size: 18px;
}

.profile-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-top-width: 4px;
  border-radius: 8px;
}

.profile-section.general {
  border-top-color: var(--general);
  background: #fbfffd;
}

.profile-section.adult {
  border-top-color: var(--adult);
  background: #fff9fb;
}

.profile-section legend {
  padding: 0 6px;
  font-weight: 800;
}

.wide {
  grid-column: 1 / -1;
}

.check-row {
  grid-template-columns: 20px minmax(0, 1fr) !important;
  align-items: center;
  color: var(--muted) !important;
  font-weight: 500 !important;
}

.check-row input {
  min-height: auto;
}

.notice-modal,
.profile-modal,
.auth-modal,
.board-modal,
.report-modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(26, 18, 22, 0.42);
  z-index: 20;
}

.notice-modal.show,
.profile-modal.show,
.auth-modal.show,
.board-modal.show,
.report-modal.show {
  display: grid;
}

.notice-card,
.profile-modal-card,
.auth-card,
.board-modal-card,
.report-card {
  width: min(460px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.profile-modal-card {
  width: min(560px, 100%);
}

.auth-card {
  width: min(420px, 100%);
}

.report-card {
  width: min(460px, 100%);
}

.board-modal-card {
  width: min(680px, 100%);
  max-height: min(780px, 92vh);
  overflow: auto;
}

.board-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-left: 12px;
  border-left: 4px solid var(--general);
}

.board-detail-header.adult {
  border-left-color: var(--adult);
}

.board-detail-header h2 {
  margin: 0;
  font-size: 24px;
}

.board-detail-body {
  margin: 0 0 18px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.board-edit-form {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.board-edit-form input,
.board-edit-form textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.board-edit-form textarea {
  min-height: 150px;
  resize: vertical;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 8px;
  margin-bottom: 14px;
}

.comment-form input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf9;
}

.comment-item.reply {
  margin-left: 22px;
  background: white;
}

.comment-main p {
  margin: 0 0 6px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.deleted-comment {
  color: var(--muted);
  font-style: italic;
}

.comment-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.auth-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.auth-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.auth-form select,
.auth-form textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.auth-form textarea {
  min-height: 110px;
  resize: vertical;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: white;
}

.site-footer a,
.policy-document a {
  color: var(--adult);
  font-weight: 800;
}

.policy-page {
  background: #faf8f8;
}

.policy-document {
  width: min(860px, calc(100% - 32px));
  margin: 32px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.policy-document h1 {
  margin-top: 0;
}

.policy-document h2 {
  margin-top: 28px;
}

.policy-document li {
  margin: 8px 0;
}

.notice-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.notice-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.profile-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 4px solid var(--general);
}

.profile-modal-header.adult {
  border-left-color: var(--adult);
}

.profile-modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.modal-traits {
  margin-bottom: 14px;
}

.modal-bio {
  margin-bottom: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(20px);
  opacity: 0;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #24131b;
  color: white;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 850px) {
  .app-shell,
  .split-panel,
  .profile-form,
  .profile-section,
  .board-form {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .nav-tab {
    min-width: 0;
    padding: 0 5px;
    font-size: 13px;
    text-align: center;
  }

  .nav-badge {
    min-width: 18px;
    height: 18px;
    margin-left: 3px;
    font-size: 11px;
  }

  .topbar,
  .toolbar,
  .request-item {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .filter-stack {
    justify-content: stretch;
  }

  .view,
  .topbar,
  .sidebar {
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .nav-tabs,
  .segmented,
  .composer,
  .comment-form {
    grid-template-columns: 1fr;
  }

  .segmented {
    display: grid;
  }

  .toolbar h2,
  .topbar h2 {
    font-size: 22px;
  }
}
