/* ==================== */
/* Fonts */
/* ==================== */

@font-face {
  font-family: 'Geist Pixel';
  src: url('fonts/geist-pixel/GeistPixel-Square.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ==================== */
/* Global Hidden Element Rules */
/* ==================== */

/* Prevent hidden elements from being clickable */
.hidden,
[hidden],
[aria-hidden="true"] {
  pointer-events: none !important;
}

/* Hide Thought Train app (temporarily disabled) */
.nav-icon-btn[data-view="thoughtTrain"],
.mobile-menu-app-btn[data-view="thoughtTrain"] {
  display: none !important;
}

/* ==================== */
/* System Alert         */
/* ==================== */

.system-alert {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--welcome-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--welcome-border);
  border-radius: 0px;
  box-shadow: 0 8px 32px var(--welcome-shadow);
  padding: 1.5rem 1.5rem;
  max-width: 420px;
  width: calc(100% - 40px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.system-alert.show {
  opacity: 1;
  visibility: visible;
  
}

.system-alert-content {
  padding: 0;
  padding-right: 2.5rem;
  font-family: 'Geist Pixel', var(--font-sans);
}

.system-alert-content h1 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--welcome-text-primary);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.3;
}

.system-alert-content p {
  font-size: 0.8125rem;
  color: var(--welcome-text-secondary);
  margin: 0;
  line-height: 1.6;
}

.system-alert-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--welcome-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
  border-radius: 0px;
}

.system-alert-close:hover {
  color: var(--welcome-text-primary);
  background: var(--welcome-hover);
}

.system-alert-close svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  .system-alert {
    padding: 1.25rem 1.25rem;
    max-width: calc(100% - 40px);
    bottom: 20px;
    /* Respect safe area on iOS Safari */
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: 20px;
  }
  
  .system-alert-content {
    padding-right: 2rem;
  }

  .system-alert-content h1 {
    font-size: 1rem;
  }

  .system-alert-content p {
    font-size: 0.75rem;
  }
}

/* ==================== */
/* Info Popup           */
/* ==================== */

.info-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  z-index: 1002;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.info-button svg {
  width: 20px;
  height: 20px;
}

.info-button:hover {
  color: var(--text-primary);
  transform: translateY(-1px);
}

.info-popup {
  position: fixed;
  bottom: 68px;
  left: 20px;
  max-width: 320px;
  width: calc(100% - 40px);
  background: var(--bg-secondary);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: 0;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px var(--shadow-color);
  padding: var(--space-md) var(--space-lg);
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.18s ease-out, visibility 0.18s ease-out, transform 0.18s ease-out;
}

.info-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.info-popup-title {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.info-popup-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0 0 0.2rem;
}

.info-popup-content p:last-of-type {
  margin-bottom: 0;
}

.info-label {
  font-weight: 600;
  color: var(--text-primary);
}

.info-popup a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-popup a:hover {
  color: var(--accent-hover);
}

@media (max-width: 768px) {
  .info-button {
    bottom: 16px;
    /* Respect safe area on iOS Safari */
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 16px;
  }

  .info-popup {
    bottom: 64px;
    /* Respect safe area on iOS Safari */
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 16px;
    width: calc(100% - 32px);
  }
}

/* ==================== */
/* Version footer       */
/* (versions link + badge, inline) */
/* ==================== */

