/* ============================================================
   方块资源站 - Minecraft 像素风样式
   ============================================================ */

:root {
  /* 草方块绿主题 */
  --grass:        #6aa84f;
  --grass-dark:   #4d7c37;
  --grass-light:  #8bc06c;
  --dirt:         #9c6b3c;
  --dirt-dark:    #6f4a28;
  --sky:          #7ec8e3;
  --sky-dark:     #4aa3c9;
  --ink:          #23211c;      /* 主文字 */
  --ink-soft:     #5c584d;      /* 次要文字 */
  --paper:        #fbf8ec;      /* 卡片底色 */
  --panel:        #efe9d6;      /* 面板底 */
  --border:       #1f1d18;      /* 硬边框 */
  --stone:        #a7a18f;
  --gold:         #f2c14e;

  --pixel-shadow: 4px 4px 0 rgba(0, 0, 0, .38);
  --pixel-shadow-sm: 3px 3px 0 rgba(0, 0, 0, .32);

  /* 不再引用 Google Fonts（国内加载会挂起 30s+ 导致白屏），改用系统等宽字体 */
  --font-pixel: 'Courier New', 'Consolas', 'Lucida Console', monospace;
  --font-body:  -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: #e9e4d3;
  /* 像素网格背景 */
  background-image:
    linear-gradient(rgba(35,33,28,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35,33,28,.05) 1px, transparent 1px);
  background-size: 16px 16px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* 通用：hidden 属性必须压过元素自身的 display 声明
   （.modal-mask/grid、.auth-form/flex、.user-chip/inline-flex、.btn/inline-block 都靠它显隐） */
[hidden] { display: none !important; }

/* ===== 顶部导航 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--grass-dark);
  border-bottom: 4px solid var(--border);
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.logo-text {
  font-family: var(--font-pixel);
  font-size: 13px;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.4);
}

/* 草方块小图标 */
.logo-cube {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: none;
  background:
    linear-gradient(#7cb75a 0 0) top / 100% 8px no-repeat,
    linear-gradient(#5a9a3f 0 0) center / 100% 8px no-repeat,
    var(--dirt);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 rgba(0,0,0,.3);
}

.nav-links { display: flex; gap: 6px; }

.nav-links a {
  color: #eef5e6;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 3px solid transparent;
  border-radius: 4px;
  transition: background .15s, color .15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--grass);
  color: #fff;
  border-color: var(--border);
  box-shadow: var(--pixel-shadow-sm);
}

.nav-toggle {
  display: none;
  background: none;
  border: 3px solid var(--border);
  color: #fff;
  font-size: 18px;
  padding: 4px 12px;
  cursor: pointer;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  background: linear-gradient(180deg, var(--sky) 0%, #9ed6ec 58%, #b9e4a9 58%, var(--grass-light) 62%, var(--grass) 100%);
  border-bottom: 4px solid var(--border);
  overflow: hidden;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 860px;
  margin: 0 auto;
  padding: 72px 20px 96px;
  text-align: center;
}

.hero-kicker {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.45);
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--font-pixel);
  font-size: clamp(26px, 5vw, 46px);
  line-height: 1.35;
  color: #fff;
  text-shadow:
    3px 3px 0 rgba(0,0,0,.55),
    6px 6px 0 rgba(0,0,0,.22);
  margin-bottom: 18px;
}

.hero-title span {
  color: var(--gold);
  text-shadow:
    3px 3px 0 rgba(0,0,0,.55),
    6px 6px 0 rgba(0,0,0,.22);
}

.hero-sub {
  font-size: 15px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
  margin-bottom: 26px;
}

/* 搜索框 */
.search-box {
  display: flex;
  max-width: 560px;
  margin: 0 auto 20px;
  background: #fff;
  border: 4px solid var(--border);
  box-shadow: var(--pixel-shadow);
  overflow: hidden;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink);
  background: transparent;
}

.search-box input::placeholder { color: #9a9483; }

.search-box button {
  border: none;
  border-left: 4px solid var(--border);
  background: var(--grass);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 0 26px;
  cursor: pointer;
  transition: background .15s;
}

.search-box button:hover { background: var(--grass-dark); }

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-badges span {
  background: rgba(255,255,255,.85);
  border: 3px solid var(--border);
  box-shadow: var(--pixel-shadow-sm);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--grass-dark);
}

