/* 成语大全 - 前台+后台共用样式（中国风 · 浅色） */
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: #f7f4ee; color: #333; line-height: 1.7; }
a { color: #b03a2e; text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* 头部 */
.site-header { background: #fff; border-bottom: 1px solid #e8e2d6; position: sticky; top: 0; z-index: 10; }
.header-in { display: flex; align-items: center; gap: 20px; padding: 12px 16px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: #2c2c2c; }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: #b03a2e; color: #fff; border-radius: 6px; font-family: "STKaiti", "KaiTi", serif; font-size: 20px; }
.search-bar { flex: 1; display: flex; min-width: 240px; }
.search-bar input { flex: 1; padding: 9px 14px; border: 2px solid #b03a2e; border-right: 0; border-radius: 6px 0 0 6px; font-size: 14px; outline: none; }
.search-bar button { padding: 0 22px; background: #b03a2e; color: #fff; border: 0; border-radius: 0 6px 6px 0; cursor: pointer; font-size: 14px; }
.top-nav { display: flex; gap: 16px; margin-left: auto; }
.top-nav a { color: #666; font-size: 14px; }

/* 分类导航条 */
.cat-nav { background: linear-gradient(180deg, #b8402f, #a53424); box-shadow: 0 2px 6px rgba(120,40,25,.25); }
.cat-nav-in { display: flex; gap: 2px; overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
.cat-nav-in::-webkit-scrollbar { display: none; }
.cat-nav-in a { color: rgba(255,244,230,.92); font-size: 15px; padding: 11px 18px; white-space: nowrap; letter-spacing: 1px; transition: background .15s; }
.cat-nav-in a:hover { background: rgba(0,0,0,.14); color: #fff; text-decoration: none; }
.cat-nav-in a.on { background: rgba(0,0,0,.20); color: #fff; font-weight: 700; box-shadow: inset 0 -3px 0 #f2d492; }

/* 首页 */
.hero { position: relative; text-align: center; padding: 58px 24px 46px; margin-top: 22px; background: linear-gradient(135deg, #fbf5e6 0%, #f6edd7 60%, #f3e8cf 100%); border: 1px solid #e8dcc0; border-radius: 14px; overflow: hidden; box-shadow: 0 3px 14px rgba(140,110,60,.10); }
.hero::before { content: "語"; position: absolute; right: -18px; top: -52px; font-family: "STKaiti", "KaiTi", serif; font-size: 230px; line-height: 1; color: rgba(176,58,46,.055); pointer-events: none; }
.hero::after { content: "辭"; position: absolute; left: -24px; bottom: -70px; font-family: "STKaiti", "KaiTi", serif; font-size: 200px; line-height: 1; color: rgba(176,58,46,.045); pointer-events: none; }
.hero h1 { position: relative; font-family: "STKaiti", "KaiTi", "STSong", serif; font-size: 42px; margin: 0 0 10px; color: #8f2d1c; letter-spacing: 10px; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.hero .sub { position: relative; color: #6f6045; margin: 0 0 28px; letter-spacing: 2px; }
.big-search { position: relative; max-width: 620px; margin: 0 auto; display: flex; box-shadow: 0 4px 16px rgba(176,58,46,.18); border-radius: 8px; }
.big-search input { flex: 1; padding: 14px 18px; font-size: 16px; border: 2px solid #b03a2e; border-right: 0; border-radius: 8px 0 0 8px; outline: none; background: #fffdf7; }
.big-search input::placeholder, .search-bar input::placeholder { color: #757575; opacity: 1; }
.big-search button { padding: 0 34px; font-size: 16px; background: linear-gradient(180deg,#bc4231,#a53424); color: #fff; border: 0; border-radius: 0 8px 8px 0; cursor: pointer; letter-spacing: 2px; }
.big-search button:hover { background: #93301f; }

.block { margin: 30px 0; }
.block-title { font-family: "STKaiti", "KaiTi", serif; font-size: 21px; letter-spacing: 2px; border-left: 4px solid #b03a2e; padding-left: 12px; margin: 0 0 16px; color: #2c2c2c; }
.block-title .more { float: right; font-size: 13px; font-weight: 400; color: #6b6b6b; font-family: "Microsoft YaHei", sans-serif; letter-spacing: 0; }

.letter-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.letter-nav a { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #e5dfd2; border-radius: 6px; font-weight: 700; color: #2c2c2c; }
.letter-nav a:hover { background: #b03a2e; color: #fff; text-decoration: none; }

.chip-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-block; padding: 6px 16px; background: #fff; border: 1px solid #e5dfd2; border-radius: 999px; font-size: 14px; color: #555; }
.chip:hover { border-color: #b03a2e; color: #b03a2e; text-decoration: none; }

.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff; border: 1px solid #e8e2d6; border-radius: 10px; padding: 16px; }
.chain a { font-family: "STKaiti", "KaiTi", serif; font-size: 18px; color: #2c2c2c; }
.chain a:hover { color: #b03a2e; text-decoration: none; }
.chain .arrow { color: #b03a2e; }
.big-chain { font-size: 20px; line-height: 2.2; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { position: relative; background: #fffdf8; border: 1px solid #e8e0cd; border-top: 3px solid #b03a2e; border-radius: 8px; padding: 16px; display: block; color: inherit; transition: box-shadow .15s, transform .15s; }
.card:hover { text-decoration: none; box-shadow: 0 6px 16px rgba(176,58,46,.14); transform: translateY(-2px); }
.card h3 { margin: 0 0 4px; font-family: "STKaiti", "KaiTi", serif; font-size: 21px; letter-spacing: 2px; color: #a53424; }
.card .py { color: #6b6b6b; font-size: 12px; }
.card p { margin: 8px 0 0; font-size: 13px; color: #666; }

/* 面包屑 / 列表页 */
.crumbs { font-size: 13px; color: #6b6b6b; margin: 16px 0; }
.crumbs strong { color: #555; }
.page-title { font-family: "STKaiti", "KaiTi", serif; font-size: 26px; margin: 10px 0 4px; }
.count { color: #6b6b6b; font-size: 13px; margin-top: 0; }
.empty { color: #6b6b6b; padding: 30px 0; text-align: center; width: 100%; }

/* 内容页 */
/* ===== 内容页：书页质感 ===== */
.detail {
  position: relative;
  background: #fbf5e6;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(190,160,110,.08), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(190,160,110,.07), transparent 50%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(150,120,70,.05) 31px 32px);
  border: 1px solid #e3d5b5;
  border-radius: 4px;
  padding: 34px 38px 30px;
  margin-bottom: 20px;
  box-shadow: inset 0 0 50px rgba(160,130,80,.12), 0 2px 10px rgba(120,95,50,.10);
}
.detail::before { /* 左侧装订线 */
  content: ""; position: absolute; left: 12px; top: 14px; bottom: 14px; width: 0;
  border-left: 1px solid rgba(176,58,46,.35);
  box-shadow: 4px 0 0 -3px rgba(176,58,46,.25);
}
.detail-head { text-align: center; position: relative; }
.detail-head h1 { margin: 0; }
.detail-head .py { font-size: 16px; color: #6f6045; margin: 12px 0 6px; letter-spacing: 2px; }
.idiom-fig { margin: 18px auto 4px; text-align: center; }
.idiom-fig img { max-width: 320px; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 3px 12px rgba(120,95,50,.20); border: 1px solid #e3d5b5; }

/* 田字格标题 */
.tzg-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.tzg {
  position: relative; width: 66px; height: 66px; box-sizing: border-box;
  border: 2px solid #b03a2e; border-radius: 2px; background: #fffdf4;
  display: flex; align-items: center; justify-content: center;
  font-family: "STKaiti", "KaiTi", "楷体", serif; font-size: 40px; line-height: 1;
  color: #2b2b2b; text-shadow: 0 1px 0 rgba(0,0,0,.06);
  box-shadow: 0 2px 5px rgba(140,110,60,.15), inset 0 0 12px rgba(190,160,110,.12);
}
.tzg::before, .tzg::after { content: ""; position: absolute; pointer-events: none; }
.tzg::before { left: 3px; right: 3px; top: 50%; border-top: 1px dashed rgba(176,58,46,.55); }
.tzg::after { top: 3px; bottom: 3px; left: 50%; border-left: 1px dashed rgba(176,58,46,.55); }

/* 首字印章 */
.seal {
  position: absolute; top: -6px; right: 0;
  width: 46px; height: 46px; border-radius: 6px;
  background: #b03a2e; color: #fdf6e3;
  display: flex; align-items: center; justify-content: center;
  font-family: "STKaiti", "KaiTi", serif; font-size: 26px;
  transform: rotate(4deg);
  box-shadow: 0 2px 6px rgba(176,58,46,.35), inset 0 0 6px rgba(255,235,200,.35);
  opacity: .92;
}

/* 书页正文排版 */
.detail .sec p, .detail .liju { font-family: "STKaiti", "KaiTi", serif; font-size: 17px; line-height: 2; color: #4a4136; }
.detail .sec h2 { font-family: "STKaiti", "KaiTi", serif; font-size: 18px; letter-spacing: 2px; color: #9c3524; margin: 0 0 8px; padding-left: 10px; border-left: 3px solid #b03a2e; }
.detail .liju li { border-bottom: 1px dashed #ddd0b4; padding: 6px 0; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: 12px; color: #6b6b6b; border-bottom: 1px dashed #e8e2d6; padding-bottom: 14px; }
.terms a { color: #b03a2e; text-decoration: none; border-bottom: 1px dashed #d8b4ae; }
.terms a:hover { color: #8e2b21; border-bottom-style: solid; }
.meta span { background: #f7f4ee; border-radius: 4px; padding: 2px 10px; }
.meta .ai-tag { background: #eef4ff; color: #4a72c4; }
.sec { margin: 20px 0; }
.sec h2 { font-size: 16px; color: #b03a2e; margin: 0 0 8px; }
.sec p { margin: 0; white-space: pre-wrap; }
.liju { margin: 0; padding-left: 20px; }
.liju li { margin: 4px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.story { background: #fbf9f4; border: 1px solid #efe9db; border-radius: 10px; padding: 18px 22px; }

.side { background: #fff; border: 1px solid #e8e2d6; border-radius: 12px; padding: 20px 24px; margin-bottom: 30px; }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-list li { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px dashed #f0ebe0; padding: 8px 0; }
.rel-list li a { font-family: "STKaiti", "KaiTi", serif; font-size: 17px; }
.rel-list .py { font-size: 12px; color: #6b6b6b; }
.actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }

@media (min-width: 900px) {
  .detail-and-side { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
}

/* 分页 */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 26px 0; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; background: #fff; border: 1px solid #e5dfd2; border-radius: 6px; font-size: 14px; color: #555; }
.pagination a:hover { border-color: #b03a2e; color: #b03a2e; text-decoration: none; }
.pagination .cur { background: #b03a2e; border-color: #b03a2e; color: #fff; }

/* 页脚 */
.site-footer { border-top: 1px solid #e8e2d6; background: #fff; margin-top: 40px; padding: 22px 0; color: #6b6b6b; font-size: 13px; text-align: center; }

/* 404 */
.empty-page { text-align: center; padding: 80px 0; }
.empty-page h1 { font-size: 80px; margin: 0; color: #e5dfd2; }

/* flash */
.flash { padding: 10px 16px; border-radius: 8px; margin: 14px 0; font-size: 14px; }
.flash.ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.flash.err { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }

/* ===== 后台 ===== */
body.admin { background: #f2f3f7; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 200px; background: #23262e; color: #cfd3dc; flex-shrink: 0; }
.admin-side .brand { display: block; padding: 18px 16px; color: #fff; font-weight: 700; font-size: 16px; border-bottom: 1px solid #33363f; }
.admin-side a.menu { display: block; padding: 12px 18px; color: #cfd3dc; font-size: 14px; border-left: 3px solid transparent; }
.admin-side a.menu:hover { background: #2c303a; text-decoration: none; color: #fff; }
.admin-side a.menu.cur { background: #2c303a; border-left-color: #b03a2e; color: #fff; }
.admin-main { flex: 1; padding: 24px 28px; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.admin-top h1 { font-size: 20px; margin: 0; }
.panel { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { background: #fff; border-radius: 10px; padding: 18px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat b { display: block; font-size: 28px; color: #b03a2e; }
.stat span { font-size: 13px; color: #6b6b6b; }
table.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tb th, table.tb td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
table.tb th { color: #6b6b6b; font-weight: 600; font-size: 13px; background: #fafbfc; }
table.tb td .ops a { margin-right: 8px; }
.btn { display: inline-block; padding: 8px 18px; border: 0; border-radius: 6px; background: #b03a2e; color: #fff; font-size: 14px; cursor: pointer; }
.btn:hover { background: #93301f; }
.btn.gray { background: #6b7280; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.green { background: #2e7d32; }
input.f, select.f, textarea.f { width: 100%; padding: 9px 12px; border: 1px solid #d7dbe2; border-radius: 6px; font-size: 14px; font-family: inherit; }
textarea.f { min-height: 90px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.progress { height: 22px; background: #eef0f4; border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress b { display: block; height: 100%; background: #2e7d32; width: 0; transition: width .3s; }
#log { max-height: 260px; overflow-y: auto; font-size: 13px; background: #23262e; color: #cfd3dc; border-radius: 8px; padding: 12px; margin-top: 10px; display: none; }
.login-box { max-width: 360px; margin: 80px auto; background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.login-box h1 { text-align: center; color: #b03a2e; font-size: 22px; margin-top: 0; }
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .detail { padding: 22px 18px; }
  .detail::before { left: 6px; }
  .tzg { width: 52px; height: 52px; font-size: 31px; }
  .tzg-row { gap: 8px; }
  .seal { width: 38px; height: 38px; font-size: 21px; }
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; display: flex; overflow-x: auto; }
  .admin-side .brand { display: none; }
  .admin-side a.menu { white-space: nowrap; }
}
