/* Catppuccin Latte Theme */
:root {
  --latte-base: #eff1f5;
  --latte-mantle: #e6e9ef;
  --latte-crust: #dce0e8;
  --latte-text: #4c4f69;
  --latte-subtext0: #6c6f85;
  --latte-subtext1: #5c5f77;
  --latte-overlay0: #9ca0b0;
  --latte-surface0: #ccd0da;
  --latte-surface1: #bcc0cc;
  --latte-surface2: #acb0be;
  --latte-rosewater: #dc8a78;
  --latte-flamingo: #dd7878;
  --latte-pink: #ea76cb;
  --latte-mauve: #8839ef;
  --latte-red: #d20f39;
  --latte-maroon: #e64553;
  --latte-peach: #fe640b;
  --latte-yellow: #df8e1d;
  --latte-green: #40a02b;
  --latte-teal: #179299;
  --latte-sky: #04a5e5;
  --latte-sapphire: #209fb5;
  --latte-blue: #1e66f5;
  --latte-lavender: #7287fd;
  --mocha-base: #1e1e2e;
  --mocha-mantle: #181825;
  --mocha-crust: #11111b;
  --mocha-text: #cdd6f4;
  --mocha-subtext0: #a6adc8;
  --mocha-subtext1: #bac2de;
  --mocha-overlay0: #6c7086;
  --mocha-surface0: #313244;
  --mocha-surface1: #45475a;
  --mocha-surface2: #585b70;
  --mocha-rosewater: #f5e0dc;
  --mocha-flamingo: #f2cdcd;
  --mocha-pink: #f5c2e7;
  --mocha-mauve: #cba6f7;
  --mocha-red: #f38ba8;
  --mocha-maroon: #eba0ac;
  --mocha-peach: #fab387;
  --mocha-yellow: #f9e2af;
  --mocha-green: #a6e3a1;
  --mocha-teal: #94e2d5;
  --mocha-sky: #89dceb;
  --mocha-sapphire: #74c7ec;
  --mocha-blue: #89b4fa;
  --mocha-lavender: #b4befe;
  --overlay-backdrop: rgba(76, 79, 105, 0.4);
  --elevated-surface: rgba(255, 255, 255, 0.64);
  --elevated-surface-strong: rgba(255, 255, 255, 0.68);
  --elevated-surface-hover: rgba(255, 255, 255, 0.92);
  --elevated-inset-shadow: rgba(255, 255, 255, 0.8);
  --active-surface-bg: #ffffff;
  --tooltip-bg: rgba(76, 79, 105, 0.96);
  --tooltip-text: #ffffff;
  --panel-shadow: 0 14px 32px rgba(76, 79, 105, 0.18);
  --sidebar-mobile-shadow: 0 24px 48px rgba(76, 79, 105, 0.2);
  --accent-hover: #7030d0;
  --accent-strong: #6732ca;
  --desktop-sidebar-default: 420px;
  --desktop-sidebar-min: 320px;
  --desktop-viewer-min: 680px;
  --splitter-width: 10px;
}

