

/* ═══════════════════════════════════════════
   common.css — 书卷小程序公共样式
   适用于：home.html / library.html / stats.html
═══════════════════════════════════════════ */

/* ─────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────── */
:root {
  --red:          #C0251A;
  --red-light:    #E8352A;
  --red-dark:     #8B1A12;
  --red-pale:     #FDF0EE;
  --red-muted:    #F5C8C4;
  --gold:         #C9A84C;
  --gold-pale:    #FDF5E6;
  --green:        #2A7A4A;
  --green-pale:   #EAF5EE;
  --purple:       #5A4A9A;
  --purple-pale:  #F0EEF8;
  --purple-muted: #C8C0E8;
  --ink:          #1A1008;
  --ink-muted:    #5A4A3A;
  --ink-hint:     #9A8A7A;
  --paper:        #FBF7F2;
  --paper-warm:   #F5EDE0;
  --surface:      #FFFFFF;
  --border:       rgba(192, 37, 26, 0.11);
  --border-soft:  rgba(0, 0, 0, 0.07);
  --serif:        serif;
  --sans:         sans-serif;
  --tab-h:        60px;
}

/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────
   APP WRAPPER — max-width 430px，居中
───────────────────────────────────────── */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

/* ─────────────────────────────────────────
   PAGE HEADER — sticky 顶部
───────────────────────────────────────── */
.page-header {
  background: var(--red);
  padding: 12px 20px 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-header .h-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-header .h-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .04em;
}
.page-header .h-sub {
  font-family: var(--sans);
  font-size: 11px;
  color: rgba(255,255,255,.6);
  margin-top: 3px;
  letter-spacing: .06em;
}

/* ─────────────────────────────────────────
   PAGE SCROLL BODY
───────────────────────────────────────── */
.page-scroll {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tab-h) + 20px);
}
.page-scroll::-webkit-scrollbar { display: none; }

/* ─────────────────────────────────────────
   SECTION LABEL
───────────────────────────────────────── */
.sec-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px 10px;
}
.sec-label .sl-bar {
  width: 3px;
  height: 13px;
  background: var(--red);
  border-radius: 2px;
  flex-shrink: 0;
}
.sec-label .sl-text {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: .1em;
}

/* ─────────────────────────────────────────
   CARD
───────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: 14px;
  border: 0.5px solid var(--border);
  overflow: hidden;
}
.card-mx { margin-left: 16px; margin-right: 16px; }
.card-mb { margin-bottom: 14px; }

/* ─────────────────────────────────────────
   BADGE
───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
}
.badge-red    { background: var(--red-pale);    color: var(--red-dark); border: .5px solid var(--red-muted); }
.badge-green  { background: var(--green-pale);  color: var(--green);    border: .5px solid #B0DCC0; }
.badge-purple { background: var(--purple-pale); color: var(--purple);   border: .5px solid var(--purple-muted); }
.badge-gray   { background: #F5F0E8;            color: #8A7A5A;         border: .5px solid #DDD5C0; }

/* ─────────────────────────────────────────
   STATS CHIPS ROW
───────────────────────────────────────── */
.stats-row { display: flex; gap: 10px; margin-bottom: 16px; }
.stat-chip {
  flex: 1;
  background: var(--surface);
  border: .5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.chip-num { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--red); }
.chip-lbl { font-family: var(--sans); font-size: 10px; color: var(--ink-hint); margin-top: 2px; letter-spacing: .04em; }

/* ─────────────────────────────────────────
   BOOK GRID
───────────────────────────────────────── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 12px;
}
.book-item { display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.cover-box {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-box .cb-spine  { position: absolute; left: 0; top: 0; width: 7px; height: 100%; background: rgba(0,0,0,.22); }
.cover-box .cb-text   { font-family: var(--serif); font-size: 11px; font-weight: 700; color: #fff; writing-mode: vertical-rl; letter-spacing: .1em; position: relative; z-index: 1; }
.cover-box .cb-author { position: absolute; bottom: 8px; right: 6px; font-family: var(--sans); font-size: 8px; color: rgba(255,255,255,.5); writing-mode: vertical-rl; }
.cover-box .cb-overlay{ position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,.15); }
.cover-box .cb-fill   { height: 100%; }
.item-title  { font-family: var(--serif); font-size: 11px; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-badges { display: flex; gap: 4px; flex-wrap: wrap; }
/* 想看角标 */
.want-tag::after {
  content: '想看';
  position: absolute; top: 6px; right: 0;
  background: rgba(90,74,154,.82);
  font-family: var(--sans); font-size: 8px; color: #fff;
  padding: 2px 5px; border-radius: 2px 0 0 2px; letter-spacing: .04em;
}

