*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

:root {
  --bg: #1a1a1a;
  --bg-soft: #0a0a0a;
  --bg-deep: #050505;
  --fg: #d0d0d0;
  --fg-mute: #888;
  --fg-faint: #666;
  --link: #aaccff;
  --warn: #f88;
  --danger: #c66;
  --hint: #f0d090;
  --quote: #7c9;
  --border: #333;
  --border-soft: #222;
}

html, body, button, input, textarea, select, code, pre,
h1, h2, h3, h4, h5, h6, p, span, div, a, li, td, th, label, kbd {
  font-family: "MS PGothic", "ＭＳ Ｐゴシック",
               "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3",
               "Noto Sans SC", "Microsoft YaHei", "PingFang SC",
               Arial, sans-serif;
  font-size: 13px;
  line-height: 1.55;
}

body {
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─────────────────────  网易 2003 风格门户  ───────────────────── */

.warning-bar,
.site-head,
.counter,
.titlebar,
.board-layout { max-width: 1040px; }

/* 顶部导航条 */
.topnav {
  max-width: 1040px; margin: 0 auto; padding: 6px 12px;
  background: linear-gradient(#2a2a2a, #1a1a1a);
  border: 1px solid #555; border-top: 0;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  font-size: 12px;
}
.topnav-item {
  color: var(--fg); padding: 3px 10px;
  text-decoration: none; border: 1px solid transparent;
}
.topnav-item:hover {
  background: #000; border-color: var(--hint); color: var(--hint);
  text-decoration: none;
}
.topnav-item.active {
  background: #1a1410; color: var(--hint);
  border-color: var(--hint); font-weight: bold;
}
.topnav-icon { color: var(--hint); margin-right: 2px; }
.topnav-sep { color: #555; margin: 0 6px; }
.topnav-secret { color: var(--warn) !important; }
.topnav-secret:hover { background: #1a0a0a; border-color: var(--warn); color: var(--warn) !important; }

/* 搜索条 */
.searchbar {
  max-width: 1040px; margin: 0 auto; padding: 8px 12px;
  background: #0e0e0e; border: 1px solid var(--border); border-top: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.searchbar-label { color: var(--hint); font-weight: bold; }
.searchbar input {
  flex: 1; min-width: 200px;
  padding: 5px 8px; background: #000; border: 1px solid #444;
  color: var(--fg); font-family: inherit; font-size: 12px;
}
.searchbar input:focus { outline: 0; border-color: var(--hint); }
.searchbar button {
  background: #1a1410; border: 1px solid var(--hint); color: var(--hint);
  padding: 4px 14px; cursor: pointer; font-family: inherit; font-size: 12px;
}
.searchbar button:hover { background: #2a1f15; }
.searchbar-tip { color: var(--fg-faint); font-size: 10px; }

/* Hero 焦点 */
.hero {
  max-width: 1040px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr; gap: 12px;
  padding: 12px;
}
.hero-focus {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 14px; min-height: 240px;
  background-image: linear-gradient(135deg, #1a1410 0%, #0a0a0a 100%);
}
.hero-tag {
  display: inline-block; color: #000; background: var(--hint);
  padding: 2px 8px; font-size: 11px; font-weight: bold;
}
.hero-title { margin: 8px 0 4px; font-size: 18px; line-height: 1.4; }
.hero-title a { color: var(--hint); }
.hero-title a:hover { color: #fff; }
.hero-meta { color: var(--fg-faint); font-size: 11px; margin-bottom: 8px; }
.hero-excerpt { color: var(--fg); font-size: 13px; line-height: 1.7; margin: 6px 0 12px; }
.hero-comments {
  background: #050505; border: 1px dotted var(--border);
  padding: 6px 10px; margin-top: 8px;
}
.hero-comments h4 { color: var(--hint); font-size: 11px; margin: 0 0 4px; }
.hero-comments ul { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.hero-comments li { padding: 3px 0; border-bottom: 1px dotted #1a1a1a; }
.hero-comments .cm-author { color: var(--link); }
.hero-comments .cm-body { color: var(--fg-mute); margin-left: 4px; }
.hero-comments .cm-votes { color: var(--fg-faint); font-size: 10px; margin-left: 4px; }
.hero-comments .cm-empty { color: var(--fg-faint); }
.hero-cta {
  display: inline-block; margin-top: 10px;
  background: var(--bg-deep); border: 1px solid var(--hint);
  color: var(--hint); padding: 4px 14px; font-size: 12px;
}
.hero-cta:hover { background: #1a1410; text-decoration: none; }

.hero-sub {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 10px;
}
.block-head {
  margin: 0 0 6px; font-size: 12px; color: var(--hint);
  border-bottom: 1px dotted var(--border); padding-bottom: 4px;
}
.hero-sub-list { list-style: none; padding: 0; margin: 0; }
.hero-sub-list li {
  display: grid; grid-template-columns: 60px 1fr 40px; gap: 6px;
  padding: 4px 0; border-bottom: 1px dotted #1a1a1a; font-size: 12px;
  align-items: baseline;
}
.hero-sub-list .num { color: var(--fg-faint); }
.hero-sub-list .meta { color: var(--fg-faint); text-align: right; font-size: 10px; }
.hero-sub-list .is-main { color: var(--hint); }
/* (保留兼容：原 .is-main 标记已被 .is-hot 取代) */

/* 三栏门户：主区 + 侧栏 */
.portal {
  max-width: 1040px; margin: 0 auto; padding: 0 12px 12px;
  display: grid; grid-template-columns: 1fr 240px; gap: 12px;
}
.portal-main { display: flex; flex-direction: column; gap: 12px; }
.portal-side { display: flex; flex-direction: column; gap: 10px; }

/* 板块块 */
.portal-block {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 8px 10px;
}
.portal-block-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid #444; padding-bottom: 4px; margin-bottom: 6px;
}
.portal-block-head h2 {
  margin: 0; font-size: 14px; color: var(--hint);
  letter-spacing: .05em;
}
.portal-block-head .more { color: var(--fg-faint); font-size: 11px; }
.portal-block-head .more:hover { color: var(--hint); }
.block-tip {
  font-size: 11px; color: var(--fg-faint); margin-top: 6px;
  background: #0a0805; border-left: 2px solid var(--hint);
  padding: 4px 8px;
}

/* 帖子卡片网格 */
.thread-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
}
.thread-grid-main { grid-template-columns: 1fr; }
.thread-card {
  display: grid; grid-template-columns: 56px 1fr; gap: 6px;
  padding: 5px 4px; border-bottom: 1px dotted #222;
  transition: background .1s;
}
.thread-card:hover { background: #111; }
.thread-card-num {
  color: var(--fg-faint); font-size: 11px; text-align: right;
  padding-top: 2px;
}
.thread-card-title {
  color: var(--link); text-decoration: none; font-size: 13px;
  display: block; line-height: 1.4;
}
.thread-card-title:hover { text-decoration: underline; color: #fff; }
/* 热门帖子：左侧金边 + 标题加粗金色（不再绑定 main 标记） */
.thread-card.is-hot .thread-card-title { color: var(--hint); font-weight: bold; }
.thread-card.is-hot { border-left: 2px solid var(--hint); padding-left: 6px; }
.thread-card-meta {
  font-size: 10px; color: var(--fg-faint); margin-top: 2px;
}
.thread-card-meta .author { color: var(--fg-mute); }
.thread-card-meta .trip { color: #c8a060; }
.thread-card-meta .id { color: #888; margin-left: 2px; }
.thread-card-meta .dot { margin: 0 4px; color: #444; }
.thread-card-meta .replies { color: #6a8; }
.thread-card-meta .badge-hot {
  margin-left: 6px; background: #1a1410; border: 1px solid var(--hint);
  color: var(--hint); padding: 0 4px; font-size: 9px;
}

/* 公告列表 */
.announce-list { list-style: none; padding: 0; margin: 0; }
.announce-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; border-bottom: 1px dotted #1a1a1a; font-size: 12px;
}
.announce-list .ann-tag {
  background: #1a1410; border: 1px solid var(--hint); color: var(--hint);
  padding: 0 6px; font-size: 10px; min-width: 28px; text-align: center;
}
.announce-list .ann-tag + .ann-tag { background: #0a0a0a; border-color: #555; color: #888; }
.announce-list a { color: var(--link); flex: 1; }
.announce-list .meta { color: var(--fg-faint); font-size: 10px; }

/* 友情链接 */
.friend-links { background: #0a0a0a; }
.friend-text { font-size: 12px; line-height: 1.8; color: var(--fg-mute); margin: 4px 0; }
.friend-text a { color: var(--link); margin: 0 4px; }

/* 侧栏块 */
.side-block {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 8px 10px; font-size: 12px;
}
.side-block h3 {
  margin: 0 0 6px; font-size: 12px; color: var(--hint);
  border-bottom: 1px dotted var(--border); padding-bottom: 3px;
  letter-spacing: .05em;
}

/* 跟贴排行 */
.side-rank { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.side-rank li {
  display: grid; grid-template-columns: 22px 1fr 40px; gap: 6px;
  padding: 3px 0; border-bottom: 1px dotted #1a1a1a; font-size: 12px;
  align-items: baseline;
}
.side-rank .rank-no {
  background: #333; color: #fff; text-align: center;
  font-size: 10px; font-weight: bold; padding: 1px 0;
}
.side-rank li:nth-child(1) .rank-no { background: #c33; }
.side-rank li:nth-child(2) .rank-no { background: #c84; }
.side-rank li:nth-child(3) .rank-no { background: #68a; }
.side-rank a { color: var(--link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-rank .rank-replies { color: var(--fg-faint); font-size: 10px; text-align: right; }

/* 新到访客 */
.side-users { list-style: none; padding: 0; margin: 0; }
.side-user {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 6px;
  padding: 3px 0; border-bottom: 1px dotted #1a1a1a; font-size: 12px;
  align-items: center;
}
.side-user .avatar {
  background: #222; border: 1px solid #444; color: var(--hint);
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.side-user .name { color: var(--fg-mute); }
.side-user .trip { color: #c8a060; font-size: 10px; }
.side-user.is-founder { background: #1a0a0a; }
.side-user.is-founder .avatar { background: #5a2020; border-color: var(--warn); color: var(--warn); }
.side-user.is-founder .name { color: var(--warn); font-weight: bold; }

/* 站务统计 */
.side-stats { width: 100%; border-collapse: collapse; font-size: 11px; }
.side-stats td { padding: 3px 4px; border-bottom: 1px dotted #1a1a1a; }
.side-stats td:first-child { color: var(--fg-faint); width: 90px; }
.side-stats td:last-child { color: var(--fg-mute); text-align: right; }
.side-stats .live { color: #9c6; font-weight: bold; }
.side-stats .founder { color: #c8a060; }

/* 站长寄语 */
.side-fade p { color: var(--fg-mute); font-size: 11px; line-height: 1.7; margin: 4px 0; }
.side-fade .signature {
  text-align: right; color: #c8a060; font-style: italic; margin-top: 6px;
}

/* 空状态 */
.empty-block {
  padding: 30px; text-align: center; color: var(--fg-mute);
  background: #0a0a0a; border: 1px dotted var(--border); margin: 10px 0;
}
.empty-block p { margin: 4px 0; }

/* Home / list (旧版兼容) */
.unknown-route { padding: 40px; text-align: center; color: var(--fg-mute); }

/* Thread detail */
.thread-missing { padding: 40px; text-align: center; color: var(--fg-mute); }

/* 帖子页布局 */
.thread-layout {
  max-width: 1040px; margin: 0 auto; padding: 0 12px;
  display: grid; grid-template-columns: 1fr 240px; gap: 12px;
}
.thread-main { display: flex; flex-direction: column; gap: 10px; }
.thread-side { display: flex; flex-direction: column; gap: 10px; }

.post {
  padding: 14px; background: var(--bg-soft); border: 1px solid var(--border);
}
.post-head {
  font-size: 11px; color: #777; margin-bottom: 6px;
  display: flex; justify-content: space-between; gap: 8px;
}
.post-head .author { color: var(--link); }
.post-head .trip { color: #c8a060; margin-left: 4px; }
.post-head .id { color: #888; margin-left: 6px; }
.post-body {
  font-size: 13px; color: var(--fg); line-height: 1.7;
  white-space: normal;
}
.post-actions {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dotted var(--border);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.post-actions button {
  background: var(--bg-deep); border: 1px solid var(--border);
  color: var(--fg); padding: 4px 10px; font-size: 11px;
  cursor: pointer; font-family: inherit;
}
.post-actions button:hover { border-color: var(--hint); color: var(--hint); }

/* 跟贴区 */
.comments-block {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 8px 12px;
}
.comments-block-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid #444; padding-bottom: 4px; margin-bottom: 6px;
}
.comments-block-head h2 {
  margin: 0; font-size: 14px; color: var(--hint); letter-spacing: .05em;
}
.sort-tip { font-size: 11px; color: var(--fg-faint); }
.comments-list { list-style: none; padding: 0; margin: 0; }
.comment {
  display: grid; grid-template-columns: 36px 1fr; gap: 8px;
  padding: 10px 4px; border-bottom: 1px dotted #1a1a1a;
}
.comment:hover { background: #0a0a0a; }
.comment.is-op { background: #0e0a05; }
.comment.is-mine { background: #0a0e05; }
.comment-num {
  color: var(--fg-faint); text-align: right; font-size: 11px; padding-top: 2px;
}
.comment-body { font-size: 13px; }
.comment-head {
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  font-size: 11px; color: var(--fg-faint); margin-bottom: 4px;
}
.comment-head .cm-author { color: var(--link); font-weight: bold; }
.comment-head .trip { color: #c8a060; }
.comment-head .cm-id { color: #888; }
.comment-head .cm-date { color: #555; margin-left: auto; }
.comment-head .cm-op {
  background: #2a1f15; border: 1px solid var(--hint); color: var(--hint);
  padding: 0 4px; font-size: 9px;
}
.comment-text { color: var(--fg); line-height: 1.7; white-space: pre-wrap; }
.comment-foot {
  margin-top: 4px; font-size: 11px; color: var(--fg-faint);
  display: flex; gap: 10px;
}
.comment-foot a { color: var(--link); }
.comment-foot a:hover { color: var(--hint); }
.comment-foot .cm-votes { color: #6a8; }

/* 跟贴表单 */
.comment-form {
  background: #0a0a0a; border: 1px dotted var(--border);
  padding: 8px 10px; margin-top: 8px;
}
.comment-form p { margin: 0 0 6px; color: var(--hint); font-size: 11px; }
.comment-form textarea {
  width: 100%; background: #000; border: 1px solid #444; color: var(--fg);
  font-family: inherit; font-size: 12px; padding: 6px; resize: vertical;
}
.comment-form textarea:focus { outline: 0; border-color: var(--hint); }
.comment-form-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
}
.comment-submit {
  background: #1a1410; border: 1px solid var(--hint); color: var(--hint);
  padding: 4px 14px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.comment-submit:hover { background: #2a1f15; }
.comment-tip { font-size: 10px; color: var(--fg-faint); }

.back-link { padding: 12px 14px; max-width: 1040px; margin: 0 auto; }
.back-link a { color: var(--link); font-size: 12px; }

/* HUD */
.hud {
  position: fixed; top: 8px; right: 12px; z-index: 100;
  background: var(--bg-soft); border: 1px solid #555; color: #888;
  padding: 4px 10px; font-size: 11px; letter-spacing: .05em;
  box-shadow: 1px 1px 0 #000;
  display: flex; gap: 12px; align-items: center;
}
.hud-player { color: var(--fg-mute); }
.hud-san { font-weight: bold; font-size: 14px; cursor: pointer; }
.hud-mute {
  background: transparent; border: 1px solid #444; color: var(--fg-mute);
  padding: 2px 6px; cursor: pointer; font-family: inherit;
}
.hud-mute:hover { color: var(--hint); border-color: var(--hint); }
.hud[data-threshold="anxious"] .hud-san { animation: blink 1s infinite; }
.hud[data-threshold="panicked"] .hud-san { color: var(--danger) !important; }
.hud[data-threshold="lost"] .hud-san { color: #a48 !important; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--bg-soft); border: 1px solid #555; padding: 20px;
  max-width: 400px; width: 90%;
  box-shadow: 0 0 0 1px #000, 0 0 30px rgba(0,0,0,0.7);
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal h3 { color: var(--hint); margin: 0 0 10px; font-size: 14px; }
.modal p { margin: 0 0 12px; font-size: 12px; color: var(--fg-mute); }
.modal input {
  width: 100%; padding: 6px 8px; background: var(--bg-deep);
  border: 1px solid #444; color: var(--fg); font-family: inherit;
  font-size: 13px; margin-bottom: 10px;
}
.modal .suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.modal .suggestions button {
  background: var(--bg-deep); border: 1px solid #444; color: var(--fg);
  padding: 3px 8px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.modal .suggestions button:hover { border-color: var(--hint); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions button {
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--fg); padding: 4px 12px; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.modal-actions button:hover { border-color: var(--hint); }

/* Dice modal */
.dice-modal { text-align: center; min-width: 280px; }
.dice-rolling {
  font-size: 48px; padding: 20px; color: var(--hint);
  display: inline-block;
  animation: diceShake .12s infinite linear;
  text-shadow: 0 0 8px rgba(240, 208, 144, 0.4);
}
@keyframes diceShake {
  0%   { transform: translate(-2px, -1px) rotate(-2deg); }
  25%  { transform: translate( 2px,  1px) rotate( 1deg); }
  50%  { transform: translate(-1px,  2px) rotate(-1deg); }
  75%  { transform: translate( 1px, -2px) rotate( 2deg); }
  100% { transform: translate(-2px,  1px) rotate(-1deg); }
}
.dice-final { font-size: 64px; font-weight: bold; padding: 10px 0; }
.dice-final.dice-success { color: #9c6; }
.dice-final.dice-fail { color: var(--danger); }
.dice-final.dice-crit { color: #ff8; text-shadow: 0 0 12px rgba(255,200,80,0.5); }
.dice-final.dice-fumble { color: #a48; }
.dice-hint { color: var(--fg-faint); font-size: 11px; }
.dice-result { padding: 16px 0; }
.dice-num { font-size: 64px; font-weight: bold; line-height: 1; }
.dice-total { font-size: 14px; color: var(--fg-mute); margin-top: 6px; }
.dice-verdict { margin-top: 12px; font-size: 18px; font-weight: bold; }
.dice-result.hit .dice-num, .dice-result.hit .dice-verdict { color: var(--hint); }
.dice-result.crit .dice-num, .dice-result.crit .dice-verdict { color: #9c6; animation: pulse 0.5s infinite alternate; }
.dice-result.fail .dice-num, .dice-result.fail .dice-verdict { color: var(--danger); }
.dice-result.fumble .dice-num, .dice-result.fumble .dice-verdict { color: #a48; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.05); } }

/* Board 4 */
.board4-shell {
  padding: 14px; border: 2px dashed #a06060; background: #0a0606;
  margin: 14px auto; max-width: 720px;
}
.board4-shell h2 { color: var(--warn); margin: 0 0 8px; }
.board4-shell .warn {
  color: var(--warn); font-size: 11px; border: 1px solid #a06060;
  padding: 4px 8px; display: inline-block; margin-bottom: 10px;
}
.board4-shell input {
  background: var(--bg-deep); border: 1px solid #444; color: var(--hint);
  padding: 6px; font-family: inherit; font-size: 13px; width: 220px; margin-right: 8px;
}
.board4-shell button {
  background: var(--bg-soft); border: 1px solid var(--hint); color: var(--hint);
  padding: 4px 14px; cursor: pointer; font-family: inherit;
}
.board4-post {
  background: #0a0606; border: 1px solid #5a2020; padding: 10px;
  margin: 8px 0; color: #c0a0a0;
}
.board4-post.unlocked { border-color: var(--warn); color: var(--warn); }
.board4-post pre { white-space: pre-wrap; font-family: inherit; margin: 0; }
.board4-image {
  padding: 20px; text-align: center; color: var(--hint); font-style: italic;
  border: 1px dotted #5a2020; margin: 8px 0;
}
.board4-actions button {
  background: var(--bg-soft); border: 1px solid #5a2020; color: #c0a0a0;
  padding: 4px 12px; cursor: pointer; font-family: inherit; font-size: 12px;
}

/* Endings */
.ending { padding: 40px; text-align: center; min-height: 60vh; }
.ending h2 { color: var(--hint); font-size: 28px; margin-bottom: 20px; }
.ending-body {
  max-width: 600px; margin: 0 auto; text-align: left;
  color: var(--fg); line-height: 1.8;
}
.ending-body p { margin: 8px 0; }
.ending-D { background: #0a0606; min-height: 100vh; color: #a06060; }
.ending-D h2 { color: #a06060; }

/* C ending */
.c-stage { padding: 30px; text-align: center; }
.c-btn {
  background: #1a1410; border: 1px solid var(--hint); color: var(--hint);
  padding: 8px 24px; font-size: 16px; cursor: pointer; margin: 0 8px; font-family: inherit;
}
.c-reject { background: #0a0a0a; border-color: #888; color: #888; }
.c-accept.giant {
  padding: 20px 60px; font-size: 24px; background: #1a0a0a;
  border: 2px solid var(--warn); color: var(--warn);
  animation: pulse 1s infinite;
}
.c-reject.tiny { padding: 2px 6px; font-size: 10px; }
.c-hint { color: var(--fg-faint); font-size: 12px; margin-top: 16px; }
.welcome-c {
  position: fixed; inset: 0; background: #000; color: var(--warn);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; letter-spacing: .3em; z-index: 500;
}
.c-bottom {
  position: fixed; bottom: 20px; left: 0; right: 0; text-align: center;
  color: #a06060; font-size: 12px; background: #0a0606; padding: 10px;
  border-top: 1px solid #a06060;
}
