/* ==========================================================================
   岸喵 · 留言板 (messages.html)
   --------------------------------------------------------------------------
   加载顺序：styles.css -> messages.css -> ui.css（ui.css 必须最后）
   ========================================================================== */

.msg-page { padding: 2rem 0 3.5rem; }

.msg-hero {
  display: grid;
  gap: .55rem;
  padding: 1.6rem 1.6rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 88% -10%, var(--primary-soft) 0%, transparent 60%),
    var(--surface);
  box-shadow: var(--shadow);
}
.msg-hero .section-kicker { justify-self: start; }
.msg-hero h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.01em; }
.msg-hero p { margin: 0; max-width: 60ch; color: var(--text-2); font-size: .95rem; }
.msg-hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .35rem; }
.msg-count {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: .85rem; font-weight: 600;
}
.msg-count strong { font-variant-numeric: tabular-nums; }

/* ------------------------------ 发布区 ------------------------------ */
.msg-compose {
  margin-top: 1.25rem;
  padding: 1.15rem 1.25rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.msg-compose-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.msg-compose-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: -.01em; }
.msg-compose-head small { color: var(--muted); font-size: .82rem; }

.msg-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .85rem 0 .7rem; }
.msg-chip {
  padding: .4rem .85rem; min-height: 36px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2);
  font-size: .88rem; transition: background .15s, border-color .15s, color .15s;
}
.msg-chip:hover { border-color: var(--primary); color: var(--primary); }
.msg-chip[aria-pressed="true"] {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}

.msg-editor { position: relative; }
.msg-editor textarea {
  width: 100%; min-height: 116px; padding: .85rem .95rem;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--bg-soft); color: var(--text);
  font-size: .98rem; line-height: 1.7; resize: vertical;
}
.msg-editor textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.msg-editor textarea::placeholder { color: var(--muted); }

.msg-emoji-wrap { position: relative; }
.msg-emoji-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font-size: 1.05rem;
}
.msg-emoji-btn:hover { border-color: var(--primary); }
.msg-emoji-panel {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: .2rem;
  width: min(320px, 78vw); max-height: 220px; overflow-y: auto;
  padding: .55rem; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.msg-emoji-panel[hidden] { display: none; }
.msg-emoji-panel button {
  padding: .25rem 0; border: 0; border-radius: 8px; background: transparent; font-size: 1.15rem;
}
.msg-emoji-panel button:hover { background: var(--bg-soft); }

.msg-compose-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .7rem;
}
.msg-identity { flex: 1 1 auto; color: var(--text-2); font-size: .88rem; }
.msg-identity a { color: var(--primary); font-weight: 600; text-decoration: underline; }
.msg-identity.need-login {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 .85rem;
  border: 1px dashed var(--line-strong); border-radius: 10px;
  background: var(--bg-soft);
}
.msg-editor textarea:disabled { opacity: .6; cursor: not-allowed; }
.msg-emoji-btn:disabled { opacity: .45; cursor: not-allowed; }
.msg-counter { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.msg-counter.over { color: #d9483b; font-weight: 600; }
.msg-submit {
  min-height: 42px; padding: .5rem 1.35rem; border: 0; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: .95rem;
}
.msg-submit:hover { background: var(--primary-dark); }
.msg-submit:disabled { opacity: .55; cursor: not-allowed; }
.msg-tip { margin: .55rem 0 0; color: var(--muted); font-size: .8rem; }

/* ------------------------------ 工具栏 ------------------------------ */
.msg-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin: 1.5rem 0 .9rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.msg-search {
  flex: 1 1 240px; display: flex; align-items: center; gap: .45rem;
  min-height: 42px; padding: 0 .8rem;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg-soft);
}
.msg-search span { color: var(--muted); }
.msg-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: .92rem; }
.msg-filter { display: flex; flex-wrap: wrap; gap: .35rem; }
.msg-filter button {
  padding: .35rem .75rem; min-height: 36px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: .85rem;
}
.msg-filter button[aria-pressed="true"] {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600;
}

/* ------------------------------ 留言卡 ------------------------------ */
.msg-list { display: grid; gap: .85rem; }
.msg-card {
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
}
.msg-card.is-new { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.msg-card-head { display: flex; align-items: center; gap: .65rem; }
.msg-avatar {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: .95rem;
}
.msg-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; min-width: 0; }
.msg-name { font-weight: 600; font-size: .95rem; }
.msg-badge {
  padding: .1rem .5rem; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--text-2); font-size: .75rem;
}
.msg-badge[data-category="suggestion"] { background: var(--primary-soft); border-color: transparent; color: var(--primary-dark); }
.msg-badge[data-category="bug"] { background: #fdecec; border-color: transparent; color: #c0392b; }
.msg-badge[data-category="content"] { background: var(--purple-soft); border-color: transparent; color: var(--purple); }
.msg-time { color: var(--muted); font-size: .78rem; }
.msg-body {
  margin: .6rem 0 0; padding-left: 3.15rem;
  font-size: .98rem; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere;
}

.msg-reply {
  margin: .7rem 0 0 3.15rem; padding: .7rem .85rem;
  border-left: 3px solid var(--green); border-radius: 0 10px 10px 0;
  background: var(--green-soft);
}
.msg-reply-head {
  display: flex; align-items: center; gap: .4rem; margin-bottom: .25rem;
  color: var(--green); font-size: .82rem; font-weight: 600;
}
.msg-reply-body { font-size: .93rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }

.msg-empty, .msg-loading {
  padding: 2.2rem 1rem; text-align: center; color: var(--muted); font-size: .92rem;
  border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--bg-soft);
}
.msg-more-wrap { display: flex; justify-content: center; margin-top: 1.1rem; }
.msg-more {
  min-height: 42px; padding: .5rem 1.5rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: .9rem;
}
.msg-more:hover { border-color: var(--primary); color: var(--primary); }
.msg-more[hidden] { display: none; }
.msg-error { margin-top: .8rem; padding: .7rem .9rem; border-radius: 10px; background: #fdecec; color: #a5342a; font-size: .88rem; }
.msg-error[hidden] { display: none; }

/* ------------------------------ 手机端 ------------------------------ */
@media (max-width: 680px) {
  .msg-hero { padding: 1.2rem 1.05rem; }
  .msg-hero h1 { font-size: 1.45rem; }
  .msg-compose { padding: 1rem .95rem; }
  .msg-body, .msg-reply { margin-left: 0; padding-left: 0; }
  .msg-reply { margin-left: 0; }
  .msg-compose-foot > .msg-submit { flex: 1 1 100%; }
  .msg-emoji-panel { grid-template-columns: repeat(7, 1fr); }
}