:root[data-theme="dark"] {
  --latte-base: var(--mocha-base);
  --latte-mantle: var(--mocha-mantle);
  --latte-crust: var(--mocha-crust);
  --latte-text: var(--mocha-text);
  --latte-subtext0: var(--mocha-subtext0);
  --latte-subtext1: var(--mocha-subtext1);
  --latte-overlay0: var(--mocha-overlay0);
  --latte-surface0: var(--mocha-surface0);
  --latte-surface1: var(--mocha-surface1);
  --latte-surface2: var(--mocha-surface2);
  --latte-rosewater: var(--mocha-rosewater);
  --latte-flamingo: var(--mocha-flamingo);
  --latte-pink: var(--mocha-pink);
  --latte-mauve: var(--mocha-mauve);
  --latte-red: var(--mocha-red);
  --latte-maroon: var(--mocha-maroon);
  --latte-peach: var(--mocha-peach);
  --latte-yellow: var(--mocha-yellow);
  --latte-green: var(--mocha-green);
  --latte-teal: var(--mocha-teal);
  --latte-sky: var(--mocha-sky);
  --latte-sapphire: var(--mocha-sapphire);
  --latte-blue: var(--mocha-blue);
  --latte-lavender: var(--mocha-lavender);
  --overlay-backdrop: rgba(17, 17, 27, 0.6);
  --elevated-surface: rgba(49, 50, 68, 0.72);
  --elevated-surface-strong: rgba(69, 71, 90, 0.74);
  --elevated-surface-hover: rgba(88, 91, 112, 0.78);
  --elevated-inset-shadow: rgba(205, 214, 244, 0.14);
  --active-surface-bg: rgba(69, 71, 90, 0.52);
  --tooltip-bg: rgba(17, 17, 27, 0.95);
  --tooltip-text: var(--mocha-text);
  --panel-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  --sidebar-mobile-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  --accent-hover: #a985f6;
  --accent-strong: #dfcbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--latte-base);
  color: var(--latte-text);
  font-family: "Inter", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.menu-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 220;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--latte-blue);
  background: var(--latte-base);
  color: var(--latte-text);
  font-weight: 600;
  transform: translateY(-180%);
  transition: transform 0.18s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--latte-blue);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--latte-mantle);
}

::-webkit-scrollbar-thumb {
  background: var(--latte-surface0);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--latte-surface1);
}

a {
  color: var(--latte-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

/* Layout */
.app-root {
  --sidebar-width: var(--desktop-sidebar-default);
  display: grid;
  grid-template-columns:
    minmax(var(--desktop-sidebar-min), var(--sidebar-width))
    var(--splitter-width)
    minmax(var(--desktop-viewer-min), 1fr);
  height: 100vh;
  width: 100vw;
}

.app-root.is-resizing,
.app-root.is-resizing * {
  cursor: col-resize !important;
  user-select: none;
}

.app-splitter {
  position: relative;
  width: var(--splitter-width);
  background: transparent;
  border: 0;
  cursor: col-resize;
  touch-action: none;
}

.app-splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-0.5px);
  background: var(--latte-surface0);
}

.app-splitter::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-2px);
  background: transparent;
  transition: background 0.15s ease;
}

.app-splitter:hover::after,
.app-splitter:focus-visible::after,
.app-root.is-resizing .app-splitter::after {
  background: rgba(30, 102, 245, 0.22);
}

.app-splitter:focus-visible {
  outline: none;
}

/* Sidebar */
.sidebar {
  background: var(--latte-mantle);
  border-right: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(1.5px);
  z-index: 80;
}

.sidebar-overlay[hidden] {
  display: none;
}

.sidebar-header {
  position: relative;
  padding: 24px 20px;
  border-bottom: 1px solid var(--latte-surface0);
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 18px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--latte-surface0);
  background: var(--latte-base);
  color: var(--latte-subtext1);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-close:hover {
  color: var(--latte-text);
}

.sidebar-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-terminal {
  color: var(--latte-mauve);
  font-size: 20px;
}

.sidebar-branch {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 8px;
  row-gap: 10px;
  margin-top: 12px;
}

.branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1;
  background: var(--elevated-surface);
  border: 1px solid var(--latte-surface1);
  border-radius: 999px;
  color: var(--latte-subtext0);
  box-shadow: 0 1px 0 var(--elevated-inset-shadow) inset;
}

.icon-branch {
  font-size: 13px;
  color: var(--latte-overlay0);
}

.branch-info {
  grid-column: 1 / -1;
  display: block;
  font-size: 0.75rem;
  color: var(--latte-overlay0);
}

.branch-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.branch-pill {
  border: 1px solid var(--latte-surface1);
  border-radius: 999px;
  background: var(--elevated-surface-strong);
  color: var(--latte-subtext1);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--elevated-inset-shadow) inset;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.branch-pill:hover {
  border-color: var(--latte-surface2);
  background-color: var(--elevated-surface-hover);
  color: var(--latte-text);
  transform: translateY(-1px);
}

