:root {
  --bg: #F5EFE3;
  --paper: #FDFCF7;
  --text: #2C2C2C;
  --text-light: #3D3D3D;
  --accent: #8B5E3C;
  --accent-dim: #8A6B4A;
  --border: #C4B6A0;
  --shadow: rgba(0,0,0,0.06);
  --font-en: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-zh: 'Noto Serif SC', 'Source Han Serif SC', STSong, serif;
  --nav-height: 56px;
}
body.dark {
  --bg: #171411;
  --paper: #231F19;
  --text: #E3D8C8;
  --text-light: #B7A996;
  --accent: #D3B07A;
  --accent-dim: #B69467;
  --border: #4A4238;
  --shadow: rgba(0,0,0,0.38);
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }

body, nav, .card, .card-face, .card-flip, .card-inner,
.flip-btn, .lang-toggle, .interest-item, .msg-board-btn,
.visi-toggle, .form-submit, .lightcone-btn, .pdf-modal-inner,
.pdf-modal-close, .cal-nav, .calendar, .cal-header, .cal-grid,
.cal-cell, .cal-event-info, .back-actions button, .bf-editor, .bf-toolbar,
.board-msg-card, .board-msg-reply, .board-reply-item, .board-post-back,
.sp-card, .sp-back {
  transition: background 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-zh);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  margin: 0;
}
#app-root {
  width: 1700px;
  height: 936px;
  display: flex;
  flex-direction: column;
  transform-origin: top left;
  position: relative;
}

nav {
  height: var(--nav-height);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  box-shadow: 0 1px 4px var(--shadow);
}
.nav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-name {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--accent);
  text-decoration: none;
}
.nav-links {
  display: flex;
  gap: 2px;
  align-items: center;
}
.nav-links a,
.nav-parent {
  font-family: var(--font-zh);
  font-size: 0.82rem;
  color: var(--text-light);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 3px;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover,
.nav-links a.active,
.nav-parent:hover {
  color: var(--accent);
  background: rgba(139,94,60,0.07);
}
body.dark .nav-links a:hover,
body.dark .nav-links a.active,
body.dark .nav-parent:hover {
  background: rgba(211,176,122,0.12);
}
.nav-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-bottom: 4px;
  margin-bottom: -4px;
}
.nav-parent {
  cursor: default;
  gap: 4px;
}
.nav-caret {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-menu:hover .nav-caret,
.nav-menu:focus-within .nav-caret {
  transform: rotate(180deg);
}
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 150px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 6px 18px var(--shadow);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transform-origin: top left;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.28s;
}
body.dark .nav-dropdown {
  box-shadow: 0 12px 30px rgba(0,0,0,0.42);
}
.nav-dropdown a {
  padding: 5px 8px;
  border-radius: 2px;
}
.nav-dropdown a:hover {
  background: rgba(139,94,60,0.09);
}
body.dark .nav-dropdown a:hover {
  background: rgba(211,176,122,0.12);
}
.nav-menu:hover .nav-dropdown,
.nav-menu:focus-within .nav-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
}
body:not(.en) .nav-links .lang-en { display: none !important; }
body:not(.en) .nav-links .lang-zh { display: inline-flex !important; }
body.en .nav-links .lang-zh { display: none !important; }
body.en .nav-links .lang-en { display: inline-flex !important; }
.lang-toggle {
  font-family: var(--font-en);
  font-size: 0.78rem;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
  margin-left: 10px;
  letter-spacing: 0.5px;
}
.lang-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
}
#langToggle {
  width: 34px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#darkToggle {
  width: 34px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.card-row {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.card {
  flex: 1;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 20px 22px;
  box-shadow: 0 2px 8px var(--shadow);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation-fill-mode: forwards;
  animation-duration: 0.6s;
  animation-timing-function: ease-out;
}
.card.anim-left,
.card-flip.anim-left  { animation-name: slideInLeft; }
.card.anim-right,
.card-flip.anim-right { animation-name: slideInRight; }
.card.anim-up,
.card-flip.anim-up   { animation-name: slideInUp; }

.card-flip {
  flex: 1;
  perspective: 1200px;
  position: relative;
  min-height: 0;
  opacity: 0;
  animation-fill-mode: forwards;
  animation-duration: 0.6s;
  animation-timing-function: ease-out;
}
.card-flip > .card-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
  border-radius: 3px;
}
.card-flip.page-1 > .card-inner {
  transform: rotateY(180deg);
}
#academics.page-1 > .card-inner,
#contact.page-1 > .card-inner {
  transform: rotateX(180deg);
}
.card-face {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  backface-visibility: hidden;
  border-radius: 3px;
  background: var(--paper);
  border: 1px solid var(--border);
  padding: 20px 22px;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.card-face-back {
  transform: rotateY(180deg);
}
#academics .card-face-back,
#contact .card-face-back {
  transform: rotateX(180deg);
}

