* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0d0d0d;
  --bg2: #1a1a1a;
  --bg3: #2a2a2a;
  --accent: #f0c040;
  --text: #f0f0f0;
  --muted: #888;
  --nav: 60px;
  --top: 58px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; overflow: hidden; }

#app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg); }

.screen { display: none; position: absolute; top: 0; left: 0; right: 0; bottom: var(--nav); overflow: hidden; flex-direction: column; }
.screen.active { display: flex; }

.top-bar { height: var(--top); padding: 10px 14px; background: var(--bg); flex-shrink: 0; display: flex; align-items: center; border-bottom: 1px solid #1c1c1c; }
.search-wrap { position: relative; width: 100%; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-wrap:focus-within .search-icon { color: var(--accent); }
#search-input { width: 100%; background: var(--bg3); border: 1.5px solid transparent; border-radius: 13px; padding: 11px 14px 11px 38px; font-size: 15px; color: var(--text); outline: none; caret-color: var(--accent); transition: border-color .2s; }
#search-input:focus { border-color: var(--accent); }
#search-input::placeholder { color: var(--muted); }

.books-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.books-list::-webkit-scrollbar { display: none; }

.section-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 14px 14px 8px; }

.top-scroll { display: flex; gap: 10px; padding: 0 14px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.top-scroll::-webkit-scrollbar { display: none; }
.top-card { flex-shrink: 0; width: 110px; cursor: pointer; }
.top-card:active .top-img { opacity: .8; }
.top-img { width: 110px; height: 165px; border-radius: 10px; overflow: hidden; background: var(--bg3); }
.top-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.top-card-title { font-size: 12px; font-weight: 600; color: var(--text); margin-top: 7px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top-card-author { font-size: 11px; color: var(--muted); margin-top: 2px; }
.top-card-reads { font-size: 10px; color: var(--accent); font-weight: 700; margin-top: 2px; }

.books-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 14px; }
.book-card { background: var(--bg2); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform .15s; }
.book-card:active { transform: scale(.96); }
.grid-img { width: 100%; aspect-ratio: 2/3; background: var(--bg3); overflow: hidden; }
.grid-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-info { padding: 8px 10px 10px; }
.book-title { font-size: 12px; font-weight: 600; line-height: 1.3; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { font-size: 11px; color: var(--muted); }

.detail-header { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid #1c1c1c; flex-shrink: 0; }
.back-btn { background: var(--bg3); border: none; border-radius: 10px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.back-btn:active { background: #333; }
.back-btn svg { width: 18px; height: 18px; color: var(--text); }
.detail-title-top { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 14px 20px; }
.detail-content::-webkit-scrollbar { display: none; }
.detail-hero { display: flex; gap: 14px; margin-bottom: 20px; }
.detail-cover { width: 86px; height: 129px; border-radius: 10px; overflow: hidden; background: var(--bg3); flex-shrink: 0; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-meta { flex: 1; padding-top: 2px; }
.detail-book-title { font-size: 16px; font-weight: 700; line-height: 1.3; margin-bottom: 5px; }
.detail-book-author { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.detail-badge { font-size: 10px; font-weight: 700; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.thoughts-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.thoughts-list { display: flex; flex-direction: column; gap: 10px; }
.thought-card { background: var(--bg2); border-radius: 13px; padding: 14px; border-left: 3px solid var(--accent); }
.thought-num { font-size: 10px; font-weight: 700; color: var(--accent); margin-bottom: 5px; }
.thought-title { font-size: 14px; font-weight: 600; margin-bottom: 7px; line-height: 1.35; }
.thought-example { font-size: 13px; color: var(--muted); line-height: 1.55; }

.bottom-nav { position: absolute; bottom: 0; left: 0; right: 0; height: var(--nav); background: var(--bg2); border-top: 1px solid #1c1c1c; display: flex; align-items: center; justify-content: center; }
.nav-btn { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 28px; cursor: pointer; opacity: .45; }
.nav-btn.active { opacity: 1; }
.nav-btn img { width: 24px; height: 24px; display: block; object-fit: contain; }
.nav-btn span { font-size: 10px; font-weight: 600; color: var(--text); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 14px; }
