:root {
  --bg: #050505;
  --bg-soft: #0c0c0c;
  --pane: #101010;
  --pane-hover: #1a1a1a;
  --line: #262626;
  --line-strong: #3a3a3a;
  --text: #f4f4f4;
  --text-dim: #9c9c9c;
  --accent: #f9f9f9;
  --radius-lg: 20px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  color-scheme: dark;
}

body {
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.08), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(255, 255, 255, 0.05), transparent 22%),
    linear-gradient(165deg, #030303 0%, #090909 45%, #050505 100%);
  line-height: 1.6;
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.08);
}

.skip-link {
  position: absolute;
  top: -50px;
  left: 12px;
  z-index: 99;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: #000;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 12px;
}

.app-shell {
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0.75rem;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 0.9rem;
  overflow: hidden;
}

.sheet-pane,
.content-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.sheet-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sheet-head {
  padding: 1.1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sheet-head h1 {
  margin: 0.4rem 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  letter-spacing: 0.03em;
  line-height: 0.95;
  font-weight: 400;
  text-wrap: balance;
}

.sheet-meta {
  margin: 0 0 0.7rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.sheet-head label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.sheet-head input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  color: var(--text);
  padding: 0.62rem 0.72rem;
  font: inherit;
}

.sheet-head input::placeholder {
  color: #8e8e8e;
}

.sheet-head input:focus-visible,
.sheet-list button:focus-visible,
.source-link:focus-visible {
  outline: 2px solid #d8d8d8;
  outline-offset: 2px;
}

.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0.8rem;
  display: grid;
  gap: 0.45rem;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.sheet-list li {
  content-visibility: auto;
  contain-intrinsic-size: 2.6rem;
}

.sheet-list button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: #0d0d0d;
  color: var(--text);
  text-align: left;
  padding: 0.72rem;
  cursor: pointer;
  font: inherit;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sheet-list button:hover {
  border-color: var(--line-strong);
  background: var(--pane-hover);
  transform: translateX(3px);
}

.sheet-list button.active {
  border-color: #5a5a5a;
  background: linear-gradient(90deg, #1d1d1d, #111111);
}

.sheet-id {
  display: block;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
}

.sheet-title {
  display: block;
  margin-top: 0.16rem;
  overflow-wrap: anywhere;
}

.content-pane {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(0.9rem, 2.4vw, 1.5rem);
}

.content-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 16, 16, 0.97), rgba(16, 16, 16, 0.86));
  backdrop-filter: blur(6px);
}

.question-number {
  margin: 0;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
}

.content-head h2 {
  margin: 0.35rem 0;
  font-size: clamp(1.2rem, 2.4vw, 2rem);
  line-height: 1.2;
  text-wrap: balance;
}

.source-link {
  color: #d6d6d6;
  text-decoration-color: #6a6a6a;
  text-underline-offset: 3px;
}

.source-link:hover {
  color: #fff;
}

.answer-content {
  margin-top: 1rem;
  overflow-wrap: anywhere;
}

.answer-content p,
.answer-content li,
.answer-content blockquote,
.answer-content h1,
.answer-content h2,
.answer-content h3,
.answer-content h4 {
  overflow-wrap: anywhere;
}

.answer-content pre {
  max-width: 100%;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #0b0b0b;
  padding: 0.8rem;
}

.answer-content code {
  font-family: "JetBrains Mono", monospace;
}

.answer-content table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background: #0a0a0a;
}

.answer-content th,
.answer-content td {
  border: 1px solid var(--line-strong);
  padding: 0.52rem;
  vertical-align: top;
  word-break: break-word;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #0a0a0a;
}

.table-wrap table {
  min-width: 100%;
  border: 0;
}

.table-wrap th {
  background: #121212;
  font-weight: 600;
}

.floating-nav {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: grid;
  gap: 0.5rem;
}

.floating-nav button {
  min-width: 122px;
  border: 1px solid #4c4c4c;
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.92);
  color: #efefef;
  padding: 0.56rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.floating-nav button:hover {
  background: rgba(30, 30, 30, 0.96);
  border-color: #707070;
  transform: translateY(-1px);
}

.floating-nav button:focus-visible {
  outline: 2px solid #e4e4e4;
  outline-offset: 2px;
}

.floating-nav button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 1024px) {
  .app-shell {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    padding: 0.7rem;
  }

  .sheet-pane {
    max-height: min(44dvh, 500px);
  }

  .content-pane {
    max-height: min(52dvh, 760px);
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: 100vw;
    margin: 0;
    border-radius: 0;
    border: 0;
    height: 100dvh;
  }

  .sheet-pane,
  .content-pane {
    border-radius: 16px;
  }

  .sheet-pane {
    max-height: 42dvh;
  }

  .content-pane {
    max-height: 58dvh;
  }

  .floating-nav {
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    grid-template-columns: 1fr 1fr;
  }

  .floating-nav button {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