.version-footer {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.version-back {
  flex-shrink: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.version-back:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ==================== */
/* App Version Badge    */
/* ==================== */

.app-version {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 0.875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.8;
  cursor: pointer;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.app-version:hover {
  opacity: 1;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .version-footer {
    right: 16px;
    bottom: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ==================== */
/* Changelog Modal       */
/* ==================== */

.changelog-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10003;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.changelog-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.changelog-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.changelog-modal-content {
  position: relative;
  background: var(--bg-secondary);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: 0px;
  box-shadow: 0 16px 48px var(--shadow-color);
  max-width: 600px;
  width: calc(100% - 40px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  z-index: 1;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.changelog-modal[aria-hidden="false"] .changelog-modal-content {
  transform: scale(1);
}

.changelog-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.changelog-modal-title {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.changelog-modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
  border-radius: 0px;
}

.changelog-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.changelog-modal-close svg {
  width: 20px;
  height: 20px;
}

.changelog-modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
  /* Hide scrollbar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.changelog-modal-body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.changelog-version {
  margin-bottom: var(--space-xl);
}

.changelog-version:last-child {
  margin-bottom: 0;
}

.changelog-version-header {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.changelog-version-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog-version-item {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: var(--space-md);
  position: relative;
  margin-bottom: var(--space-xs);
}

.changelog-version-item:last-child {
  margin-bottom: 0;
}

.changelog-version-item::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .changelog-modal-content {
    width: calc(100% - 32px);
    max-height: 85vh;
  }

  .changelog-modal-header {
    padding: var(--space-md);
  }

  .changelog-modal-body {
    padding: var(--space-md);
  }

  .changelog-modal-title {
    font-size: 1rem;
  }
}

/* ==================== */
/* Top Menu Bar         */
/* ==================== */

.top-menu-bar {
  position: fixed;
  top: 20px;
  top: calc(20px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  width: 100%;
  height: 60px; /* Reduced from 52px */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10002;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: top var(--transition-normal), background var(--transition-normal), border-color var(--transition-normal);
}

.top-menu-bar.app-active {
  top: 0;
  top: env(safe-area-inset-top);
  background: var(--bg-primary);
  border-bottom-color: var(--border);
}

.top-menu-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  width: 100%;
}

.menu-left,
.menu-center,
.menu-right {
  display: flex;
  align-items: center;
}

.menu-left {
  gap: var(--space-sm);
  flex-shrink: 0; /* Don't shrink */
  z-index: 1; /* Ensure it appears above centered nav if needed */
  padding-left: 32px; /* Match version stamp positioning */
}

.menu-location {
  font-size: 1rem;
  color: var(--text-muted);
  font-family: 'Geist Pixel', var(--font-sans);
  margin-right: var(--space-xs);
}

.menu-time {
  font-size: 1rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-family: 'Geist Pixel', var(--font-sans);
  white-space: nowrap;
}

.menu-divider {
  color: var(--text-muted);
  font-size: 1rem;
}

.menu-center {
  position: absolute;
  left: 50vw; /* Center relative to viewport */
  transform: translateX(-50%);
  pointer-events: none; /* Allow clicks through to background */
}

.menu-center > * {
  pointer-events: auto; /* Re-enable clicks on children */
}

.menu-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs);
  background: var(--bg-secondary);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: 0px;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px var(--space-sm);
  border-radius: 0px;
  color: var(--text-primary);
  transition: color var(--transition-fast), background var(--transition-fast), gap var(--transition-fast);
  border: none;
  background: transparent;
  cursor: var(--cursor-pointer);
  position: relative;
}

.nav-icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-icon-btn.active {
  color: white;
  background: var(--bg-active);
  gap: 0; /* Remove gap since we're hiding the label */
}

/* Navigation icon backgrounds match titlebar colors */
.nav-icon-btn[data-view="tasks"].active {
  background: #5B9BD5; /* Blue */
}

.nav-icon-btn[data-view="tasks"].active svg,
.nav-icon-btn[data-view="tasks"].active img {
  filter: brightness(0); /* Dark icons on light background */
}

.nav-icon-btn[data-view="notes"].active {
  background: #4DB8A8; /* Teal */
}

.nav-icon-btn[data-view="notes"].active svg,
.nav-icon-btn[data-view="notes"].active img {
  filter: brightness(0); /* Dark icons on light background */
}

.nav-icon-btn[data-view="music"].active {
  background: #9B59B6; /* Purple */
}

.nav-icon-btn[data-view="music"].active svg,
.nav-icon-btn[data-view="music"].active img {
  filter: brightness(0) invert(1); /* White icons on dark background */
}

.nav-icon-btn[data-view="thoughtTrain"].active {
  background: #E89844; /* Orange */
}

.nav-icon-btn[data-view="thoughtTrain"].active svg,
.nav-icon-btn[data-view="thoughtTrain"].active img {
  filter: brightness(0); /* Dark icons on light background */
}

.nav-icon-btn[data-view="labs"].active {
  background: #52C41A; /* Green */
}

.nav-icon-btn[data-view="labs"].active svg,
.nav-icon-btn[data-view="labs"].active img {
  filter: brightness(0); /* Dark icons on light background */
}

.nav-icon-btn[data-view="gallery"].active {
  background: #E91E63; /* Pink */
}

.nav-icon-btn[data-view="gallery"].active svg,
.nav-icon-btn[data-view="gallery"].active img {
  filter: brightness(0) invert(1); /* White icons on dark background */
}

.nav-icon-btn[data-view="guestbook"].active {
  background: #FFA726; /* Amber */
}

.nav-icon-btn[data-view="guestbook"].active svg,
.nav-icon-btn[data-view="guestbook"].active img {
  filter: brightness(0); /* Dark icons on light background */
}

.nav-icon-btn[data-view="library"].active {
  background: #5C6BC0; /* Indigo */
}

.nav-icon-btn[data-view="library"].active svg,
.nav-icon-btn[data-view="library"].active img {
  filter: brightness(0) invert(1); /* White icons on dark background */
}

/* External link indicator */
.nav-icon-btn.external-link .external-icon {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  opacity: 0.7;
  color: white;
}

.nav-icon-btn.external-link:hover .external-icon {
  opacity: 1;
}

.nav-icon-btn svg,
.nav-icon-btn img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.nav-icon-btn.active svg,
.nav-icon-btn.active img {
  filter: brightness(0) invert(1); /* Keep icons white on colored backgrounds */
}

.nav-label {
  display: none; /* Hide labels completely - only show icons */
}

.menu-weather {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1rem;
  color: var(--text-secondary);
  font-family: 'Geist Pixel', var(--font-sans);
}

.weather-icon {
  font-size: 1.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
}

.weather-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  color: inherit;
}

.weather-icon svg path[data-arcade-2="on"] {
  stroke-opacity: 0.25;
}

.weather-icon svg path[data-arcade-3="on"] {
  stroke-opacity: 0;
}

.weather-temp {
  color: var(--text-primary);
}

.menu-right {
  gap: var(--space-sm);
  flex-shrink: 0; /* Don't shrink */
  justify-content: flex-end;
  z-index: 1; /* Ensure it appears above centered nav if needed */
  padding-right: 32px; /* Match version stamp positioning */
}

/* Info icon button in navbar (Desktop only) */
.info-icon-btn {
  display: none; /* Hidden on mobile, shown on desktop */
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: var(--cursor-pointer);
  transition: color var(--transition-fast), background var(--transition-fast);
  border-radius: 0;
}

.info-icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.info-icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Desktop: Hide info icon in navbar, keep at bottom left */
@media (min-width: 769px) {
  .info-icon-btn {
    display: none;
  }

  .info-button {
    display: flex;
  }
}

.follow-btn {
  display: none; /* Hidden - functionality moved to hamburger menu */
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 0px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.follow-btn:hover {
  background: var(--bg-hover);
}

.follow-btn.active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.follow-btn svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.follow-btn.active svg {
  transform: rotate(180deg);
}

/* Hide follow button on wider screens - show social icons directly */
@media (min-width: 769px) {
  .follow-btn {
    display: none;
  }
  
  .social-icons {
    display: flex;
  }
}

.social-icons {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-right: -6px; /* Align rightmost icon edge with version stamp */
}

/* On mobile, hide social icons by default and show them in dropdown */
@media (max-width: 768px) {
  .social-icons {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: 0px;
    box-shadow: 0 8px 24px var(--shadow-color);
    flex-direction: column;
    align-items: stretch;
    min-width: 200px;
    z-index: 1002;
  }

  .social-icons.show {
    display: flex;
  }

  .menu-right {
    position: relative;
  }
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0px;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
  gap: var(--space-xs);
}

.social-icon:hover {
  color: var(--social-hover-fg);
  background: var(--social-hover-bg);
}

.social-icon:hover .social-label {
  color: var(--social-hover-fg);
}

.social-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.social-label {
  display: none;
  margin-left: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}


/* Hamburger Menu Button */
.hamburger-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0px;
  color: var(--text-primary);
  transition: color var(--transition-fast), background var(--transition-fast);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 10001;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-menu-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.hamburger-menu-btn.active {
  color: var(--accent);
  background: var(--bg-active);
}

.hamburger-menu-btn svg {
  width: 26px;
  height: 26px;
  color: var(--text-primary);
}

/* Mobile Header Menu Dropdown */
.mobile-header-menu {
  display: none;
  position: fixed;
  top: calc(84px + env(safe-area-inset-top)); /* 64px menubar + 20px offset */
  right: 20px;
  max-width: 280px;
  width: calc(100% - 40px);
  background: rgba(36, 36, 36, 0.98);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: 0px;
  box-shadow: 0 16px 48px var(--shadow-color);
  z-index: 10000 !important;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

/* When app is active/docked, adjust for no offset */
.top-menu-bar.app-active ~ .mobile-header-menu,
body.app-active .mobile-header-menu {
  top: calc(64px + env(safe-area-inset-top)); /* No 20px offset when docked */
}

.mobile-header-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-header-menu-content {
  padding: var(--space-md);
  max-height: calc(100vh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-apps {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.mobile-menu-app-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 0px;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-app-btn:hover {
  background: var(--bg-hover);
}

.mobile-menu-app-btn.active {
  background: var(--bg-active);
  color: white;
}

/* Mobile menu buttons match titlebar colors */
.mobile-menu-app-btn[data-view="tasks"].active {
  background: #5B9BD5; /* Blue */
  color: rgba(0, 0, 0, 0.87); /* Dark text on light background */
}

.mobile-menu-app-btn[data-view="tasks"].active svg {
  filter: brightness(0); /* Dark icons on light background */
}

.mobile-menu-app-btn[data-view="notes"].active {
  background: #4DB8A8; /* Teal */
  color: rgba(0, 0, 0, 0.87); /* Dark text on light background */
}

.mobile-menu-app-btn[data-view="notes"].active svg {
  filter: brightness(0); /* Dark icons on light background */
}

.mobile-menu-app-btn[data-view="music"].active {
  background: #9B59B6; /* Purple */
  color: white; /* White text on dark background */
}

.mobile-menu-app-btn[data-view="music"].active svg {
  filter: brightness(0) invert(1); /* White icons on dark background */
}

.mobile-menu-app-btn[data-view="thoughtTrain"].active {
  background: #E89844; /* Orange */
  color: rgba(0, 0, 0, 0.87); /* Dark text on light background */
}

.mobile-menu-app-btn[data-view="thoughtTrain"].active svg {
  filter: brightness(0); /* Dark icons on light background */
}

.mobile-menu-app-btn[data-view="labs"].active {
  background: #52C41A; /* Green */
  color: rgba(0, 0, 0, 0.87); /* Dark text on light background */
}

.mobile-menu-app-btn[data-view="labs"].active svg {
  filter: brightness(0); /* Dark icons on light background */
}

.mobile-menu-app-btn[data-view="gallery"].active {
  background: #E91E63; /* Pink */
  color: white; /* White text on dark background */
}

.mobile-menu-app-btn[data-view="gallery"].active svg {
  filter: brightness(0) invert(1); /* White icons on dark background */
}

.mobile-menu-app-btn[data-view="guestbook"].active {
  background: #FFA726; /* Amber */
  color: rgba(0, 0, 0, 0.87); /* Dark text on light background */
}

.mobile-menu-app-btn[data-view="guestbook"].active svg {
  filter: brightness(0); /* Dark icons on light background */
}

.mobile-menu-app-btn[data-view="library"].active {
  background: #5C6BC0; /* Indigo */
  color: white; /* White text on dark background */
}

.mobile-menu-app-btn[data-view="library"].active svg {
  filter: brightness(0) invert(1); /* White icons on dark background */
}

.mobile-menu-app-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.mobile-menu-app-btn.active svg {
  filter: brightness(0) invert(1); /* Keep icons white on colored backgrounds */
}

.mobile-menu-app-btn span {
  flex: 1;
}

.mobile-menu-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.mobile-menu-social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0px;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.mobile-menu-social-icon:hover {
  color: var(--social-hover-fg);
  background: var(--social-hover-bg);
}

.mobile-menu-social-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Mobile adjustments for top menu bar */
@media (max-width: 768px) {
  .top-menu-bar {
    padding: 0;
    gap: var(--space-sm);
    z-index: 10002 !important;
  }

  .menu-left {
    min-width: auto;
    padding-left: 16px; /* Match version stamp positioning on mobile */
  }

  .menu-right {
    padding-right: 16px; /* Match version stamp positioning on mobile */
  }

  .menu-time {
    font-size: 0.75rem;
  }

  .menu-weather {
    font-size: 0.75rem;
  }

  .social-icon {
    width: 100%;
    height: auto;
    padding: var(--space-sm);
    justify-content: flex-start;
    gap: var(--space-sm);
    border-radius: 0px;
  }

  .social-icon svg {
    width: 18px;
    height: 18px;
  }

  .social-label {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--text-primary);
  }

  /* Hide desktop nav, show hamburger on mobile */
  .menu-nav {
    display: none;
  }

  .hamburger-menu-btn {
    display: flex;
  }

  .mobile-header-menu {
    display: block;
  }

  /* Hide view mode toggle on mobile */
  .view-mode-toggle {
    display: none;
  }
}

/* CSS Custom Properties */
:root {
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Sizing */
  --sidebar-width: 220px;
  --post-list-width: 300px;

  /* Touch targets for mobile */
  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  /* Typography */
  --font-sans: 'Segoe UI', 'Segoe UI Variable Text', 'Segoe UI Variable', sans-serif;
  --font-mono: 'Segoe UI Mono', 'Segoe UI', monospace;
  --cursor-default: url('images/cursor-arcade.svg') 15 15, auto;
  --cursor-pointer: url('images/cursor-arcade-pointer.svg') 15 15, pointer;

  --social-hover-bg: #111111;
  --social-hover-fg: #ffffff;

  /* Effects */
  --glass-blur: 32px;
  --shell-radius: 16px;

  /* Background image - JS will override with cache-busted version */
  --bg-fill: #06080c;
  --bg-image: url('images/dark.jpg');
  --stars-color: rgba(255, 255, 255, 0.85);

  /* Colors - WCAG AA compliant contrast ratios */
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2d2d2d;
  --bg-hover: #363636;
  --bg-active: #404040;

  --bg-primary-solid: #1a1a1a;
  --bg-secondary-solid: #242424;
  --bg-tertiary-solid: #2d2d2d;

  --text-primary: #f5f5f5;
  --text-secondary: #b3b3b3;
  --text-muted: #808080;

  /* Accent: neutral gray palette (dark mode defaults) */
  --accent: #9CA3AF;
  --accent-hover: #D1D5DB;
  --text-on-accent: #111827;

  --border: rgba(61, 61, 61, 0.7);
  --border-light: rgba(74, 74, 74, 0.7);

  --shadow-color: rgba(0, 0, 0, 0.4);
  --overlay-bg: rgba(0, 0, 0, 0.5);

  /* Welcome/landing message is shown over the dark space background */
  --welcome-surface: rgba(26, 26, 26, 0.92);
  --welcome-border: rgba(255, 255, 255, 0.12);
  --welcome-shadow: rgba(0, 0, 0, 0.55);
  --welcome-text-primary: #f5f5f5;
  --welcome-text-secondary: #b3b3b3;
  --welcome-hover: rgba(255, 255, 255, 0.08);

  /* Gallery polaroid cards - lighter than bg-fill for dark mode */
  --card-bg: #1a1a1a;
  --image-bg: #242424;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* Prevent horizontal scroll globally */
  /* Fix iOS Safari height issues */
  height: 100%;
  height: -webkit-fill-available;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-fill);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari */
  height: 100vh;
  overflow: hidden; /* Prevent body scroll - only windows scroll */
  cursor: var(--cursor-default);
  position: relative;
  /* Extend background behind iOS Safari bottom bar */
  padding-bottom: env(safe-area-inset-bottom);
}

/* Animated background canvas */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Extend into safe areas on iOS */
  height: calc(100% + env(safe-area-inset-bottom));
  z-index: -2;
  pointer-events: none;
}

/* Stars are now rendered in the canvas background (background.js) */

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
}

a {
  cursor: var(--cursor-pointer);
}

ul {
  list-style: none;
}

/* App Layout */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) var(--post-list-width) 1fr;
  grid-template-rows: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* View Mode States */
.notes-view.view-mode-three-column .app {
  grid-template-columns: var(--sidebar-width) var(--post-list-width) 1fr;
}

.notes-view.view-mode-three-column .sidebar,
.notes-view.view-mode-three-column .post-list,
.notes-view.view-mode-three-column .note-view {
  display: flex;
}

.notes-view.view-mode-two-column .app {
  grid-template-columns: var(--post-list-width) 1fr;
}

.notes-view.view-mode-two-column .sidebar {
  display: none;
}

.notes-view.view-mode-two-column .post-list,
.notes-view.view-mode-two-column .note-view {
  display: flex;
}

.notes-view.view-mode-one-column .app {
  grid-template-columns: 1fr;
}

.notes-view.view-mode-one-column .sidebar,
.notes-view.view-mode-one-column .post-list {
  display: none;
}

.notes-view.view-mode-one-column .note-view {
  display: flex;
}

/* Sidebar */
.sidebar {
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.tag-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.notes-view .tag-list,
.notes-view .posts,
.notes-view .note-view {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge Legacy */
}

.notes-view .tag-list::-webkit-scrollbar,
.notes-view .posts::-webkit-scrollbar,
.notes-view .note-view::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none; /* Safari/Chrome */
}

.tag-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 6px;
  color: var(--text-secondary);
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast), transform 0.05s ease-out;
}

.tag-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tag-item.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

/* Mobile: Better touch targets and readability */
@media (max-width: 768px) {
  .tag-item {
    min-height: var(--touch-target-min); /* 44px minimum */
    color: var(--text-primary); /* Better contrast */
    padding: var(--space-sm) var(--space-md);
    -webkit-tap-highlight-color: transparent;
  }

  .tag-item:active {
    background: var(--bg-active);
    transform: scale(0.98);
  }
}

.tag-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tag-item span {
  flex: 1;
}

.tag-item .tag-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Nested Tag Tree */
.tag-tree-item {
  display: flex;
  flex-direction: column;
}

.tag-item-row {
  display: flex;
  align-items: center;
}

.tag-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 0;
  border-radius: 4px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.tag-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tag-toggle .icon-toggle {
  width: 12px;
  height: 12px;
  transition: transform var(--transition-fast);
}

.tag-toggle.expanded .icon-toggle {
  transform: rotate(90deg);
}

/* Mobile: Larger touch targets for toggle buttons */
@media (max-width: 768px) {
  .tag-toggle {
    min-width: var(--touch-target-min); /* 44px */
    min-height: var(--touch-target-min);
    margin-left: calc((var(--touch-target-min) - 18px) / -2); /* Negative margin to prevent layout shift */
    -webkit-tap-highlight-color: transparent;
  }

  .tag-toggle:active {
    background: var(--bg-active);
    color: var(--accent);
  }
}

.tag-toggle-spacer {
  width: 18px;
  margin-left: 0;
  flex-shrink: 0;
}

.tag-item.nested {
  padding-left: var(--space-xs);
}

.tag-children {
  margin-left: var(--space-md);
  border-left: 1px solid var(--border);
  padding-left: var(--space-xs);
  overflow: hidden;
  transition: max-height var(--transition-normal), opacity var(--transition-normal);
}

.tag-children.collapsed {
  display: none;
}

/* Post List */
.post-list {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.posts {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.post-item {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast);
}

.post-item:hover {
  background: var(--bg-hover);
}

.post-item.active {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--space-lg) - 3px);
}

.post-item-title {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-item-excerpt {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Note View */
.note-view {
  background: var(--bg-secondary);
  overflow-y: auto;
  position: relative;
  min-height: 0;
}

.note-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: var(--space-md);
}

.icon-large {
  width: 64px;
  height: 64px;
  opacity: 0.5;
}

.note-content {
  padding: var(--space-xl) var(--space-lg) 4rem;
  max-width: 720px;
  margin: 0 auto;
  animation: fadeIn var(--transition-normal);
}

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

.note-header {
  margin-bottom: var(--space-xl);
}

.note-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.note-meta time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.note-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.note-tag {
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-active);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.note-tag:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Note Body Typography */
.note-body {
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.note-body h1,
.note-body h2,
.note-body h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.note-body h1 { font-size: 1.5rem; }
.note-body h2 { font-size: 1.25rem; }
.note-body h3 { font-size: 1.125rem; }

.note-body p {
  margin-bottom: var(--space-md);
}

.note-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

.note-body a:hover {
  color: var(--accent-hover);
}

.note-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.125em 0.375em;
  background: var(--bg-active);
  border-radius: 4px;
}

.note-body pre {
  background: var(--bg-primary);
  padding: var(--space-md);
  border-radius: 8px;
  overflow-x: auto;
  margin: var(--space-md) 0;
  max-width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
}

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

.note-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.note-body ul,
.note-body ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.note-body li {
  margin-bottom: var(--space-xs);
}

.note-body ul li {
  list-style: disc;
}

.note-body ol li {
  list-style: decimal;
}

/* Checkboxes in markdown */
.note-body li.task-item {
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.note-body li.task-item input[type="checkbox"] {
  margin-top: 0.3em;
  flex-shrink: 0;
  cursor: not-allowed;
}

.note-body li.task-item.completed {
  opacity: 0.6;
}

.note-body li.task-item.completed > span:last-child {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Iframes (YouTube embeds, etc.) */
.note-body iframe {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  margin: var(--space-md) 0;
  display: block;
  border: none;
}

.note-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: var(--space-md) 0;
  display: block;
}

.note-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 1100; /* Above everything else for easy mobile access */
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.mobile-menu-toggle:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--text-on-accent);
}

/* Responsive Design */
@media (max-width: 1024px) {
  /* Force 2-column layout at tablet: sidebar + post-list */
  .notes-view .app {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  /* Override view-mode classes at tablet - always show sidebar + post-list */
  .notes-view.view-mode-three-column .app,
  .notes-view.view-mode-two-column .app,
  .notes-view.view-mode-one-column .app {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  /* Ensure sidebar and post-list are always visible at tablet */
  .notes-view .sidebar,
  .notes-view .post-list {
    display: flex !important;
  }

  /* Ensure post-list fills available space and scrolls */
  .notes-view .post-list {
    min-height: 0;
    overflow: hidden;
  }

  .notes-view .posts {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide view mode toggle on tablet - layout is fixed */
  .notes-view .view-mode-toggle {
    display: none;
  }

  /* Note view is hidden by default, shown as overlay when active */
  .notes-view .note-view {
    display: none !important;
  }

  .notes-view .note-view.active {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 64px; /* Account for top menu bar */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    background: var(--bg-primary-solid);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* Sidebar overlay and sidebar z-index for tablet */
  .sidebar.open {
    z-index: 1100;
  }

  .sidebar-overlay.active {
    z-index: 1099;
  }

  .note-content {
    padding-top: var(--space-xl);
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  /* Notes view app layout - single column on mobile */
  .notes-view .app {
    display: flex;
    flex-direction: column;
  }

  .notes-view .post-list {
    flex: 1;
    border-right: none;
    min-height: 0;
    overflow-y: auto;
  }

  .notes-view .note-view {
    display: none;
  }

  .notes-view .note-view.active {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px; /* Mobile menubar height (view mode toggle is hidden) */
    top: calc(64px + env(safe-area-inset-top)); /* Add safe area */
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary-solid);
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom); /* Prevent bottom cutoff */
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 64px; /* Mobile menubar height */
    top: calc(64px + env(safe-area-inset-top)); /* Add safe area */
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 999; /* Below top menu bar (1001) */
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    padding-bottom: env(safe-area-inset-bottom); /* Prevent bottom cutoff */
  }

  .sidebar.open {
    transform: translateX(0);
    z-index: 1100; /* Above note-view overlay (1050) */
  }

  .mobile-menu-toggle {
    display: flex;
    /* Respect safe area on iOS Safari */
    bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
  }

  /* Ensure mobile menu toggle is visible when notes view is active */
  .notes-view.active .mobile-menu-toggle {
    display: flex;
  }

  .post-item {
    padding: var(--space-md);
  }

  /* Overlay when sidebar is open - covers area to the right of sidebar */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: var(--sidebar-width); /* Start after sidebar */
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    z-index: 1099; /* Above note-view (1050), sidebar handles its own z-index */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

/* Back button for mobile note view */
.note-back {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  color: var(--accent);
  font-weight: 500;
  border: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-primary-solid);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  width: 100%;
  text-align: left;
  font-size: 0.9375rem;
  position: sticky;
  top: 0;
  z-index: 120;
  -webkit-tap-highlight-color: transparent;
}

.note-back:hover {
  background: var(--bg-hover);
}

.note-back:active {
  background: var(--bg-active);
  color: var(--accent-hover);
}

.note-back svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 1024px) {
  .note-back {
    display: flex;
  }
}

/* Mac OS 9 Scrollbar styling - Dark Mode (default) */
::-webkit-scrollbar {
  width: 20px;
  height: 20px;
}

::-webkit-scrollbar-track {
  background: #3a3a3a;
  border: 1px solid #555;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #505050 0%, #3a3a3a 50%, #505050 100%);
  border: 1px solid #555;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #5a5a5a 0%, #454545 50%, #5a5a5a 100%);
}

::-webkit-scrollbar-button {
  background: linear-gradient(180deg, #505050 0%, #3a3a3a 100%);
  border: 1px solid #555;
  height: 16px;
  width: 16px;
  display: block;
}

::-webkit-scrollbar-button:hover {
  background: linear-gradient(180deg, #5a5a5a 0%, #454545 100%);
}

::-webkit-scrollbar-button:vertical:decrement {
  border-bottom: 1px solid #666;
}

::-webkit-scrollbar-button:vertical:increment {
  border-top: 1px solid #666;
}

::-webkit-scrollbar-button:horizontal:decrement {
  border-right: 1px solid #666;
}

::-webkit-scrollbar-button:horizontal:increment {
  border-left: 1px solid #666;
}

/* Firefox scrollbar - Dark Mode */
* {
  scrollbar-width: auto;
  scrollbar-color: #3a3a3a #2a2a2a;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  height: 200px;
}

.empty-state .icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* ==================== */
/* View Fade Transition  */
/* ==================== */

/* Simple fade transition for views - works well on mobile */
.view {
  opacity: 0;
  transition: opacity 200ms ease-out;
  pointer-events: none;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== */
/* Views & Navigation   */
/* ==================== */

/* View containers - Full-screen app views */
.view {
  display: none;
  position: fixed;
  top: 60px; /* Start after menubar (40px height when app is active) */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 20px var(--space-lg) 0 var(--space-lg); /* 20px top spacing, horizontal padding, no bottom */
  background: var(--bg-fill); /* Stays dark to show space background */
  overflow: hidden;
  pointer-events: none;
}

.view.active {
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

/* All view children (e.g., .tasks-view, .gallery-view) should fill available space */
.view.active > * {
  flex: 1;
  min-height: 0; /* Allow flex children to shrink below content size */
}

/* Content container with max-width */
.view-content {
  max-width: 1170px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-lg);
  height: 100%;
  overflow-y: auto;
}

/* ==================== */
/* Mac OS 9 Window Chrome */
/* ==================== */

/* Animated gradient border */
@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotateGradient {
  to {
    --gradient-angle: 360deg;
  }
}

.os9-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 1200px; /* Default, overridden per-app below */
  margin: 0 auto; /* Center horizontally, no top margin - windows rise from header */
  background: var(--bg-primary);
  border-radius: 0; /* Flat, no rounded corners */
  overflow: hidden;
  position: relative;

  /* Animated gradient border using pseudo-element */
  border: 1px solid transparent;
  border-bottom: none; /* Remove bottom border to extend off page */
  background:
    linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
    conic-gradient(
      from var(--gradient-angle) at 50% 50%,
      rgba(255, 255, 255, 0.1),
      rgba(255, 255, 255, 0.6),
      rgba(255, 255, 255, 0.9),
      rgba(255, 255, 255, 0.6),
      rgba(255, 255, 255, 0.1)
    ) border-box;

  animation: rotateGradient 8s linear infinite;
}

/* Per-app max-widths based on content needs */
.tasks-view .os9-window { max-width: 700px; }
.notes-view .os9-window { max-width: 1200px; }
.music-view .os9-window { max-width: 700px; }
.life-stories-view .os9-window { max-width: 900px; }
.thought-train-view .os9-window { max-width: 800px; }
.labs-view .os9-window { max-width: 1000px; }
.gallery-view .os9-window { max-width: 1400px; }
.guestbook-view .os9-window { max-width: 900px; }

.os9-titlebar {
  background: #3a3a3c; /* Default flat color */
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

/* Unique flat colors for each app */
.tasks-view .os9-titlebar {
  background: #5B9BD5; /* Blue */
}

.tasks-view .os9-title {
  color: rgba(0, 0, 0, 0.87); /* Dark text for light background */
  text-shadow: none;
}

.notes-view .os9-titlebar {
  background: #4DB8A8; /* Teal */
}

.notes-view .os9-title {
  color: rgba(0, 0, 0, 0.87); /* Dark text for light background */
  text-shadow: none;
}

.music-view .os9-titlebar {
  background: #9B59B6; /* Purple */
}

.music-view .os9-title {
  color: white; /* White text for dark background */
}

.thought-train-view .os9-titlebar {
  background: #E89844; /* Orange */
}

.thought-train-view .os9-title {
  color: rgba(0, 0, 0, 0.87); /* Dark text for light background */
  text-shadow: none;
}

.labs-view .os9-titlebar {
  background: #52C41A; /* Green */
}

.labs-view .os9-title {
  color: rgba(0, 0, 0, 0.87); /* Dark text for light background */
  text-shadow: none;
}

.gallery-view .os9-titlebar {
  background: #E91E63; /* Pink */
}

.gallery-view .os9-title {
  color: white; /* White text for dark background */
}

.guestbook-view .os9-titlebar {
  background: #FFA726; /* Amber */
}

.guestbook-view .os9-title {
  color: rgba(0, 0, 0, 0.87); /* Dark text for light background */
  text-shadow: none;
}

.library-view .os9-titlebar {
  background: #5C6BC0; /* Indigo */
}

.library-view .os9-title {
  color: white; /* White text for dark background */
}

.life-stories-view .os9-titlebar {
  background: #E74C3C; /* Red */
}

.life-stories-view .os9-title {
  color: white; /* White text for medium-dark background */
}

.project-shredder-view .os9-titlebar {
  background: #95A5A6; /* Gray */
}

.project-shredder-view .os9-title {
  color: rgba(0, 0, 0, 0.87); /* Dark text for light background */
  text-shadow: none;
}

.os9-titlebar-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  z-index: 1;
}

.os9-title {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 0.875rem; /* Increased from 0.75rem */
  font-weight: 900; /* Increased from 700 to make it bolder */
  color: white; /* White text on colored titlebar backgrounds */
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
}

/* Titlebar with integrated toolbar (for Notes view) */
.os9-titlebar-with-toolbar {
  height: 40px;
  flex-direction: row;
  padding: 0;
}

.os9-titlebar-with-toolbar .os9-titlebar-content {
  position: absolute;
  left: 0;
  right: 0;
  height: 40px;
  justify-content: center;
  pointer-events: none; /* Allow clicks to pass through to buttons */
}

.os9-titlebar-with-toolbar .view-mode-toggle {
  background: transparent;
  border: none;
  padding: 0 var(--space-sm);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.os9-window-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
  min-height: 0;
}

/* Mobile adjustments for OS9 chrome */
@media (max-width: 768px) {
  .os9-window {
    border-radius: 0;
    border-left: none;
    border-right: none;
    max-width: 100%;
  }

  .os9-titlebar {
    height: 20px;
  }

  .os9-title {
    font-size: 0.6875rem;
  }
}

/* Tasks View - Elegant Table Layout */
.tasks-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Inherits padding from .view */
}

.tasks-view .os9-window-body {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tasks Year Tabs Header */
.tasks-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
}

.tasks-year-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 0px;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
  border: none;
  background: transparent;
  cursor: var(--cursor-pointer);
  font-family: inherit;
  white-space: nowrap;
}

.tasks-year-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tasks-year-btn.active {
  color: var(--text-primary);
  background: var(--bg-active);
}

/* Loading squares animation for 2026 */
.loading-squares {
  display: flex;
  gap: 3px;
  margin-left: 8px;
}

.loading-square {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  opacity: 0.3;
  animation: fillSquare 2.4s ease-in-out infinite;
}

.loading-square:nth-child(1) { animation-delay: 0s; }
.loading-square:nth-child(2) { animation-delay: 0.3s; }
.loading-square:nth-child(3) { animation-delay: 0.6s; }
.loading-square:nth-child(4) { animation-delay: 0.9s; }
.loading-square:nth-child(5) { animation-delay: 1.2s; }
.loading-square:nth-child(6) { animation-delay: 1.5s; }
.loading-square:nth-child(7) { animation-delay: 1.8s; }
.loading-square:nth-child(8) { animation-delay: 2.1s; }

@keyframes fillSquare {
  0%, 100% {
    opacity: 0.3;
  }
  12.5% {
    opacity: 1;
  }
  25%, 100% {
    opacity: 0.3;
  }
}

/* Loading state for future years */
.tasks-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 20px;
}

.tasks-loading-state .loading-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

.tasks-view .tasks-container {
  width: 100%;
  margin: 0;
  padding: var(--space-xl);
  padding-top: var(--space-xl);
  background: var(--bg-primary);
  flex: 1;
  overflow-y: auto;
}

/* Notes View - Full-screen with 3-pane layout */
.notes-view {
  /* Don't use position absolute - inherit from .view container */
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.notes-view .view-mode-toggle {
  width: 100%;
  margin: 0;
  background: transparent;
  flex-shrink: 0;
  /* border-top: 1px solid rgba(0, 0, 0, 0.1); */
}

.notes-view .app {
  flex: 1;
  min-height: 0;
  max-width: 1170px;
  width: 100%;
  margin: 0 auto;
  height: 100%; /* Ensure grid fills flex space */
}

/* View Mode Toggle */
.view-mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.view-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0px;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
  padding: 0;
  border: none;
  background: transparent;
  cursor: var(--cursor-pointer);
}

.view-mode-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.view-mode-btn.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.view-mode-btn svg {
  width: 16px;
  height: 16px;
}

/* Hide view mode toggle on mobile - must come after base definition */
@media (max-width: 768px) {
  .view-mode-toggle {
    display: none !important;
  }
}

/* Section container */
.tasks-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

/* Section Header - Table header row */
.tasks-section-header {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--space-md);
  align-items: baseline;
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-sm);
  margin-top: var(--space-xl);
}