.branch-pill:focus-visible {
  outline: 2px solid var(--latte-blue);
  outline-offset: 1px;
}

.branch-pill.is-active {
  border-color: rgba(136, 57, 239, 0.45);
  background: rgba(136, 57, 239, 0.14);
  color: var(--accent-strong);
  box-shadow: 0 1px 0 var(--elevated-inset-shadow) inset, 0 2px 6px rgba(136, 57, 239, 0.22);
}

/* Tree */
.tree-root {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 24px;
}

.tree-folder {
  margin-bottom: 2px;
  --tree-depth: 0;
}

.tree-children {
  --tree-indent-step: clamp(6px, calc(12px - (var(--tree-depth, 0) * 1px)), 12px);
  margin-left: var(--tree-indent-step);
  padding-left: calc(var(--tree-indent-step) + 1px);
  border-left: 1px solid var(--latte-surface0);
}

.tree-row {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  text-align: left;
  min-height: 38px;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--latte-subtext1);
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.tree-row:hover {
  background: rgba(204, 208, 218, 0.5);
  color: var(--latte-text);
}

.tree-row:focus-visible {
  outline: 2px solid var(--latte-blue);
  outline-offset: 1px;
}

.tree-folder-row {
  font-weight: 500;
}

.tree-folder-row .material-symbols-outlined {
  color: var(--latte-blue);
}

.tree-folder.virtual > .tree-folder-row .material-symbols-outlined {
  color: var(--latte-teal);
}

.tree-file-row .material-symbols-outlined {
  color: var(--latte-overlay0);
}

.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-label-tooltip {
  position: fixed;
  z-index: 140;
  pointer-events: none;
  max-width: min(440px, calc(100vw - 24px));
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 0.75rem;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(76, 79, 105, 0.24);
}

.tree-label-tooltip[hidden] {
  display: none;
}

/* Active file state */
.tree-file-row.is-active {
  background: var(--active-surface-bg);
  color: var(--latte-text);
  font-weight: 500;
  border: 1px solid var(--latte-surface0);
  border-left: 4px solid var(--latte-mauve);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding-left: 8px;
}

.tree-file-row.is-active .material-symbols-outlined {
  color: var(--latte-mauve);
}

/* NEW badge */
.badge-new {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 999px;
  color: white;
  background: var(--latte-red);
}

/* Active badge */
.badge-active {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--latte-mauve);
  background: rgba(136, 57, 239, 0.1);
}

/* Sidebar footer */
.sidebar-footer {
  position: relative;
  padding: 12px 16px;
  background: var(--latte-crust);
  border-top: 1px solid var(--latte-surface0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--latte-subtext1);
}

.status-online {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--latte-green);
  animation: pulse 2s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-encoding {
  font-family: "JetBrains Mono", monospace;
  color: var(--latte-overlay0);
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--latte-surface0);
  background: var(--latte-base);
  color: var(--latte-subtext1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-toggle:hover {
  color: var(--latte-text);
}

.settings-toggle .material-symbols-outlined {
  font-size: 18px;
}

.sidebar-settings {
  position: absolute;
  right: 12px;
  bottom: 52px;
  width: min(300px, calc(100vw - 24px));
  background: var(--latte-base);
  border: 1px solid var(--latte-surface0);
  border-radius: 10px;
  box-shadow: var(--panel-shadow);
  padding: 12px;
  z-index: 120;
}

.sidebar-settings-title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--latte-text);
}

.settings-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-group legend {
  font-size: 0.75rem;
  color: var(--latte-subtext1);
  margin-bottom: 8px;
}

.settings-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--latte-subtext1);
  padding: 6px 0;
}

.settings-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.settings-segment-option {
  position: relative;
  min-width: 0;
}

.settings-segment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-segment-option span {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--latte-surface0);
  background: var(--latte-mantle);
  color: var(--latte-subtext1);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.settings-segment-option input:checked + span {
  border-color: var(--latte-mauve);
  background: rgba(136, 57, 239, 0.14);
  color: var(--latte-text);
}

.settings-segment-option input:focus-visible + span {
  outline: 2px solid var(--latte-blue);
  outline-offset: 1px;
}