/* 漂浮像素方块 */
.float-cubes { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.cube {
  position: absolute;
  width: 22px;
  height: 22px;
  background:
    linear-gradient(#7cb75a 0 0) top / 100% 8px no-repeat,
    linear-gradient(#5a9a3f 0 0) center / 100% 8px no-repeat,
    var(--dirt);
  border: 2px solid var(--border);
  opacity: .9;
  animation: floaty 5s ease-in-out infinite;
}

.c1 { left: 8%;  top: 30%; animation-delay: 0s; }
.c2 { left: 16%; top: 58%; width: 14px; height: 14px; animation-delay: 1.2s; }
.c3 { right: 12%; top: 36%; animation-delay: .6s; }
.c4 { right: 20%; top: 60%; width: 16px; height: 16px; animation-delay: 2s; }
.c5 { left: 45%; top: 20%; width: 12px; height: 12px; animation-delay: 1.6s; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-16px) rotate(6deg); }
}

/* hero 底部草皮锯齿 */
.hero-ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 18px;
  background: var(--grass);
  border-top: 4px solid var(--border);
  z-index: 1;
}

/* ===== 资源区 ===== */
.resources {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 20px 60px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h2 {
  font-family: var(--font-pixel);
  font-size: 20px;
  color: var(--grass-dark);
  text-shadow: 2px 2px 0 rgba(0,0,0,.12);
}

.section-head p { color: var(--ink-soft); font-size: 14px; }

/* 分类筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel);
  border: 3px solid var(--border);
  box-shadow: var(--pixel-shadow-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, background .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-btn .count {
  font-size: 12px;
  background: var(--stone);
  color: #fff;
  padding: 1px 7px;
  border-radius: 999px;
}

.filter-btn:hover { transform: translate(-1px, -1px); }

.filter-btn.active {
  background: var(--grass);
  color: #fff;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0,0,0,.35);
}

.filter-btn.active .count { background: rgba(0,0,0,.28); }

/* 布局 */
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}

/* 资源卡片 */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  background: var(--paper);
  border: 4px solid var(--border);
  box-shadow: var(--pixel-shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s, box-shadow .12s;
}

.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0,0,0,.38);
}

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

.card-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
}

.card-cat {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--dirt);
  border: 2px solid var(--border);
  padding: 2px 8px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.25);
}

.card-cat.mods      { background: #3f8f4a; }
.card-cat.texture   { background: #b06a3a; }
.card-cat.shader    { background: #5b5fc7; }
.card-cat.pack      { background: #a0408e; }
.card-cat.launcher  { background: #3a7ca8; }
.card-cat.java      { background: #c0392b; }

.card-desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  min-height: 42px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-top: 2px dashed #cfc8b2;
  padding-top: 8px;
}

.card-meta b { color: var(--ink); font-weight: 700; }

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.card-tags span {
  font-size: 12px;
  background: #e3ddc4;
  border: 1px solid #b5ad8e;
  border-radius: 3px;
  padding: 1px 7px;
  color: #6d6752;
}

.card-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dl-count { font-size: 12.5px; color: var(--ink-soft); }
.dl-count b { color: var(--gold); text-shadow: 1px 1px 0 rgba(0,0,0,.2); font-size: 14px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: var(--grass);
  border: 3px solid var(--border);
  box-shadow: 3px 3px 0 rgba(0,0,0,.35);
  padding: 9px 18px;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, background .15s;
  text-align: center;
}

.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,.35); background: var(--grass-dark); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.35); }

.btn-ghost {
  background: var(--stone);
  color: #fff;
}
.btn-ghost:hover { background: #8f8a79; }

/* ===== 侧栏 ===== */
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 84px; }

.panel {
  background: var(--paper);
  border: 4px solid var(--border);
  box-shadow: var(--pixel-shadow-sm);
  padding: 16px;
}

.panel-title {
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--grass-dark);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--border);
}

.hot-list { list-style: none; counter-reset: hot; display: flex; flex-direction: column; gap: 10px; }

.hot-list li {
  counter-increment: hot;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border: 2px solid transparent;
  transition: background .15s, border-color .15s;
}

.hot-list li:hover { background: var(--panel); border-color: #cfc8b2; }

.hot-list li::before {
  content: counter(hot);
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--stone);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 rgba(0,0,0,.25);
}

