:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1c1c1e;
  background: #f5f5f7;
  font-synthesis: none;
  --bg: #f5f5f7;
  --panel: #fff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --blue: #0071e3;
  --tint: #eaf3ff;
  --input: #e9e9ee;
  --glass: rgba(250, 250, 253, 0.86);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  color: inherit;
  border: 0;
  background: none;
  min-height: 44px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #007aff;
  outline-offset: 3px;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -1.3px;
  font-weight: 720;
}
h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
}
h3 {
  font-size: 18px;
  line-height: 1.35;
}
p {
  line-height: 1.6;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
  font-size: 14px;
}
.app {
  max-width: 1600px;
  min-height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 34px 22px;
  background: var(--glass);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.brand {
  font-size: 20px;
  letter-spacing: -0.5px;
  font-weight: 650;
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: var(--blue);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 24px;
}
.sidebar-caption,
.eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 1.3px;
  color: var(--muted);
}
.sidebar-caption {
  margin: 36px 14px 0;
}
.desktop-nav {
  display: grid;
  gap: 5px;
}
.desktop-nav button {
  text-align: left;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
}
.desktop-nav button.active {
  background: var(--tint);
  color: var(--blue);
}
.privacy {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}
.privacy span {
  color: #34c759;
  font-size: 10px;
}
.quiet {
  color: var(--blue);
  text-align: left;
  font-size: 14px;
}
main {
  padding: 58px clamp(28px, 5vw, 90px) 60px;
  max-width: 1200px;
  width: 100%;
  min-width: 0;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}
.eyebrow {
  margin-bottom: 12px;
}
#page-subtitle {
  margin-top: 12px;
}
.circle-button {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  background: var(--panel);
  color: var(--blue);
  font-size: 32px;
  line-height: 1;
  box-shadow: 0 2px 8px #00000005;
  flex-shrink: 0;
}
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--input);
  border-radius: 15px;
  padding: 3px 6px 3px 17px;
}
.search svg {
  width: 21px;
  height: 21px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}
.search input {
  border: 0;
  background: transparent;
  outline: none;
  padding: 14px 0;
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-size: 17px;
}
.search button {
  color: var(--blue);
  padding: 0 14px;
  font-size: 15px;
  font-weight: 550;
}
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0 28px;
  flex-wrap: wrap;
}
.filters select {
  max-width: 100%;
  min-height: 40px;
  border: 0;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}