.tasks-section-header:first-child {
  margin-top: 0;
}

.tasks-section-header-number {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
}

.tasks-section-header-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0;
}

.tasks-section-header-status {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
  padding-right: 8px;
}

/* Tasks list container */
.tasks-list {
  display: flex;
  flex-direction: column;
}

/* Individual task row */
.task-item {
  display: grid;
  grid-template-columns: 48px 1fr 40px;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(61, 61, 61, 0.5);
  background: transparent;
  transition: background-color 0.15s ease;
}

.task-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Row number column */
.task-row-number {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
}

/* Task text column */
.task-text {
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.5;
}

.task-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.task-text a:hover {
  color: var(--accent-hover);
}

/* Status indicator column - Circular checkmarks */
.task-status-indicator {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  transition: all 0.2s ease;
}

/* Completed state - filled circle with checkmark */
.task-status-indicator.completed {
  background: var(--accent);
  border-color: var(--accent);
}

.task-status-indicator.completed::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--text-on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

/* Pending/unchecked state - empty circle */
.task-status-indicator.pending {
  background: transparent;
  border-color: var(--border-light);
}

/* Active/in-progress state - subtle glow */
.task-status-indicator.active {
  background: transparent;
  border-color: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.task-status-indicator.active::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
}

/* Completed task row styling */
.task-item.completed {
  opacity: 0.7;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  color: var(--text-muted);
}