.flip-controls {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 10;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.25s;
}
.card-flip:hover .flip-controls {
  opacity: 1;
}
.flip-controls.hint-show {
  opacity: 1;
}
.flip-btn {
  font-family: var(--font-en);
  font-size: 1.1rem;
  font-weight: 700;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  backdrop-filter: blur(4px);
  padding: 0;
  line-height: 1;
}
.flip-btn:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.flip-btn.hint-blink {
  animation: flipHintBlink 0.9s ease-in-out 2;
}

/* ---- Flip card contact form ---- */
.contact-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group {
  flex: 1;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-dim);
}
.form-group input,
.form-group textarea {
  font-family: var(--font-zh);
  font-size: 0.85rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.5s ease, color 0.5s ease;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
  flex: 1;
}
.form-submit {
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 20px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.form-submit:hover {
  background: var(--accent);
  color: var(--paper);
}
.msg-board-btn {
  font-family: var(--font-zh);
  font-size: 0.82rem;
  padding: 5px 16px;
  line-height: 1.4;
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.msg-board-btn:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.form-submit {
  font-size: 0.82rem;
  padding: 5px 20px;
  line-height: 1.4;
}
.visi-toggle {
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 5px 10px;
  line-height: 1.4;
  min-width: 150px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.visi-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.visi-toggle.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139,94,60,0.06);
}
.back-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 30px;
}
.visi-toggle {
  margin-left: auto;
}

.contact-form.hidden {
  display: none;
}

/* Placeholder page 2 */
.page2-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  padding: 16px;
}

.card-title {
  font-family: var(--font-zh);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  align-self: flex-start;
}
.card-title.en {
  font-family: var(--font-en);
}

/* About card */
.about-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}
.about-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--paper);
}
.about-name {
  font-family: var(--font-en);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
}
.about-subtitle {
  font-size: 0.82rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: 2px;
}
.about-bio {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
}

