/* Root variables for light and dark themes */
:root {
  --bg-color: #EFE8DC;
  --text-color: #1A1A1A;
  --accent-color: #C16A28;
  --border-color: rgba(26, 26, 26, 0.1);
  --entry-bg: rgba(255, 255, 255, 0.3);
  
  /* Toggle switch positioning - aligned with reading-time-summary height */
  --toggle-bottom: 20px;
  --toggle-left: 1.5rem;
}

[data-theme="dark"] {
  --bg-color: #000000;
  --text-color: #E2E8F0;
  --accent-color: #C16A28;
  --border-color: rgba(226, 232, 240, 0.1);
  --entry-bg: rgba(255, 255, 255, 0.02);
}

/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Corner button */
.corner-btn {
  position: fixed;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  z-index: 1000;
  margin: 0;
  padding: 0;
}

.corner-btn::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 20px 20px 0;
  border-color: transparent var(--accent-color) transparent transparent;
  opacity: 0.4;
  filter: drop-shadow(-1px 1px 2px rgba(0, 0, 0, 0.15));
  margin: 0;
  padding: 0;
  transition: opacity 0.2s ease;
}

.corner-btn:hover::before {
  opacity: 1;
}

/* Corner button - left side */
.corner-btn-left {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  z-index: 1000;
  margin: 0;
  padding: 0;
}

.corner-btn-left::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: var(--accent-color);
  clip-path: polygon(0 0, 0 20px, 20px 0);
  opacity: 0.4;
  filter: drop-shadow(1px -1px 2px rgba(0, 0, 0, 0.15));
  margin: 0;
  padding: 0;
  transition: opacity 0.2s ease;
}

.corner-btn-left:hover::before {
  opacity: 1;
}

/* Corner button - bottom left */
.corner-btn-bottom-left {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 20px;
  height: 20px;
  z-index: 1000;
  margin: 0;
  padding: 0;
}

.corner-btn-bottom-left::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: var(--accent-color);
  clip-path: polygon(0 20px, 0 0, 20px 20px);
  opacity: 0.4;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.15));
  margin: 0;
  padding: 0;
  transition: opacity 0.2s ease;
}

.corner-btn-bottom-left:hover::before {
  opacity: 1;
}

/* Corner button - bottom right */
.corner-btn-bottom-right {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  z-index: 1000;
  margin: 0;
  padding: 0;
}

.corner-btn-bottom-right::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background-color: var(--accent-color);
  clip-path: polygon(20px 20px, 0 20px, 20px 0);
  opacity: 0.4;
  filter: drop-shadow(-1px 1px 2px rgba(0, 0, 0, 0.15));
  margin: 0;
  padding: 0;
  transition: opacity 0.2s ease;
}

.corner-btn-bottom-right:hover::before {
  opacity: 1;
}

/* Admin main panel: room for bottom corner links + larger tap targets */
body.admin-page .container {
  padding-bottom: 4rem;
}

body.admin-page .entries {
  padding-bottom: 2.5rem;
}

body.admin-page .corner-btn-bottom-left,
body.admin-page .corner-btn-bottom-right {
  width: 44px;
  height: 44px;
  z-index: 1100;
  -webkit-tap-highlight-color: transparent;
}

/* Keep the visible triangle at 20px in the true corner */
body.admin-page .corner-btn-bottom-left::before,
body.admin-page .corner-btn-bottom-right::before {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  body.admin-page .container {
    padding-bottom: 4.5rem;
  }

  body.admin-page .entries {
    padding-bottom: 3rem;
  }
}

.hidden {
  display: none !important;
}

/* Bookshelf text link - bottom left */
.bookshelf-text {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-color);
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.3s ease, color 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}

.bookshelf-text:hover {
  opacity: 1;
  color: var(--accent-color);
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.8;
  transition: background-color 0.3s ease, color 0.3s ease;
  font-size: 18px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Navigation */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4rem;
  padding-bottom: 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-right {
  display: flex;
  gap: 1.5rem;
}

.site-title {
  font-size: 1.8rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--text-color);
  letter-spacing: -0.02em;
  cursor: default;
}

.site-title:hover {
  color: var(--text-color);
}

nav a {
  text-decoration: none;
  color: var(--text-color);
  transition: color 0.2s ease;
  font-size: 1rem;
}

nav a:hover:not(.site-title) {
  color: var(--accent-color);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-color);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  line-height: 0;
}

.theme-toggle:hover {
  color: var(--accent-color);
}

