:root {
  --bg: #f7f0e6;
  --bg-soft: #fffaf4;
  --panel: rgba(255, 250, 244, 0.82);
  --panel-strong: rgba(255, 248, 239, 0.95);
  --line: rgba(88, 56, 33, 0.14);
  --text: #2d211a;
  --muted: #6d5a4d;
  --accent: #b4552d;
  --accent-deep: #8f3515;
  --green: #47614b;
  --shadow: 0 22px 60px rgba(99, 62, 27, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(197, 134, 78, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(76, 118, 86, 0.16), transparent 30%),
    linear-gradient(180deg, #f8f1e8 0%, #f1e8dc 100%);
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

body.drawer-open {
  overflow: hidden;
}

.site-record-footer {
  padding: 18px 20px 28px;
  text-align: center;
  color: rgba(45, 33, 26, 0.42);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.hidden {
  display: none !important;
}

.auth-overlay,
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(39, 28, 18, 0.34);
  backdrop-filter: blur(18px);
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.auth-panel,
.modal-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: 32px;
  background: rgba(255, 250, 243, 0.88);
  border: 1px solid rgba(88, 56, 33, 0.12);
  box-shadow: var(--shadow);
}

.modal-card {
  width: min(560px, 100%);
  grid-template-columns: 1fr;
}

.auth-card,
.auth-copy {
  padding: 1.2rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(88, 56, 33, 0.08);
}

.auth-tabs,
.top-nav-right,
.account-chip,
.admin-card-actions,
.modal-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-form label,
.admin-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-form input,
.admin-form-grid input,
.journal-editor-form input {
  width: 100%;
  min-height: 52px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
}

.hero-side {
  display: grid;
  gap: 1rem;
}

.top-nav-right {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}

.account-chip {
  padding: 0.65rem 0.8rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(88, 56, 33, 0.08);
}

.account-chip-copy {
  display: flex;
  flex-direction: column;
  margin-right: 0.2rem;
}

.account-chip-copy strong {
  font-size: 0.98rem;
}

.account-chip-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-layout {
  display: grid;
  gap: 1rem;
}

.admin-user-list,
.admin-feedback-list {
  display: grid;
  gap: 0.9rem;
}

.admin-upload-block {
  display: grid;
  gap: 1rem;
}

.admin-upload-actions,
.random-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.random-advanced-grid {
  grid-template-columns: minmax(0, 2fr) minmax(220px, 0.8fr);
  align-items: start;
}

.random-inline-actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.random-inline-actions .issue-select {
  flex: 1 1 220px;
}

.upload-file-picker,
.random-advanced-grid label,
.random-preset-name-label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.random-preset-name-label input {
  width: 100%;
  min-height: 52px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
}

.random-search-input {
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
}

.random-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 420px;
  max-height: 520px;
  padding: 0.8rem 0.85rem;
  overflow: auto;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
}

.random-check-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 0.65rem;
  color: var(--text);
  line-height: 1.35;
  cursor: pointer;
  padding: 0.4rem 0.1rem;
  width: 100%;
  text-align: left;
}

.random-check-item input {
  margin-top: 0;
  accent-color: var(--accent);
}

.random-check-item span {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  justify-self: start;
  text-align: left;
}

.upload-file-picker input[type="file"] {
  width: 100%;
  min-height: 52px;
  padding: 0.78rem 0.95rem;
  border: 1px dashed rgba(88, 56, 33, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font: inherit;
}

.admin-upload-draft {
  display: grid;
  gap: 0.9rem;
}

.upload-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.upload-preview-block {
  padding: 1rem 1.1rem;
}

.random-advanced-card {
  width: min(1180px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
  align-self: start;
  margin: 1rem 0;
}

.random-advanced-help {
  margin: 0;
}

.random-advanced-card .random-advanced-grid {
  min-height: 0;
}

.random-advanced-card .modal-actions {
  position: sticky;
  bottom: 0;
  padding-top: 0.9rem;
  background: rgba(255, 250, 243, 0.92);
}

.random-advanced-card {
  width: min(1280px, calc(100vw - 2rem));
  max-height: min(900px, calc(100vh - 2rem));
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.random-advanced-body {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.25fr);
  gap: 1rem;
  min-height: 0;
}

.random-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  gap: 0.7rem;
}

.random-pane-head {
  display: grid;
  gap: 0.55rem;
}

.random-pane-head h4,
.random-pane-head p {
  margin: 0;
}

.random-advanced-summary {
  color: var(--muted);
  line-height: 1.65;
}

.random-preset-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.random-preset-bar .issue-select {
  flex: 1 1 280px;
}

.random-checklist {
  min-height: 0;
  height: 100%;
  max-height: 100%;
}

.random-list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.random-list-row .detail-btn {
  margin-top: 0;
  min-width: 4.5rem;
  padding: 0.62rem 0.9rem;
}

.random-list-row span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.random-empty {
  color: var(--muted);
  line-height: 1.7;
}

.random-selected-card {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(88, 56, 33, 0.1);
  background: rgba(255, 255, 255, 0.65);
}

.random-selected-head,
.random-years-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.random-selected-head strong {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.random-selected-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.random-year-dropdown {
  position: relative;
}

.random-year-dropdown summary {
  list-style: none;
  cursor: pointer;
  min-height: 40px;
  padding: 0.58rem 0.82rem;
  border-radius: 14px;
  border: 1px solid rgba(88, 56, 33, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}

.random-year-dropdown summary::-webkit-details-marker {
  display: none;
}

.random-year-dropdown[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.random-year-dropdown-panel {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  z-index: 4;
  width: min(460px, 72vw);
  padding: 0.85rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 0 0 18px 18px;
  background: rgba(255, 250, 243, 0.98);
  box-shadow: 0 12px 32px rgba(45, 33, 26, 0.12);
}

.random-selected-head .detail-btn,
.random-years-actions .detail-btn {
  margin-top: 0;
  padding: 0.58rem 0.82rem;
}

.random-year-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem 0.8rem;
}

.random-year-item {
  padding: 0.25rem 0;
}

.admin-user-card,
.admin-feedback-card {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(88, 56, 33, 0.08);
}

.admin-user-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.admin-user-head h4,
.admin-user-head p {
  margin: 0;
}

.admin-user-head p {
  color: var(--muted);
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.admin-form-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.admin-form-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  top: 6rem;
  right: 8vw;
  width: 16rem;
  height: 16rem;
  background: rgba(180, 85, 45, 0.1);
}

.orb-b {
  left: 4vw;
  bottom: 10rem;
  width: 14rem;
  height: 14rem;
  background: rgba(71, 97, 75, 0.1);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1360px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 3.5rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1rem;
  align-items: stretch;
  padding: 0.2rem 0 1.15rem;
}

.hero-copy,
.hero-side {
  padding: 1.2rem 1.25rem;
  border-radius: 30px;
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 204px;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent-deep);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 9ch;
  font-size: clamp(2.2rem, 4.8vw, 4rem);
  line-height: 1.02;
  font-weight: 600;
}

.hero-text {
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.8;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric-card,
.control-panel,
.paper-card,
.detail-panel {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 1rem 1.1rem;
  border-radius: 22px;
}

.metric-label {
  display: block;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.metric-card strong {
  font-size: 1.7rem;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) repeat(6, minmax(140px, 1fr));
  gap: 0.85rem;
  align-items: end;
  margin: 0 0 1.15rem;
  padding: 1rem 1rem 1.05rem;
  border-radius: var(--radius);
}

.top-nav,
.home-toolbar,
.library-side-block,
.library-item,
.library-empty {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.top-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin: 0 0 0.95rem;
  padding: 0.8rem 0.9rem;
  border-radius: 24px;
}

.view-switch,
.recommend-actions,
.card-actions,
.read-manager-actions,
.library-item-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.recommend-actions {
  flex-wrap: nowrap;
  align-items: center;
}

#randomAdvancedBtn {
  white-space: nowrap;
  padding-left: 0.8rem;
  padding-right: 0.8rem;
}

.nav-btn {
  min-height: 42px;
  padding: 0.68rem 0.95rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.nav-btn.is-active,
.nav-btn:hover {
  background: var(--accent);
  color: #fffaf4;
  transform: translateY(-1px);
}

.view-panel {
  display: block;
}

.home-toolbar {
  margin: 0 0 1.2rem;
  padding: 0.95rem 1.1rem;
  border-radius: 22px;
}

.home-hint {
  color: var(--muted);
  line-height: 1.75;
}

.search-box,
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.search-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: stretch;
}

.search-submit-btn {
  margin-top: 0;
  min-height: 48px;
  padding: 0.78rem 1rem;
  white-space: nowrap;
}

.home-random-preset-group {
  min-width: 180px;
}

.filter-group:first-of-type {
  grid-column: 2 / span 1;
}

.search-box span,
.filter-label {
  font-size: 0.84rem;
  color: var(--muted);
}

.search-box input,
.issue-select,
.chat-form textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  font: inherit;
}

.search-box input,
.issue-select {
  min-height: 48px;
}

.chip-row,
.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip,
.load-more,
.detail-btn,
.suggestion-chip {
  border: none;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.chip {
  padding: 0.72rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font: inherit;
}

.chip.is-active,
.chip:hover,
.suggestion-chip:hover {
  background: var(--accent);
  color: #fff7ef;
  transform: translateY(-1px);
}

.suggestion-chip {
  padding: 0.68rem 0.92rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font: inherit;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
}

.paper-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.15rem;
  min-height: 380px;
  border-radius: 24px;
  transform: translateY(16px);
  opacity: 0;
  animation: cardIn 420ms ease forwards;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.issue-pill,
.type-pill,
.keyword-chip,
.highlight-tag,
.chat-context-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.issue-pill,
.type-pill,
.chat-context-tag {
  padding: 0.35rem 0.7rem;
  background: rgba(180, 85, 45, 0.08);
  color: var(--accent-deep);
  font-size: 0.78rem;
}

.paper-title {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.2;
}

.paper-title-en,
.paper-summary,
.mini-text,
.chat-helper,
.chat-tip {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.paper-title-en {
  font-size: 0.9rem;
}

.keyword-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  width: 100%;
}

.keyword-chip {
  justify-content: center;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.72rem;
  background: rgba(71, 97, 75, 0.1);
  color: var(--green);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
  word-break: break-word;
}

.highlight-tag {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.65rem 0.85rem;
  background: rgba(45, 33, 26, 0.06);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: left;
  word-break: break-word;
  border-radius: 16px;
}

.highlights {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.mini-section {
  padding-top: 0.35rem;
  border-top: 1px solid rgba(88, 56, 33, 0.08);
}

.mini-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent-deep);
  font-size: 0.82rem;
}

.detail-btn,
.load-more {
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #cf7041 100%);
  color: #fffaf4;
  font: inherit;
}

.detail-btn {
  margin-top: auto;
}

.card-actions {
  margin-top: auto;
}

.card-actions .detail-btn {
  flex: 1 1 0;
  margin-top: 0;
}

.detail-btn:hover,
.load-more:hover {
  transform: translateY(-2px);
}

.feed-footer {
  display: flex;
  justify-content: center;
  padding: 1.6rem 0 0;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.detail-drawer.hidden {
  display: none;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 22, 17, 0.36);
}

.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(1320px, 100vw);
  height: 100vh;
  padding: 1.4rem;
  overflow-y: auto;
  background: var(--panel-strong);
  animation: drawerIn 240ms ease;
}

.close-btn {
  position: sticky;
  top: 0;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(45, 33, 26, 0.08);
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: 1.2rem;
  align-items: start;
}

.detail-single {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-sidebar {
  position: sticky;
  top: 0.5rem;
  align-self: start;
  width: 520px;
  max-width: min(760px, 48vw);
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-hero h2 {
  margin: 0.3rem 0;
  font-size: 2rem;
  line-height: 1.15;
}

.detail-kicker,
.detail-title-en,
.detail-authors {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-block {
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(88, 56, 33, 0.08);
}

.detail-block h3,
.note-card h4,
.concept-card h4 {
  margin: 0 0 0.6rem;
}

.detail-block p,
.detail-block li,
.note-card p,
.concept-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.markdown-body {
  color: var(--muted);
  line-height: 1.8;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0 0 0.7rem;
}

.markdown-body p:last-child,
.markdown-body ul:last-child,
.markdown-body ol:last-child,
.markdown-body pre:last-child {
  margin-bottom: 0;
}

.markdown-body strong {
  color: var(--text);
  font-weight: 700;
}

.markdown-body em {
  font-style: italic;
}

.markdown-body code {
  padding: 0.08rem 0.35rem;
  border-radius: 8px;
  background: rgba(45, 33, 26, 0.08);
  color: var(--accent-deep);
  font-family: "Iosevka Curly", "Cascadia Code", "Consolas", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: rgba(45, 33, 26, 0.06);
  overflow: auto;
}

.markdown-body pre code {
  padding: 0;
  background: none;
}

.markdown-body ul,
.markdown-body ol,
.markdown-list {
  padding-left: 1.2rem;
}

.read-manager-row,
.folder-create {
  display: flex;
  gap: 0.9rem;
  align-items: end;
  flex-wrap: wrap;
}

.folder-picker,
.library-folder-picker {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 220px;
}

.folder-picker span,
.library-folder-picker span,
.library-side-head p,
.library-feedback,
.library-title-en,
.library-meta-row {
  color: var(--muted);
}

.library-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.2rem;
}

.library-sidebar,
.library-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.library-side-block,
.library-empty {
  padding: 1rem 1.1rem;
  border-radius: 22px;
}

.library-side-head h2,
.library-side-head h3,
.library-header h2 {
  margin: 0 0 0.35rem;
}

.library-side-head p,
.library-header p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.folder-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.folder-chip strong {
  color: var(--accent-deep);
}

.folder-chip.is-active,
.folder-chip:hover {
  transform: translateY(-1px);
  background: rgba(180, 85, 45, 0.12);
}

.folder-create input {
  flex: 1 1 220px;
  min-height: 50px;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 22px;
}

.library-open-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.library-open-btn:hover {
  color: var(--accent-deep);
}

.library-title-en {
  margin: 0.35rem 0 0.7rem;
  line-height: 1.7;
}

.library-meta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
  line-height: 1.7;
}

.library-item-side {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.detail-block ul {
  margin: 0;
  padding-left: 1.2rem;
}

.note-grid,
.concept-grid,
.study-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.note-grid {
  grid-template-columns: 1fr;
}

.note-card,
.concept-card,
.study-card {
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 56, 33, 0.08);
}

.concept-card span,
.study-meta {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--accent-deep);
  font-size: 0.82rem;
}

.detail-block-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.detail-block-head h3,
.detail-block-head p {
  margin: 0;
}

.detail-block-head p {
  color: var(--muted);
  line-height: 1.7;
}

.concept-accordion {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.concept-item {
  border: 1px solid rgba(88, 56, 33, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.concept-item summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.concept-item summary::-webkit-details-marker {
  display: none;
}

.concept-item[open] summary {
  border-bottom: 1px solid rgba(88, 56, 33, 0.08);
  background: rgba(180, 85, 45, 0.07);
}

.concept-body {
  padding: 0.95rem 1rem 1rem;
}

.concept-body span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--accent-deep);
  font-size: 0.82rem;
}

.journal-editor-meta {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}

.journal-editor-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.journal-editor-form label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.journal-editor-form span {
  font-size: 0.9rem;
  color: var(--muted);
}

.journal-editor-form input {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
}

.journal-editor-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.journal-editor-feedback {
  margin: 0;
  color: var(--muted);
}

.review-flag {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  background: rgba(180, 85, 45, 0.12);
  color: var(--accent-deep);
  font-size: 0.8rem;
}

.chat-block {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: calc(100vh - 4rem);
}

.chat-head,
.chat-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 160px;
  max-height: 420px;
  padding: 0.3rem;
  overflow-y: auto;
}

.chat-empty {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.chat-bubble {
  max-width: 92%;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(88, 56, 33, 0.08);
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(180, 85, 45, 0.12);
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.78);
}

.chat-role {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent-deep);
  font-size: 0.82rem;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.chat-form textarea {
  min-height: 140px;
  resize: vertical;
}

.chat-resize-handle {
  width: 100%;
  height: 10px;
  margin: 0.2rem 0 0.6rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(176, 132, 96, 0.18), rgba(176, 132, 96, 0.55), rgba(176, 132, 96, 0.18));
  cursor: ew-resize;
}