/* Academics card */
.academic-item {
  margin-bottom: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  transition: border-color 0.2s;
}
.academic-item:hover { border-left-color: var(--accent); }
.academic-item .item-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.academic-item .item-meta {
  font-size: 0.78rem;
  color: var(--text-light);
  font-style: italic;
}
.academic-item .item-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Interests card */
.interests-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
}
.interest-item {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.interest-item:hover {
  border-color: var(--accent-dim);
  background: rgba(139,94,60,0.02);
}
.interest-item h3 {
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.interest-item p {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.4;
}

/* Contact card */
.contact-list {
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.contact-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.contact-list li:last-child { border-bottom: none; }
.contact-label {
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  min-width: 50px;
}
.contact-value {
  font-size: 0.85rem;
  color: var(--text);
}
.accent-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.accent-link:hover { border-bottom-color: var(--accent); }

/* Light Cone card */
.lightcone-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.lightcone-body h2 {
  font-family: var(--font-en);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 6px;
}
.lightcone-body p {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 14px;
  max-width: 90%;
}
.lightcone-btn {
  display: inline-block;
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
  padding: 8px 28px;
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.2s;
}
.lightcone-btn:hover { background: #7A5232; }
body.dark .lightcone-btn:hover { background: #B28C5A; }

.pdf-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
body.dark .pdf-modal {
  background: rgba(0,0,0,0.62);
}
.pdf-modal.open {
  display: flex;
}
.pdf-modal-inner {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 95vw;
  max-height: 95vh;
}
.pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.pdf-modal-header span {
  font-family: var(--font-en);
  font-size: 0.82rem;
  color: var(--text-light);
}
.pdf-modal-close {
  font-family: var(--font-en);
  font-size: 1.2rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.pdf-modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pdf-modal-body {
  flex: 1;
  min-height: 0;
}
.pdf-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.calendar {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-family: var(--font-en);
  font-size: 0.75rem;
  padding: 4px 2px 6px 2px;
  overflow: hidden;
  will-change: transform, opacity;
}
.cal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cal-body.slide-next {
  animation: calSlideNext 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}
.cal-body.slide-prev {
  animation: calSlidePrev 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
  -webkit-user-select: none;
}
.cal-nav {
  font-family: var(--font-en);
  font-size: 0.85rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.cal-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.cal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.cal-cell {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  padding: 4px 0;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  min-height: 32px;
}
.cal-cell.weekday {
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--accent-dim);
  background: var(--bg);
}
.cal-cell.other-month {
  color: var(--text-light);
  opacity: 0.4;
}
.cal-cell.today {
  background: var(--accent);
  color: var(--paper);
  font-weight: 700;
  border-radius: 2px;
}
.cal-cell.has-event {
  position: relative;
}
.ev-markers {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}
.ev-marker {
  width: 8px;
  height: 3px;
  border-radius: 1px;
}
.cal-event-info .ev-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}
.cal-event-info {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
  font-family: var(--font-zh);
  font-size: 0.75rem;
  color: var(--text-light);
}
.cal-event-info .ev-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cal-event-info .ev-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.radar-note {
  font-size: 0.75rem;
  color: var(--text-light);
  font-style: italic;
  position: absolute;
  bottom: 2px;
  left: 2px;
}
.radar-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.radar-chart {
  width: 100%;
  height: 100%;
  min-height: 180px;
}

.black-spoiler {
  background: var(--text);
  color: transparent;
  cursor: help;
  transition: color 0.3s, background 0.3s;
  border-radius: 2px;
  padding: 0 3px;
}
.black-spoiler:hover {
  background: transparent;
  color: var(--text);
}
.about-bio.lang-zh p {
  text-indent: 2em;
}
.strike {
  text-decoration: line-through;
}

.lang-zh { display: block; }
.lang-en { display: none; }
body.en .lang-zh { display: none; }
body.en .lang-en { display: block; }

@keyframes slideInLeft {
  from { transform: translateX(-80px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(80px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideInUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes slideInDown {
  from { transform: translateY(-60px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes calSlideNext {
  from { transform: translate3d(18px, 0, 0) scale(0.995); opacity: 0.86; }
  to   { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}
@keyframes calSlidePrev {
  from { transform: translate3d(-18px, 0, 0) scale(0.995); opacity: 0.86; }
  to   { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}
@keyframes flipHintBlink {
  0%, 100% {
    background: transparent;
    color: var(--text-light);
    border-color: var(--border);
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
  50% {
    background: var(--accent);
    color: var(--paper);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139,94,60,0.18);
  }
}

/* ---- Page Transition ---- */
.page-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
#mainPage {
  padding: 16px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-wrapper.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}
.page-wrapper:not(.active) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Main cards exit */
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(-80px); opacity: 0; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(80px); opacity: 0; }
}
@keyframes slideOutUp {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(-60px); opacity: 0; }
}
@keyframes slideOutDown {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(60px); opacity: 0; }
}
@keyframes replySlideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.card.exiting, .card-flip.exiting { pointer-events: none; }
.card.exiting.anim-left,  .card-flip.exiting.anim-left  { animation: slideOutLeft 0.4s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.card.exiting.anim-right, .card-flip.exiting.anim-right { animation: slideOutRight 0.4s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.card.exiting.anim-up,    .card-flip.exiting.anim-up    { animation: slideOutUp 0.4s cubic-bezier(0.4, 0, 0.6, 1) forwards; }

/* Board cards entry (match homepage style) */
.board-card { opacity: 0; }
.board-card.anim-left  { animation: slideInLeft 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.board-card.anim-right { animation: slideInRight 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.board-card.anim-up    { animation: slideInUp 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.board-card.anim-done  { opacity: 1; transform: translate(0, 0); }

/* Board cards exit */
.board-card.exiting { pointer-events: none; }
.board-card.exiting.anim-left  { animation: slideOutLeft 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.board-card.exiting.anim-right { animation: slideOutRight 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.board-card.exiting.anim-up    { animation: slideOutUp 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }

/* ---- Board Page ---- */
.page-board {
  background: var(--bg);
}
.board-container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 28px 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.board-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-zh);
  font-size: 0.82rem;
  border-radius: 3px;
  padding: 4px 12px 4px 8px;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s;
  margin-bottom: 16px;
  align-self: flex-start;
  flex-shrink: 0;
}
.board-back:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.board-back svg {
  flex-shrink: 0;
}
.board-header {
  text-align: center;
  margin-bottom: 24px;
  flex-shrink: 0;
}
.board-header h2 {
  font-family: var(--font-en);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
  letter-spacing: 1px;
}
.board-sub {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
  font-style: italic;
}

/* ---- Board Grid: left list (span 2 rows) + right stack ---- */
.board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}
.board-card-list {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.board-card-list .board-msgs {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.board-card-info {
  grid-column: 2;
  grid-row: 1;
}
.board-card-editor {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.board-card-editor .bf-group-msg {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  min-height: 0;
}
/* Rich text editor */
.bf-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: var(--bg);
  flex-shrink: 0;
  transition: background 0.5s ease, border-color 0.5s ease;
}
.bf-toolbar button {
  width: 28px;
  height: 26px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-en);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.bf-toolbar button:hover {
  background: var(--accent);
  color: var(--paper);
}
.bf-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.bf-editor {
  flex: 1;
  min-height: 100px;
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: 0 0 4px 4px;
  padding: 10px 12px;
  font-family: var(--font-zh);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  overflow-y: auto;
  line-height: 1.6;
  transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
  word-wrap: break-word;
}
.bf-toolbar + .bf-group-msg .bf-editor {
  border-top: none;
  border-radius: 0 0 4px 4px;
}
.bf-editor:focus {
  border-color: var(--accent);
}
.bf-editor:empty::before {
  color: var(--text-light);
  pointer-events: none;
}
body:not(.en) .bf-editor:empty::before {
  content: attr(data-placeholder-zh);
}
body.en .bf-editor:empty::before {
  content: attr(data-placeholder-en);
}
.bf-editor blockquote {
  border-left: 3px solid var(--accent);
  margin: 6px 0;
  padding: 4px 12px;
  color: var(--text-light);
  font-style: italic;
}
.bf-editor ul, .bf-editor ol {
  padding-left: 1.8em;
  margin: 0.3em 0;
}
/* Reply bar */
.bf-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: rgba(139,94,60,0.06);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--accent);
}
body.dark .bf-reply-bar {
  background: rgba(211,176,122,0.1);
}
.bf-reply-info {
  flex: 1;
}
.bf-cancel-reply {
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.bf-cancel-reply:hover {
  color: var(--accent);
}

.board-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 10px var(--shadow);
  padding: 18px 20px;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.board-card-header {
  font-family: var(--font-en);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Board Form */
.bf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bf-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bf-group label {
  font-size: 0.78rem;
  color: var(--accent-dim);
  font-weight: 600;
}
.bf-group input,
.bf-group textarea {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  padding: 8px 10px;
  font-family: 'Noto Serif SC', serif;
  font-size: 0.85rem;
  transition: background 0.5s ease, border-color 0.3s, color 0.5s ease;
}
.bf-group input:focus,
.bf-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.bf-info-foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
}
.bf-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bf-visi {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 6px 14px;
  background: rgba(139,94,60,0.06);
  color: var(--accent);
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  min-width: 80px;
  justify-content: center;
}
body.dark .bf-visi {
  background: rgba(211,176,122,0.1);
}
.bf-visi.off {
  border-color: var(--border);
  background: transparent;
  color: var(--text-light);
}
.bf-visi::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.bf-visi.off::before {
  opacity: 0.3;
}
.bf-submit {
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 6px 18px;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--font-zh);
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.3s, box-shadow 0.3s;
  margin-left: auto;
}
.bf-submit:hover {
  box-shadow: 0 2px 8px rgba(139,94,60,0.25);
}
.bf-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bf-status {
  font-size: 0.78rem;
  color: var(--accent-dim);
  min-height: 18px;
  margin-top: 8px;
}

/* Board post detail view */
.board-post-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-en);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-right: 10px;
  transition: opacity 0.2s;
}
.board-post-back:hover { opacity: 0.7; }
.board-header-title {
  font-family: var(--font-en);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.board-post-detail {
  display: flex;
  flex-direction: column;
}
.board-post-content {
  padding: 6px 0 14px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.board-post-author {
  font-family: var(--font-en);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.board-post-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
}
.board-post-text ul, .board-post-text ol {
  padding-left: 1.5em;
  margin: 0.3em 0;
}
.board-post-time {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 10px;
}
.board-replies-section {
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.board-replies-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 8px;
}
.board-reply-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  transition: background 0.5s ease;
  animation: replySlideIn 0.4s cubic-bezier(0.25, 0, 0, 1) forwards;
  opacity: 0;
}
.board-reply-item:last-child { border-bottom: none; }
.board-reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.board-reply-floor {
  font-family: var(--font-en);
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  background: rgba(139,94,60,0.08);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
body.dark .board-reply-floor { background: rgba(211,176,122,0.12); }
.board-reply-author {
  font-family: var(--font-en);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}
.board-reply-time {
  font-family: var(--font-en);
  font-size: 0.68rem;
  color: var(--text-light);
  margin-left: auto;
}
.board-reply-text {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.55;
}
.board-reply-text blockquote {
  border-left: 3px solid var(--accent);
  margin: 4px 0;
  padding: 3px 10px;
  color: var(--text-light);
  font-style: italic;
  font-size: 0.8rem;
}
.board-reply-actions {
  margin-top: 6px;
}
.board-reply-reply-btn {
  border: none;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-en);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 2px;
  transition: color 0.2s, background 0.2s;
}
.board-reply-reply-btn:hover {
  color: var(--accent);
  background: rgba(139,94,60,0.06);
}
/* Board Messages (list view) */
.board-msgs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.board-msgs.swapping {
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
}
.board-msg-placeholder {
  font-size: 0.85rem;
  color: var(--text-light);
  text-align: center;
  padding: 20px 0;
}
.board-msg-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.2s;
}
.board-msg-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 1px 4px var(--shadow);
}
.board-msg-card:active {
  transform: scale(0.975);
  transition: transform 0.1s ease;
}
.board-msg-card.selected {
  border-color: var(--accent);
  background: rgba(139,94,60,0.04);
}
body.dark .board-msg-card.selected {
  background: rgba(211,176,122,0.06);
}
.board-msg-reply-count {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 4px;
}
.board-msg-reply-count::before {
  content: '↳ ';
}
/* Reply chain inside message card */
.board-msg-replies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.board-msg-reply {
  padding: 6px 8px;
  background: var(--paper);
  border-radius: 3px;
  font-size: 0.8rem;
  line-height: 1.5;
  transition: background 0.5s ease;
}
.board-msg-reply-author {
  font-weight: 600;
  color: var(--accent);
  margin-right: 6px;
}
.board-msg-reply-text {
  color: var(--text);
}
.board-msg-reply-time {
  display: block;
  font-size: 0.68rem;
  color: var(--text-light);
  margin-top: 2px;
}
.board-msg-author {
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}
.board-msg-text {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.board-msg-time {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 6px;
}

/* ---- Shared Subpage ---- */
.sp-container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 28px 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.sp-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-zh);
  font-size: 0.82rem;
  border-radius: 3px;
  padding: 4px 12px 4px 8px;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background 0.5s ease;
  margin-bottom: 16px;
  align-self: flex-start;
  flex-shrink: 0;
}
.sp-back:hover { border-color: var(--accent); color: var(--accent); }
.sp-back svg { flex-shrink: 0; }
.sp-header {
  text-align: center;
  margin-bottom: 28px;
  flex-shrink: 0;
}
.sp-header h2 {
  font-family: var(--font-en);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
  letter-spacing: 1px;
}
.sp-sub {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
  font-style: italic;
}
.sp-cards {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sp-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 10px var(--shadow);
  padding: 24px 28px;
  opacity: 0;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.sp-card.anim-left  { animation: slideInLeft 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.sp-card.anim-right { animation: slideInRight 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.sp-card.anim-up    { animation: slideInUp 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.sp-card.anim-down  { animation: slideInDown 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.sp-card.anim-done  { opacity: 1; transform: translate(0, 0); }
.sp-card.exiting { pointer-events: none; }
.sp-card.exiting.anim-left  { animation: slideOutLeft 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.sp-card.exiting.anim-right { animation: slideOutRight 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.sp-card.exiting.anim-up    { animation: slideOutUp 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.sp-card.exiting.anim-down  { animation: slideOutDown 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.sp-card.exiting.anim-down  { animation: slideOutDown 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }

/* Resume PDF viewer */
.sp-resume {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: 4px; box-shadow: 0 2px 10px var(--shadow);
  overflow: hidden;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.sp-resume-pdf {
  flex: 1; min-height: 0; width: 100%; border: 0;
  background: #fff;
}
.sp-resume-footer {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--paper); flex-shrink: 0;
  transition: background 0.5s ease, border-color 0.5s ease;
}
.sp-resume-dl {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 22px;
  background: var(--accent); color: var(--paper);
  border-radius: 4px; text-decoration: none;
  font-family: var(--font-zh); font-size: 0.88rem; font-weight: 600;
  transition: opacity 0.3s, box-shadow 0.3s;
  letter-spacing: 0.5px;
}
.sp-resume-dl:hover { opacity: 0.85; box-shadow: 0 4px 12px var(--shadow); }
.sp-resume-dl svg { flex-shrink: 0; }

/* Ability page */
.sp-ability { display: flex; flex-direction: column; gap: 20px; }
.sp-ability .sp-card { transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease; }
.sp-ability-row { display: flex; gap: 20px; flex: 1; min-height: 0; }
.sp-ability-row .sp-card { flex: 1; min-height: 0; }
/* Ensure the explanation card uses column layout so pagination sits at the bottom */
.sp-ability-row .sp-card:has(.ability-explain) { display: flex; flex-direction: column; }
.radar-full { width: 100%; height: 100%; min-height: 280px; }
.ability-explain { font-size: 0.82rem; color: var(--text); line-height: 1.8; display: flex; flex-direction: column; flex: 1; justify-content: center; }
.ability-page { display: none; }
.ability-page.active { display: flex; flex-direction: column; animation: abilityFadeIn 0.35s ease; }
@keyframes abilityFadeIn { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: translateX(0); } }
.ability-explain-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex: 1; }
.ability-explain-item:last-child { margin-bottom: 0; }
.ability-explain-grade { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-family: var(--font-en); font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.ability-explain-text { flex: 1; }
.ability-explain-text .ae-head { display: block; white-space: nowrap; }
.ability-explain-text .ae-head .lang-zh { display: inline; }
.ability-explain-text .ae-head .lang-en { display: none; }
body.en .ability-explain-text .ae-head .lang-zh { display: none; }
body.en .ability-explain-text .ae-head .lang-en { display: inline; }
.ability-explain-text .ae-desc { display: block; }
.ability-explain-text strong { color: var(--accent); }
.ability-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.ability-page-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; transition: all 0.25s ease; }
.ability-page-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.ability-page-btn:disabled { opacity: 0.35; cursor: default; }
.ability-page-indicator { font-size: 0.75rem; font-family: var(--font-en); color: var(--text); min-width: 36px; text-align: center; }

/* Ability skill bars */
.sp-ability .sp-skill-item { display: flex; align-items: center; margin-bottom: 10px; gap: 12px; }
.sp-ability .sp-skill-item:last-child { margin-bottom: 0; }
.sp-ability .sp-skill-name { width: 80px; font-size: 0.82rem; font-weight: 600; color: var(--text); flex-shrink: 0; font-family: var(--font-en); }
.sp-ability .sp-skill-bar { flex: 1; height: 18px; background: rgba(139,94,60,0.08); border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
body.dark .sp-ability .sp-skill-bar { background: rgba(211,176,122,0.06); }
.sp-ability .sp-skill-bar-fill { height: 100%; background: var(--accent); border-radius: 9px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 0.68rem; color: #fff; font-family: var(--font-en); font-weight: 600; transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
body.dark .sp-ability .sp-skill-bar-fill { color: #1a1a2e; }

/* Story page */
.sp-story { display: flex; flex-direction: row; gap: 18px; overflow: hidden; }
.sp-story-nav { width: 200px; min-width: 180px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; padding-right: 4px; }
.sp-story-nav-item {
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border-left: 3px solid transparent;
  font-family: var(--font-zh);
  line-height: 1.4;
}
.sp-story-nav-item:hover { background: rgba(139,94,60,0.04); color: var(--accent); }
.sp-story-nav-item.active {
  border-left-color: var(--accent);
  color: var(--accent);
  background: rgba(139,94,60,0.05);
  font-weight: 600;
}
body.dark .sp-story-nav-item.active { background: rgba(211,176,122,0.08); }
.sp-story-content { flex: 1; min-width: 0; overflow-y: auto; }
.sp-story-content .sp-card { flex: none; }
.sp-story-title { font-family: var(--font-zh); font-size: 1.15rem; font-weight: 700; color: var(--accent); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); letter-spacing: 0.5px; }
.story-text { font-size: 0.92rem; color: var(--text); line-height: 2; }
.story-text blockquote { border-left: 3px solid var(--accent); margin: 16px 0; padding: 8px 16px; color: var(--accent-dim); font-style: italic; font-size: 1.05rem; }
.story-divider { text-align: center; margin: 24px 0; color: var(--accent); font-size: 1.2rem; letter-spacing: 8px; opacity: 0.5; }

/* Calendar page */
.sp-calendar { display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.sp-calendar .sp-card { flex: 1 1 50%; min-height: 0; padding: 12px; overflow-y: auto; }
.calendar-full { width: 100%; height: 100%; display: flex; flex-direction: column; }
.cal-detail-placeholder { font-size: 0.84rem; color: var(--text-light); opacity: 0.6; text-align: center; padding: 8px 0; }
.cal-detail-active { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.cal-detail-card {
  background: rgba(139,94,60,0.03); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px 14px; flex: 1; min-width: 200px;
  cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease;
}
.cal-detail-card:hover { background: rgba(139,94,60,0.07); border-color: var(--accent); }
.cal-detail-card .cal-detail-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.cal-detail-card .cal-detail-title { font-size: 0.84rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.cal-detail-card .cal-detail-dates { font-size: 0.76rem; color: var(--text-light); font-family: var(--font-en); }
.cal-detail-card .cal-detail-hint { font-size: 0.7rem; color: var(--text-light); opacity: 0.5; margin-top: 4px; }
.cal-cell.selected { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }

/* Event detail view in bottom card */
.cal-selected-date { font-size: 0.78rem; color: var(--accent-dim); font-family: var(--font-en); margin-bottom: 8px; opacity: 0.8; display: none; }
.cal-ev-back { display: none; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--accent); cursor: pointer; margin-bottom: 10px; width: fit-content; transition: opacity 0.2s; }
.cal-ev-back:hover { opacity: 0.7; }
.cal-ev-back svg { width: 14px; height: 14px; }
.cal-ev-detail { display: none; flex-direction: column; gap: 10px; }
.cal-ev-detail .cal-ev-dot-lg { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cal-ev-detail .cal-ev-title-row { display: flex; align-items: flex-start; gap: 8px; }
.cal-ev-detail .cal-ev-title { font-size: 1rem; font-weight: 700; color: var(--accent); line-height: 1.4; }
.cal-ev-detail .cal-ev-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.78rem; color: var(--text-light); font-family: var(--font-en); }
.cal-ev-detail .cal-ev-meta span { display: inline-flex; align-items: center; gap: 4px; }
.cal-ev-detail .cal-ev-organizer { font-size: 0.82rem; color: var(--text); }
.cal-ev-detail .cal-ev-organizer strong { color: var(--accent-dim); margin-right: 4px; }
.cal-ev-detail .cal-ev-desc { font-size: 0.84rem; color: var(--text); line-height: 1.75; }
.cal-ev-detail .cal-ev-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--accent); text-decoration: none; font-family: var(--font-en); transition: opacity 0.2s; width: fit-content; }
.cal-ev-detail .cal-ev-link:hover { opacity: 0.7; text-decoration: underline; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Journal page */
.journal-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 18px;
  overflow: hidden;
}

/* ---- Timeline (left) ---- */
.journal-timeline {
  width: 200px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 4px 12px;
  position: relative;
}
.journal-timeline::before {
  content: '';
  position: absolute;
  left: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.jtl-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 20px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.25s ease, color 0.25s ease;
  user-select: none;
}
.jtl-item:hover { background: rgba(139,94,60,0.06); }
.jtl-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg);
  z-index: 1;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.jtl-item.selected::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,94,60,0.18);
}
.jtl-item.selected {
  background: rgba(139,94,60,0.08);
}
.jtl-date {
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.3;
  transition: color 0.25s;
}
.jtl-item.selected .jtl-date { color: var(--accent); }
.jtl-weekday {
  font-size: 0.65rem;
  color: var(--text-light);
  opacity: 0.6;
  transition: color 0.25s;
}
.jtl-item.selected .jtl-weekday { color: var(--accent); opacity: 0.8; }
.jtl-empty { opacity: 0.4; }
.jtl-empty .jtl-date { font-weight: 400; font-size: 0.7rem; }
.jtl-empty::before { background: var(--border); opacity: 0.3; }

/* ---- Content (right) ---- */
.journal-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px;
  line-height: 1.85;
}
.journal-placeholder {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-light);
  opacity: 0.5;
  margin-top: 80px;
}
.journal-content h1 {
  font-family: var(--font-zh);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.journal-content .jtl-meta {
  font-size: 0.78rem;
  color: var(--text-light);
  font-family: var(--font-en);
  margin-bottom: 18px;
  opacity: 0.7;
}
.journal-content h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-dim);
  margin: 20px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.journal-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 6px;
}
.journal-content p {
  margin: 0 0 12px;
  font-size: 0.88rem;
}
.journal-content ul, .journal-content ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.journal-content li { margin-bottom: 4px; font-size: 0.88rem; }
.journal-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 12px 0;
  padding: 8px 16px;
  color: var(--accent-dim);
  font-style: italic;
  background: rgba(139,94,60,0.03);
  border-radius: 0 4px 4px 0;
  font-size: 0.88rem;
}
.journal-content code {
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 0.8rem;
  background: rgba(139,94,60,0.07);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent-dim);
}
.journal-content pre {
  background: rgba(139,94,60,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin: 12px 0;
  overflow-x: auto;
}
.journal-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.6;
}
.journal-content img {
  max-width: 100%;
  border-radius: 4px;
  margin: 12px 0;
  border: 1px solid var(--border);
}
.journal-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  transition: opacity 0.2s;
}
.journal-content a:hover { opacity: 0.7; }
.journal-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}
.journal-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.84rem;
}
.journal-content th, .journal-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.journal-content th {
  background: rgba(139,94,60,0.06);
  color: var(--accent-dim);
  font-weight: 600;
}
.journal-content .katex { font-size: 1em; }
.journal-content .katex-display {
  margin: 12px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Journal page entrance/exit overrides — use sp-card system */
.page-journal .sp-card { opacity: 0; }
.page-journal .sp-card.anim-left  { animation: slideInLeft 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.page-journal .sp-card.anim-right { animation: slideInRight 0.5s cubic-bezier(0.25, 0, 0, 1) forwards; }
.page-journal .sp-card.anim-done  { opacity: 1; transform: translate(0, 0); }
.page-journal .sp-card.exiting { pointer-events: none; }
.page-journal .sp-card.exiting.anim-left  { animation: slideOutLeft 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
.page-journal .sp-card.exiting.anim-right { animation: slideOutRight 0.35s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
body.dark .sp-jc-tag { background: rgba(211,176,122,0.1); }