.hot-list li:nth-child(1)::before { background: var(--gold); }
.hot-list li:nth-child(2)::before { background: #c9c9c9; }
.hot-list li:nth-child(3)::before { background: #c98a4b; }

.hot-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hot-num  { flex: none; font-size: 12px; color: var(--ink-soft); }
.hot-num b { color: var(--gold); text-shadow: 1px 1px 0 rgba(0,0,0,.15); }

.tip-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.tip-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

.tip-list li::before {
  content: '▶';
  position: absolute;
  left: 0;
  color: var(--grass-dark);
  font-size: 10px;
  top: 3px;
}

.tip-list a {
  color: var(--grass-dark);
  font-weight: 700;
  text-decoration: underline;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--paper);
  border: 4px dashed var(--stone);
  margin-top: 24px;
}

.empty-icon { font-size: 44px; display: block; margin-bottom: 10px; }
.empty-state p { font-size: 16px; font-weight: 700; }
.empty-sub { color: var(--ink-soft); font-size: 14px; font-weight: 400 !important; }

/* ===== 页脚 ===== */
.site-footer {
  background: var(--dirt-dark);
  border-top: 4px solid var(--border);
  color: #e8dcc6;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 28px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.footer-brand strong { font-family: var(--font-pixel); font-size: 14px; color: #fff; }
.footer-brand p { margin-top: 10px; font-size: 13px; color: #c9b894; }
.footer-brand .logo-cube { margin-bottom: 10px; }

.footer-col h4 {
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }

.footer-col a {
  font-size: 13.5px;
  color: #e8dcc6;
  transition: color .15s;
}

.footer-col a:hover { color: var(--gold); }

.footer-legal {
  grid-column: 1 / -1;
  font-size: 12.5px;
  color: #b5a07e;
  border-top: 2px dashed rgba(255,255,255,.15);
  padding-top: 16px;
  line-height: 1.8;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 18, 14, .62);
  display: grid;
  place-items: center;
  padding: 20px;
}

/* hidden 属性的 display:none 必须显式声明，
   否则会被上面的 display:grid 覆盖，导致遮罩层隐形挡住整个页面 */
.modal-mask[hidden] {
  display: none !important;
}

.modal {
  width: min(440px, 100%);
  background: var(--paper);
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 rgba(0,0,0,.4);
  padding: 24px;
}

.modal-title {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--grass-dark);
  margin-bottom: 14px;
}

.modal-desc { font-size: 14px; color: var(--ink-soft); margin-bottom: 12px; }

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.modal-meta span {
  font-size: 12px;
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 3px 9px;
}

.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  border: 3px solid var(--gold);
  box-shadow: var(--pixel-shadow);
  padding: 12px 22px;
  max-width: 90vw;
  text-align: center;
}

/* ===== 用户区（导航） ===== */
.user-area { display: flex; align-items: center; gap: 10px; position: relative; }

/* ===== 消息通知（信封 + 小红点 + B 站风格弹窗） ===== */
.msg-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 3px solid var(--border);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .28);
  cursor: pointer;
  color: var(--ink);
  flex: none;
  padding: 0;
}
.msg-btn svg { width: 17px; height: 17px; display: block; }
.msg-btn:hover { background: var(--grass-light); }
.msg-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .28); }

.msg-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: #e03131;
  border: 2px solid var(--border);
  border-radius: 999px;
}

/* 遮罩 */
.msg-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 24px;
  background: rgba(20, 18, 14, .55);
  overflow-y: auto;
}

/* 弹窗主体 */
.msg-modal {
  width: min(420px, 100%);
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 4px solid var(--border);
  box-shadow: var(--pixel-shadow);
}

.msg-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--grass);
  color: #fff;
  border-bottom: 3px solid var(--border);
  flex: none;
}
.msg-modal-title { font-family: var(--font-pixel); font-size: 11px; }
.msg-modal-close {
  width: 26px;
  height: 26px;
  font-size: 17px;
  line-height: 1;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}