.task-item.completed .task-row-number {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Habit items with progress bars */
.habit-item {
  grid-template-columns: 48px 1fr 200px !important;
}

.habit-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-self: end;
}

.habit-progress-bar {
  width: 120px;
  height: 20px;
  background: #1a1a1a;
  border: 2px solid #444;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.habit-progress-fill {
  height: 100%;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 50%, #16a34a 100%);
  transition: width 0.3s ease;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 8px rgba(74, 222, 128, 0.4);
}

.habit-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  pointer-events: none;
}

.habit-progress-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

/* Mobile adjustments for tasks */
@media (max-width: 768px) {
  .tasks-view {
    padding: var(--space-md);
  }

  .tasks-view .tasks-container {
    padding: var(--space-lg) var(--space-md);
    padding-top: 48px;
  }

  .task-item {
    grid-template-columns: 36px 1fr 32px;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
  }

  .task-row-number {
    font-size: 0.875rem;
  }

  .task-text {
    font-size: 1rem;
  }

  .task-status-indicator {
    width: 20px;
    height: 20px;
  }

  .tasks-section-header {
    grid-template-columns: 36px 1fr auto;
    gap: var(--space-sm);
  }

  .tasks-section-header-title {
    font-size: 0.8125rem;
  }

  .habit-item {
    grid-template-columns: 36px 1fr !important;
    gap: var(--space-sm);
  }

  .habit-progress {
    grid-column: 2 / -1;
    margin-top: var(--space-xs);
    justify-self: start;
  }

  .habit-progress-bar {
    width: 100px;
    height: 18px;
  }

  .habit-progress-text {
    font-size: 0.8125rem;
    min-width: 50px;
  }
}

/* General Mobile adjustments */
@media (max-width: 768px) {

  /* Full-screen views adjust for mobile header */
  .view {
    top: 64px; /* Start after header on mobile */
    top: calc(64px + env(safe-area-inset-top)); /* Add safe area */
    /* padding inherited from base .view - 20px top, var(--space-lg) horizontal */
  }

  .menu-nav {
    gap: var(--space-xs);
  }

  .nav-icon-btn {
    height: 36px;
    padding: 0 var(--space-xs);
  }

  .nav-icon-btn svg,
  .nav-icon-btn img {
    width: 24px;
    height: 24px;
  }

  /* Hide nav labels on mobile */
  .nav-label {
    display: none;
  }

  .menu-left {
    min-width: auto;
  }

  /* Global Touch UX Improvements */

  /* Prevent double-tap zoom on buttons */
  button {
    touch-action: manipulation;
  }

  /* Active state feedback for all interactive elements */
  button:not(:disabled):active,
  .clickable:active,
  .post-item:active,
  .nav-icon-btn:active,
  .mobile-menu-app-btn:active {
    transform: scale(0.97);
    transition: transform 0.05s ease-out;
  }

  /* Allow vertical scrolling in scrollable containers */
  .sidebar,
  .post-list,
  .note-view,
  .zen-playlist,
  .tasks-container {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  /* Better tap highlighting */
  a,
  button,
  .clickable {
    -webkit-tap-highlight-color: transparent;
  }
}


/* ==================== */
/* Music View           */
/* ==================== */

.music-view {
  padding-left: 0; /* Music window goes edge to edge */
  padding-right: 0;
}

.music-view .os9-window-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Zen Layout - Side by Side */
.zen-layout {
  display: grid;
  grid-template-columns: 320px 380px;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
  height: 100%;
}

/* Sidebar Container */
.zen-sidebar {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  align-self: stretch;
  box-shadow: none;
}

.zen-sidebar-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.zen-sidebar-title {
  font-family: var(--zen-font-display);
  font-size: 0.875rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 0;
  font-weight: 700;
}

/* Folder List (vertical) */
.zen-folder-list {
  display: flex;
  flex-direction: column;
  padding: var(--space-xs) 0;
}

.zen-folder-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  cursor: var(--cursor-pointer);
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  font-family: var(--zen-font-body);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.zen-folder-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.zen-folder-item.active {
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
  color: var(--accent);
}

.zen-folder-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.zen-folder-name {
  flex: 1 1 0;
  min-width: 0;
  text-transform: capitalize;
  letter-spacing: 0.05em;
}

.zen-folder-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 8px;
  min-width: 20px;
  text-align: center;
}

/* Playlist inside sidebar */
.zen-playlist {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.zen-playlist:empty {
  display: none;
}

/* Device Container */
.zen-device-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 100%;
  align-self: stretch;
  padding-bottom: var(--space-lg);
}

/* The Physical Device */
.zen-device {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(145deg, #2a2a2c 0%, #1a1a1c 50%, #0d0d0e 100%);
  border-radius: 0;
  padding: 24px;
  box-shadow: none;
  position: relative;
}

.zen-device::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  border-radius: 0;
}

/* LCD Screen */
.zen-screen {
  background: var(--zen-screen-bg);
  border: 2px solid var(--zen-border);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.5),
    inset 0 0 20px var(--zen-screen-glow);
}

.zen-screen-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.05) 0px,
    rgba(0,0,0,0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 10;
}

.zen-screen-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Track Info in Screen */
.zen-track-title {
  font-family: var(--zen-font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--zen-lcd-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.zen-track-artist {
  font-family: var(--zen-font-body);
  font-size: 0.6875rem;
  color: var(--zen-lcd-dim);
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Artwork in Screen */
.zen-artwork {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--zen-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.zen-artwork svg {
  width: 24px;
  height: 24px;
  color: var(--zen-lcd-muted);
  opacity: 0.6;
}

.zen-artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(0.95) brightness(0.9);
}

.zen-artwork.is-video {
  background: #000;
}

.zen-artwork iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Progress in Screen */
.zen-progress {
  margin-top: var(--space-xs);
}

.zen-progress-bar {
  height: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 0;
  cursor: var(--cursor-pointer);
  overflow: hidden;
}

.zen-progress-fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    #9CA3AF 0px,
    #9CA3AF 3px,
    #6B7280 3px,
    #6B7280 6px
  );
  width: 0%;
  transition: width 0.15s linear;
}

.zen-progress-time {
  display: flex;
  justify-content: space-between;
  font-family: var(--zen-font-body);
  font-size: 0.5625rem;
  color: var(--zen-lcd-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Mosaic Button Grid */
.zen-mosaic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 6px;
  background: linear-gradient(145deg, #0a0a0a 0%, #151515 100%);
  border-radius: 6px;
  margin-bottom: 12px;
}

/* Base Button Style */
.zen-btn {
  aspect-ratio: 1.2; /* Wider than tall for compact fit */
  border: none;
  border-radius: 3px;
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 2px 0 rgba(0,0,0,0.4);
  min-height: 48px;
}

.zen-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 3px 0 rgba(0,0,0,0.4),
    0 4px 8px rgba(0,0,0,0.3);
}

.zen-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.5);
}

.zen-btn svg {
  width: 20px;
  height: 20px;
  color: #2a2a2a; /* Dark gray for readability on grayscale buttons */
}

.zen-btn:hover svg {
  color: #1a1a1a;
}