.semantic-toggle {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.semantic-toggle input {
  accent-color: var(--blue);
  width: 17px;
  height: 17px;
}
.ask-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 20px 24px;
  background: var(--panel);
  border-radius: 20px;
  text-align: left;
}
.ask-banner strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
}
.ask-banner small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}
.spark {
  font-size: 30px;
  color: var(--blue);
}
.chevron {
  font-size: 26px;
  color: #c7c7cc;
  margin-left: auto;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 34px 0 16px;
  gap: 12px;
}
.material-list {
  background: var(--panel);
  border-radius: 20px;
  overflow: hidden;
}
.material-row {
  display: flex;
  width: 100%;
  text-align: left;
  padding: 22px;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.material-row:last-child {
  border-bottom: 0;
}
.material-row:hover {
  background: var(--tint);
}
.type-icon {
  width: 50px;
  height: 62px;
  border-radius: 11px;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 25px;
  flex-shrink: 0;
  color: var(--blue);
}
.type-icon.instagram {
  color: #af52de;
}
.type-icon.document {
  color: #ff9500;
}
.row-copy {
  min-width: 0;
  flex: 1;
}
.row-copy h3 {
  overflow-wrap: anywhere;
  font-weight: 600;
  font-size: 17px;
}
.row-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.row-preview {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.row-chevron {
  font-size: 23px;
  color: #c7c7cc;
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}
.primary,
.secondary {
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 550;
}
.primary {
  background: var(--blue);
  color: white;
}
.primary:hover {
  filter: brightness(1.08);
}
.secondary {
  background: var(--panel);
  color: var(--blue);
}
.status {
  margin-top: 20px;
  line-height: 1.5;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.status.error {
  color: #c93434;
}
.empty {
  padding: 60px 24px;
  text-align: center;
  background: var(--panel);
  border-radius: 20px;
  color: var(--muted);
}
.empty h2 {
  color: var(--text);
  margin-bottom: 10px;
}
.back {
  color: var(--blue);
  padding: 0;
  margin-bottom: 24px;
}
.detail-title {
  font-size: 34px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  letter-spacing: -0.8px;
}
.detail-meta {
  font-size: 14px;
  color: var(--muted);
  margin: 14px 0 20px;
}
.tag {
  display: inline-block;
  background: var(--tint);
  color: var(--blue);
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
  margin: 0 6px 8px 0;
}
.segments {
  display: flex;
  background: var(--input);
  padding: 3px;
  border-radius: 11px;
  margin: 24px 0 30px;
}
.segments button {
  flex: 1;
  border-radius: 8px;
  font-size: 14px;
  min-height: 36px;
}
.segments button[aria-selected="true"] {
  background: var(--panel);
  box-shadow: 0 1px 4px #0000000d;
  font-weight: 550;
}
#detail-content {
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.reading {
  font-size: 17px;
  white-space: pre-wrap;
  margin: 18px 0 28px;
}
.reading-section {
  margin: 28px 0;
}
.reading-section h2 {
  font-size: 20px;
  margin-bottom: 14px;
}
.source-card,
.note-card,
.citation {
  padding: 22px;
  background: var(--panel);
  border-radius: 16px;
  margin: 16px 0;
}
.source-card header {
  color: var(--blue);
  font-size: 14px;
  font-weight: 550;
}
.source-card pre {
  font-family: inherit;
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 14px 0 0;
}
.source-origin {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}
.notice {
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--input);
  font-size: 14px;
  color: var(--muted);
  margin: 20px 0;
}
.note-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.6;
}
.note-actions {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}
.note-actions button {
  color: var(--blue);
  font-size: 14px;
}
.note-actions .danger {
  color: #d32f2f;
}
.section-intro {
  max-width: 650px;
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 16px;
}
.ask-form {
  padding: 28px;
  background: var(--panel);
  border-radius: 20px;
  display: grid;
  gap: 14px;
  max-width: 760px;
}
.ask-form label {
  font-size: 18px;
  font-weight: 600;
}
textarea {
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  width: 100%;
}
.ask-form .primary {
  justify-self: start;
}
.answer-box {
  margin: 30px 0;
  font-size: 17px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.citation {
  display: block;
  text-align: left;
  width: 100%;
  color: var(--text);
}
.citation strong {
  display: block;
  font-weight: 600;
}
.citation small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
}
.citation blockquote {
  margin: 12px 0 0;
  border-left: 3px solid var(--blue);
  padding-left: 14px;
  font-size: 15px;
  line-height: 1.6;
}
.login {
  padding-top: 40px;
  max-width: 680px;
}
.login h1 {
  font-size: 46px;
  margin: 24px 0;
}
.login > p {
  font-size: 18px;
  color: var(--muted);
}
.login-symbol {
  font-size: 48px;
  color: var(--blue);
}
.login-box {
  background: var(--panel);
  padding: 28px;
  border-radius: 20px;
  margin-top: 36px;
}
.login-box h2 {
  margin-bottom: 14px;
}
.login-box p {
  margin: 12px 0;
}
.tabbar {
  display: none;
}
.sr-only,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip:focus {
  position: fixed;
  z-index: 99;
  background: var(--panel);
  padding: 15px;
  left: 10px;
  top: 10px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--text);
  width: min(580px, calc(100% - 32px));
  padding: 26px;
  box-shadow: 0 20px 80px #0002;
}
dialog::backdrop {
  background: #171b2644;
  backdrop-filter: blur(5px);
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 20px;
}
#note-form {
  display: grid;
  gap: 14px;
}
#note-form .primary {
  justify-self: end;
}
@media (max-width: 800px) {
  .app {
    display: block;
  }
  .sidebar {
    display: none;
  }
  main {
    padding: 40px 20px calc(120px + env(safe-area-inset-bottom));
    max-width: 680px;
    margin: auto;
  }
  .page-header {
    margin-bottom: 25px;
  }
  h1 {
    font-size: 34px;
  }
  .eyebrow {
    display: none;
  }
  #page-subtitle {
    font-size: 14px;
    line-height: 1.5;
  }
  .circle-button {
    width: 42px;
    height: 42px;
  }
  .search {
    border-radius: 13px;
  }
  .search input {
    font-size: 16px;
  }
  .search button {
    font-size: 14px;
    padding: 0 9px;
  }
  .filters {
    gap: 8px;
    margin-bottom: 23px;
  }
  .filters select {
    font-size: 12px;
    max-width: 48%;
  }
  .ask-banner {
    padding: 18px;
    border-radius: 18px;
    gap: 14px;
  }
  .ask-banner small {
    font-size: 12px;
  }
  .ask-banner strong {
    font-size: 16px;
  }
  .section-heading {
    margin-top: 28px;
  }
  h2 {
    font-size: 22px;
  }
  .material-row {
    padding: 18px 15px;
    gap: 14px;
  }
  .type-icon {
    width: 44px;
    height: 56px;
  }
  .row-copy h3 {
    font-size: 16px;
  }
  .row-preview {
    font-size: 13px;
  }
  .row-chevron {
    display: none;
  }
  .tabbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(15px + env(safe-area-inset-bottom));
    width: min(calc(100% - 36px), 400px);
    display: flex;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    padding: 6px;
    border-radius: 36px;
    border: 1px solid #ffffff8c;
    box-shadow: 0 4px 18px #181a3410;
    z-index: 5;
  }
  .tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-radius: 28px;
    min-height: 54px;
    padding: 7px 3px;
    font-size: 10px;
    color: var(--muted);
  }
  .tabbar button.active {
    background: var(--tint);
    color: var(--blue);
  }
  .tabbar svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linejoin: round;
  }
  .detail-title {
    font-size: 30px;
  }
  .source-card,
  .note-card,
  .citation {
    padding: 18px;
  }
  .ask-form {
    padding: 20px;
  }
  .login {
    padding-top: 30px;
  }
  .login h1 {
    font-size: 36px;
  }
  .login-box {
    padding: 22px;
  }
  .reading {
    font-size: 17px;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --panel: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: #333336;
    --blue: #409cff;
    --tint: #18334c;
    --input: #252528;
    --glass: rgba(32, 32, 35, 0.88);
    background: var(--bg);
    color: var(--text);
  }
  .tabbar {
    border-color: #ffffff1c;
  }
  .primary {
    color: #071b2d;
  }
  .status.error {
    color: #ff8a80;
  }
  .note-actions .danger {
    color: #ff8a80;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button,
  a {
    transition:
      background-color 0.15s,
      color 0.15s;
  }
  .note-card,
  .source-card,
  .material-list {
    animation: appear 0.2s ease-out;
  }
  @keyframes appear {
    from {
      opacity: 0.5;
      transform: translateY(3px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
@media (prefers-contrast: more) {
  :root {
    --muted: var(--text);
  }
  .material-row {
    border-bottom-width: 2px;
  }
  .tabbar {
    background: var(--panel);
    backdrop-filter: none;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar,
  .tabbar {
    background: var(--panel);
    backdrop-filter: none;
  }
}
.logged-out .sidebar {
  visibility: hidden;
}
.logged-out main {
  grid-column: 2;
}
.logged-out .app {
  display: block;
}
@media (max-width: 800px) {
  .logged-out main {
    grid-column: auto;
  }
}