/* Tab */
.msg-tabs {
  display: flex;
  border-bottom: 3px solid var(--border);
  flex: none;
}
.msg-tab {
  position: relative;
  flex: 1;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 8px;
  background: var(--panel);
  color: var(--ink-soft);
  border: none;
  border-right: 3px solid var(--border);
  cursor: pointer;
}
.msg-tab:last-child { border-right: none; }
.msg-tab.is-active { background: var(--paper); color: var(--grass-dark); }
.msg-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  background: #e03131;
  border-radius: 50%;
  vertical-align: middle;
}

/* 内容区 */
.msg-body { flex: 1; min-height: 0; display: flex; }
.msg-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.msg-view-bar {
  padding: 8px 12px;
  border-bottom: 2px dashed rgba(31, 29, 24, .18);
  text-align: right;
  flex: none;
}
.msg-readall {
  font-family: var(--font-body);
  font-size: 11px;
  padding: 4px 9px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--border);
  cursor: pointer;
}

.msg-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

.msg-item {
  display: flex;
  gap: 9px;
  padding: 9px;
  background: #fff;
  border: 2px solid rgba(31, 29, 24, .18);
}
.msg-item.is-unread { background: #fff9e8; border-color: var(--gold); }
.msg-item.is-clickable { cursor: pointer; }
.msg-item.is-clickable:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(0, 0, 0, .18); }

.msg-item-avatar { flex: none; }
.msg-item-body { min-width: 0; flex: 1; }
.msg-item-text { font-size: 13px; line-height: 1.6; word-break: break-word; }
.msg-item-text b { color: var(--grass-dark); }
.msg-item-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--panel);
  border-left: 3px solid var(--grass);
  padding: 4px 7px;
  word-break: break-word;
}
.msg-item-time { margin-top: 4px; font-size: 11px; color: var(--stone); }

.convo-preview {
  margin-top: 3px;
  font-size: 12px;
  color: var(--stone);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.msg-unread-num {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: #e03131;
  border-radius: 999px;
  vertical-align: middle;
}

.msg-empty { font-size: 13px; color: var(--stone); text-align: center; padding: 26px 8px; line-height: 1.8; }
.msg-empty-sub { font-size: 12px; color: var(--stone); }

/* ===== 个人主页浮层 ===== */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(20, 18, 14, .55);
  overflow-y: auto;
}

.sheet {
  width: min(440px, 100%);
  max-height: min(640px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 4px solid var(--border);
  box-shadow: var(--pixel-shadow);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--grass);
  color: #fff;
  border-bottom: 3px solid var(--border);
  flex: none;
}
.sheet-head-title { font-family: var(--font-pixel); font-size: 11px; }
.sheet-close {
  width: 26px;
  height: 26px;
  font-size: 17px;
  line-height: 1;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.sheet-body { padding: 16px; overflow-y: auto; flex: 1; }
.sheet-body .profile-name { font-size: 13px; }
.sheet-blocked { font-size: 13px; color: #b0302a; width: 100%; }

.sheet-section {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--grass-dark);
  margin: 16px 0 8px;
}

.sheet-posts { display: flex; flex-direction: column; gap: 7px; }

.sheet-post {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  background: #fff;
  border: 2px solid rgba(31, 29, 24, .18);
  cursor: pointer;
}
.sheet-post:hover {
  border-color: var(--grass);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .15);
}

.sheet-post-title {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sheet-post-meta { font-size: 11px; color: var(--stone); flex: none; }

/* ---------- 聊天界面 ---------- */
.chat-view { }

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--panel);
  border-bottom: 2px solid rgba(31, 29, 24, .18);
  flex: none;
}
.chat-back {
  font-size: 15px;
  line-height: 1;
  padding: 3px 9px;
  background: var(--paper);
  border: 2px solid var(--border);
  cursor: pointer;
}
.chat-peer { font-size: 13px; font-weight: 800; color: var(--ink); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: #f7f3e6;
}

.chat-bubble { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.chat-bubble.is-me { align-self: flex-end; align-items: flex-end; }

.chat-text {
  font-size: 13px;
  line-height: 1.65;
  padding: 8px 11px;
  background: #fff;
  border: 2px solid var(--border);
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-bubble.is-me .chat-text { background: var(--grass-light); }

.chat-time { font-size: 10px; color: var(--stone); margin-top: 3px; }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 3px solid var(--border);
  background: var(--paper);
  flex: none;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 11px;
  background: #fff;
  border: 3px solid var(--border);
  outline: none;
}
.chat-form input:focus { border-color: var(--grass-dark); }

@media (max-width: 640px) {
  .msg-mask { padding: 56px 10px 16px; }
  .msg-modal { height: min(560px, calc(100vh - 90px)); }
}

.auth-entry { font-size: 13px; padding: 7px 14px; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .14);
  border: 3px solid rgba(255, 255, 255, .55);
  padding: 4px 8px 4px 6px;
}