/* Individual Button Colors - Mosaic Pattern (neutral grayscale like real Zen Mosaic) */
.zen-btn-back { background: #4a4a4a; }
.zen-btn-up { background: #8a8a8a; }
.zen-btn-menu { background: #3a3a3a; }
.zen-btn-left { background: #6a6a6a; }
.zen-btn-select {
  background: linear-gradient(135deg, #b0b0b0 0%, #909090 100%);
}
.zen-btn-select svg { color: #2a2a2a; }
.zen-btn-right { background: #5a5a5a; }
.zen-btn-shuffle { background: #3a3a3a; }
.zen-btn-down { background: #7a7a7a; }
.zen-btn-repeat { background: #5a5a5a; }

/* Active states for shuffle/repeat */
.zen-btn-shuffle.active,
.zen-btn-repeat.active {
  background: #a0a0a0;
}

.zen-btn-shuffle.active svg,
.zen-btn-repeat.active svg {
  color: #2a2a2a;
}

/* ZEN Branding */
.zen-branding {
  text-align: center;
  padding: 8px 0 4px;
}

.zen-logo {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--zen-lcd-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.music-playlist {
  width: 100%;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-primary);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
  max-height: 420px;
  min-height: 220px;
}

.playlist-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: 0 var(--space-xl) var(--space-sm);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
}

.filter-btn {
  padding: var(--space-xs) var(--space-md);
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: transparent;
}

.playlist-items {
  overflow: hidden;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border);
}

.playlist-item:hover {
  background: var(--bg-hover);
}

.playlist-item.active {
  background: var(--bg-tertiary);
}

.playlist-item.playing {
  color: var(--accent);
}

.playlist-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--bg-secondary);
  overflow: hidden;
  flex-shrink: 0;
}

.playlist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.playlist-info {
  flex: 1;
  min-width: 0;
}

.playlist-title {
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-artist {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.playlist-duration {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.playlist-channel {
  text-decoration: none;
  color: inherit;
}

.playlist-external {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.playlist-channel:hover .playlist-external {
  color: var(--accent);
}

.playlist-thumb svg {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

/* Hide thumbnail for local audio tracks */
.playlist-item.no-thumb .playlist-thumb {
  display: none;
}

/* Hide player controls when folder only has channels */
.music-container.channels-only .player-controls,
.music-container.channels-only .player-progress,
.music-container.channels-only .music-artwork {
  display: none;
}

.music-container.channels-only .music-player {
  flex: 0 0 auto;
}

.music-container.channels-only .player-info {
  text-align: center;
}

.playlist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  gap: var(--space-md);
}

.playlist-empty code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border-radius: 4px;
}

/* Mobile adjustments for music view - Complete Redesign */
@media (max-width: 768px) {
  /* MOBILE MUSIC PLAYER */

  .music-view {
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
  }

  .music-view .zen-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
    padding: 0;
    max-width: none;
    min-height: 0;
    overflow: hidden;
  }

  /* Sidebar contains folders and playlist - reorder children */
  .music-view .zen-sidebar {
    display: contents;
  }

  .music-view .zen-sidebar-header {
    display: none;
  }

  /* Folder tabs - single row with icons only */
  .music-view .zen-folder-list {
    order: 1;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    width: 100vw;
  }

  .music-view .zen-folder-item {
    min-height: var(--touch-target-min);
    flex: 1;
    padding: var(--space-xs);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
  }

  /* Hide folder name and count on mobile/tablet */
  .music-view .zen-folder-item .zen-folder-name,
  .music-view .zen-folder-item .zen-folder-count {
    display: none;
  }

  /* Make icon larger since it's the only visible element */
  .music-view .zen-folder-item .zen-folder-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .music-view .zen-folder-item .zen-folder-icon svg {
    width: 24px;
    height: 24px;
    display: block;
  }

  .music-view .zen-folder-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
  }

  /* Playlist - fill remaining space */
  .music-view .zen-playlist,
  .music-view .zen-playlist:empty {
    order: 2;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-md);
    display: block !important;
    width: 100%;
    background: var(--bg-primary);
  }

  /* Player - fixed at bottom */
  .music-view .zen-device-container {
    order: 3;
    flex: 0 0 auto !important;
    height: auto !important;
    position: relative;
    padding: var(--space-md);
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    width: 100vw;
  }

  .music-view .zen-playlist .playlist-item {
    min-height: var(--touch-target-comfortable);
    padding: var(--space-md);
    -webkit-tap-highlight-color: transparent;
  }

  .music-view .zen-playlist .playlist-item:active {
    background: var(--bg-active);
    transform: scale(0.98);
  }

  .music-view .zen-device {
    max-width: none;
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .music-view .zen-branding {
    display: none;
  }

  /* Screen layout - horizontal with artwork */
  .music-view .zen-screen {
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  .music-view .zen-screen-content {
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-xs) var(--space-md);
    align-items: center;
  }

  .music-view .zen-artwork {
    grid-row: 1 / 4;
    grid-column: 1;
    width: 72px;
    height: 72px;
    flex: none;
  }

  .music-view .zen-track-title {
    grid-row: 1;
    grid-column: 2;
    font-size: 0.9375rem;
  }

  .music-view .zen-track-artist {
    grid-row: 2;
    grid-column: 2;
    font-size: 0.8125rem;
  }

  .music-view .zen-progress {
    grid-row: 3;
    grid-column: 2;
  }

  /* Button grid - 3x3 */
  .music-view .zen-mosaic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--space-sm);
    padding: 0;
    background: transparent;
    margin-bottom: 0;
    width: 100%;
    max-width: none;
    min-height: 160px;
  }

  .music-view .zen-btn {
    min-height: 48px;
    aspect-ratio: auto;
    border-radius: 6px;
    font-size: 0;
    width: 100%;
  }

  .music-view .zen-btn svg {
    width: 28px;
    height: 28px;
  }

  /* Show all 9 buttons in grid */
  .music-view .zen-btn-back,
  .music-view .zen-btn-menu,
  .music-view .zen-btn-shuffle,
  .music-view .zen-btn-repeat,
  .music-view .zen-btn-up,
  .music-view .zen-btn-down,
  .music-view .zen-btn-left,
  .music-view .zen-btn-right,
  .music-view .zen-btn-select {
    display: flex;
  }
}


/* ==================== */
/* Creative Zen Mosaic Theme */
/* ==================== */

/* Zen Mosaic Color Palette - Neutral grayscale */
.music-view {
  --zen-body: #1a1a1a;
  --zen-body-edge: #0d0d0d;
  --zen-screen-bg: #2a2a2a;
  --zen-screen-glow: rgba(128, 128, 128, 0.15);
  --zen-lcd-text: #e8e8e8;
  --zen-lcd-dim: #909090;
  --zen-lcd-muted: #606060;
  --zen-accent: var(--accent);
  --zen-accent-dim: color-mix(in srgb, var(--accent) 75%, black);
  --zen-button: #3a3a3a;
  --zen-button-hover: #4a4a4a;
  --zen-button-active: #2a2a2a;
  --zen-border: #505050;
  --zen-border-light: #686868;
  --zen-pixel-size: 4px;

  /* Retro digital font stack */
  --zen-font-display: 'Geist Pixel', var(--font-sans);
  --zen-font-body: var(--font-sans);
}

/* Welcome message in zero state */
.zen-welcome-message {
  font-family: var(--zen-font-display);
  font-size: 0.75rem;
  color: var(--zen-lcd-muted);
  text-align: center;
  line-height: 1.6;
  padding: 1rem;
  letter-spacing: 0.05em;
}

/* Music Player Container - Device Shell */
.music-view .music-container {
  background: linear-gradient(135deg, var(--zen-body) 0%, var(--zen-body-edge) 100%);
  border: 3px solid var(--zen-body-edge);
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    inset 0 -2px 8px rgba(0,0,0,0.4),
    0 8px 24px rgba(0,0,0,0.6);
  padding: 16px;
  gap: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 20px 18px 28px;
  position: relative;
}

/* Device Edge Detail */
.music-view .music-container::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(145deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0) 40%,
    rgba(0,0,0,0.3) 100%
  );
  border-radius: 3px;
  pointer-events: none;
  z-index: 0;
}

.music-view .music-container > * {
  position: relative;
  z-index: 1;
}

/* Screen Area - LCD Display */
.music-view .music-player {
  background: var(--zen-screen-bg);
  border: 2px solid var(--zen-border);
  border-radius: 2px;
  padding: 10px 12px;
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.5),
    inset 0 0 20px var(--zen-screen-glow),
    0 1px 0 rgba(255,255,255,0.03);
  position: relative;
  overflow: hidden;
}

/* Scan line effect for LCD */
.music-view .music-player::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.08) 0px,
    rgba(0,0,0,0.08) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 10;
}

/* Player Info - LCD Text */
.music-view .player-info {
  gap: 6px;
}

.music-view .player-title {
  font-family: var(--zen-font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--zen-lcd-text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.music-view .player-artist {
  font-family: var(--zen-font-body);
  font-size: 0.6875rem;
  color: var(--zen-lcd-dim);
  letter-spacing: 0.3px;
  line-height: 1.2;
}

/* Progress Bar - Pixel Blocks */
.music-view .progress-bar {
  height: 12px;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.3) 100%
  );
  border: 1px solid rgba(0,0,0,0.4);
  border-radius: 0;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 0 rgba(255,255,255,0.02);
  overflow: hidden;
  position: relative;
}

.music-view .progress-fill {
  background: repeating-linear-gradient(
    90deg,
    var(--zen-accent) 0px,
    var(--zen-accent) var(--zen-pixel-size),
    var(--zen-accent-dim) var(--zen-pixel-size),
    var(--zen-accent-dim) calc(var(--zen-pixel-size) * 2)
  );
  border-radius: 0;
  box-shadow:
    inset 0 -1px 0 rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: width 0.15s linear;
  position: relative;
}

/* Pixel block edge effect */
.music-view .progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--zen-pixel-size);
  background: var(--zen-accent);
  box-shadow: 0 0 4px var(--zen-accent);
}

.music-view .progress-time {
  font-family: var(--zen-font-body);
  font-size: 0.625rem;
  color: var(--zen-lcd-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Control Buttons - D-Pad Style */
.music-view .player-controls {
  gap: 10px;
  margin-bottom: 6px;
}

.music-view .player-btn {
  background: var(--zen-button);
  border: 2px solid var(--zen-border);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 2px 0 rgba(0,0,0,0.4),
    0 4px 8px rgba(0,0,0,0.3);
  color: var(--zen-lcd-dim);
  transition: all 0.08s ease;
  position: relative;
}

.music-view .player-btn:hover {
  background: var(--zen-button-hover);
  border-color: var(--zen-border-light);
  color: var(--zen-lcd-text);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 3px 0 rgba(0,0,0,0.4),
    0 5px 10px rgba(0,0,0,0.4);
}

.music-view .player-btn:active {
  background: var(--zen-button-active);
  border-color: var(--zen-border);
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 0 rgba(0,0,0,0.2);
}

.music-view .player-prev,
.music-view .player-next {
  width: 40px;
  height: 40px;
  border-radius: 2px;
}

.music-view .player-play {
  width: 64px;
  height: 64px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--zen-accent) 0%, var(--zen-accent-dim) 100%);
  border-color: var(--zen-accent-dim);
  color: var(--zen-lcd-text);
}

.music-view .player-play:hover {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--zen-accent) 90%, white) 0%,
    var(--zen-accent) 100%
  );
  border-color: var(--zen-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 3px 0 rgba(0,0,0,0.4),
    0 5px 12px rgba(209, 107, 146, 0.3);
}

.music-view .player-play:active {
  background: var(--zen-accent-dim);
}

/* Artwork - Small Device Screen */
.music-view .music-artwork {
  width: min(320px, 100%);
  aspect-ratio: 4 / 5;
  flex: 0 0 auto;
  order: -1;
}

.music-view .artwork-placeholder {
  background: var(--zen-screen-bg);
  border: 2px solid var(--zen-border);
  border-radius: 18px;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.5),
    inset 0 0 15px var(--zen-screen-glow);
}

.music-view .artwork-placeholder svg {
  width: 28px;
  height: 28px;
  color: var(--zen-lcd-muted);
  opacity: 0.7;
}

.music-view .artwork-placeholder img {
  filter: contrast(0.95) brightness(0.9);
  image-rendering: pixelated;
}

/* Playlist - Menu Rows */
.music-view .music-playlist {
  background: rgba(26, 26, 28, 0.9);
  border: 1px solid var(--zen-border);
  border-radius: 18px;
  overflow: hidden;
}

.music-view .playlist-item {
  border-bottom: 1px solid rgba(82, 80, 90, 0.3);
  padding: 10px 14px;
  transition: all 0.05s ease;
}

.music-view .playlist-item:hover {
  background: var(--zen-button);
  border-bottom-color: var(--zen-border);
}

.music-view .playlist-item.active {
  background: var(--zen-button-hover);
  border-bottom-color: var(--zen-border-light);
}

.music-view .playlist-item.playing {
  color: var(--zen-accent);
  background: rgba(209, 107, 146, 0.08);
}

.music-view .playlist-title {
  font-family: var(--zen-font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}

.music-view .playlist-artist {
  font-family: var(--zen-font-body);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.music-view .playlist-duration {
  font-family: var(--zen-font-body);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.music-view .playlist-thumb {
  background: var(--zen-screen-bg);
  border: 1px solid var(--zen-border);
  border-radius: 2px;
  width: 40px;
  height: 40px;
}

.music-view .playlist-thumb img {
  filter: contrast(0.95) brightness(0.9);
  image-rendering: pixelated;
}

.music-view .playlist-thumb svg {
  width: 18px;
  height: 18px;
  color: var(--zen-lcd-muted);
}

.music-view .playlist-item.no-thumb .playlist-thumb {
  display: none;
}

/* Folder Grid - Device Menu */
.music-view .music-folders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.65));
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 32px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.music-view .folder-tab {
  font-family: var(--zen-font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  background: var(--zen-button);
  border: 2px solid var(--zen-border);
  border-radius: 22px;
  padding: 0.35rem 1.25rem;
  min-height: 48px;
  color: var(--zen-lcd-dim);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 4px 12px rgba(0,0,0,0.45);
  transition: all 0.15s ease;
}

.music-view .folder-tab:hover {
  background: var(--zen-button-hover);
  color: var(--zen-lcd-text);
  border-color: var(--zen-border-light);
  transform: translateY(-1px);
}

.music-view .folder-tab.active {
  background: linear-gradient(135deg, var(--zen-accent) 0%, var(--zen-accent-dim) 100%);
  color: var(--zen-lcd-text);
  border-color: var(--zen-accent-dim);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 8px 28px rgba(209, 107, 146, 0.45);
  transform: translateY(0);
}

.music-view .folder-tab:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.4),
    0 2px 6px rgba(0,0,0,0.2);
}

/* Mobile Adjustments for Zen Theme - See earlier comprehensive mobile styles */


/* ==================== */
/* Timeline View        */
/* ==================== */

.timeline-view {
  /* Inherits full-screen positioning from .view */
}

.timeline-window {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.98) 0%, rgba(6, 8, 12, 0.98) 100%);
}

.timeline-window::before {
  content: "";
  position: absolute;
  inset: -1px;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 5px 5px, 5px 5px;
  opacity: 0.4;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.timeline-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
}

.timeline-header {
  max-width: 520px;
  margin-bottom: var(--space-xl);
  color: var(--text-primary);
}

.timeline-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.timeline-title {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.timeline-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 420px;
}

.timeline-scroll {
  position: relative;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: var(--space-md);
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.timeline-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.timeline-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  padding: 80px 10vw 80px 4vw;
  min-height: 400px;
}

.timeline-item-top {
  padding-top: 0;
  padding-bottom: 0;
}

.timeline-item-bottom {
  padding-top: 0;
  padding-bottom: 0;
}

.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent) 10%, var(--accent) 90%, transparent);
  opacity: 0.6;
  transform: translateY(-50%);
  z-index: 0;
}

.timeline-item {
  position: relative;
  flex: 0 0 280px;
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}

.timeline-item.fade-in {
  opacity: 1;
  transform: translateX(0);
}

.timeline-item-top {
  align-self: flex-start;
  padding-bottom: 0;
}

.timeline-item-bottom {
  align-self: flex-end;
  padding-top: 0;
}

.timeline-icon-year-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  z-index: 2;
}

.timeline-item-top .timeline-icon-year-group {
  order: 1;
  margin-bottom: var(--space-xs);
  margin-top: 0;
}

.timeline-item-bottom .timeline-icon-year-group {
  order: 3;
  margin-top: var(--space-xs);
  margin-bottom: 0;
}

