:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 252, 246, 0.82);
  --panel-strong: rgba(255, 251, 244, 0.94);
  --ink: #1e1d1a;
  --muted: #695f4c;
  --line: rgba(73, 61, 36, 0.16);
  --accent: #8f4a21;
  --accent-soft: #d7b596;
  --shadow: 0 18px 40px rgba(71, 48, 21, 0.12);
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(207, 158, 103, 0.22), transparent 32%),
    linear-gradient(180deg, #f3ecdf 0%, var(--bg) 100%);
}

a {
  color: var(--accent);
}

.eyebrow {
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin: 0;
}

.lab-browser {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 10px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 1rem 0.85rem 1rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(249, 244, 236, 0.96);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

.sidebar-top,
.sidebar-controls,
.viewer-topbar,
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-controls {
  align-items: stretch;
}

.app-title {
  font-size: 2rem;
  line-height: 1;
  margin: 0.15rem 0 0;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 0.72rem 0.88rem;
  font: inherit;
  color: var(--ink);
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.ghost-button:hover,
.exploration-link:hover {
  background: rgba(255, 255, 255, 0.92);
}

.exploration-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.exploration-link {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 14px;
  text-align: left;
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.exploration-link.active {
  background: var(--panel-strong);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.exploration-title {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
}

.exploration-meta {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.resize-handle {
  cursor: col-resize;
  background: linear-gradient(180deg, rgba(143, 74, 33, 0.08), rgba(143, 74, 33, 0.18), rgba(143, 74, 33, 0.08));
}

.viewer {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.viewer-topbar {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 232, 0.92);
  position: sticky;
  top: 0;
  z-index: 2;
}

.viewer-heading {
  min-width: 0;
  flex: 1;
}

.viewer-heading h2 {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
}

.viewer-subtitle {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.45;
  max-width: 58rem;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.viewer-canvas {
  flex: 1;
  min-height: 0;
}

.viewer-canvas iframe {
  width: 100%;
  height: calc(100vh - 82px);
  border: 0;
  background: transparent;
}

.viewer-mobile-toggle {
  display: none;
}

.viewer-restore-toggle {
  display: none;
}

.sidebar-collapsed {
  grid-template-columns: 0 0 minmax(0, 1fr);
}

.sidebar-collapsed .sidebar,
.sidebar-collapsed .resize-handle {
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sidebar-collapsed .viewer-restore-toggle {
  display: inline-flex;
}

.about-dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  width: min(620px, calc(100vw - 2rem));
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.about-dialog::backdrop {
  background: rgba(38, 28, 18, 0.28);
}

.about-copy {
  padding: 1.25rem 1.35rem;
}

.content {
  max-width: 1080px;
  margin: 0 auto;
}

h1 {
  margin: 0.25rem 0 0.75rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.96;
}

.lede {
  max-width: 52rem;
  font-size: 1.08rem;
  line-height: 1.65;
  margin: 0;
}

.content {
  padding: 1.15rem 1.25rem 4rem;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.panel {
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.5rem;
}

.panel h2,
.panel h3,
.card h3 {
  margin-top: 0;
}

.asset-preview {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.exploration-body .content {
  max-width: 1120px;
  padding-top: 0.35rem;
}

.exploration-body .flat-section {
  padding: 0.55rem 0 0.9rem;
  margin: 0;
}

.exploration-body .flat-section + .flat-section {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.exploration-body .panel,
.exploration-body .card,
.exploration-body .flat-section {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border-left: 0;
  border-right: 0;
}

.exploration-body .panel {
  border: 0;
  padding: 0;
  margin: 0;
}

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.section-title-row h2,
.flat-section h2 {
  margin: 0;
  font-size: 1.55rem;
}

.section-title-row a {
  font-size: 0.98rem;
  white-space: nowrap;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.comparison-grid h3 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
}

.supporting-chart-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.supporting-chart h3 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid rgba(73, 61, 36, 0.1);
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(215, 181, 150, 0.22);
}

ul {
  line-height: 1.6;
}

.panel-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.small-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.link-button {
  display: inline-flex;
  align-items: center;
}

.is-resizing {
  cursor: col-resize;
  user-select: none;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 360px);
    z-index: 5;
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: var(--shadow);
  }

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

  .resize-handle {
    display: none;
  }

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

  .viewer-restore-toggle {
    display: none !important;
  }

  .viewer-canvas iframe {
    height: calc(100vh - 86px);
  }
}

@media (max-width: 720px) {
  .sidebar-controls,
  .viewer-topbar,
  .dialog-top {
    flex-wrap: wrap;
  }

  .viewer-heading {
    width: auto;
    order: 0;
  }

  .viewer-topbar {
    padding: 0.55rem 0.65rem;
    gap: 0.45rem;
  }

  .viewer-heading .eyebrow,
  .viewer-subtitle {
    display: none;
  }

  .viewer-heading h2 {
    font-size: 1rem;
    margin: 0;
    line-height: 1.2;
  }

  .viewer-actions {
    gap: 0.35rem;
  }

  .viewer-actions .ghost-button,
  .viewer-mobile-toggle,
  .viewer-restore-toggle {
    padding: 0.45rem 0.55rem;
    border-radius: 9px;
    font-size: 0.9rem;
  }

  .viewer-canvas iframe {
    height: calc(100vh - 52px);
  }

  .section-title-row {
    display: block;
  }

  .section-title-row a {
    display: inline-block;
    margin-top: 0.3rem;
  }

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