/* 达咩大陆 - 不太正经的小镇日报风 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #1a1a1a;
  --paper: #faf3e3;
  --card: #fffdf6;
  --pink: #ff5d8f;
  --orange: #ffb03a;
  --teal: #3ec1d3;
  --dim: #8a8272;
  --shadow: 4px 4px 0 rgba(26, 26, 26, .85);
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  background-image: radial-gradient(rgba(26,26,26,.05) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
}

/* ---------- 头部 ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 14px 20px 10px;
  border-bottom: 3px solid var(--ink);
  background: var(--card);
  position: sticky; top: 0; z-index: 50;
}
.logo { font-size: 26px; font-weight: 900; letter-spacing: 1px; }
.logo .sub { font-size: 12px; font-weight: 600; color: var(--dim); margin-left: 8px; letter-spacing: 2px; }
.worldmeta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 3px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip.hot { background: var(--orange); }
.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); background: var(--pink); color: #fff; } }

/* ---------- 头条 ---------- */
#headlines {
  overflow: hidden; white-space: nowrap; background: var(--ink); color: #ffe9a8;
  font-size: 14px; padding: 6px 0; border-bottom: 3px solid var(--ink);
}
#headline-text { display: inline-block; padding-left: 100%; animation: marquee 30s linear infinite; }
@keyframes marquee { to { transform: translateX(-200%); } }

/* ---------- 标签页 ---------- */
#tabs { display: flex; gap: 10px; padding: 14px 20px 0; flex-wrap: wrap; max-width: 1280px; margin: 0 auto; }
.tabbtn {
  font-size: 15px; font-weight: 800; padding: 8px 18px; cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; box-shadow: var(--shadow);
  transition: transform .08s;
}
.tabbtn:hover { transform: translate(-1px, -1px); }
.tabbtn.active { background: var(--pink); color: #fff; transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(26,26,26,.85); }

/* ---------- 布局 ---------- */
#layout {
  display: grid; grid-template-columns: 340px 1fr; gap: 20px;
  max-width: 1280px; margin: 0 auto; padding: 18px 20px 60px; align-items: start;
}
#sidebar { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
#content { min-width: 0; }
.pane-title { font-size: 22px; font-weight: 900; margin: 4px 0 14px; }
.pane-title .dim { font-size: 13px; font-weight: 500; }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px;
}
.card.empty { text-align: center; color: var(--dim); padding: 40px; }
.end-note { text-align: center; color: var(--dim); font-size: 13px; margin: 20px 0; }

/* ---------- 编年史 ---------- */
.tick-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.tick-no { font-size: 19px; font-weight: 900; color: var(--pink); }
.tick-meta { font-size: 12.5px; color: var(--dim); }
.hl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.hl {
  font-size: 12.5px; font-weight: 700; background: #fff3cd; border: 2px solid var(--ink);
  border-radius: 8px; padding: 2px 8px;
}
.narrative { margin-top: 10px; }
.narrative p { margin-bottom: 10px; }
.narrative p:last-child { margin-bottom: 0; }
.nm { font-weight: 800; }
.ev-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; border-top: 2px dashed rgba(26,26,26,.25); padding-top: 10px; }
.ev { font-size: 13px; }