.timeline-icon {
  width: 48px;
  height: 48px;
  padding: 8px;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 50%, rgba(86, 152, 251, 0.3), rgba(86, 152, 251, 0.1));
  border: 2px solid rgba(86, 152, 251, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.timeline-icon svg {
  width: 100%;
  height: 100%;
  color: var(--accent);
  transition: color 0.2s ease;
}

.timeline-icon::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 50%, rgba(86, 152, 251, 0.4), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.timeline-icon:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

.timeline-icon:hover::before {
  opacity: 1;
  animation: pixelGlow 0.6s ease-in-out;
}

.timeline-icon:hover::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 9px;
  background: 
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(86, 152, 251, 0.1) 2px, rgba(86, 152, 251, 0.1) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(86, 152, 251, 0.1) 2px, rgba(86, 152, 251, 0.1) 4px);
  animation: pixelBreak 0.5s ease-in-out;
  pointer-events: none;
}

@keyframes pixelGlow {
  0%, 100% {
    opacity: 0;
    filter: blur(0px);
  }
  50% {
    opacity: 1;
    filter: blur(8px);
  }
}

@keyframes pixelBreak {
  0% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

.timeline-connector {
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, rgba(86, 152, 251, 0.5), rgba(86, 152, 251, 0.2));
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin: 0;
}

.timeline-item-top .timeline-connector {
  order: 2;
  background: linear-gradient(to bottom, rgba(86, 152, 251, 0.5), rgba(86, 152, 251, 0.2));
}

.timeline-item-bottom .timeline-connector {
  order: 2;
  background: linear-gradient(to top, rgba(86, 152, 251, 0.5), rgba(86, 152, 251, 0.2));
}

.timeline-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 2;
}

.timeline-item-top .timeline-content {
  order: 3;
  margin-top: var(--space-md);
  margin-bottom: 0;
}

.timeline-item-bottom .timeline-content {
  order: 1;
  margin-bottom: var(--space-md);
  margin-top: 0;
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--text-secondary);
}

.timeline-year {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.timeline-card {
  position: relative;
  padding: var(--space-md) var(--space-lg);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 0%, rgba(86, 152, 251, 0.18), transparent 60%),
              rgba(9, 11, 20, 0.96);
  border: 1px solid rgba(86, 152, 251, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  width: 100%;
  text-align: center;
}

.timeline-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: soft-light;
  opacity: 0.24;
  pointer-events: none;
}

.timeline-item-title {
  font-size: 1rem;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.timeline-item-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 1024px) {
  .timeline-inner {
    padding: var(--space-lg);
  }

  .timeline-track {
    padding: 60px var(--space-md);
    gap: var(--space-lg);
  }

  .timeline-item {
    flex: 0 0 240px;
    width: 240px;
  }

  .timeline-icon {
    width: 40px;
    height: 40px;
  }

  .timeline-connector {
    height: 30px;
  }
}

@media (max-width: 768px) {
  .timeline-inner {
    padding: var(--space-md);
  }

  .timeline-header {
    margin-bottom: var(--space-lg);
  }

  .timeline-title {
    font-size: 1.4rem;
  }

  .timeline-track {
    padding: 50px var(--space-sm);
    gap: var(--space-md);
  }

  .timeline-item {
    flex: 0 0 200px;
    width: 200px;
  }

  .timeline-card {
    padding: var(--space-sm) var(--space-md);
  }

  .timeline-item-title {
    font-size: 0.9rem;
  }

  .timeline-item-description {
    font-size: 0.8rem;
  }

  .timeline-icon {
    width: 36px;
    height: 36px;
  }

  .timeline-connector {
    height: 25px;
  }

  .timeline-year {
    font-size: 1.25rem;
  }
}

/* ==================== */
/* Mini Music Player     */
/* ==================== */

.mini-player {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 200px;
  max-width: 240px;
  height: 64px;
  background: var(--bg-primary);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: 0px;
  box-shadow: 0 8px 32px var(--shadow-color);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-normal), visibility var(--transition-normal), transform var(--transition-normal);
  /* Respect safe area on iOS Safari */
  bottom: calc(20px + env(safe-area-inset-bottom));
}

.mini-player[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.mini-player-content {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  height: 100%;
}

.mini-player-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-player-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mini-player-placeholder {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

.mini-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.mini-player-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.mini-player-artist {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.mini-player-play-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0px;
  color: var(--text-primary);
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  padding: 0;
}

.mini-player-play-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: scale(1.05);
}

.mini-player-play-btn:active {
  transform: scale(0.95);
  background: var(--bg-active);
}

.mini-player-play-btn svg {
  width: 18px;
  height: 18px;
}

.mini-player-icon-play,
.mini-player-icon-pause {
  display: block;
}

.mini-player-icon-play.hidden,
.mini-player-icon-pause.hidden {
  display: none;
}

/* Mobile adjustments for mini player */
@media (max-width: 768px) {
  .mini-player {
    min-width: 180px;
    max-width: 220px;
    height: 56px;
    bottom: 16px;
    /* Respect safe area on iOS Safari */
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .mini-player-content {
    padding: var(--space-xs);
    gap: var(--space-xs);
  }

  .mini-player-thumb {
    width: 36px;
    height: 36px;
  }

  .mini-player-title {
    font-size: 0.75rem;
  }

  .mini-player-artist {
    font-size: 0.625rem;
  }

  .mini-player-play-btn {
    width: 32px;
    height: 32px;
  }

  .mini-player-play-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* ==================== */
/* Life Stories View    */
/* ==================== */

.life-stories-view {
  /* Inherits padding from .view */
  overflow: hidden;
}

.life-stories-view .os9-window-body {
  padding: 0;
  overflow: hidden;
}

.life-stories-view .life-stories-container {
  width: 100%;
  margin: 0;
  padding: 0;
  height: 100%;
}

.life-stories-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.elevator-sidebar {
  width: 80px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.elevator-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.elevator-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 0px;
  color: var(--text-primary);
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.elevator-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: scale(1.05);
}

.elevator-btn:active:not(:disabled) {
  transform: scale(0.95);
}

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

.elevator-btn svg {
  width: 24px;
  height: 24px;
}

.floor-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
}

.floor-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: 'Geist Pixel', var(--font-sans);
}

.floor-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Geist Pixel', var(--font-sans);
  line-height: 1;
  transition: opacity 0.2s ease-in-out;
}

.floor-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs);
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
}

.floor-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: var(--cursor-pointer);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  min-height: 32px;
  font-family: 'Geist Pixel', var(--font-sans);
}

.floor-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.floor-btn.active {
  background: var(--bg-active);
  color: var(--accent);
  border-color: var(--accent);
}

.floor-btn.milestone {
  color: var(--accent);
  font-weight: 700;
}

.building-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-tertiary);
  position: relative;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

#buildingCanvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Mobile adjustments for Life Stories view */
@media (max-width: 768px) {
  .life-stories-view .building-viewport {
    position: relative;
    z-index: 1;
  }

  .elevator-sidebar {
    width: 60px;
  }

  .elevator-controls {
    padding: var(--space-sm);
  }

  .elevator-btn {
    width: 40px;
    height: 40px;
  }

  .elevator-btn svg {
    width: 20px;
    height: 20px;
  }

  .floor-number {
    font-size: 1.25rem;
  }

  .floor-btn {
    font-size: 0.625rem;
    min-height: 28px;
  }
}

/* ========================================
   THOUGHT TRAIN VIEW
   ======================================== */

.thought-train-view {
  /* Inherits padding from .view */
}

.thought-train-view .os9-window-body {
  padding: var(--space-lg);
  overflow: hidden;
}

.thought-train-view .thought-train-container {
  width: 100%;
  margin: 0;
  padding: 0;
  height: 100%;
}

.thought-train-container {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.train-timeline-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.train-timeline-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(86, 152, 251, 0.05), transparent);
}

.train-eyebrow {
  font-family: 'Geist Pixel', monospace;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm) 0;
}

.train-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* 3D Stack Container */
.train-stack-container {
  position: relative;
  flex: 1;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  overflow: hidden;
  min-height: 0;
}

.train-stack-3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

/* Train Cards */
.train-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  max-width: 90%;
  height: 400px;
  max-height: 60vh;
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.train-card[data-position="center"]:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(86, 152, 251, 0.3);
}

/* Pixel grid overlay */
.train-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: soft-light;
  opacity: 0.15;
  pointer-events: none;
  z-index: 1;
}

/* Position-based transforms for 3D stack effect */
.train-card[data-position="center"] {
  z-index: 100;
  opacity: 1;
  transform: translate(-50%, -50%) translateZ(0) scale(1);
}

.train-card[data-position="next-1"] {
  z-index: 90;
  opacity: 0.85;
  transform: translate(-50%, -50%) translateZ(-100px) translateY(-20px) scale(0.95);
}

.train-card[data-position="next-2"] {
  z-index: 80;
  opacity: 0.65;
  transform: translate(-50%, -50%) translateZ(-200px) translateY(-40px) scale(0.90);
}

.train-card[data-position="next-3"] {
  z-index: 70;
  opacity: 0.45;
  transform: translate(-50%, -50%) translateZ(-300px) translateY(-60px) scale(0.85);
}

.train-card[data-position="prev-1"] {
  z-index: 90;
  opacity: 0.85;
  transform: translate(-50%, -50%) translateZ(-100px) translateY(20px) scale(0.95);
}

.train-card[data-position="prev-2"] {
  z-index: 80;
  opacity: 0.65;
  transform: translate(-50%, -50%) translateZ(-200px) translateY(40px) scale(0.90);
}

.train-card[data-position="prev-3"] {
  z-index: 70;
  opacity: 0.45;
  transform: translate(-50%, -50%) translateZ(-300px) translateY(60px) scale(0.85);
}

.train-card[data-position="hidden"] {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) translateZ(-500px) scale(0.7);
}

/* Ticket Stub Header with Torn Edge */
.train-card-stub {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(86, 152, 251, 0.12), rgba(86, 152, 251, 0.04));
  border-bottom: 1px dashed var(--border-light);
  font-family: 'Geist Pixel', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  z-index: 2;
}

/* Torn edge effect using gradient zigzag */
.train-card-stub::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(135deg,
    transparent 0%, transparent 25%,
    var(--bg-secondary) 25%, var(--bg-secondary) 50%,
    transparent 50%, transparent 75%,
    var(--bg-secondary) 75%);
  background-size: 12px 12px;
  z-index: 1;
}

/* Compact View (Hidden) */
.train-card-compact {
  display: none;
}

/* Card Content - Always Visible Notecard Format */
.train-card-expanded {
  display: block;
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
  position: relative;
  z-index: 2;
}

.train-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.4;
}

.train-route,
.train-takeaway,
.train-why,
.train-next {
  margin-bottom: var(--space-lg);
}

.train-route strong,
.train-takeaway strong,
.train-why strong,
.train-next strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-family: 'Geist Pixel', monospace;
}

.train-route ol {
  margin: 0;
  padding-left: var(--space-lg);
  color: var(--text-primary);
}

.train-route li {
  margin-bottom: var(--space-sm);
  line-height: 1.6;
}

.train-quote {
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--accent);
  background: rgba(86, 152, 251, 0.05);
  font-style: italic;
  color: var(--text-primary);
}

.train-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.train-tags .tag {
  font-size: 0.75rem;
  padding: 4px 8px;
  background: rgba(86, 152, 251, 0.1);
  border: 1px solid rgba(86, 152, 251, 0.3);
  border-radius: 4px;
  color: var(--accent);
  font-family: 'Geist Pixel', monospace;
}

/* No hover behavior - all content always visible */

/* Train Detail View (Expanded) */
.train-detail-view {
  width: 600px;
  max-width: 90%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.train-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.train-detail-back {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  border-radius: 4px;
  z-index: 10;
  position: relative;
  pointer-events: auto;
}

.train-detail-back:hover {
  background: var(--bg-primary);
  border-color: var(--accent);
  color: var(--accent);
}

.train-detail-back svg {
  width: 18px;
  height: 18px;
}

.train-detail-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.train-detail-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-xl);
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.train-detail-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.3;
}

.train-detail-journey {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.train-detail-journey .train-start,
.train-detail-journey .train-end {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.train-detail-journey .train-arrow {
  color: var(--accent);
  font-size: 1.25rem;
}

.train-detail-journey .train-stop-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Geist Pixel', monospace;
}

/* Empty State */
.train-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: var(--space-xl);
}

/* Navigation Controls */
.train-nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.train-nav-prev,
.train-nav-next {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.25rem;
  font-weight: 600;
}

.train-nav-prev:hover,
.train-nav-next:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}

.train-nav-prev:active,
.train-nav-next:active {
  transform: scale(0.95);
}

