* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { background: #68b3e6; color: #111; }
[hidden] { display: none !important; }
.view { min-height: 100dvh; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- 登录 ---------------- */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #68b3e6;
}
.login-card {
  width: 320px;
  max-width: 100%;
  background: #e7e7e7;
  padding: 22px 22px 18px;
  border: 1px solid #c9c9c9;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.login-title {
  background: #fff;
  border: 1px solid #cfcfcf;
  text-align: center;
  font-size: 22px;
  letter-spacing: 4px;
  padding: 8px 0 9px;
  margin-bottom: 16px;
}
.login-label {
  display: block;
  font-size: 17px;
  margin: 12px 0 7px;
}
.login-input {
  width: 100%;
  height: 34px;
  border: 1px solid #8f8f8f;
  background: #fff;
  font-size: 16px;
  letter-spacing: 1px;
  padding: 0 9px;
  outline: none;
  border-radius: 1px;
}
.login-input:focus { border-color: #4a90c8; box-shadow: 0 0 0 2px rgba(74, 144, 200, 0.18); }
.login-input:disabled { background: #bdbdbd; color: #333; letter-spacing: 2px; }
.agree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 8px;
  font-size: 11px;
  color: #333;
  cursor: pointer;
}
.agree-row input { width: 13px; height: 13px; margin: 0; }
.turnstile-box { margin: 6px 0 10px; min-height: 0; }
.turnstile-box:empty { display: none; }
.login-btn {
  width: 100%;
  height: 36px;
  background: #6fb8ea;
  border: 1px solid #3e7ea8;
  font-size: 18px;
  letter-spacing: 1px;
  border-radius: 3px;
  transition: background .18s ease, transform .18s ease;
}
.login-btn:hover { background: #5cabdf; }
.login-btn:active { transform: scale(.99); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-err { min-height: 18px; margin-top: 8px; color: #c0392b; font-size: 12px; text-align: center; }

/* ---------------- 禁行 ---------------- */
.blocked-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 20px;
}
.blocked-wrap { position: relative; width: 260px; height: 260px; display: flex; align-items: center; justify-content: center; }
.blocked-symbol { width: 260px; height: 260px; }
.blocked-title {
  position: absolute;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 6px;
  color: #111;
}
.blocked-sub { margin-top: 6px; font-size: 20px; font-weight: 600; letter-spacing: 1px; color: #111; }
.back-btn {
  margin-top: 26px;
  background: #e2574c;
  color: #111;
  border: none;
  border-radius: 4px;
  font-size: 17px;
  padding: 6px 14px 6px 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back-arrow { font-size: 13px; }
.back-btn:hover { background: #d24a3f; }

/* ---------------- 群聊 ---------------- */
.chat-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: #fff;
}
.chat-header {
  position: relative;
  flex: 0 0 auto;
  height: 58px;
  background: #85c3e9;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #6ea9cd;
}
.chat-title { font-size: 20px; letter-spacing: 1px; }
.exit-btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.4);
  color: #14364a;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 14px;
}
.exit-btn:hover { background: rgba(255, 255, 255, 0.8); }
.admin-dot {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.45);
  font-size: 22px;
  line-height: 30px;
  color: #1a3d55;
}
.admin-dot:hover { background: rgba(255, 255, 255, 0.75); }
.announce-bar {
  flex: 0 0 auto;
  background: #fff7d6;
  border-bottom: 1px solid #ecdca0;
  color: #6b5310;
  font-size: 13px;
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.announce-tag {
  flex: 0 0 auto;
  background: #f0c24b;
  color: #4a3800;
  border-radius: 3px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 18px;
}
.lock-bar {
  flex: 0 0 auto;
  background: #fde8e6;
  color: #a4342a;
  font-size: 12px;
  text-align: center;
  padding: 6px;
  border-bottom: 1px solid #f3c9c4;
}
.msg-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg-row { display: flex; flex-direction: column; max-width: 78%; }
.msg-row.other { align-self: flex-start; align-items: flex-start; }
.msg-row.self { align-self: flex-end; align-items: flex-end; }
.msg-row.system { align-self: center; align-items: center; max-width: 92%; }
.msg-name { font-size: 11px; color: #999; margin: 0 6px 4px; }
.bubble {
  padding: 8px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: #111;
}
.msg-row.other .bubble { background: #7d8ff0; border-bottom-left-radius: 4px; }
.msg-row.self .bubble { background: #8fcf6d; border-bottom-right-radius: 4px; }
.msg-row.ai .bubble { background: #e5dcf7; border: 1px solid #cdbcee; border-bottom-left-radius: 4px; }
.msg-row.system .bubble {
  background: #f0f0f0;
  color: #777;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
}
.bubble p { margin: 0 0 6px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble code {
  background: rgba(0, 0, 0, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.bubble pre {
  background: #1e2430;
  color: #e6edf3;
  padding: 9px 11px;
  border-radius: 7px;
  overflow-x: auto;
  margin: 6px 0;
  font-size: 13px;
}
.bubble pre code { background: none; padding: 0; color: inherit; }
.bubble a { color: #0b57d0; text-decoration: underline; }
.bubble ul, .bubble ol { margin: 5px 0; padding-left: 20px; }
.bubble table { border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.bubble th, .bubble td { border: 1px solid rgba(0, 0, 0, 0.25); padding: 3px 7px; }
.bubble blockquote { margin: 5px 0; padding-left: 9px; border-left: 3px solid rgba(0, 0, 0, 0.25); color: #444; }
.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #ececec;
  border-top: 1px solid #d2d2d2;
}
.plus-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #9a9a9a;
  background: #fff;
  font-size: 24px;
  line-height: 32px;
  color: #111;
}
.plus-btn:hover { background: #f4f4f4; }
.msg-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  border: 1px solid #cfcfcf;
  background: #fff;
  border-radius: 2px;
  padding: 0 11px;
  font-size: 16px;
  outline: none;
}
.msg-input:focus { border-color: #7fb6dd; }
.sos-btn {
  flex: 0 0 auto;
  width: 60px;
  height: 44px;
  border: none;
  background: #d8443c;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  padding-top: 16px;
  border-radius: 3px;
}
.sos-btn:hover { background: #c53a33; }
.emoji-panel {
  position: fixed;
  right: 12px;
  bottom: 62px;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  border-radius: 8px;
  padding: 8px;
  z-index: 20;
}
.emoji-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.emoji-actions button {
  flex: 1 1 0;
  border: 1px solid #c9c9c9;
  background: #f7f7f7;
  border-radius: 6px;
  font-size: 13px;
  padding: 6px 8px;
  white-space: nowrap;
}
.emoji-actions button:hover { background: #ededed; }
.emoji-grid { display: grid; grid-template-columns: repeat(4, 34px); gap: 4px; }
.emoji-grid button {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  font-size: 20px;
  border-radius: 6px;
}
.emoji-grid button:hover { background: #f0f0f0; }
.att-img {
  display: block;
  margin-top: 6px;
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  cursor: zoom-in;
}
.att-video { display: block; margin-top: 6px; max-width: 100%; max-height: 300px; border-radius: 8px; }
.att-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.14);
  color: #14364a;
  font-size: 13px;
  text-decoration: none;
  word-break: break-all;
}
.att-file:hover { background: rgba(255, 255, 255, 0.85); }
.att-file .att-size { color: #667; font-size: 12px; }

/* ---------------- 管理 ---------------- */
.admin-view { background: #fff; min-height: 100dvh; display: flex; flex-direction: column; }
.admin-header {
  display: flex;
  align-items: center;
  padding: 12px 12px 4px;
  gap: 8px;
}
.admin-back {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  font-size: 26px;
  line-height: 28px;
  color: #333;
}
.admin-title { flex: 1 1 auto; text-align: center; font-size: 20px; letter-spacing: 3px; }
.admin-spacer { width: 34px; }
.admin-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  padding: 14px 18px 6px;
}
.pill {
  border: none;
  border-radius: 999px;
  padding: 9px 26px;
  font-size: 17px;
  letter-spacing: 2px;
  color: #111;
  transition: filter .16s ease, transform .16s ease;
}
.pill:hover { filter: brightness(0.95); }
.pill:active { transform: scale(.97); }
.pill-red { background: #d9534f; }
.pill-green { background: #6aa84f; }
.admin-panel {
  flex: 1 1 auto;
  padding: 8px 18px 28px;
  overflow-y: auto;
}
.panel-title { font-size: 15px; color: #444; margin: 14px 0 8px; }
.panel-note { font-size: 12px; color: #888; margin-bottom: 8px; }
.panel-list { display: flex; flex-direction: column; gap: 8px; }
.panel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  background: #fafafa;
}
.panel-item .grow { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.panel-item .muted { color: #999; font-size: 12px; }
.panel-item .preview { color: #333; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-item .preview .who { color: #888; font-size: 12px; margin-right: 6px; }
.btn-sm {
  flex: 0 0 auto;
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  padding: 4px 10px;
}
.btn-sm:hover { background: #f2f2f2; }
.btn-sm.danger { border-color: #d9534f; color: #b5312c; }
.btn-sm.primary { border-color: #3e7ea8; background: #6fb8ea; color: #082430; }
.panel-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.panel-form label { font-size: 12px; color: #666; }
.panel-form input, .panel-form textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.panel-form input:focus, .panel-form textarea:focus { border-color: #7fb6dd; }
.panel-form textarea { min-height: 76px; resize: vertical; }
.panel-row { display: flex; gap: 8px; align-items: center; }
.panel-row .grow { flex: 1 1 auto; }
.switch-state { font-size: 13px; color: #666; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(20, 24, 32, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  max-width: 86vw;
  text-align: center;
  z-index: 100;
  pointer-events: none;
}

@media (max-width: 420px) {
  .login-card { padding: 18px 16px; }
  .pill { padding: 8px 20px; font-size: 16px; }
  .msg-row { max-width: 86%; }
}