/* ---------- 地图 ---------- */
.map-card { padding: 8px; }
#map-svg { width: 100%; height: auto; display: block; }
.map-edge { stroke: rgba(26,26,26,.4); stroke-width: 2.5; stroke-dasharray: 6 5; }
.map-node { cursor: pointer; }
.map-node:hover circle:first-child { stroke-width: 4; }
.map-emoji { font-size: 24px; text-anchor: middle; }
.map-label { font-size: 14px; font-weight: 800; text-anchor: middle; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 4; }
.map-count { font-size: 12px; font-weight: 800; fill: #fff; text-anchor: middle; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.loc-card, .loc-focus { margin-bottom: 0; }
.loc-focus { border-color: var(--pink); border-width: 3px; margin-bottom: 16px; }
.loc-name { font-weight: 900; font-size: 16px; }
.loc-desc { font-size: 13.5px; margin: 6px 0; }
.loc-meta { font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.badge-new, .badge-old {
  font-size: 11px; font-weight: 700; border: 1.5px solid var(--ink); border-radius: 6px;
  padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.badge-new { background: var(--teal); color: #fff; }
.badge-old { background: #eee; }

/* ---------- 角色 ---------- */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.char-card { margin-bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.char-head { display: flex; align-items: center; gap: 10px; }
.char-avatar {
  font-size: 26px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; flex-shrink: 0;
}
.char-avatar.big { font-size: 32px; width: 56px; height: 56px; }
.char-name { font-size: 18px; font-weight: 900; line-height: 1.3; }
.char-title { font-size: 12.5px; color: var(--dim); font-weight: 600; }
.idle-tag, .active-tag {
  margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 2px 8px;
  border: 2px solid var(--ink); border-radius: 999px; white-space: nowrap;
}
.idle-tag { background: #e8e8e8; }
.active-tag { background: var(--orange); }
.char-persona { font-size: 13px; color: #55503f; background: rgba(26,26,26,.04); border-radius: 8px; padding: 6px 10px; }
.char-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; font-weight: 600; }
.inv { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-item {
  font-size: 12px; font-weight: 600; background: #fff; border: 2px solid var(--ink);
  border-radius: 8px; padding: 1px 8px;
}
.char-foot { font-size: 11.5px; border-top: 2px dashed rgba(26,26,26,.2); padding-top: 6px; }

/* ---------- 侧栏 ---------- */
.side-card { margin-bottom: 0; }
.side-title { font-weight: 900; font-size: 15.5px; margin-bottom: 10px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.authtab {
  flex: 1; padding: 6px; font-weight: 800; font-size: 14px; cursor: pointer;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff;
}
.authtab.on { background: var(--teal); color: #fff; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 13px; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.form .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
input, textarea {
  font: inherit; font-size: 14px; padding: 8px 12px; width: 100%;
  border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--pink); }
.btn {
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; padding: 8px 16px;
  border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; box-shadow: 3px 3px 0 rgba(26,26,26,.85);
  transition: transform .08s;
}
.btn:hover { transform: translate(-1px, -1px); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.primary { background: var(--pink); color: #fff; }
.btn.ghost { background: #fff; }
.btn.wide { width: 100%; }
.btn.small { font-size: 12.5px; padding: 5px 12px; box-shadow: 2px 2px 0 rgba(26,26,26,.85); }
.btn.tiny { font-size: 11px; padding: 2px 8px; box-shadow: none; }
.btn.danger-btn { background: #e63946; color: #fff; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.policy-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.private-latest { font-size: 13.5px; background: #fff8e1; border: 2px dashed var(--ink); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.h-item { border-top: 2px dashed rgba(26,26,26,.2); padding: 8px 0; font-size: 13px; }
.gm-badge { background: var(--ink); color: #ffd54a; font-size: 10.5px; padding: 1px 7px; border-radius: 6px; margin-left: 4px; vertical-align: 2px; }
details summary { cursor: pointer; }
details textarea { margin: 8px 0; }

/* ---------- 玩法 ---------- */
.about h3 { margin: 14px 0 6px; font-size: 16.5px; }
.about h3:first-child { margin-top: 0; }
.about p, .about li { font-size: 14px; margin-bottom: 6px; }
.about ul { padding-left: 20px; }

/* ---------- GM ---------- */
.gm-card { margin-bottom: 16px; }
.gm-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.gm-error {
  background: #ffe3e3; border: 2px solid #e63946; border-radius: 10px; padding: 8px 12px;
  font-size: 13px; margin: 10px 0; word-break: break-all;
}
.test-ok { background: #e7f9ed; border: 2px solid #0a8754; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-top: 8px; }
.gm-pending { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.gm-ev {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #fff3cd; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 12px; font-size: 13px;
}
.log-item { margin-top: 10px; font-size: 13px; }
.log-item pre {
  white-space: pre-wrap; word-break: break-all; background: #f4efe2; border-radius: 8px;
  padding: 10px; font-size: 12px; max-height: 300px; overflow: auto; margin-top: 6px;
}
.card.danger { border-color: #e63946; }

/* ---------- QQ ---------- */
.btn.qq { background: #12b7f5; color: #fff; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 12px 0;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 2px dashed rgba(26,26,26,.25); }
#qq-modal {
  position: fixed; inset: 0; background: rgba(26,26,26,.55); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card { max-width: 420px; width: 100%; margin: 0; }
.qq-code {
  font-size: 26px; font-weight: 900; letter-spacing: 3px; text-align: center;
  background: #fff8e1; border: 3px dashed var(--ink); border-radius: 12px;
  padding: 14px; margin: 12px 0; user-select: all;
}
.qq-avatar {
  width: 100%; height: 100%; object-fit: cover; border-radius: 9px; display: block;
}
.qq-avatar.mini {
  width: 22px; height: 22px; border-radius: 6px; display: inline-block;
  vertical-align: -6px; border: 1.5px solid var(--ink); margin-right: 2px;
}
.qq-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- 杂项 ---------- */
#foot { text-align: center; color: var(--dim); font-size: 12px; padding: 20px 20px 40px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 999; max-width: min(360px, 90vw); }
.toast {
  background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  border: 2px solid #fff; box-shadow: var(--shadow); animation: slidein .25s;
}
.toast.ok { background: #0a8754; }
.toast.err { background: #e63946; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* ---------- 移动端 ---------- */
@media (max-width: 900px) {
  #layout { grid-template-columns: 1fr; padding: 14px 12px 60px; }
  #sidebar { position: static; order: -1; }
  #topbar { padding: 10px 12px 8px; }
  .logo { font-size: 21px; }
  #tabs { padding: 12px 12px 0; gap: 7px; }
  .tabbtn { font-size: 13.5px; padding: 7px 13px; }
  .char-grid, .loc-grid { grid-template-columns: 1fr; }
  .worldmeta { font-size: 12px; }
}