.train-nav-indicator {
  font-family: 'Geist Pixel', monospace;
  font-size: 0.875rem;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  /* Simplified 3D for performance */
  .train-stack-container {
    perspective: 800px;
  }

  .train-card {
    width: 100%;
    height: 350px;
  }

  .train-detail-view {
    width: 100%;
    max-width: 100%;
  }

  .train-card[data-position="next-1"],
  .train-card[data-position="prev-1"] {
    transform: translate(-50%, -50%) translateZ(-80px) translateY(-15px) scale(0.96);
  }

  .train-card[data-position="next-2"],
  .train-card[data-position="prev-2"] {
    transform: translate(-50%, -50%) translateZ(-160px) translateY(-30px) scale(0.92);
  }

  .train-card[data-position="next-3"],
  .train-card[data-position="prev-3"] {
    transform: translate(-50%, -50%) translateZ(-240px) translateY(-45px) scale(0.88);
  }

  .train-timeline-header {
    padding: var(--space-md);
  }

  .train-title {
    font-size: 1rem;
  }

  .train-card-expanded {
    padding: var(--space-md);
  }

  .train-detail-header {
    padding: var(--space-md);
  }

  .train-detail-content {
    padding: var(--space-md);
  }

  .train-detail-title {
    font-size: 1.5rem;
  }

  .train-detail-journey {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .train-detail-journey .train-stop-count {
    margin-left: 0;
  }
}

/* ========================================
   Labs View
   ======================================== */

.labs-view {
  /* Inherits padding from .view */
  overflow-y: auto;
}

.labs-view .os9-window-body {
  padding: var(--space-lg);
  overflow-y: auto;
}

.labs-container {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

/* Regular Grid (switched from masonry to avoid hover glitches) */
.labs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* Card Styles */
.labs-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  overflow: hidden;
}

.labs-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow-color);
  border-color: var(--accent);
}

.labs-card-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.labs-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.labs-card:hover .labs-card-thumbnail img {
  transform: scale(1.05);
}

.labs-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-family: 'Geist Pixel', var(--font-sans);
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
}

.labs-card-content {
  padding: var(--space-md);
}

.labs-card-title {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
  letter-spacing: 0.05em;
}

.labs-card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Labs Modal */
.labs-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.labs-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.labs-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.labs-modal-content {
  position: relative;
  background: var(--bg-secondary);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px var(--shadow-color);
  max-width: 800px;
  width: calc(100% - 40px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  z-index: 1;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.labs-modal[aria-hidden="false"] .labs-modal-content {
  transform: scale(1);
}

.labs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.labs-modal-title {
  font-family: 'Geist Pixel', var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.labs-modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.labs-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.labs-modal-close svg {
  width: 20px;
  height: 20px;
}

.labs-modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.labs-modal-body::-webkit-scrollbar {
  display: none;
}

/* Markdown content in modal */
.labs-modal-body h1,
.labs-modal-body h2,
.labs-modal-body h3 {
  color: var(--text-primary);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.labs-modal-body h1:first-child,
.labs-modal-body h2:first-child,
.labs-modal-body h3:first-child {
  margin-top: 0;
}

.labs-modal-body p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.labs-modal-body a {
  color: var(--accent);
}

.labs-modal-body a:hover {
  text-decoration: underline;
}

.labs-modal-body img {
  max-width: 100%;
  height: auto;
  margin: var(--space-md) 0;
}

.labs-modal-body code {
  background: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  font-size: 0.875em;
}

.labs-modal-body pre {
  background: var(--bg-tertiary);
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-md) 0;
}

.labs-modal-body pre code {
  background: transparent;
  padding: 0;
}

/* Empty state */
.labs-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
  .labs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .labs-view {
    padding: var(--space-md);
  }

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

  .labs-modal-content {
    width: calc(100% - 32px);
    max-height: 90vh;
  }

  .labs-modal-header {
    padding: var(--space-md);
  }

  .labs-modal-body {
    padding: var(--space-md);
  }

  .labs-modal-title {
    font-size: 1rem;
  }
}

/* ==================== */
/* Gallery              */
/* ==================== */

.gallery-view {
  /* Inherits padding from .view */
  overflow: hidden;
}

.gallery-view .os9-window-body {
  padding: 0;
  overflow: hidden;
}

.gallery-container {
  width: 100%;
  flex: 1; /* Fill os9-window-body which is a flex container */
  min-height: 0; /* Allow shrinking */
  overflow-y: auto;
  padding: var(--space-lg);
  position: relative;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  width: 100%;
}

.gallery-album-card {
  cursor: pointer;
}

/* Polaroid Stack */
.polaroid-stack {
  position: relative;
  width: 92%;
  margin: 0 auto; /* Center within grid cell */
  padding-top: 110%; /* Maintain aspect ratio */
}

.polaroid {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--card-bg, white);
  padding: 12px 12px 56px 12px; /* Extra bottom for caption */
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: 2px;
  width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Dark mode: lighter polaroid frames for better contrast */
@media (prefers-color-scheme: dark) {
  .polaroid {
    background: #2a2a2c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }

  .gallery-album-card:hover .polaroid {
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  }
}

.polaroid[style*="--stack-index: 0"] {
  transform: translate(-4px, -8px) rotate(-3deg);
  z-index: 1;
}

.polaroid[style*="--stack-index: 1"] {
  transform: translate(0px, -4px) rotate(1deg);
  z-index: 2;
}

.polaroid[style*="--stack-index: 2"] {
  transform: translate(2px, 0px) rotate(0deg);
  z-index: 3;
}

.gallery-album-card:hover .polaroid {
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* Hover: fan out the stack */
.gallery-album-card:hover .polaroid[style*="--stack-index: 0"] {
  transform: translate(-20px, -16px) rotate(-6deg);
}

.gallery-album-card:hover .polaroid[style*="--stack-index: 1"] {
  transform: translate(16px, -12px) rotate(4deg);
}

.gallery-album-card:hover .polaroid[style*="--stack-index: 2"] {
  transform: translate(0px, 4px) rotate(0deg) scale(1.02);
}

.polaroid-photo {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--image-bg, #f0f0f0);
  position: relative;
}

.polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

/* Image scale on hover removed to prevent layout glitching */

.polaroid-caption {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  text-align: center;
}

.polaroid-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #333);
  margin-bottom: 2px;
  line-height: 1.2;
}

.polaroid-date {
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
  line-height: 1.2;
}

.polaroid-exif {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-secondary, #666);
  line-height: 1.4;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Empty State */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Expanded Album View */
.gallery-expanded {
  position: absolute;
  inset: 0;
  background: var(--bg-fill);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
  overflow-y: auto;
}

.gallery-expanded[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.gallery-view.album-expanded .gallery-grid {
  display: none;
}

.gallery-expanded-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 32px 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 1;
}

.gallery-nerd-mode-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-color);
  cursor: pointer;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.gallery-nerd-mode-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.gallery-nerd-mode-toggle.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.gallery-nerd-mode-toggle svg {
  width: 16px;
  height: 16px;
}

.gallery-back-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: background 0.2s ease;
  border-radius: 4px;
}

.gallery-back-btn:hover {
  background: var(--bg-hover);
}

.gallery-back-btn svg {
  width: 24px;
  height: 24px;
}

.gallery-expanded-titles h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.gallery-expanded-titles p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
}

.gallery-expanded-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  padding: 32px;
}

.gallery-photo-card {
  cursor: pointer;
  transition: transform 0.2s ease;
  will-change: transform;
}

.gallery-photo-card:hover {
  transform: scale(1.05) !important;
}

.gallery-photo-card .polaroid {
  position: relative;
  width: 100%;
  padding: 12px 12px 32px 12px; /* Smaller bottom padding when nerd mode is off */
  transition: padding 0.2s ease;
}

.gallery-photo-card .polaroid.has-exif {
  padding: 12px 12px 56px 12px; /* Larger bottom padding when EXIF is shown */
}

.gallery-photo-card .polaroid-photo {
  aspect-ratio: 1;
}

/* Gallery Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10003;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gallery-lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.gallery-lightbox-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.gallery-lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}

.gallery-lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  padding: 12px;
  border-radius: 4px;
  transition: background 0.2s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox-close svg {
  width: 24px;
  height: 24px;
}

.gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  padding: 16px 12px;
  border-radius: 4px;
  transition: background 0.2s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox-nav svg {
  width: 24px;
  height: 24px;
}

.gallery-lightbox-prev {
  left: 24px;
}

.gallery-lightbox-next {
  right: 24px;
}

/* Responsive Gallery */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .gallery-expanded-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .gallery-container {
    padding: 16px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .gallery-expanded-header {
    padding: 16px;
  }

  .gallery-expanded-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px;
  }

  .gallery-lightbox-nav {
    padding: 12px 8px;
  }

  .gallery-lightbox-prev {
    left: 12px;
  }

  .gallery-lightbox-next {
    right: 12px;
  }
}

/* ==================== */
/* Light Mode           */
/* ==================== */

@media (prefers-color-scheme: light) {
  :root {
    /* Light gray background for app views */
    --bg-fill: #e8e8e8;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #ebebeb;
    --bg-hover: #e0e0e0;
    --bg-active: #d5d5d5;

    --bg-primary-solid: #ffffff;
    --bg-secondary-solid: #f5f5f5;
    --bg-tertiary-solid: #ebebeb;

    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;

    /* Accent: charcoal for light mode */
    --accent: #374151;
    --accent-hover: #4B5563;
    --text-on-accent: #ffffff;

    --border: rgba(0, 0, 0, 0.12);
    --border-light: rgba(0, 0, 0, 0.08);

    --shadow-color: rgba(0, 0, 0, 0.1);
    --overlay-bg: rgba(0, 0, 0, 0.3);

    /* Gallery polaroid cards - keep white/light for light mode */
    --card-bg: white;
    --image-bg: #f0f0f0;
  }

  /* Keep body dark for black hole when no app is open */
  body {
    background-color: #06080c;
  }

  /* Fix icon filters - remove invert to show dark icons */
  .nav-icon-btn svg,
  .nav-icon-btn img {
    filter: brightness(0); /* Dark icons in light mode */
  }

  .nav-icon-btn.active svg,
  .nav-icon-btn.active img {
    filter: none; /* Keep accent color for active state */
  }

  .hamburger-menu-btn svg {
    color: var(--text-primary);
  }

  .hamburger-menu-btn.active svg {
    color: var(--accent);
  }

  .mobile-menu-app-btn svg {
    filter: brightness(0);
  }

  .mobile-menu-app-btn.active svg {
    filter: none;
  }

  /* Mobile header menu background */
  .mobile-header-menu {
    background: rgba(255, 255, 255, 0.98);
  }

  /* Task items border */
  .task-item {
    border-bottom-color: var(--border);
  }

  .task-item:hover {
    background: rgba(0, 0, 0, 0.02);
  }

  /* Checkmark color in completed tasks */
  .task-status-indicator.completed::after {
    border-color: #ffffff;
  }

  /* Habit progress bars - Light Mode */
  .habit-progress-bar {
    background: #e0e0e0;
    border-color: #999;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  }

  .habit-progress-fill {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.4),
      0 0 6px rgba(34, 197, 94, 0.3);
  }

  /* Window titlebar - Light Mode */
  .os9-titlebar {
    background: linear-gradient(180deg,
      #f8f8f8 0%,
      #e8e8e8 50%,
      #d8d8d8 100%
    );
  }

  .os9-titlebar::after {
    background: linear-gradient(180deg,
      #f8f8f8 0%,
      #e8e8e8 50%,
      #d8d8d8 100%
    );
  }

  .os9-title {
    color: var(--text-primary);
  }

  /* Animated gradient border - Light Mode (dark gray/black glow) */
  .os9-window {
    background:
      linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
      conic-gradient(
        from var(--gradient-angle) at 50% 50%,
        rgba(0, 0, 0, 0.08),
        rgba(40, 40, 40, 0.4),
        rgba(60, 60, 60, 0.7),
        rgba(40, 40, 40, 0.4),
        rgba(0, 0, 0, 0.08)
      ) border-box;
  }

  /* Guestbook buttons - Light Mode */
  .guestbook-btn {
    background: var(--bg-secondary);
    border-color: var(--border);
  }

  .guestbook-btn:hover {
    background: var(--bg-hover);
  }

  .guestbook-btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
  }

  /* Mac OS 9 Scrollbar styling - Light Mode */
  ::-webkit-scrollbar-track {
    background: #d4d4d4;
    border: 1px solid #888;
  }

  ::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    border: 1px solid #888;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #e8e8e8 0%, #d0d0d0 50%, #e8e8e8 100%);
  }

  ::-webkit-scrollbar-button {
    background: linear-gradient(180deg, #f0f0f0 0%, #d0d0d0 100%);
    border: 1px solid #888;
  }

  ::-webkit-scrollbar-button:hover {
    background: linear-gradient(180deg, #e8e8e8 0%, #c0c0c0 100%);
  }

  ::-webkit-scrollbar-button:vertical:decrement {
    border-bottom: 1px solid #999;
  }

  ::-webkit-scrollbar-button:vertical:increment {
    border-top: 1px solid #999;
  }

  ::-webkit-scrollbar-button:horizontal:decrement {
    border-right: 1px solid #999;
  }

  ::-webkit-scrollbar-button:horizontal:increment {
    border-left: 1px solid #999;
  }

  /* Firefox scrollbar - Light Mode */
  * {
    scrollbar-color: #d0d0d0 #d4d4d4;
  }

  /* Keep header text LIGHT when no app is open (transparent header over dark space) */
  .top-menu-bar:not(.app-active) .menu-location,
  .top-menu-bar:not(.app-active) .menu-divider {
    color: #808080; /* Keep muted gray for dark background */
  }

  .top-menu-bar:not(.app-active) .menu-time,
  .top-menu-bar:not(.app-active) .weather-temp {
    color: #f5f5f5; /* Keep light for dark background */
  }

  .top-menu-bar:not(.app-active) .menu-weather {
    color: #b3b3b3; /* Keep secondary light for dark background */
  }

  .top-menu-bar:not(.app-active) .social-icon {
    color: #b3b3b3;
  }

  .top-menu-bar:not(.app-active) .social-icon:hover {
    color: var(--social-hover-fg);
    background: var(--social-hover-bg);
  }

  /* Keep navbar DARK when no app is open (even in light mode) */
  .top-menu-bar:not(.app-active) .menu-nav {
    background: rgba(36, 36, 36, 0.85);
    border-color: rgba(61, 61, 61, 0.7);
  }

  .top-menu-bar:not(.app-active) .nav-icon-btn {
    color: #f5f5f5;
  }

  .top-menu-bar:not(.app-active) .nav-icon-btn:hover {
    background: rgba(54, 54, 54, 0.85);
  }

  .top-menu-bar:not(.app-active) .nav-icon-btn.active {
    color: var(--accent);
    background: rgba(64, 64, 64, 0.85);
  }

  .top-menu-bar:not(.app-active) .nav-icon-btn svg,
  .top-menu-bar:not(.app-active) .nav-icon-btn img {
    filter: brightness(0) invert(1);
  }

  .top-menu-bar:not(.app-active) .nav-icon-btn.active svg,
  .top-menu-bar:not(.app-active) .nav-icon-btn.active img {
    filter: none;
  }
}



/* ==================== */
/* Guestbook View       */
/* ==================== */

.guestbook-view {
  /* Inherits padding from .view */
  overflow: hidden;
}

.guestbook-view .os9-window-body {
  padding: 0;
}

.guestbook-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
  padding: 0;
}