/* ─────────────────────────────────────────
   BOTTOM TAB BAR — fixed 锁底
───────────────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--tab-h);
  background: var(--surface);
  border-top: .5px solid var(--border-soft);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.safe-area-bottom {
  height: env(safe-area-inset-bottom, 0px);
  background: var(--paper);
  border-top: .5px solid var(--border-soft);
}
.tb-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 8px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.tb-item:active { opacity: .65; }
.tb-lbl {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--ink-hint);
  transition: color .2s;
}
.tb-item.active .tb-lbl { color: var(--red); font-weight: 500; }

/* 中间首页圆形浮起按钮 */
.tb-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  margin-top: -18px;
  cursor: pointer;
  align-self: center;
}
.home-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  aspect-ratio: 1/1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--paper);
  transition: transform .15s;
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
}
.home-btn:active { transform: scale(.93); }
.tb-center.active .home-btn      { background: var(--red); box-shadow: 0 3px 12px rgba(192,37,26,.4); }
.tb-center.active .home-btn svg { stroke: #fff !important; }
.tb-center:not(.active) .home-btn{ background: #EDE8E1; box-shadow: 0 2px 8px rgba(0,0,0,.1); color: #fff}
.tb-center .tb-lbl   { font-size: 10px; }
.tb-center.active .tb-lbl { color: var(--red); font-weight: 500; }

/* ─────────────────────────────────────────
   ADD SHEET — 书库添加弹出层
───────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }
.sheet {
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 0 0 20px;
  max-height: 80dvh;
  overflow-y: auto;
  transform: translateY(40px);
  transition: transform .28s;
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet::-webkit-scrollbar { display: none; }
.sheet-handle { width: 36px; height: 4px; background: rgba(0,0,0,.14); border-radius: 2px; margin: 12px auto 16px; }
.sheet-title  { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--ink); padding: 0 20px 14px; border-bottom: .5px solid var(--border); }

.type-row { display: flex; gap: 10px; padding: 14px 20px 0; }
.type-btn { flex: 1; height: 48px; border-radius: 10px; border: .5px solid var(--border); display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; transition: .2s; background: var(--surface); }
.type-btn.sel { border: 1.5px solid var(--red); background: var(--red-pale); }
.type-btn span { font-family: var(--sans); font-size: 13px; font-weight: 500; }
.type-btn.sel span { color: var(--red-dark); }
.type-btn:not(.sel) span { color: var(--ink-muted); }

.form-sec { padding: 14px 20px 0; }
.field-lbl { font-family: var(--sans); font-size: 11px; color: var(--ink-hint); letter-spacing: .06em; margin-bottom: 6px; }
.field-input { width: 100%; height: 40px; background: var(--surface); border: .5px solid var(--border); border-radius: 8px; padding: 0 12px; font-family: var(--sans); font-size: 13px; color: var(--ink); outline: none; }
.field-input:focus { border-color: var(--red-muted); }
.field-input::placeholder { color: var(--ink-hint); }

.cover-upload { display: flex; gap: 10px; align-items: flex-end; }
.upload-box { width: 64px; height: 86px; border: 1px dashed var(--red-muted); border-radius: 6px; background: var(--red-pale); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.upload-box span { font-family: var(--sans); font-size: 9px; color: var(--red-dark); }

.color-picks { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.color-dot   { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: .15s; }
.color-dot.sel { border-color: var(--red); transform: scale(1.15); }

.submit-btn { margin: 16px 20px 0; width: calc(100% - 40px); height: 44px; background: var(--red); border: none; border-radius: 10px; font-family: var(--serif); font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .08em; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.submit-btn:hover { background: var(--red-light); }



svg {
  width: 24px !important; /* 替换为你的目标尺寸 */
  height: 24px !important;
  min-width: 24px;
  min-height: 24px;
  max-width: none !important; /* 避免被父元素 max-width 压缩 */
  display: block; /* 避免 inline 元素的基线偏移 */
}