/* Entries */
.entries {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.entry {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.entry:last-child {
  border-bottom: none;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.entry-date {
  font-size: 0.95rem;
  color: var(--accent-color);
  margin-bottom: 1.5rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.entry-header .entry-date {
  margin-bottom: 0;
}

.delete-entry-btn {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: opacity 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.delete-entry-btn:hover {
  opacity: 1;
  color: #d32f2f;
}

.entry-content {
  font-size: 1.05rem;
  line-height: 1.9;
}

.entry-content p {
  margin-bottom: 1.2rem;
}

.entry-content p:last-child {
  margin-bottom: 0;
}

.entry-content h1,
.entry-content h2,
.entry-content h3 {
  margin: 2rem 0 1rem;
  font-weight: 400;
  line-height: 1.3;
}

.entry-content h1 {
  font-size: 1.8rem;
}

.entry-content h2 {
  font-size: 1.5rem;
}

.entry-content h3 {
  font-size: 1.2rem;
}

.entry-content a {
  color: var(--accent-color);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.entry-content a:hover {
  opacity: 0.7;
}

.entry-content ul,
.entry-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.entry-content li {
  margin-bottom: 0.5rem;
}

.entry-content blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  opacity: 0.9;
}

.entry-content code {
  font-family: 'Courier New', monospace;
  background-color: var(--entry-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.entry-content pre {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  overflow: visible;
  margin: 0 0 clamp(1.25rem, 4vw, 1.75rem);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: pre-wrap;
}

.entry-content pre code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
  white-space: pre-wrap;
}

.entry-content pre:last-child {
  margin-bottom: 0;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  opacity: 0.6;
  font-style: italic;
}

/* New entry box for admin */
.new-entry-box {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.new-entry-box textarea {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  line-height: 1.9;
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 5px;
  transition: border-color 0.2s ease;
  resize: vertical;
  margin-bottom: 1rem;
}

.new-entry-box textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.new-entry-box textarea::placeholder {
  opacity: 0.5;
  font-style: italic;
}

/* Admin page styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.95rem;
  color: var(--accent-color);
}

.form-group input,
.form-group textarea {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  padding: 0.75rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 5px;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.6;
  font-style: italic;
  margin-top: 0.25rem;
  display: block;
}

.form-group textarea {
  min-height: 300px;
  resize: vertical;
  line-height: 1.8;
}

.btn {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  background-color: var(--accent-color);
  color: #FFFFFF;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  align-self: flex-start;
}

.btn:hover {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-message {
  color: #d32f2f;
  font-size: 0.9rem;
  padding: 0.75rem;
  background-color: rgba(211, 47, 47, 0.1);
  border-radius: 5px;
}

.success-message {
  color: #2e7d32;
  font-size: 0.9rem;
  padding: 0.75rem;
  background-color: rgba(46, 125, 50, 0.1);
  border-radius: 5px;
}

.logout-link {
  color: var(--accent-color);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.95rem;
}

.logout-link:hover {
  opacity: 0.7;
}

/* Responsive design */

/* Tablet styles */
@media (max-width: 1024px) and (min-width: 769px) {
  .container {
    padding: 2.5rem 1.5rem;
  }

  .entry-content {
    font-size: 1.02rem;
  }
}

/* Mobile and tablet portrait */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem 1rem;
  }

  nav {
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-left {
    gap: 0.3rem;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .theme-toggle {
    width: 18px;
    height: 18px;
    padding: 0.2rem;
  }

  .theme-toggle .theme-icon {
    width: 18px;
    height: 18px;
  }

  .entry {
    padding: 1.5rem 0;
  }

  .entry-date {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .entry-header .entry-date {
    margin-bottom: 0;
  }

  .entry-content {
    font-size: 1rem;
    line-height: 1.8;
  }

  .entry-content h1 {
    font-size: 1.5rem;
  }

  .entry-content h2 {
    font-size: 1.3rem;
  }

  .entry-content h3 {
    font-size: 1.1rem;
  }

  .delete-entry-btn {
    width: 28px;
    height: 28px;
    font-size: 1.8rem;
  }

  .new-entry-box {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
  }

  .new-entry-box textarea {
    font-size: 1rem;
    min-height: 200px;
    padding: 0.75rem;
    border-radius: 5px;
    -webkit-appearance: none;
    resize: vertical;
  }

  .btn {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    width: 100%;
    max-width: none;
    min-height: 44px; /* Touch-friendly minimum */
    border-radius: 5px;
  }

  .login-form {
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .form-group {
    gap: 0.75rem;
  }

  .form-group label {
    font-size: 0.95rem;
  }

  .form-group input {
    font-size: 1rem;
    padding: 0.875rem;
    min-height: 44px; /* Touch-friendly minimum */
    border-radius: 5px;
    -webkit-appearance: none;
  }

  .form-group textarea {
    font-size: 1rem;
    padding: 0.75rem;
    min-height: 200px;
    border-radius: 5px;
    -webkit-appearance: none;
  }

  .entry-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .entry-header .entry-date {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
  }

  .delete-entry-btn {
    flex-shrink: 0;
  }

  .nav-right {
    width: 100%;
    margin-top: 0.5rem;
  }

  .logout-link {
    font-size: 0.9rem;
  }
}

/* Corner / Mind Map page styles */
html:has(.corner-mindmap),
body:has(.corner-mindmap) {
  overflow: hidden;
  height: 100vh;
  width: 100%;
}

.corner-mindmap {
  height: 100vh;
  padding: 3rem;
  position: relative;
  overflow: auto;
  background: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mindmap-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  align-items: start;
}

.mindmap-goal {
  width: 100%;
}

.goal-text {
  font-family: 'Kalam', 'Comic Sans MS', cursive;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-color);
  display: block;
  padding: 1rem 1.5rem;
  background: var(--entry-bg);
  border-radius: 12px;
  white-space: normal;
  word-wrap: break-word;
  border: 1px solid var(--border-color);
}

.mindmap-empty {
  font-family: 'Kalam', 'Comic Sans MS', cursive;
  font-size: 1.2rem;
  color: var(--text-color);
  text-align: center;
  opacity: 0.5;
  font-style: italic;
  margin-top: 4rem;
}



@media (max-width: 1024px) {
  .mindmap-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .goal-text {
    font-size: 1.15rem;
    padding: 0.9rem 1.3rem;
  }
  
  .corner-mindmap {
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .corner-mindmap {
    padding: 2rem 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }

  .mindmap-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
  }
  
  .goal-text {
    font-size: 1.15rem;
    padding: 1rem 1.25rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1.25rem 0.75rem;
  }

  nav {
    margin-bottom: 2rem;
  }

  .site-title {
    font-size: 1.3rem;
  }

  .entry {
    padding: 1.25rem 0;
  }

  .entries {
    gap: 2rem;
  }

  .new-entry-box {
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
  }

  .new-entry-box textarea {
    min-height: 180px;
    font-size: 0.95rem;
    padding: 0.75rem;
  }

  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }

  .login-form {
    gap: 1.25rem;
  }

  .form-group input {
    padding: 0.875rem;
    font-size: 1rem;
  }

  .entry-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .delete-entry-btn {
    align-self: flex-end;
  }
}

/* Corner Page - No scroll, fixed viewport */
body.corner-page {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  height: 100dvh; /* Dynamic viewport height for mobile */
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* Selfie wall — 100 portrait tiles, Lebensjahre 0–99 */
.selfie-wall {
  --wall-pad-top: max(1.75rem, env(safe-area-inset-top, 0px) + 1.25rem);
  --wall-pad-right: max(0.75rem, env(safe-area-inset-right, 0px) + 0.5rem);
  --wall-pad-bottom: max(3rem, env(safe-area-inset-bottom, 0px) + 2.5rem);
  --wall-pad-left: max(0.75rem, env(safe-area-inset-left, 0px) + 0.5rem);
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--wall-pad-top) var(--wall-pad-right) var(--wall-pad-bottom) var(--wall-pad-left);
  box-sizing: border-box;
  z-index: 1;
}

.selfie-wall-grid {
  --selfie-gap: clamp(1px, 0.35vmin, 5px);
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: var(--selfie-gap);
  /* Slightly taller than wide (5:6). Fit inside padded viewport with no scroll. */
  width: min(
    calc(100vw - var(--wall-pad-left) - var(--wall-pad-right)),
    calc((100dvh - var(--wall-pad-top) - var(--wall-pad-bottom)) * 5 / 6)
  );
  height: min(
    calc(100dvh - var(--wall-pad-top) - var(--wall-pad-bottom)),
    calc((100vw - var(--wall-pad-left) - var(--wall-pad-right)) * 6 / 5)
  );
  max-width: 100%;
  max-height: 100%;
}

.selfie-tile {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  background: var(--entry-bg);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.selfie-tile-number {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(0.5rem, 1.8vw, 0.8rem);
  color: var(--text-color);
  opacity: 0.4;
  line-height: 1;
  user-select: none;
  position: relative;
  z-index: 1;
}

.selfie-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.selfie-tile.has-image .selfie-tile-number {
  display: none;
}

.selfie-wall.is-loading .selfie-tile img {
  opacity: 0;
}

.selfie-wall.is-ready .selfie-tile img {
  opacity: 1;
  transition: opacity 0.18s ease;
}

.corner-page:not(.admin-corner-page) .selfie-tile.is-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.corner-page:not(.admin-corner-page) .selfie-tile.is-clickable:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 1px;
}

body.selfie-lightbox-open {
  overflow: hidden;
}

.selfie-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(10, 10, 10, 0.92);
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.22s ease;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.selfie-lightbox[hidden] {
  display: none;
}

.selfie-lightbox.is-open {
  opacity: 1;
}

.selfie-lightbox-close {
  position: absolute;
  top: max(0.65rem, env(safe-area-inset-top, 0px) + 0.35rem);
  right: max(0.65rem, env(safe-area-inset-right, 0px) + 0.35rem);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.selfie-lightbox-close:hover {
  color: #fff;
}

.selfie-lightbox-figure {
  margin: 0;
  max-width: min(100%, 92vw);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transform: scale(0.96);
  transition: transform 0.22s ease;
}

.selfie-lightbox.is-open .selfie-lightbox-figure {
  transform: scale(1);
}

.selfie-lightbox-image {
  display: block;
  max-width: min(100%, 92vw);
  max-height: calc(100dvh - 5.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.selfie-lightbox-caption {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  user-select: none;
}

@media (max-width: 480px) {
  .selfie-lightbox {
    padding: max(0.75rem, env(safe-area-inset-top, 0px))
      max(0.5rem, env(safe-area-inset-right, 0px))
      max(0.75rem, env(safe-area-inset-bottom, 0px))
      max(0.5rem, env(safe-area-inset-left, 0px));
  }

  .selfie-lightbox-image {
    max-width: 96vw;
    max-height: calc(100dvh - 4.75rem);
  }

  .selfie-lightbox-close {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.85rem;
  }
}

.selfie-tile-delete {
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 3;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.selfie-tile.has-image .selfie-tile-delete:not([hidden]) {
  display: flex;
}

.selfie-tile-delete:hover {
  background: rgba(0, 0, 0, 0.7);
}

.selfie-tile.is-uploading {
  opacity: 0.55;
  pointer-events: none;
}

.admin-corner-page .selfie-tile {
  cursor: pointer;
}

body.selfie-crop-open {
  overflow: hidden;
}

.selfie-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top, 0px))
    max(0.75rem, env(safe-area-inset-right, 0px))
    max(0.75rem, env(safe-area-inset-bottom, 0px))
    max(0.75rem, env(safe-area-inset-left, 0px));
  background: rgba(26, 26, 26, 0.55);
  box-sizing: border-box;
}

.selfie-crop-modal[hidden] {
  display: none;
}

.selfie-crop-sheet {
  width: min(100%, 28rem);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1rem 1.1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

.selfie-crop-header h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15rem;
  font-weight: normal;
  color: var(--text-color);
  line-height: 1.2;
}

.selfie-crop-hint {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-color);
  opacity: 0.55;
}

.selfie-crop-stage {
  display: flex;
  justify-content: center;
  min-height: 0;
}

.selfie-crop-viewport {
  /* Same 5:6 frame as each wall tile */
  width: min(100%, 72vw, calc(70dvh * 5 / 6));
  aspect-ratio: 5 / 6;
  position: relative;
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.selfie-crop-viewport:active {
  cursor: grabbing;
}

.selfie-crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform;
}

.selfie-crop-zoom {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.selfie-crop-zoom-btn {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background: var(--entry-bg);
  color: var(--text-color);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.selfie-crop-zoom-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.selfie-crop-zoom-range {
  flex: 1 1 auto;
  width: 100%;
  accent-color: var(--accent-color);
  height: 1.5rem;
}

.selfie-crop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.selfie-crop-btn {
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 2px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.95rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.selfie-crop-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.selfie-crop-btn-secondary {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
}

.selfie-crop-btn-primary {
  border: 1px solid var(--accent-color);
  background: var(--accent-color);
  color: #fff;
}

@media (max-width: 480px) {
  .selfie-crop-sheet {
    width: 100%;
    padding: 0.85rem 0.85rem 1rem;
    gap: 0.75rem;
  }

  .selfie-crop-viewport {
    width: min(100%, calc((100dvh - 14rem) * 5 / 6));
  }

  .selfie-crop-btn {
    min-height: 3rem;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .selfie-wall {
    --wall-pad-top: max(1.35rem, env(safe-area-inset-top, 0px) + 1rem);
    --wall-pad-right: max(0.4rem, env(safe-area-inset-right, 0px) + 0.3rem);
    --wall-pad-bottom: max(2.75rem, env(safe-area-inset-bottom, 0px) + 2.35rem);
    --wall-pad-left: max(0.4rem, env(safe-area-inset-left, 0px) + 0.3rem);
  }

  .selfie-wall-grid {
    --selfie-gap: 1.5px;
  }

  .selfie-tile-number {
    font-size: clamp(0.48rem, 2.4vw, 0.72rem);
  }

  .selfie-tile-delete {
    width: 18px;
    height: 18px;
    font-size: 13px;
    top: 0;
    right: 0;
  }

  .corner-page .bookshelf-text {
    font-size: 0.72rem;
    bottom: max(10px, env(safe-area-inset-bottom, 0px) + 6px);
    left: max(12px, env(safe-area-inset-left, 0px) + 8px);
    right: max(12px, env(safe-area-inset-right, 0px) + 8px);
    max-width: none;
    white-space: normal;
    line-height: 1.25;
  }
}

@media (max-width: 480px) {
  .selfie-wall {
    --wall-pad-top: max(1.15rem, env(safe-area-inset-top, 0px) + 0.85rem);
    --wall-pad-right: max(0.3rem, env(safe-area-inset-right, 0px) + 0.2rem);
    --wall-pad-bottom: max(2.6rem, env(safe-area-inset-bottom, 0px) + 2.2rem);
    --wall-pad-left: max(0.3rem, env(safe-area-inset-left, 0px) + 0.2rem);
  }

  .selfie-wall-grid {
    --selfie-gap: 1px;
  }

  .selfie-tile {
    border-radius: 1px;
  }

  .selfie-tile-number {
    font-size: clamp(0.45rem, 2.6vw, 0.65rem);
  }

  .corner-page .bookshelf-text {
    font-size: 0.65rem;
    bottom: max(8px, env(safe-area-inset-bottom, 0px) + 4px);
    left: max(10px, env(safe-area-inset-left, 0px) + 6px);
    right: max(10px, env(safe-area-inset-right, 0px) + 6px);
  }
}

/* Short landscape phones: prioritize fitting height */
@media (max-height: 500px) and (orientation: landscape) {
  .selfie-wall {
    --wall-pad-top: max(0.5rem, env(safe-area-inset-top, 0px) + 0.35rem);
    --wall-pad-right: max(0.75rem, env(safe-area-inset-right, 0px) + 0.5rem);
    --wall-pad-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px) + 0.35rem);
    --wall-pad-left: max(0.75rem, env(safe-area-inset-left, 0px) + 0.5rem);
  }

  .corner-page .bookshelf-text {
    font-size: 0.6rem;
    bottom: 6px;
    left: 10px;
    right: auto;
    max-width: 45vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ========================================
   BOOKSHELF STYLES
   ======================================== */

/* Bookshelf page - full screen network */
.bookshelf-page {
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
}

/* Toggle switch and office link - bottom left corner */
.bookshelf-toggle-container {
  position: fixed;
  bottom: var(--toggle-bottom);
  left: var(--toggle-left);
  z-index: 950;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(26, 26, 26, 0.15);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 11px;
  width: 11px;
  left: 2px;
  bottom: 2.5px;
  background-color: var(--text-color);
  transition: all 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(13px);
  background-color: #FFFFFF;
}

.toggle-switch:hover .toggle-slider {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .toggle-slider {
  background-color: rgba(226, 232, 240, 0.1);
}

[data-theme="dark"] .toggle-slider:before {
  background-color: var(--text-color);
}

/* Bookshelf header - floats over network */
.bookshelf-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  padding: 2rem 3rem;
  pointer-events: none; /* Allow clicks through to network */
}

.bookshelf-header .nav-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: auto; /* But allow clicks on the nav items */
}

.bookshelf-header .site-title {
  font-size: 1.8rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--text-color);
  letter-spacing: -0.02em;
  cursor: default;
  pointer-events: auto;
}

.bookshelf-header .site-title:hover {
  color: var(--text-color);
}

.bookshelf-header .theme-toggle {
  pointer-events: auto;
}

#bookshelf-network {
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  transition: background-color 0.3s ease;
  /* Hardware acceleration for smooth zoom/pan */
  transform: translateZ(0);
  will-change: transform;
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#bookshelf-network canvas {
  /* Smooth rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Timeline View - Simple Line Graph */
.bookshelf-timeline {
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  overflow: auto;
  padding: 8rem 2rem 2rem 2rem;
  display: none;
  transition: background-color 0.3s ease;
  z-index: 1;
  position: relative;
}

.timeline-svg {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: block;
}

.timeline-grid-line {
  stroke: var(--border-color);
  stroke-width: 1;
  opacity: 0.3;
}

.timeline-line {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-marker-line {
  stroke: var(--text-color);
  stroke-width: 1;
  opacity: 0.2;
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
  cursor: pointer;
  pointer-events: stroke;
}

.timeline-marker-line:hover {
  opacity: 0.6;
  stroke-width: 2;
}

.timeline-marker-dot {
  fill: var(--accent-color);
  stroke: var(--bg-color);
  stroke-width: 2;
  transition: stroke-width 0.2s ease;
  cursor: pointer;
  pointer-events: all;
}

.timeline-marker-dot:hover {
  stroke-width: 3;
}

.timeline-axis-label {
  fill: var(--text-color);
  font-size: 12px;
  opacity: 0.7;
}

.timeline-axis-title {
  fill: var(--text-color);
  font-size: 14px;
  font-weight: 400;
  opacity: 0.8;
}

/* Reading Time Summary */
.reading-time-summary {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.5;
  z-index: 900;
}

/* Book details overlay */
.book-details {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--entry-bg);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  z-index: 1000;
  max-width: 500px;
  width: 90%;
  text-align: center;
  transition: all 0.3s ease;
}

.book-details.hidden {
  display: none;
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}

.book-details-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.book-cover-detail {
  width: 120px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 0.5rem;
}

.book-details h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
  color: var(--text-color);
}

.book-author {
  font-size: 1.1rem;
  color: var(--accent-color);
  margin: 0;
  font-style: italic;
}

.book-dates {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

.book-date {
  font-size: 0.95rem;
  color: var(--text-color);
  opacity: 0.7;
  margin: 0;
}

.book-research-block {
  width: 100%;
  text-align: left;
  max-height: none;
  overflow: visible;
}

.book-research-block.hidden {
  display: none;
}

.book-genre {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-color);
  opacity: 0.55;
  margin: 0 0 0.4rem;
  text-align: center;
}

.book-research-about {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-color);
  opacity: 0.8;
  margin: 0;
}

.book-research-about[contenteditable="true"] {
  cursor: text;
  outline: none;
  border-radius: 4px;
  padding: 0.2rem 0.15rem;
  min-height: 2.6em;
}

.book-research-about[contenteditable="true"]:hover,
.book-research-about[contenteditable="true"]:focus {
  background: rgba(193, 106, 40, 0.08);
  opacity: 1;
}

.close-details {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  padding: 0.25rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-details:hover {
  opacity: 1;
}

/* Admin book panel */
.admin-book-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1.5rem 1rem 50px;
  background: transparent;
}

.admin-book-panel.hidden {
  display: none;
}

.admin-book-panel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  background: var(--entry-bg);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  max-width: 500px;
  width: 90%;
  text-align: center;
}

.admin-reread-section {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  width: 100%;
}

.admin-delete-section {
  width: 100%;
  padding-top: 0.75rem;
}

.btn-delete-book {
  background: transparent;
  color: #941E2F;
  border: 1px solid #941E2F;
  width: 100%;
}

.btn-delete-book:hover {
  background: #941E2F;
  color: #fff;
}

.admin-reread-section h3 {
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 0.75rem 0;
  color: var(--text-color);
}

.reread-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.reread-form input[type="date"] {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  padding: 0.75rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 5px;
  transition: border-color 0.2s ease;
  width: 100%;
}

.reread-form input[type="date"]:focus {
  outline: none;
  border-color: var(--accent-color);
}

.reread-message {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  display: none;
}

.reread-message.success { color: var(--accent-color); }
.reread-message.error { color: #e53e3e; }

/* Admin Bookshelf Styles */
.add-book-section {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.add-book-section h2,
.ai-tools-section h2,
.connection-section h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.ai-tools-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ai-tools-avatar {
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.book-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
}

.book-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.book-form label {
  font-size: 0.95rem;
  color: var(--accent-color);
}

.book-form input[type="text"],
.book-form input[type="url"],
.book-form input[type="date"],
.book-form input[type="file"],
.book-form input[type="number"] {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  padding: 0.75rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 5px;
  transition: border-color 0.2s ease;
}

.book-form input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.cover-preview {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.cover-preview.hidden {
  display: none;
}

.cover-preview img {
  max-width: 200px;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-message {
  padding: 0.75rem;
  border-radius: 5px;
  margin-top: 1rem;
  display: none;
}

.form-message.success {
  background-color: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
}

.form-message.error {
  background-color: rgba(211, 47, 47, 0.1);
  color: #d32f2f;
}

.form-message.info {
  background-color: rgba(193, 106, 40, 0.1);
  color: var(--accent-color);
}

.ai-tools-section {
  margin-top: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.ai-tools-controls {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.ai-tools-controls .btn {
  margin-bottom: 0.5rem;
}

.ai-tools-hint {
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.7;
  line-height: 1.6;
  margin-top: 0.5rem;
}

#ai-tools-message {
  margin-top: 1rem;
}

.connection-section {
  margin-top: 3rem;
}

.connection-controls {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-color);
  border: 2px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.btn-secondary.active {
  background-color: var(--accent-color);
  color: #FFFFFF;
  border-color: var(--accent-color);
}

.btn-delete {
  margin-left: 1rem;
}

.btn-delete.active {
  background-color: #d32f2f;
  color: #FFFFFF;
  border-color: #d32f2f;
}

.connection-hint {
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.7;
  font-style: italic;
  margin: 0;
}

.admin-network {
  width: 100%;
  height: 60vh;
  min-height: 400px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-color);
  margin-top: 1rem;
  /* Hardware acceleration for smooth zoom/pan */
  transform: translateZ(0);
  will-change: transform;
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.admin-network canvas {
  /* Smooth rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.network-empty {
  text-align: center;
  padding: 4rem 2rem;
  opacity: 0.5;
  font-style: italic;
  display: none;
}

/* Mobile touch support for network */
@media (max-width: 768px) {
  #bookshelf-network,
  .admin-network {
    touch-action: none; /* Enable pinch-zoom and pan gestures */
  }
  
  .bookshelf-toggle-container {
    bottom: 15px;
    left: 0.5rem;
    gap: 0.5rem;
  }
  
  .toggle-switch {
    width: 26px;
    height: 15px;
  }
  
  .toggle-slider:before {
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2.5px;
  }
  
  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(12px);
  }
  
  .bookshelf-header {
    padding: 1.5rem 1.5rem;
  }
  
  .bookshelf-header .nav-left {
    gap: 0.3rem;
  }
  
  .bookshelf-header .site-title {
    font-size: 1.5rem;
  }
  
  .book-details {
    bottom: 20px;
    padding: 1.5rem;
    max-width: calc(100% - 2rem);
  }
  
  .book-cover-detail {
    width: 100px;
  }
  
  .book-details h2 {
    font-size: 1.3rem;
  }
  
  .book-form {
    max-width: 100%;
  }
  
  .admin-network {
    height: 50vh;
    min-height: 300px;
  }
  
  .bookshelf-timeline {
    padding: 6rem 1rem 1rem 1rem;
  }
  
  .timeline-svg {
    max-width: 100%;
  }
  
  .reading-time-summary {
    bottom: 15px;
    right: 15px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .bookshelf-toggle-container {
    bottom: 12px;
    left: 0.5rem;
    gap: 0.4rem;
  }
  
  .toggle-switch {
    width: 24px;
    height: 14px;
  }
  
  .toggle-slider:before {
    height: 9px;
    width: 9px;
    left: 2px;
    bottom: 2.5px;
  }
  
  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(11px);
  }
  
  .bookshelf-header {
    padding: 1rem 1rem;
  }
  
  .bookshelf-header .site-title {
    font-size: 1.3rem;
  }
  
  .book-details {
    bottom: 15px;
    padding: 1.25rem;
  }
  
  .book-cover-detail {
    width: 80px;
  }
  
  .book-details h2 {
    font-size: 1.2rem;
  }
  
  .book-author {
    font-size: 1rem;
  }
  
  .book-date {
    font-size: 0.85rem;
  }
  
  .admin-network {
    height: 40vh;
    min-height: 250px;
  }
  
  .bookshelf-timeline {
    padding: 5rem 0.5rem 0.5rem 0.5rem;
  }
  
  .reading-time-summary {
    bottom: 12px;
    right: 12px;
    font-size: 0.75rem;
  }
}

/* ========================================
   EISENKIND ADMIN
   ======================================== */

.admin-eisenkind-page .container {
  max-width: 1100px;
}

.eisenkind-admin-layout {
  display: block;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-eisenkind-page .eisenkind-admin-story {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ========================================
   COMPANY EDUCATION STYLES
   ======================================== */

.ce-page {
  max-width: 800px;
  padding-left: max(2rem, env(safe-area-inset-left));
  padding-right: max(2rem, env(safe-area-inset-right));
  padding-bottom: max(3rem, env(safe-area-inset-bottom));
}

.ce-main {
  min-height: 40vh;
}

.ce-loading,
.ce-empty,
.ce-error {
  text-align: center;
  padding: 4rem 0 2rem;
  opacity: 0.65;
  font-style: italic;
}

.ce-loading {
  display: block;
}

.ce-loading-pulse {
  display: none;
}

.ce-categories {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ce-category {
  border-bottom: 1px solid var(--border-color);
}

.ce-category:last-child {
  border-bottom: none;
}

.ce-category-header {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 1.5rem 0;
  background: none;
  border: none;
  color: var(--text-color);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ce-category-header:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.ce-folder-icon {
  color: var(--accent-color);
  font-size: 0.65rem;
  width: 0.75rem;
  flex-shrink: 0;
  position: relative;
  top: 0.05rem;
}

.ce-category-name {
  flex: 1;
  font-weight: 400;
  line-height: 1.5;
  word-break: break-word;
}

.ce-video-count {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  color: var(--accent-color);
  opacity: 0.85;
}

.ce-category-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.ce-category-content.is-open {
  grid-template-rows: 1fr;
}

.ce-category-content-inner {
  overflow: hidden;
  min-height: 0;
}

.ce-category-content.is-open .ce-category-content-inner {
  padding: 0 0 2rem;
}

.ce-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2rem 1.5rem;
  align-items: start;
}

.ce-video-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text-color);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ce-video-card:hover,
.ce-video-card:active,
.ce-video-card:focus,
.ce-video-card:focus-visible {
  color: var(--text-color);
  outline: none;
  box-shadow: none;
  transform: none;
  opacity: 1;
}

.ce-video-thumb-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border-radius: 0;
}

.ce-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.ce-video-card:hover .ce-video-thumb,
.ce-video-card:active .ce-video-thumb,
.ce-video-card:focus .ce-video-thumb,
.ce-video-card:focus-visible .ce-video-thumb {
  transform: none;
  opacity: 1;
  filter: none;
}

.ce-video-title {
  margin: 0;
  padding: 0.75rem 0 0;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

@media (max-width: 768px) {
  .ce-page {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .ce-category-header {
    padding: 1.25rem 0;
    font-size: 0.98rem;
  }

  .ce-category-content.is-open .ce-category-content-inner {
    padding-bottom: 1.5rem;
  }

  .ce-video-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

@media (max-width: 600px) {
  .ce-video-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
  }

  .ce-video-thumb-wrap {
    width: 38%;
    max-width: 9rem;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
  }

  .ce-video-title {
    flex: 1;
    padding-top: 0.15rem;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}

@media (max-width: 480px) {
  .ce-page {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .ce-loading,
  .ce-empty,
  .ce-error {
    padding: 3rem 0 1.5rem;
  }
}

@media (min-width: 769px) {
  .ce-video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ce-category-content,
  .ce-folder-icon {
    transition: none;
  }
}

#youtube-preview img {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ce-category-sort-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ce-category-sort-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ce-category-sort-item:hover {
  background-color: rgba(193, 106, 40, 0.08);
}

.ce-category-sort-item.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.ce-category-sort-item.drag-over {
  border-color: var(--accent-color);
}

.ce-category-sort-handle {
  color: var(--accent-color);
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.7;
  flex-shrink: 0;
}

.ce-category-sort-name {
  flex: 1;
  font-size: 1rem;
  min-width: 0;
}

.ce-category-sort-open {
  color: var(--accent-color);
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.65;
  flex-shrink: 0;
}

.ce-move-btn {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--entry-bg);
  color: var(--accent-color);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
}

.ce-move-btn:hover {
  background-color: rgba(193, 106, 40, 0.08);
  border-color: var(--accent-color);
}

.ce-move-btn:active {
  background-color: rgba(193, 106, 40, 0.16);
}

.ce-category-sort-empty {
  opacity: 0.6;
  font-style: italic;
  padding: 0.5rem 0;
}

.ce-category-sort-item.is-selected {
  border-color: var(--accent-color);
  background-color: rgba(193, 106, 40, 0.12);
}

.ce-category-videos-panel.hidden {
  display: none;
}

.ce-category-videos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.ce-category-videos-header h2 {
  margin: 0;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background-color: rgba(193, 106, 40, 0.08);
  border-color: var(--accent-color);
}

.ce-video-sort-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ce-video-sort-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ce-video-sort-item:hover {
  background-color: rgba(193, 106, 40, 0.08);
}

.ce-video-sort-item.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.ce-video-sort-item.drag-over {
  border-color: var(--accent-color);
}

.ce-video-sort-thumb {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background-color: var(--border-color);
}

.ce-video-sort-title {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.35;
}

.ce-video-sort-delete {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--accent-color);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ce-video-sort-delete:hover {
  background-color: rgba(148, 30, 47, 0.08);
  border-color: #941E2F;
  color: #941E2F;
}

.ce-video-sort-empty {
  opacity: 0.6;
  font-style: italic;
  padding: 0.5rem 0;
}

@media (max-width: 768px) {
  .ce-page {
    max-width: 100%;
  }

  .ce-category-sort-list,
  .ce-video-sort-list {
    max-width: 100%;
  }

  .admin-ce-page .container {
    padding: 1.25rem 0.875rem 2.5rem;
  }

  .admin-ce-page .site-title {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  .admin-ce-page nav {
    margin-bottom: 1.75rem;
  }

  .admin-ce-page .add-book-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }

  .admin-ce-page .add-book-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .admin-ce-page .book-form {
    max-width: 100%;
    gap: 1.25rem;
  }

  .admin-ce-page .book-form input[type="text"],
  .admin-ce-page .book-form input[type="url"] {
    font-size: 16px;
    min-height: 48px;
    padding: 0.875rem;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
  }

  .admin-ce-page .book-form .btn {
    width: 100%;
    align-self: stretch;
    min-height: 48px;
  }

  .admin-ce-page .form-hint {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
  }

  .admin-ce-page .cover-preview img {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .admin-ce-page .ce-category-sort-item,
  .admin-ce-page .ce-video-sort-item {
    min-height: 56px;
    padding: 0.75rem;
    gap: 0.5rem;
    touch-action: manipulation;
  }

  .admin-ce-page .ce-category-sort-handle {
    display: none;
  }

  .admin-ce-page .ce-move-btn {
    display: inline-flex;
  }

  .admin-ce-page .ce-category-sort-name {
    font-size: 1.05rem;
    padding: 0.35rem 0;
  }

  .admin-ce-page .ce-category-sort-open {
    font-size: 1.4rem;
    padding: 0.25rem 0.15rem;
  }

  .admin-ce-page .ce-category-videos-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .admin-ce-page .ce-category-videos-header h2 {
    font-size: 1.25rem;
  }

  .admin-ce-page .ce-category-videos-header .btn-secondary {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .admin-ce-page .ce-video-sort-item {
    flex-wrap: wrap;
    align-items: center;
  }

  .admin-ce-page .ce-video-sort-title {
    flex: 1 1 8rem;
    min-width: 0;
    font-size: 1rem;
    line-height: 1.4;
  }

  .admin-ce-page .ce-video-sort-thumb {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 16 / 9;
    margin-top: 0.35rem;
  }

  .admin-ce-page .ce-video-sort-delete {
    min-height: 44px;
    min-width: 72px;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    margin-left: auto;
  }

  .admin-ce-page .ce-category-videos-panel {
    scroll-margin-top: 1rem;
  }
}

/* Want — clean requirements tree page */
.want-body {
  height: 100vh;
  overflow: hidden;
}

.want-main {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 100vh;
  width: 100%;
  padding: 2rem 1.5rem 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
}

.want-tree {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.want-tree-scale {
  transform-origin: top center;
  will-change: transform;
}

.want-tree-list,
.want-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.want-tree-list {
  display: flex;
  justify-content: center;
  width: max-content;
}

.want-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.want-entry {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
  min-width: 14rem;
  max-width: 22rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(26, 26, 26, 0.28);
  border-left: 3px solid var(--accent-color);
  background: var(--bg-color);
  position: relative;
  z-index: 1;
  text-align: left;
}

.want-depth-0 > .want-entry {
  min-width: 18rem;
  max-width: 30rem;
  padding: 1.15rem 1.35rem;
  border-left-width: 4px;
}

.want-depth-0 > .want-entry .want-text {
  font-size: 1.28rem;
  line-height: 1.35;
}

.want-depth-0 > .want-entry .want-owner {
  font-size: 0.9rem;
}

.want-depth-1 > .want-entry {
  min-width: 12rem;
  max-width: 18rem;
  padding: 0.75rem 0.9rem;
}

.want-depth-1 > .want-entry .want-text {
  font-size: 0.92rem;
}

.want-depth-1 > .want-entry .want-owner {
  font-size: 0.72rem;
}

.want-depth-2 > .want-entry {
  min-width: 10rem;
  max-width: 15rem;
  padding: 0.65rem 0.8rem;
  border-left-width: 2px;
}

.want-depth-2 > .want-entry .want-text {
  font-size: 0.84rem;
}

.want-depth-2 > .want-entry .want-owner {
  font-size: 0.68rem;
}

.want-depth-3 > .want-entry {
  min-width: 9rem;
  max-width: 13rem;
  padding: 0.55rem 0.7rem;
  border-left-width: 2px;
}

.want-depth-3 > .want-entry .want-text {
  font-size: 0.78rem;
}

.want-depth-3 > .want-entry .want-owner {
  font-size: 0.64rem;
}

.want-depth-4 > .want-entry {
  min-width: 8rem;
  max-width: 12rem;
  padding: 0.5rem 0.65rem;
  border-left-width: 2px;
}

.want-depth-4 > .want-entry .want-text {
  font-size: 0.72rem;
}

.want-depth-4 > .want-entry .want-owner {
  font-size: 0.6rem;
}

[data-theme="dark"] .want-entry {
  border-color: rgba(226, 232, 240, 0.28);
}

.want-text {
  margin: 0;
  flex: 1 1 auto;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text-color);
  text-wrap: balance;
}

.want-owner {
  flex: 0 0 auto;
  font-size: 0.78rem;
  line-height: 1.4;
  letter-spacing: 0.03em;
  color: var(--accent-color);
  white-space: nowrap;
}

.want-children {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.75rem;
  position: relative;
  margin-top: 2.25rem;
  width: max-content;
}

/* Vertical stem from parent down to the children row */
.want-children::before {
  content: '';
  position: absolute;
  top: -2.25rem;
  left: 50%;
  width: 1px;
  height: 2.25rem;
  background: rgba(26, 26, 26, 0.35);
  transform: translateX(-50%);
}

[data-theme="dark"] .want-children::before,
[data-theme="dark"] .want-children > .want-node::before,
[data-theme="dark"] .want-children > .want-node::after {
  background: rgba(226, 232, 240, 0.35);
}

/* Horizontal bar across siblings */
.want-children > .want-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(26, 26, 26, 0.35);
}

.want-children > .want-node:first-child::before {
  left: 50%;
}

.want-children > .want-node:last-child::before {
  right: 50%;
}

.want-children > .want-node:only-child::before {
  display: none;
}

/* Vertical drop from the bar into each child */
.want-children > .want-node::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 1.35rem;
  background: rgba(26, 26, 26, 0.35);
  transform: translateX(-50%);
}

.want-children > .want-node {
  padding-top: 1.35rem;
}

@media (max-width: 600px) {
  .want-main {
    padding: 1.25rem 0.75rem;
  }

  .want-children {
    gap: 1.25rem;
    margin-top: 2rem;
  }

  .want-children::before {
    top: -2rem;
    height: 2rem;
  }

  .want-text {
    font-size: 0.95rem;
  }

  .want-entry {
    max-width: 18rem;
    min-width: 0;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
  }
}

/* Edu episodes */
.edu-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.edu-page .container {
  max-width: 640px;
}

.edu-page nav {
  margin-bottom: 2.5rem;
}

.edu-episodes {
  display: flex;
  flex-direction: column;
}

.edu-track {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
}

.edu-track-open {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.edu-cover {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  background: var(--entry-bg);
}

.edu-track-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.edu-name {
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.edu-track-open:hover .edu-name,
.edu-track.is-playing .edu-name {
  color: var(--accent-color);
}

.edu-born {
  color: var(--accent-color);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.edu-bio {
  font-size: 1.05rem;
  line-height: 1.8;
  margin: 0;
}

.edu-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.edu-link {
  color: var(--text-color);
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  opacity: 0.7;
  transition: opacity 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.edu-link:hover {
  opacity: 1;
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.edu-player {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.edu-play {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  background: var(--entry-bg);
  color: var(--text-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.edu-play:hover,
.edu-track.is-playing .edu-play,
.edu-now-card.is-playing .edu-play {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.edu-time-current,
.edu-time-duration {
  flex: 0 0 auto;
  font-size: 0.8rem;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 2.4rem;
}

.edu-time-duration {
  min-width: 3.6rem;
  text-align: right;
}

.edu-seek {
  flex: 1 1 auto;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}

.edu-speed-wrap {
  flex: 0 0 auto;
  position: relative;
}

.edu-speed {
  background: none;
  border: none;
  color: var(--accent-color);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  min-width: 2.4rem;
  text-align: right;
  line-height: 1;
}

.edu-speed:hover {
  opacity: 0.7;
}

.edu-download {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.edu-download:hover {
  opacity: 0.7;
}

.edu-download.is-busy {
  opacity: 0.35;
  pointer-events: none;
}

.edu-track .edu-download {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  background: var(--entry-bg);
  color: var(--text-color);
  border-radius: 50%;
  opacity: 1;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.edu-track .edu-download:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  opacity: 1;
}

.edu-speed-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  grid-template-columns: repeat(3, 2.6rem);
  gap: 0.15rem;
  padding: 0.35rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  z-index: 20;
}

.edu-speed-wrap.is-open .edu-speed-menu {
  display: grid;
}

.edu-speed-option {
  background: none;
  border: none;
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.3rem 0;
  text-align: center;
  border-radius: 6px;
}

.edu-speed-option:hover,
.edu-speed-option.is-active {
  color: var(--accent-color);
}

.edu-seek::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--border-color);
  border: none;
}

.edu-seek::-moz-range-track {
  height: 3px;
  background: var(--border-color);
  border: none;
}

.edu-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
  margin-top: -6.5px;
}

.edu-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
}

.edu-empty {
  opacity: 0.6;
}

.edu-transcript {
  width: 100%;
  margin-top: 0.25rem;
}

.edu-transcript-label {
  color: var(--accent-color);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0;
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.edu-transcript-label::-webkit-details-marker {
  display: none;
}

.edu-transcript-label::before {
  content: '▶';
  font-size: 0.65rem;
  line-height: 1;
}

.edu-transcript[open] .edu-transcript-label::before {
  content: '▼';
}

.edu-transcript-body {
  margin-top: 1rem;
}

.edu-transcript p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin: 0 0 1.2rem;
}

.edu-transcript p:last-child {
  margin-bottom: 0;
}

.edu-now .container {
  max-width: none;
  padding: 0;
}

.edu-now nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  margin: 0;
  padding: 1.25rem 1.5rem 0;
}

.edu-now-hero {
  height: 100svh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  padding: 5rem 1.5rem calc(5.75rem + env(safe-area-inset-bottom));
}

.edu-now-cover {
  width: min(86vw, calc(100svh - 18rem), 520px);
  height: min(86vw, calc(100svh - 18rem), 520px);
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  flex-shrink: 1;
  background: var(--entry-bg);
  cursor: pointer;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
}

.edu-now-hero .edu-name {
  font-size: 1.7rem;
  margin: 1.25rem 0 0.35rem;
}

.edu-now-hero .edu-born {
  font-size: 0.95rem;
  margin: 0;
}

.edu-now-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  background: var(--bg-color);
  padding: 0.75rem 1.5rem 0;
}

.edu-now-dock .edu-player {
  width: min(100%, 520px);
  margin: 0 auto;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.edu-now-dock::after {
  content: "";
  display: block;
  height: calc(0.35rem + env(safe-area-inset-bottom));
}

.edu-now .edu-play {
  width: 44px;
  height: 44px;
}

.edu-now-dock .edu-speed-menu {
  top: auto;
  bottom: calc(100% + 0.4rem);
}

.edu-now-copy {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 640px;
  margin: 2.5rem auto calc(7rem + env(safe-area-inset-bottom));
  padding: 0 1.5rem;
  text-align: left;
}

@media (max-width: 600px) {
  .edu-cover {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .edu-name {
    font-size: 0.98rem;
  }

  .edu-player {
    gap: 0.3rem;
  }

  .edu-play {
    width: 32px;
    height: 32px;
  }

  .edu-track .edu-download {
    width: 32px;
    height: 32px;
  }

  .edu-now .edu-play {
    width: 40px;
    height: 40px;
  }

  .edu-now-hero {
    padding: 4.25rem 1.15rem calc(5.35rem + env(safe-area-inset-bottom));
  }

  .edu-now-cover {
    width: min(78vw, calc(100svh - 16.5rem));
    height: min(78vw, calc(100svh - 16.5rem));
  }

  .edu-now-hero .edu-name {
    font-size: 1.35rem;
    margin: 0.9rem 0 0.25rem;
  }

  .edu-now-dock {
    padding: 0.65rem 1rem 0;
  }

  .edu-time-current,
  .edu-time-duration {
    font-size: 0.72rem;
    min-width: 2.1rem;
  }

  .edu-time-duration {
    min-width: 3.2rem;
  }
}

/* Liquidity */
.form-group select,
.book-form select {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  padding: 0.75rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 5px;
  transition: border-color 0.2s ease;
  appearance: none;
}

.form-group select:focus,
.book-form select:focus {
  outline: none;
  border-color: var(--accent-color);
}

.liquidity-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.liquidity-summary-box .liquidity-now {
  font-size: 2rem;
  margin: 0 0 1rem;
}

.liquidity-calc {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
  font-family: Georgia, 'Times New Roman', serif;
}

.liquidity-calc-row {
  display: grid;
  grid-template-columns: 1.2rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.liquidity-calc-row label,
.liquidity-calc-row span {
  font-size: 0.95rem;
}

.liquidity-calc-row input {
  grid-column: 3;
  width: 8.5rem;
  text-align: right;
}

.liquidity-calc-total {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-color);
}

.admin-liquidity-chart {
  position: relative;
  margin: 0 0 2.5rem;
}

.admin-liquidity-page #liquidity-chart {
  width: 100%;
  height: 380px;
  max-width: 100%;
  background: transparent;
}

.admin-liquidity-page #liquidity-balance {
  display: none;
}

.admin-liquidity-page .liquidity-tooltip {
  position: absolute;
}

.admin-liquidity-page .new-entry-box textarea {
  min-height: 120px;
}

.liquidity-start-box {
  margin-bottom: 3rem;
}

.admin-liquidity-page .new-entry-box h2,
.admin-liquidity-page .liquidity-monthly-section h2,
.admin-liquidity-page .liquidity-pending-block h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.admin-liquidity-page .liquidity-pending-block {
  margin: 0 0 2.5rem;
}

.liquidity-start-box > .form-hint {
  margin-bottom: 1.25rem;
}

.liquidity-open-total {
  margin: 1.1rem 0 0;
  color: var(--accent-color);
}

.liquidity-runway {
  margin: 1.25rem 0 0;
  color: var(--accent-color);
}

.admin-liquidity-page .liquidity-liability-list,
.admin-liquidity-page .liquidity-recurring-list {
  margin-top: 1.25rem;
  gap: 0;
}

.admin-liquidity-page .liquidity-liability-list .entry,
.admin-liquidity-page .liquidity-recurring-list .entry {
  padding: 0.55rem 0;
}

.admin-liquidity-page .liquidity-liability-list .entry-header,
.admin-liquidity-page .liquidity-recurring-list .entry-header {
  margin-bottom: 0.1rem;
  align-items: center;
}

.admin-liquidity-page .liquidity-liability-list .entry-date,
.admin-liquidity-page .liquidity-recurring-list .entry-date {
  margin-bottom: 0;
}

.admin-liquidity-page .liquidity-liability-list .entry-content,
.admin-liquidity-page .liquidity-recurring-list .entry-content {
  line-height: 1.3;
}

.admin-liquidity-page .liquidity-liability-list .entry-content p,
.admin-liquidity-page .liquidity-recurring-list .entry-content p {
  margin-bottom: 0;
}

.admin-liquidity-page .liquidity-liability-list .liquidity-amount,
.admin-liquidity-page .liquidity-recurring-list .liquidity-amount {
  margin-bottom: 0;
}

.admin-liquidity-page .liquidity-row-meta {
  margin-left: 0.4rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-color);
  opacity: 0.6;
  font-weight: 400;
}

.liquidity-entry-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.liquidity-liability-save-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-liquidity-page .liquidity-liability-list .entry.is-editing .entry-date {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.liquidity-paid-btn {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.95rem;
  background: none;
  border: none;
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  padding: 0.4rem 0.2rem;
  min-height: 44px;
  min-width: 44px;
}

.liquidity-paid-btn:hover {
  opacity: 0.7;
}

.liquidity-monthly-section {
  margin-top: 2rem;
}

.liquidity-monthly-section .book-form {
  max-width: none;
}

.liquidity-recurring-list {
  margin-top: 1.25rem;
}

.liquidity-amount {
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.liquidity-in {
  color: var(--accent-color);
}

.liquidity-out {
  color: var(--text-color);
}

.liquidity-field-label,
.admin-liquidity-page .form-group label {
  font-size: 0.95rem;
  color: var(--accent-color);
  display: block;
  margin-bottom: 0.15rem;
}

.liquidity-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.liquidity-pill {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--entry-bg);
  color: var(--text-color);
  border-radius: 5px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.liquidity-pill.is-active {
  background: var(--accent-color);
  color: #FFFFFF;
  border-color: var(--accent-color);
}

.liquidity-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.liquidity-marker .timeline-marker-dot {
  pointer-events: none;
}

.liquidity-page {
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background-color: var(--bg-color);
}

.liquidity-page .liquidity-ledger {
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
}

#liquidity-chart {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-color);
}

.liquidity-page .reading-time-summary {
  bottom: 52px;
}

.liquidity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.liquidity-monthly-toggle {
  pointer-events: auto;
  position: relative;
  z-index: 1300;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--text-color);
  opacity: 0.55;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  min-height: 44px;
  padding: 0.15rem 0;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.liquidity-monthly-toggle:hover,
.liquidity-monthly-toggle[aria-expanded="true"] {
  opacity: 0.9;
}

.liquidity-monthly-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: max(0.35rem, env(safe-area-inset-top, 0px)) 0.5rem max(0.35rem, env(safe-area-inset-bottom, 0px));
}

.liquidity-monthly-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  height: auto;
  margin: auto;
  overflow: visible;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: Georgia, 'Times New Roman', serif;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.15rem 1.5rem 0.95rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

#liquidity-monthly-list {
  overflow: visible;
}

#liquidity-monthly-totals {
  flex-shrink: 0;
}

.liquidity-monthly-sheet h2 {
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 2rem 0.55rem 0;
}

.liquidity-monthly-close {
  position: absolute;
  top: 0.85rem;
  right: 0.95rem;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.7rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  cursor: pointer;
}

.liquidity-monthly-close:hover {
  opacity: 1;
}

.liquidity-monthly-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
}

.liquidity-monthly-copy {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.5rem;
  min-width: 0;
}

.liquidity-monthly-name {
  display: inline;
}

.liquidity-monthly-sum {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #c62828;
}

.liquidity-monthly-sum-in {
  color: var(--text-color);
}

.liquidity-monthly-meta,
.liquidity-monthly-empty {
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0;
}

.liquidity-monthly-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  font-size: 1.35rem;
  font-weight: 700;
}

.liquidity-monthly-totals .liquidity-runway {
  margin: 0.7rem 0 0;
  font-size: 1rem;
  opacity: 0.85;
}

[data-theme="dark"] .liquidity-monthly-sum {
  color: #ff5252;
}

.liquidity-optional-date {
  margin-top: 1.25rem;
}

.liquidity-line-future {
  stroke-dasharray: 7 7;
  opacity: 0.55;
}

.liquidity-now-line {
  stroke: var(--text-color);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.35;
}

.liquidity-dot-future {
  opacity: 0.45;
}

.liquidity-tooltip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.9rem;
  line-height: 1.35;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  min-width: 8.5rem;
  max-width: min(280px, calc(100vw - 32px));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.liquidity-tooltip.hidden {
  display: none;
}

.liquidity-tooltip-when {
  font-size: 0.78rem;
  opacity: 0.5;
}

.liquidity-tooltip-log {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.35rem 0;
}

.liquidity-tooltip-log .liquidity-tooltip-note {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.liquidity-tooltip-log .liquidity-tooltip-delta {
  flex-shrink: 0;
}

.liquidity-tooltip-delta {
  font-variant-numeric: tabular-nums;
}

.liquidity-tooltip-sum {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.15rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}

.liquidity-tooltip-sum-label {
  opacity: 0.85;
}

.liquidity-tooltip-balance {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
  padding-top: 0.3rem;
  color: var(--text-color);
}

.liquidity-tooltip-out {
  color: #c62828;
}

[data-theme="dark"] .liquidity-tooltip-out {
  color: #ff5252;
}

@media (max-width: 768px) {
  .liquidity-form-row {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .admin-liquidity-page {
    -webkit-text-size-adjust: 100%;
  }

  .admin-liquidity-page .corner-btn-left {
    width: 44px;
    height: 44px;
  }

  .admin-liquidity-page .container {
    padding: 1.25rem 0.9rem calc(3.5rem + env(safe-area-inset-bottom, 0px));
  }

  .admin-liquidity-page nav {
    margin-bottom: 1.75rem;
  }

  .admin-liquidity-page .site-title {
    font-size: 1.45rem;
  }

  .admin-liquidity-page .form-group input,
  .admin-liquidity-page .form-group input[type="date"],
  .admin-liquidity-page .form-group input[type="number"],
  .admin-liquidity-page .book-form input,
  .admin-liquidity-page .book-form input[type="date"],
  .admin-liquidity-page .book-form input[type="number"],
  .admin-liquidity-page .book-form input[type="text"] {
    font-size: 16px;
    min-height: 48px;
    padding: 0.85rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 5px;
  }

  .admin-liquidity-page .new-entry-box textarea {
    font-size: 16px;
    min-height: 96px;
    padding: 0.85rem;
    width: 100%;
    -webkit-appearance: none;
  }

  .admin-liquidity-page .btn,
  .admin-liquidity-page .book-form .btn {
    width: 100%;
    max-width: none;
    min-height: 48px;
    align-self: stretch;
  }

  .admin-liquidity-page .liquidity-liability-save-row {
    flex-wrap: wrap;
  }

  .admin-liquidity-page .liquidity-liability-save-row .btn {
    flex: 1 1 auto;
  }

  .admin-liquidity-page .new-entry-box,
  .admin-liquidity-page .liquidity-start-box,
  .admin-liquidity-page .liquidity-monthly-section {
    margin-bottom: 2.25rem;
    padding-bottom: 1.5rem;
  }

  .admin-liquidity-page .add-book-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .admin-liquidity-page .entry-header {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }

  .admin-liquidity-page .delete-entry-btn {
    width: 44px;
    height: 44px;
    font-size: 2rem;
    align-self: auto;
    flex-shrink: 0;
  }

  .admin-liquidity-page .liquidity-paid-btn {
    min-height: 44px;
    min-width: 48px;
    font-size: 1rem;
    padding: 0.5rem 0.35rem;
  }

  .admin-liquidity-page .liquidity-pill {
    min-height: 48px;
    font-size: 16px;
  }

  .liquidity-header {
    padding: 1.15rem 1.15rem 0;
  }

  .liquidity-header .site-title {
    font-size: 1.45rem;
  }

  .liquidity-page .reading-time-summary {
    top: 3.55rem;
    left: 1.15rem;
    right: auto;
    bottom: auto;
    font-size: 0.95rem;
    opacity: 0.7;
  }

  .liquidity-monthly-toggle {
    font-size: 0.95rem;
  }

  .liquidity-monthly-sheet {
    width: 100%;
    height: auto;
    max-height: none;
    padding: 1.1rem 1.1rem 0.9rem;
    border-radius: 10px;
  }

  .liquidity-monthly-sheet h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .liquidity-monthly-total {
    font-size: 1.2rem;
  }

  .liquidity-tooltip {
    font-size: 0.95rem;
    max-width: min(280px, calc(100vw - 32px));
  }
}

/* People intro graph */
body.people-graph-page {
  overflow: hidden;
  height: 100%;
}

.people-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.people-graph-question {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.45rem;
  max-width: min(28rem, calc(100vw - 11rem));
  margin: 0;
  padding: 0.2rem 0.2rem 0 0;
  border: none;
  background: none;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(0.78rem, 1.05vw, 0.95rem);
  line-height: 1.38;
  font-style: italic;
  color: var(--text-color);
  opacity: 0.62;
  text-align: right;
  pointer-events: auto;
  cursor: pointer;
}

.people-graph-question-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.08em;
}

.people-graph-q-line {
  display: block;
  white-space: nowrap;
}

.people-graph-question:hover {
  opacity: 0.88;
}

.people-lang-seal {
  display: inline-flex;
  width: 1.2rem;
  height: 1.2rem;
  margin-left: 0.45rem;
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #B44A2A;
  color: #B44A2A;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", Georgia, serif;
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1;
  transform: rotate(-9deg);
  opacity: 0.85;
}

.people-lang-seal.is-stamping {
  animation: people-seal-stamp 0.48s ease;
}

@keyframes people-seal-stamp {
  0% { transform: rotate(-9deg) scale(1); }
  30% { transform: rotate(-2deg) scale(0.78); }
  58% { transform: rotate(-14deg) scale(1.16); }
  100% { transform: rotate(-9deg) scale(1); }
}

#people-graph-question-text.is-inking {
  animation: people-ink 0.55s ease;
}

@keyframes people-ink {
  0% { opacity: 1; filter: blur(0); }
  42% { opacity: 0; filter: blur(5px); }
  100% { opacity: 1; filter: blur(0); }
}

body.people-graph-page.is-zh,
body.people-graph-page.is-zh .people-graph-question,
body.people-graph-page.is-zh .people-node,
body.people-graph-page.is-zh .people-details,
body.people-graph-page.is-zh .site-title {
  font-family: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", "FangSong", Georgia, 'Times New Roman', serif;
}

body.people-graph-page.is-zh .people-graph-question {
  font-style: normal;
  letter-spacing: 0.04em;
}

.people-details-added {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.55;
}

.people-admin-zh {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  opacity: 0.72;
}

.people-graph {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-color);
  cursor: grab;
  touch-action: none;
}

.people-graph.is-panning {
  cursor: grabbing;
}

.people-graph-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.people-graph-svg {
  position: absolute;
  overflow: visible;
  width: 1px;
  height: 1px;
}

.people-graph-nodes {
  position: absolute;
  left: 0;
  top: 0;
}

.people-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 92px;
  padding: 0;
  border: none;
  background: none;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--text-color);
  cursor: pointer;
}

.people-node-photo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.45);
  border: 1.5px solid rgba(193, 106, 40, 0.28);
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.08);
}

[data-theme="dark"] .people-node-photo {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(193, 106, 40, 0.45);
}

.people-node.is-open .people-node-photo {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(193, 106, 40, 0.12), 0 8px 22px rgba(26, 26, 26, 0.1);
}

.people-node-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.people-node-photo span {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.people-node-name {
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
  max-width: 92px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.people-node-slots {
  display: flex;
  gap: 0.28rem;
}

.people-node-slot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid rgba(193, 106, 40, 0.55);
  background: transparent;
}

.people-node-slot.is-filled {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.people-details {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--entry-bg);
  backdrop-filter: blur(10px);
  padding: 2rem 2.25rem 1.75rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  z-index: 1000;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.people-details-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.people-details-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.45);
  border: 1.5px solid rgba(193, 106, 40, 0.28);
}

.people-details-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.people-details-photo span {
  font-size: 2rem;
}

.people-details h2 {
  font-size: 1.45rem;
  font-weight: 400;
  margin: 0;
}

.people-details-from {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--accent-color);
}

.people-details-desc {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  opacity: 0.88;
}

.people-photo-preview img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
}

.book-form textarea {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  padding: 0.75rem;
  background-color: var(--entry-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 5px;
  resize: vertical;
  min-height: 6rem;
  line-height: 1.45;
}

.book-form textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.people-form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.people-admin-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.people-admin-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.people-admin-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--entry-bg);
  border: 1px solid var(--border-color);
}

.people-admin-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.people-admin-meta {
  flex: 1;
  min-width: 0;
}

.people-admin-from {
  margin: 0.15rem 0 0.4rem;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--accent-color);
}

.people-admin-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.people-edit-btn {
  background: none;
  border: none;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.55;
  cursor: pointer;
}

.people-edit-btn:hover {
  opacity: 1;
  color: var(--accent-color);
}

@media (max-width: 700px) {
  .people-graph-header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 1.5rem;
  }

  .people-graph-question {
    align-self: flex-start;
    justify-content: flex-start;
    max-width: calc(100vw - 3rem);
    font-size: clamp(0.72rem, 3.4vw, 0.88rem);
  }

  .people-graph-question-text {
    align-items: flex-start;
  }

  .people-details {
    bottom: 20px;
  }
}