/* Header with Mode Toggle */
.guestbook-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.guestbook-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 0px;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
  border: none;
  background: transparent;
  cursor: var(--cursor-pointer);
  font-family: inherit;
  white-space: nowrap;
}

.guestbook-mode-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.guestbook-mode-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.guestbook-mode-btn.active {
  color: var(--text-primary);
  background: var(--bg-active);
}

/* Drawing Panel */
.guestbook-draw-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 32px;
  overflow: hidden;
  gap: 12px;
  background: var(--bg-primary);
  min-height: 0;
}

.guestbook-draw-panel.hidden {
  display: none;
}

.guestbook-draw-content {
  flex: 1;
  display: flex;
  gap: 32px;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.guestbook-canvas-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  max-width: 800px;
  height: 100%;
  max-height: calc(100vh - 200px);
  background: #0a0a0a;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

#guestbookCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Controls */
.guestbook-controls {
  flex-shrink: 0;
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.guestbook-palette {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.palette-color {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.palette-color:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.palette-color.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(100, 150, 255, 0.3);
}

.guestbook-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guestbook-btn {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
  border-radius: 4px;
  width: 100%;
  white-space: nowrap;
  font-size: 0.9rem;
}

.guestbook-btn svg {
  width: 18px;
  height: 18px;
}

.guestbook-btn:hover {
  background: var(--hover-bg);
  border-color: var(--accent);
}

.guestbook-btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.guestbook-btn-primary:hover {
  opacity: 0.9;
}

.guestbook-attribution {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
  padding: 0;
  flex-shrink: 0;
}

.guestbook-attribution a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.guestbook-attribution a:hover {
  text-decoration: underline;
}

/* Gallery Panel */
.guestbook-gallery-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.guestbook-gallery-panel.hidden {
  display: none;
}

.guestbook-gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  align-content: start;
}

.guestbook-star-card {
  aspect-ratio: 4 / 3;
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guestbook-star-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.guestbook-star-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guestbook-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 32px;
  border-top: 1px solid var(--border-color);
}

.pagination-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
  border-radius: 4px;
}

.pagination-btn svg {
  width: 20px;
  height: 20px;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

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

.pagination-info {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .guestbook-header {
    padding: var(--space-sm);
  }

  .guestbook-draw-panel {
    padding: 16px;
  }

  .guestbook-draw-content {
    flex-direction: column;
    gap: 20px;
  }

  .guestbook-controls {
    width: 100%;
  }

  .guestbook-canvas-wrapper {
    max-width: 100%;
  }

  .guestbook-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    padding: 16px;
    gap: 16px;
  }

  .palette-color {
    width: 40px;
    height: 40px;
  }

  .guestbook-pagination {
    padding: 16px;
    gap: 16px;
  }
}

/* =============================================================================
   PROJECT SHREDDER
   ============================================================================= */

.project-shredder-view .os9-window {
  max-width: 900px;
  transition: opacity 0.8s ease-out;
}

.project-shredder-view .os9-window.fading {
  opacity: 0;
  pointer-events: none;
}

.project-shredder-view.launching {
  pointer-events: none;
  background: transparent !important;
}

.project-shredder-view .os9-window-body {
  padding: 0;
  overflow: hidden;
  position: relative;
  min-height: 500px;
}

.project-shredder-container {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

/* Drop Zone Overlay */
.shredder-dropzone {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.shredder-dropzone.active {
  display: flex;
}

.dropzone-content {
  text-align: center;
  color: var(--text-primary);
}

.dropzone-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-md);
  animation: bounce 1s infinite;
}

.dropzone-text {
  font-size: 24px;
  font-weight: 600;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Instructions Area */
.shredder-instructions {
  text-align: center;
  z-index: 1;
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}

.shredder-message {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.shredder-file-btn {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: var(--space-md) var(--space-xl);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  border-radius: 8px;
  transition: all 0.2s;
}

.shredder-file-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.shredder-file-btn svg {
  width: 20px;
  height: 20px;
}

/* Space Capsule */
.space-capsule {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.space-capsule.visible {
  display: flex;
}

.space-capsule.launching {
  animation: launchShake 0.5s;
}

.space-capsule.transforming {
  animation: transformToStar 1s ease-out forwards;
}

@keyframes launchShake {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  25% { transform: translateX(-50%) translateY(-8px); }
  50% { transform: translateX(-50%) translateY(8px); }
  75% { transform: translateX(-50%) translateY(-8px); }
}

@keyframes transformToStar {
  0% {
    transform: translateX(-50%) scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) scale(0.5) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: translateX(-50%) scale(0.3) rotate(360deg);
    opacity: 1;
  }
}

#capsuleCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 240px;
  height: 320px;
}

.capsule-filename {
  background: rgba(0, 0, 0, 0.9);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: monospace;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Launch Button */
.launch-button {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.launch-button::before {
  content: '';
  width: 280px;
  height: 280px;
  background:
    repeating-linear-gradient(
      45deg,
      #000 0px,
      #000 25px,
      #ffdd00 25px,
      #ffdd00 50px
    );
  border-radius: 20px;
  border: 8px solid #333;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5),
              inset 0 -8px 16px rgba(0, 0, 0, 0.4);
  position: absolute;
  top: -20px;
  z-index: -1;
}

.launch-button span {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at 30% 30%, #ff4444, #cc0000);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 900;
  color: white;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
  border: 8px solid #8b0000;
  box-shadow:
    0 12px 30px rgba(255, 0, 0, 0.6),
    inset 0 -10px 20px rgba(0, 0, 0, 0.4),
    inset 0 10px 20px rgba(255, 100, 100, 0.3);
  position: relative;
  transition: all 0.15s ease;
}

.launch-button:hover span {
  transform: translateY(-8px);
  box-shadow:
    0 20px 50px rgba(255, 0, 0, 0.8),
    inset 0 -10px 20px rgba(0, 0, 0, 0.4),
    inset 0 10px 20px rgba(255, 100, 100, 0.4);
}

.launch-button:active span {
  transform: translateY(4px);
  box-shadow:
    0 5px 15px rgba(255, 0, 0, 0.4),
    inset 0 5px 15px rgba(0, 0, 0, 0.6);
}

.launch-button svg {
  display: none;
}

.launch-button.hidden {
  display: none;
}

/* Success Message */
.success-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  padding: var(--space-xl);
  border-radius: 12px;
  border: 2px solid var(--accent);
  display: none;
  animation: fadeInScale 0.3s;
}

.success-message.visible {
  display: block;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.success-content {
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  color: #4caf50;
  margin-bottom: var(--space-md);
}

.success-text {
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Particle Burst Effect */
@keyframes particleBurst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

.particle-burst {
  position: fixed;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  animation: particleBurst 0.8s ease-out forwards;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .dropzone-icon {
    width: 60px;
    height: 60px;
  }

  .dropzone-text {
    font-size: 18px;
  }

  .launch-button {
    font-size: 20px;
    padding: var(--space-md) var(--space-lg);
  }

  .launch-button svg {
    width: 24px;
    height: 24px;
  }
}

/* ============================================
   Library View
   ============================================ */

.library-view {
  /* Inherits from .view */
  justify-content: center;
  align-items: flex-end;
}

.library-view .os9-window {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.library-view .os9-window-body {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.kindle-screen {
  background: #f5f3ed;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Kindle Content */
.kindle-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.kindle-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.kindle-library-title {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

/* Kindle Books Grid */
.kindle-books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 16px;
}

.kindle-empty {
  text-align: center;
  color: #666;
  font-size: 14px;
  padding: 40px 20px;
}

.kindle-book {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.kindle-book:active {
  transform: scale(0.98);
}

.kindle-book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 2px;
  overflow: hidden;
  background: #e8e5dc;
  border: 1px solid #d4d1c7;
  position: relative;
}

.kindle-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kindle-book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0ddd4 0%, #c8c4b8 100%);
  color: #555;
  font-size: 10px;
  text-align: center;
  padding: 8px;
  font-weight: 500;
  line-height: 1.3;
}

.kindle-book-info {
  margin-top: 6px;
  text-align: left;
}

.kindle-book-title {
  font-size: 11px;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kindle-book-author {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Kindle Bottom Navigation */
.kindle-bottom-nav {
  display: flex;
  border-top: 1px solid #d4d1c7;
  background: #f5f3ed;
}

.kindle-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: none;
  border: none;
  color: #666;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.kindle-nav-btn svg {
  width: 22px;
  height: 22px;
}

.kindle-nav-btn.active {
  color: #222;
}

.kindle-nav-btn:hover {
  color: #222;
}

/* Responsive */
@media (min-width: 480px) {
  .kindle-books-grid {
    gap: 20px 14px;
  }
}

@media (max-width: 420px) {
  .kindle-books-grid {
    gap: 12px 8px;
  }
}

.kindle-book.highlighted {
  animation: highlight-pulse 1s ease-in-out;
}

@keyframes highlight-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
}

@media (prefers-color-scheme: dark) {
  .kindle-book-cover-placeholder {
    opacity: 0.9;
  }
}

/* Book Suggestion Modal */
.suggest-book-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.suggest-book-modal.active {
  display: flex;
}

.suggest-book-content {
  background: #f5f3ed;
  border-radius: 8px;
  max-width: 380px;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.suggest-book-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #d4d1c7;
}

.suggest-book-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #222;
}

.suggest-book-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.suggest-book-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #222;
}

.suggest-book-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.suggest-book-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggest-book-field label {
  font-size: 13px;
  font-weight: 500;
  color: #444;
}

.suggest-book-field .optional {
  font-weight: 400;
  color: #888;
}

.suggest-book-field input,
.suggest-book-field textarea {
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-family: inherit;
  resize: none;
}

.suggest-book-field input:focus,
.suggest-book-field textarea:focus {
  outline: none;
  border-color: #666;
}

.suggest-book-field input::placeholder,
.suggest-book-field textarea::placeholder {
  color: #999;
}

.suggest-book-submit {
  background: #222;
  color: #fff;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.suggest-book-submit:hover {
  background: #444;
}

/* ============================================
   Media Rating Legend
   ============================================ */

.media-rating-legend {
  margin: 0 40px 40px 40px;
  padding: 24px 28px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.rating-legend-header {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.rating-legend-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px 24px;
  margin-bottom: 16px;
}

.rating-legend-item {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  line-height: 1.5;
}

.rating-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--border-color);
  border-radius: 3px;
  font-size: 12px;
  margin-right: 8px;
  padding: 0 6px;
}

.rating-legend-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

.rating-legend-credit {
  font-size: 12px;
  color: var(--text-tertiary);
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.rating-legend-credit a {
  color: var(--link-color);
  text-decoration: none;
}

.rating-legend-credit a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .media-rating-legend {
    margin: 0 20px 30px 20px;
    padding: 20px;
  }

  .rating-legend-items {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rating-legend-header {
    font-size: 16px;
  }
}