.user-avatar {
  width: 22px;
  height: 22px;
  flex: none;
  background: var(--grass-light);
  border: 2px solid var(--border);
  box-shadow: inset -5px -5px 0 rgba(0, 0, 0, .18);
}

.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
  border-width: 2px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .3);
}

/* ===== 登录 / 注册弹窗 ===== */
.auth-modal { position: relative; width: min(400px, 100%); }

.auth-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
.auth-close:hover { color: var(--ink); }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }

.auth-tab {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 11px;
  padding: 11px 6px;
  background: var(--panel);
  color: var(--ink-soft);
  border: 3px solid var(--border);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .25);
  cursor: pointer;
}
.auth-tab.is-active { background: var(--grass); color: #fff; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.field input {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  background: #fff;
  border: 3px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .08);
  outline: none;
}
.field input:focus {
  border-color: var(--grass-dark);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .08), 0 0 0 3px rgba(107, 168, 79, .3);
}

.btn-block { width: 100%; padding: 12px; font-size: 15px; }

.form-error {
  font-size: 13px;
  font-weight: 700;
  color: #b0302a;
  background: #fdecea;
  border-left: 4px solid #b0302a;
  padding: 8px 10px;
}

.auth-tip {
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

/* ===== 头像 ===== */
.avatar {
  display: inline-block;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--panel);
  flex: none;
  line-height: 0;
  vertical-align: middle;
}

.avatar svg,
.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ===== 头像裁剪器（拖动 + 缩放） ===== */
.crop-wrap { margin-top: 14px; }

.crop-viewport {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
  overflow: hidden;
  background: #2b2b2b;
  border: 3px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.crop-viewport.is-dragging { cursor: grabbing; }

.crop-image {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.crop-zoom-label { font-size: 12px; color: var(--ink-soft); flex: none; }
.crop-zoom input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--grass-dark);
  cursor: pointer;
}

.crop-hint {
  font-size: 11px;
  color: var(--stone);
  text-align: center;
  margin-top: 6px;
}

.crop-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

/* 导航头像（可点击更换） */
.user-avatar {
  width: 22px;
  height: 22px;
  flex: none;
  overflow: hidden;
  line-height: 0;
  background: var(--grass-light);
  border: 2px solid var(--border);
  cursor: pointer;
}
.user-avatar svg,
.user-avatar img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.user-avatar:hover { outline: 2px solid var(--gold); outline-offset: 1px; }

/* 头像设置弹窗 */
.avatar-modal { width: min(420px, 100%); }

.avatar-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 3px solid var(--border);
  margin-bottom: 16px;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  flex: none;
  border: 3px solid var(--border);
  overflow: hidden;
  line-height: 0;
  background: var(--paper);
}
.avatar-preview svg,
.avatar-preview img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.avatar-current-tip { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.avatar-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  margin: 14px 0 8px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.avatar-option {
  aspect-ratio: 1 / 1;
  padding: 0;
  background: var(--paper);
  border: 3px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
}
.avatar-option svg,
.avatar-option img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.avatar-option:hover { transform: translate(-1px, -1px); }
.avatar-option.is-selected {
  border-color: var(--grass-dark);
  box-shadow: 0 0 0 3px var(--gold);
}

.avatar-upload { display: inline-block; margin-bottom: 6px; cursor: pointer; }
.avatar-upload input { display: none; }

.avatar-hint { font-size: 12px; color: var(--stone); margin-bottom: 4px; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--grass-dark);
    flex-direction: column;
    padding: 10px;
    border-bottom: 4px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero-inner { padding: 52px 16px 84px; }
  .resource-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  /* 用户区在小屏收紧，避免和汉堡菜单挤在一起 */
  .auth-entry { font-size: 12px; padding: 6px 10px; }
  .user-name { max-width: 68px; font-size: 12px; }
  .user-chip { padding: 3px 6px 3px 5px; gap: 6px; }
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }
}