.settings-close {
  margin-top: 10px;
  width: 100%;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--latte-surface0);
  background: var(--latte-mantle);
  color: var(--latte-text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.settings-close:hover {
  background: var(--latte-base);
}

/* Viewer */
.viewer {
  overflow-y: auto;
  background: var(--latte-base);
  position: relative;
  min-width: 0;
}

.mobile-menu-toggle {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--latte-mauve);
  color: #fff;
  min-height: 48px;
  padding: 0 16px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(136, 57, 239, 0.25);
  cursor: pointer;
}

.mobile-menu-toggle .material-symbols-outlined {
  font-size: 20px;
}

body.mobile-toggle-left .mobile-menu-toggle {
  left: 18px;
  right: auto;
}

.viewer-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

/* Breadcrumb */
.viewer-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--latte-overlay0);
  margin-bottom: 24px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.breadcrumb-sep {
  font-size: 14px;
  color: var(--latte-surface2);
  flex: 0 0 auto;
}

.breadcrumb-item {
  flex: 0 0 auto;
}

.breadcrumb-ellipsis {
  flex: 0 0 auto;
  color: var(--latte-surface2);
}

.breadcrumb-current {
  color: var(--latte-mauve);
  font-weight: 500;
  flex: 0 0 auto;
}

.breadcrumb-info {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 16px;
  color: var(--latte-overlay0);
  cursor: help;
  padding-left: 8px;
}

.breadcrumb-info:hover {
  color: var(--latte-text);
}

/* Viewer header */
.viewer-header {
  margin-bottom: 32px;
}

.viewer-title {
  margin: 0 0 16px;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--latte-text);
}

.viewer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--latte-subtext0);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--latte-overlay0);
}

.meta-tags {
  color: var(--latte-lavender);
}

.meta-tags .material-symbols-outlined {
  color: var(--latte-lavender);
}

/* Viewer content */
.viewer-content {
  line-height: 1.82;
  font-size: 1.02rem;
  max-width: 72ch;
  margin: 0 auto;
  text-wrap: pretty;
  color: var(--latte-subtext0);
}

.viewer-content h1,
.viewer-content h2,
.viewer-content h3,
.viewer-content h4 {
  color: var(--latte-text);
  font-weight: 600;
  line-height: 1.35;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.viewer-content h1 { font-size: 2rem; }
.viewer-content h2 { font-size: 1.5rem; }
.viewer-content h3 { font-size: 1.25rem; }

.viewer-content p {
  margin-bottom: 1.25rem;
}

.viewer-content p,
.viewer-content li,
.viewer-content blockquote {
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: auto;
  letter-spacing: -0.01em;
}

.viewer-content strong {
  color: var(--latte-text);
}

.viewer-content a {
  color: var(--latte-blue);
}

.viewer-content ul,
.viewer-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

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

.viewer-content blockquote {
  margin: 1.5rem 0;
  padding: 12px 16px;
  padding-left: 20px;
  border-left: 4px solid var(--latte-mauve);
  background: rgba(230, 233, 239, 0.5);
  border-radius: 0 8px 8px 0;
  font-style: normal;
  color: var(--latte-subtext0);
}

/* Inline code */
.viewer-content :not(pre) > code {
  background: var(--latte-mantle);
  border: 1px solid var(--latte-surface0);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88em;
  color: var(--latte-mauve);
}

/* Code blocks */
.viewer-content .code-block {
  margin: 1.5rem 0;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #24292e;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.code-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #2b313a;
  border-bottom: 1px solid #30363d;
}

.code-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background: var(--latte-red); }
.dot-yellow { background: var(--latte-yellow); }
.dot-green { background: var(--latte-green); }

.code-filename {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: #aeb7c2;
  text-align: center;
}

.code-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #aeb7c2;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.code-copy:hover {
  color: #f0f6fc;
  background: rgba(240, 246, 252, 0.14);
}

.code-copy .material-symbols-outlined {
  font-size: 16px;
}

.code-copy.copied {
  color: var(--latte-green);
}