.chat-resize-handle:hover {
  background: linear-gradient(90deg, rgba(176, 132, 96, 0.28), rgba(176, 132, 96, 0.75), rgba(176, 132, 96, 0.28));
}

.chat-actions .detail-btn,
#submitFeedbackBtn {
  width: auto;
  min-width: 104px;
  margin-top: 0;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  flex: 0 0 auto;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.feedback-form textarea {
  width: 100%;
  min-height: 110px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(88, 56, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.feedback-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.feedback-status-text,
.feedback-latest-note {
  margin: 0 0 0.7rem;
  color: var(--muted);
  line-height: 1.75;
}

.fulltext-actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.ghost-btn {
  text-decoration: none;
  background: rgba(45, 33, 26, 0.08);
  color: var(--text);
}

.fulltext-wrap.is-hidden {
  display: none;
}

.modal-actions {
  justify-content: flex-end;
}

.fulltext-meta {
  margin-bottom: 0.8rem;
  color: var(--muted);
}

.fulltext-pre {
  margin: 0;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-family: "Iosevka Curly", "Cascadia Code", "Consolas", monospace;
  font-size: 0.92rem;
  color: var(--text);
}

.library-header {
  margin-bottom: 0.2rem;
}

.scroll-top-btn {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 20;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  background: rgba(45, 33, 26, 0.9);
  color: #fffaf4;
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drawerIn {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 1080px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .hero,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-side {
    min-height: unset;
  }

  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .library-layout,
  .library-item,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    position: static;
    width: auto;
    max-width: none;
  }

  .chat-block {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw, calc(100vw - 0.75rem));
    padding: 0.8rem 0 2.5rem;
  }

  .hero {
    gap: 0.8rem;
    padding-bottom: 0.9rem;
  }

  .hero-copy,
  .hero-side,
  .top-nav,
  .control-panel {
    border-radius: 22px;
  }

  .hero-copy,
  .hero-side {
    padding: 1rem;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(2rem, 10vw, 2.7rem);
  }

  .hero-metrics,
  .keyword-row,
  .note-grid,
  .concept-grid,
  .study-grid,
  .concept-accordion,
  .admin-layout,
  .admin-upload-actions,
  .random-advanced-grid,
  .random-advanced-body,
  .upload-form-grid {
    grid-template-columns: 1fr;
  }

  .search-submit-row {
    grid-template-columns: 1fr;
  }

  .search-submit-btn {
    width: 100%;
  }

  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .home-random-preset-group {
    grid-column: auto;
  }

  .paper-card {
    min-height: 0;
    padding: 0.9rem;
    gap: 0.65rem;
    border-radius: 18px;
  }

  .paper-title {
    font-size: 1rem;
    line-height: 1.3;
  }

  .paper-summary {
    font-size: 0.84rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 7;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .paper-title-en,
  .keyword-row,
  .mini-section,
  .highlights {
    display: none;
  }

  .card-actions {
    gap: 0.45rem;
  }

  .card-actions .detail-btn {
    min-height: 42px;
    padding: 0.72rem 0.8rem;
    font-size: 0.84rem;
    border-radius: 14px;
  }

  .detail-panel {
    width: 100vw;
    padding: 1rem;
  }

  .chat-head,
  .chat-actions,
  .detail-block-head,
  .top-nav,
  .top-nav-right,
  .read-manager-row,
  .library-item-actions,
  .admin-card-actions,
  .admin-form-checks,
  .modal-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .account-chip {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
  }

  .account-chip-copy {
    margin-right: 0;
  }

  .journal-editor-form {
    grid-template-columns: 1fr;
  }

  .random-year-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .random-preset-bar,
  .random-selected-head,
  .random-years-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .recommend-actions,
  .view-switch,
  .top-nav-right {
    width: 100%;
  }

  .recommend-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .recommend-actions::-webkit-scrollbar {
    display: none;
  }

  .recommend-actions .nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    padding-left: 0.82rem;
    padding-right: 0.82rem;
  }

  .view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-switch #adminViewBtn {
    grid-column: 1 / -1;
  }

  .random-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-btn,
  .card-actions .detail-btn {
    width: 100%;
    justify-content: center;
  }

  .recommend-actions .nav-btn {
    width: auto;
    justify-content: center;
  }

  .account-chip .nav-btn {
    width: auto;
    min-width: 5.25rem;
  }

  .control-panel {
    gap: 0.7rem;
    padding: 0.9rem;
  }

  .search-box input,
  .issue-select {
    min-height: 46px;
  }
}
