:root {
  color-scheme: dark;
  --bg: #000000;
  --card: #1c1c1e;
  --button: #2c2c2e;
  --button-strong: #38383a;
  --accent: #30d6c7;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --line: #303033;
  --danger: #ff453a;
  --radius: 8px;
  --tap: 48px;
  --content-width: 520px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

noscript {
  display: block;
  padding: 16px;
  color: var(--text);
}

.app {
  width: min(100%, var(--content-width));
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(5px, env(safe-area-inset-top)) 6px calc(8px + env(safe-area-inset-bottom));
}

body.has-bottom-nav .app {
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

.screen {
  display: flex;
  min-height: calc(100dvh - 24px);
  flex-direction: column;
  gap: 6px;
}

.home-screen {
  justify-content: flex-start;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 2px 2px 4px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0;
}

.subtle,
.meta,
.empty,
.counter {
  color: var(--muted);
}

.meta,
.counter {
  font-size: 14px;
  line-height: 1.35;
}

.toolbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.toolbar-title {
  min-width: 0;
  text-align: center;
}

.toolbar-title h2,
.toolbar-title .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--button);
  color: var(--text);
  cursor: pointer;
}

.toolbar-spacer {
  visibility: hidden;
}

.icon-button:focus-visible,
.menu-button:focus-visible,
.list-button:focus-visible,
.bottom-button:focus-visible,
.search-input:focus-visible,
.initial-search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-button[disabled],
.bottom-button[disabled],
.menu-button[disabled] {
  cursor: default;
  opacity: .38;
}

.menu-grid,
.list-stack {
  display: grid;
  gap: 9px;
}

.menu-button,
.list-button {
  display: grid;
  width: 100%;
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius);
  background: var(--button);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.menu-button {
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.menu-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  font-size: 22px;
}

.menu-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.menu-title,
.list-title {
  overflow-wrap: anywhere;
  font-weight: 720;
  line-height: 1.25;
}

.menu-detail,
.list-detail {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.list-button {
  align-items: center;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
}

.pill {
  display: inline-flex;
  min-width: 34px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--button-strong);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  padding: 4px 8px;
}

.card,
.search-panel,
.answer-card {
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: var(--radius);
  background: var(--card);
}

.question-card {
  scroll-margin-top: 34px;
  display: grid;
  gap: 4px;
  padding: 1px 0 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.question-feed > .question-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 260px;
}

.question-feed-results {
  display: grid;
  gap: 6px;
}

.question-search {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: 3px;
  background: var(--bg);
}

.initial-search {
  width: 100%;
  min-height: 30px;
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  padding: 3px 6px;
  font-size: 14px;
  line-height: 1.2;
}

.initial-search::placeholder {
  color: var(--muted);
}

.is-search-hidden {
  display: none !important;
}

.search-empty {
  padding: 16px 8px;
  color: var(--muted);
  text-align: center;
}

.card,
.search-panel {
  padding: 12px;
}

.search-panel {
  display: grid;
  gap: 10px;
}

.search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101012;
  color: var(--text);
  padding: 10px 12px;
}

.search-input::placeholder {
  color: #69696e;
}

.virtual-panel {
  position: relative;
  height: min(62dvh, 560px);
  min-height: 180px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--button-strong) transparent;
}

.virtual-spacer {
  position: relative;
  width: 100%;
}

.virtual-row {
  position: absolute;
  left: 0;
  right: 0;
  padding-bottom: 8px;
}

.question-shell {
  gap: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border-radius: 999px;
  background: var(--button);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 7px 9px;
}

.answer-card {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.question-text {
  font-size: 15px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.question-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #ffffff;
}

.option-list {
  display: grid;
  gap: 2px;
}

.option-item {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.option-item.correct-option {
  color: var(--danger);
  font-weight: 700;
}

.divider {
  height: 1px;
  margin: 2px 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.answer-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.answer-text {
  color: var(--accent);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.bottom-nav {
  position: fixed;
  right: max(12px, calc((100vw - var(--content-width)) / 2 + 12px));
  bottom: env(safe-area-inset-bottom);
  left: max(12px, calc((100vw - var(--content-width)) / 2 + 12px));
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), #000 24%, #000 100%);
}

.bottom-button {
  min-height: 52px;
  border: 0;
  border-radius: var(--radius);
  background: var(--button);
  color: var(--text);
  font-weight: 760;
  cursor: pointer;
}

.bottom-button.primary {
  background: var(--accent);
  color: #001210;
}

.empty {
  padding: 16px 8px;
  text-align: center;
}

.error {
  border: 1px solid rgba(255, 69, 58, .35);
  border-radius: var(--radius);
  background: rgba(255, 69, 58, .1);
  color: #ffd2cf;
  padding: 12px;
}

.loading {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 260px) {
  :root {
    --tap: 46px;
  }

  body {
    font-size: 14px;
    line-height: 1.3;
  }

  .app {
    padding: max(2px, env(safe-area-inset-top)) 4px calc(5px + env(safe-area-inset-bottom));
  }

  .screen {
    gap: 4px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 20px;
  }

  .search-panel {
    display: none;
  }

  .menu-grid,
  .list-stack {
    gap: 8px;
  }

  .menu-button {
    grid-template-columns: 30px 1fr;
    gap: 8px;
    min-height: 46px;
    padding: 8px 10px;
  }

  .menu-icon {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }

  .menu-detail,
  .list-detail,
  .meta {
    font-size: 12px;
  }

  .list-button {
    min-height: 46px;
    padding: 10px;
  }

  .virtual-panel {
    height: calc(100dvh - 112px);
    min-height: 130px;
  }

  .question-text {
    font-size: 14px;
    line-height: 1.3;
  }

  .answer-text {
    font-size: 20px;
  }

  .question-card,
  .answer-card {
    gap: 3px;
    padding: 1px 0 7px;
  }

  .option-list {
    gap: 1px;
  }

  .option-item {
    min-height: 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.25;
  }

  .initial-search {
    min-height: 40px;
    padding: 7px 8px;
    font-size: 15px;
    line-height: 1.25;
  }

  .bottom-button {
    min-height: 50px;
  }
}

@media (min-width: 720px) {
  body {
    font-size: 19px;
  }

  h1 {
    font-size: 34px;
  }

  .app {
    padding-top: 24px;
  }
}