.viewer-content .code-block pre {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent !important;
  color: inherit;
}

.viewer-content .code-block pre code {
  display: block;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.72;
  letter-spacing: 0.005em;
  background: transparent !important;
  color: inherit;
}

.viewer-content .code-block pre.shiki {
  margin: 0;
  border: 0;
}

.viewer-content .code-block pre.shiki code {
  white-space: normal;
  tab-size: 2;
}

.viewer-content .code-block .line {
  display: block;
  line-height: inherit;
  white-space: pre;
  tab-size: 2;
}

.viewer-content pre {
  position: relative;
  margin: 1.5rem 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--latte-surface0);
  background: var(--latte-mantle);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.viewer-content pre code {
  display: block;
  padding: 16px;
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Tables */
.viewer-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.viewer-content th {
  background: var(--latte-mantle);
  font-weight: 600;
  text-align: left;
  color: var(--latte-text);
}

.viewer-content th,
.viewer-content td {
  padding: 12px 16px;
  border: 1px solid var(--latte-surface0);
}

.viewer-content tr:hover {
  background: rgba(230, 233, 239, 0.5);
}

/* Images */
.viewer-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--latte-surface0);
}

/* Horizontal rule */
.viewer-content hr {
  border: none;
  border-top: 1px solid var(--latte-surface0);
  margin: 2rem 0;
}

/* Post navigation */
.viewer-nav {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--latte-surface0);
}

.nav-link {
  flex: 1;
  padding: 16px;
  border: 1px solid var(--latte-surface0);
  border-radius: 8px;
  background: var(--active-surface-bg);
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link:hover {
  border-color: var(--latte-mauve);
  box-shadow: 0 2px 8px rgba(136, 57, 239, 0.1);
  text-decoration: none;
}

.nav-link-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--latte-overlay0);
  margin-bottom: 4px;
}

.nav-link:hover .nav-link-label {
  color: var(--latte-mauve);
}

.nav-link-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--latte-text);
}

.nav-link:hover .nav-link-title {
  color: var(--latte-mauve);
}

.nav-link-next {
  text-align: right;
}

.nav-link-next .nav-link-label {
  justify-content: flex-end;
}

/* Placeholder */
.placeholder {
  color: var(--latte-overlay0);
  font-style: italic;
}

/* 404 Page */
.not-found {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--latte-base);
  color: var(--latte-text);
}

.not-found-icon .material-symbols-outlined {
  font-size: 64px;
  color: var(--latte-overlay0);
}

.not-found h1 {
  font-size: 4rem;
  font-weight: 700;
  margin: 0;
  color: var(--latte-text);
}

.not-found p {
  color: var(--latte-subtext0);
  margin: 0;
}

.not-found-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--latte-mauve);
  color: white;
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.not-found-link:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.not-found-link .material-symbols-outlined {
  font-size: 18px;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-root {
    grid-template-columns: 1fr;
  }

  .app-splitter {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 70vw;
    min-width: 300px;
    max-width: 560px;
    border-right: 1px solid var(--latte-surface0);
    border-bottom: 0;
    box-shadow: var(--sidebar-mobile-shadow);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    z-index: 100;
  }

  .app-root.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .viewer-container {
    max-width: 760px;
    padding: 28px 24px 104px;
  }

  .viewer-title {
    font-size: 1.75rem;
  }

  .viewer-meta {
    flex-wrap: wrap;
    row-gap: 8px;
  }

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

  .viewer-content p {
    margin-bottom: 1.35rem;
  }

  .viewer-nav {
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .sidebar {
    width: 100vw;
    min-width: 0;
    max-width: none;
  }

  .viewer-container {
    padding: 20px 18px 104px;
  }

  .viewer-content {
    font-size: 1.01rem;
    line-height: 1.88;
    max-width: 65ch;
  }

  .viewer-content h1 {
    font-size: 1.72rem;
  }

  .viewer-content h2 {
    font-size: 1.34rem;
  }

  .viewer-content h3 {
    font-size: 1.16rem;
  }

  .viewer-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
