/* Self-hosted Hebrew font: keeps the UI consistent on Windows, macOS, Linux, and mobile. */
@font-face {
  font-family: "Noto Sans Hebrew";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./assets/fonts/noto-sans-hebrew-hebrew.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Noto Sans Hebrew";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./assets/fonts/noto-sans-hebrew-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #172033;
  --muted: #6f7a8f;
  --line: #e3e7ef;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --navy: #101a2b;
  --blue: #315efb;
  --blue-soft: #edf1ff;
  --mint: #dff6eb;
  --mint-ink: #0e7550;
  --orange: #f5a33b;
  --shadow: 0 18px 55px rgba(31, 45, 74, .08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  font-family: "Noto Sans Hebrew", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(49, 94, 251, .25); outline-offset: 2px; }

.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; }
.app-shell { min-height: 100vh; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; max-width: 1440px; padding: 0 44px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.topbar-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: #45ba87; box-shadow: 0 0 0 4px #e4f6ee; }

main { max-width: 1440px; padding: 0 44px 34px; margin: 0 auto; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; min-height: 290px; padding: 48px 52px 46px; border-radius: var(--radius-lg); color: #fff; background: radial-gradient(circle at 16% 20%, rgba(98, 133, 255, .32), transparent 32%), linear-gradient(122deg, #101a2b 0%, #172a49 64%, #1c355d 100%); overflow: hidden; position: relative; }
.hero::after { content: ""; width: 440px; height: 440px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; position: absolute; inset: -260px auto auto -130px; pointer-events: none; }
.hero-copy, .hero-actions { position: relative; z-index: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: 10px; margin: 0 0 12px; color: var(--blue); }
.hero .eyebrow { color: #a9bbff; }
.hero h1 { margin: 0; font-size: clamp(31px, 4vw, 57px); line-height: 1.03; letter-spacing: -.055em; font-weight: 800; }
.hero h1 em { color: #a9bbff; font-style: normal; }
.hero-description { max-width: 570px; color: #c4cede; line-height: 1.6; font-size: 14px; margin: 20px 0 0; }
.hero-actions { display: flex; align-items: center; gap: 10px; padding-bottom: 2px; }
.button { border: 0; border-radius: 11px; min-height: 42px; padding: 0 16px; font-weight: 750; font-size: 12px; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 18px rgba(49, 94, 251, .22); }
.button-primary:hover { background: #244fe8; }
.button-quiet { background: rgba(255,255,255,.10); color: #dae1ee; }
.button-quiet:hover { background: rgba(255,255,255,.16); }
.button-secondary { color: var(--blue); background: var(--blue-soft); }
.button-secondary:hover { background: #dfe6ff; }

.stats-strip { display: grid; grid-template-columns: 1fr 1fr 1fr 2.2fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 18px 0 28px; border-radius: 15px; overflow: hidden; }
.stat { min-height: 76px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 12px 20px; background: var(--surface); }
.stat strong { font-size: 24px; letter-spacing: -.05em; line-height: 1; }
.stat > span, .stat-progress-label span { font-size: 11px; color: var(--muted); }
.stat-progress { gap: 10px; }
.stat-progress-label { display: flex; align-items: baseline; justify-content: space-between; }
.stat-progress-label strong { color: var(--blue); }
.progress-track { height: 7px; width: 100%; border-radius: 99px; background: #e9edf4; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #6c8aff); border-radius: inherit; transition: width .3s ease; }

.workspace { display: grid; grid-template-columns: 305px minmax(0, 1fr); gap: 30px; align-items: start; }
.filters { padding: 22px 0; position: sticky; top: 12px; }
.filters-heading, .content-heading, .label-row, .attempt-heading, .solution-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.filters h2, .content-heading h2 { margin: 0; letter-spacing: -.045em; font-size: 25px; line-height: 1.05; }
.filters .eyebrow, .content-heading .eyebrow { margin-bottom: 9px; }
.filter-reset { border: 0; background: transparent; color: var(--blue); font-weight: 750; font-size: 11px; padding: 3px 0; }
.search-wrap { display: block; position: relative; margin: 24px 0 22px; }
.search-icon { position: absolute; top: 10px; right: 12px; color: var(--muted); font-size: 22px; line-height: 1; }
.search-wrap input { width: 100%; height: 42px; padding: 0 37px 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 11px; outline: 0; font-size: 12px; }
.search-wrap input::placeholder { color: #9aa4b4; }
.filter-group { margin: 17px 0; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.filter-row > div { min-width: 0; }
.filter-group > label, .filter-row label, .label-row label { display: block; color: var(--ink); font-size: 11px; font-weight: 800; margin-bottom: 8px; }
.filter-group select { width: 100%; height: 39px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; color: var(--ink); background: var(--surface); font-size: 12px; }
.label-row { align-items: baseline; }
.label-row label { margin-bottom: 0; }
.label-row span { color: var(--muted); font-size: 10px; }
.unit-group { margin-top: 24px; }
.unit-filters { display: grid; gap: 6px; max-height: 490px; overflow-y: auto; padding: 3px 2px 3px 0; margin-top: 10px; scrollbar-width: thin; }
.unit-filter { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #617087; text-align: right; padding: 9px 9px 9px 7px; font-size: 11px; line-height: 1.25; transition: .18s ease; }
.unit-filter:hover { background: #f2f5fa; color: var(--ink); }
.unit-filter.is-active { background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(16, 26, 43, .14); }
.unit-filter small { color: #97a2b3; font-size: 10px; font-weight: 800; }
.unit-filter.is-active small { color: #b9c7ff; }
.unit-number { direction: ltr; font-size: 10px; font-weight: 850; opacity: .72; }
.unit-name { min-width: 0; }
.topics-details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
.topics-details summary { cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 800; list-style: none; }
.topics-details summary::-webkit-details-marker { display: none; }
.topics-details summary::before { content: '+'; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--blue); }
.topics-details[open] summary::before { content: '−'; }
.topics-details .topic-filters { margin-top: 13px; }
.topic-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-filter { border: 1px solid var(--line); border-radius: 99px; background: var(--surface); padding: 7px 9px; color: #667286; font-size: 10px; line-height: 1; transition: .18s ease; }
.topic-filter:hover { border-color: #aebcff; color: var(--blue); }
.topic-filter.is-active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.filter-tip { display: flex; align-items: flex-start; gap: 9px; padding-top: 21px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); }
.filter-tip span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 6px; flex: 0 0 auto; font-size: 12px; }
.filter-tip p { font-size: 10px; line-height: 1.5; margin: 2px 0 0; }

.question-area { min-width: 0; }
.content-heading { align-items: flex-end; padding: 22px 0 17px; border-bottom: 1px solid var(--line); }
.result-summary { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.view-note { color: var(--muted); font-size: 11px; padding-bottom: 3px; white-space: nowrap; }
.question-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding-top: 18px; }
.question-card { min-width: 0; display: flex; flex-direction: column; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 19px; background: var(--surface); box-shadow: 0 3px 14px rgba(31,45,74, .025); transition: border .18s ease, box-shadow .18s ease, transform .18s ease; }
.question-card:hover { border-color: #bdcaff; box-shadow: var(--shadow); transform: translateY(-2px); }
.question-card.is-complete { border-color: #b7e9d2; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-badges { min-width: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.card-difficulty-badge { display: inline-flex; align-items: center; min-height: 23px; border-radius: 99px; padding: 0 8px; color: #566276; background: #f1f3f7; font-size: 9px; font-weight: 850; white-space: nowrap; }
.card-difficulty-badge.is-loading { color: #8994a7; background: #f5f6f8; }
.card-difficulty-badge.is-unrated { color: #7d8798; background: #f1f3f7; }
.card-difficulty-badge.is-easy { color: var(--mint-ink); background: var(--mint); }
.card-difficulty-badge.is-light { color: #315eaa; background: #eaf1ff; }
.card-difficulty-badge.is-medium { color: #8a6419; background: #fff3d8; }
.card-difficulty-badge.is-challenging { color: #a85e12; background: #ffead0; }
.card-difficulty-badge.is-hard { color: #a13c4c; background: #ffe4e8; }
.exam-label { color: var(--muted); font-size: 10px; line-height: 1.4; }
.type-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 99px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
.split-badge { color: #7a4b00; background: #fff0c7; }
.question-card.is-complete .type-badge { color: var(--mint-ink); background: var(--mint); }
.card-unit { color: var(--blue); font-size: 10px; font-weight: 800; margin-top: 16px; }
.question-card h3 { margin: 7px 0 11px; font-size: 20px; line-height: 1.05; letter-spacing: -.04em; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 21px; }
.card-tag { color: #758095; font-size: 10px; padding: 4px 7px; background: #f4f6f9; border-radius: 6px; }
.prompt-preview, .modal-prompt, .solution-content { direction: rtl; unicode-bidi: plaintext; white-space: pre-wrap; }
.prompt-preview { color: #4d596d; font-size: 12px; line-height: 1.65; margin: 14px 0 17px; display: block; overflow: hidden; }
.pdf-image-stack { display: grid; gap: 12px; }
.pdf-page-figure { margin: 0; overflow: hidden; border: 1px solid #dfe4ec; border-radius: 9px; background: #fff; box-shadow: 0 3px 10px rgba(31,45,74,.06); }
.pdf-page-figure img { display: block; width: 100%; height: auto; background: #fff; }
.prompt-preview .pdf-image-stack { max-height: 165px; overflow: hidden; border-radius: 8px; }
.prompt-preview .pdf-page-figure { border-radius: 8px; box-shadow: none; }
.pdf-image-missing { padding: 30px 16px; color: var(--muted); background: #f7f8fb; text-align: center; font-size: 11px; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #eef0f4; padding-top: 13px; margin-top: auto; }
.card-open { border: 0; background: transparent; padding: 5px 0; color: var(--blue); font-size: 11px; font-weight: 800; }
.card-complete { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 7px 9px; font-size: 10px; font-weight: 750; }
.card-complete:hover { border-color: #9ab0ff; color: var(--blue); }
.question-card.is-complete .card-complete { color: var(--mint-ink); border-color: #a7ddc5; background: #f4fcf8; }
.load-more { display: block; width: 100%; border: 1px solid var(--line); background: transparent; color: var(--blue); border-radius: 11px; padding: 13px; margin: 19px 0 0; font-size: 11px; font-weight: 800; }
.load-more:hover { background: var(--blue-soft); }
.load-more span { padding-right: 5px; }
.empty-state { text-align: center; border: 1px dashed #cfd6e3; border-radius: var(--radius-md); padding: 60px 20px; margin-top: 18px; background: rgba(255,255,255,.55); }
.empty-icon { color: var(--blue); font-size: 28px; }
.empty-state h3 { margin: 13px 0 5px; font-size: 18px; }
.empty-state p { color: var(--muted); font-size: 12px; margin: 0 0 18px; }
.footer { max-width: 1440px; margin: 0 auto; padding: 20px 44px 30px; color: #9aa4b4; font-size: 10px; }

.modal-backdrop[hidden] { display: none; }
.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(12, 22, 39, .55); backdrop-filter: blur(5px); }
.study-modal { width: min(920px, 100%); max-height: min(900px, calc(100vh - 40px)); display: flex; flex-direction: column; background: var(--surface); border-radius: 22px; box-shadow: 0 28px 100px rgba(8, 18, 34, .25); overflow: hidden; }
.modal-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 27px 18px; border-bottom: 1px solid var(--line); }
.modal-topbar .eyebrow { margin-bottom: 8px; }
.modal-topbar h2 { font-size: 28px; letter-spacing: -.05em; margin: 0; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; color: var(--muted); font-size: 23px; line-height: 1; }
.icon-button:hover { color: var(--ink); background: #f4f6f9; }
.modal-scroll { overflow-y: auto; padding: 22px 27px 10px; }
.modal-labels { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 11px; margin-bottom: 22px; }
.modal-units { color: var(--blue); font-size: 11px; font-weight: 750; }
.prompt-block { border-radius: 14px; background: #eef1f6; padding: 14px; }
.section-label { color: var(--ink); text-transform: uppercase; letter-spacing: .1em; font-size: 10px; font-weight: 850; margin: 0 0 12px; }
.modal-prompt { color: #344055; font-size: 14px; line-height: 1.8; }
.text-fallback { margin-top: 12px; }
.text-fallback summary { cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 750; }
.fallback-text { direction: rtl; unicode-bidi: plaintext; white-space: pre-wrap; color: #667286; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin-top: 8px; font-size: 12px; line-height: 1.7; }
.attempt-block { margin-top: 24px; }
.attempt-heading { align-items: baseline; }
.attempt-heading span { color: var(--muted); font-size: 10px; }
#attempt-notes { display: block; width: 100%; min-height: 125px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: var(--surface); color: var(--ink); outline: 0; font-size: 13px; line-height: 1.6; }
#attempt-notes::placeholder { color: #9aa4b4; }
.solution-block { margin-top: 25px; }
.solution-heading { align-items: center; }
.solution-heading .section-label { margin: 0; }
.solution-content { color: #344055; border: 1px solid #dae2ff; border-radius: 13px; background: #f8f9ff; padding: 16px; font-size: 13px; line-height: 1.8; margin-top: 12px; }
.source-line { border-top: 1px solid var(--line); color: #8994a7; font-size: 10px; line-height: 1.55; padding: 16px 0 7px; margin-top: 25px; }
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 15px 27px; }
.modal-actions .button-quiet { background: #f4f6f9; color: var(--ink); }
.modal-actions .button-quiet:hover { background: #e9edf4; }

@media (max-width: 960px) {
  .topbar, main, .footer { padding-left: 24px; padding-right: 24px; }
  .hero { padding: 38px 35px; }
  .workspace { grid-template-columns: 250px minmax(0, 1fr); gap: 22px; }
  .question-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .topbar { height: 66px; }
  .topbar-note { display: none; }
  .hero { display: block; min-height: 0; padding: 32px 25px 27px; }
  .hero h1 { font-size: 36px; }
  .hero-description { font-size: 13px; margin-top: 16px; }
  .hero-actions { margin-top: 26px; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .stat-progress { grid-column: 1 / -1; }
  .workspace { display: block; }
  .filters { position: static; padding: 0; margin-bottom: 10px; }
  .filters-heading { align-items: center; }
  .filters h2 { font-size: 21px; }
  .filter-group { margin: 17px 0; }
  .filter-row { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 5px; }
  .filter-row > div { width: auto; }
  .filter-group > label, .filter-row label { font-size: 10px; }
  .filter-group select { font-size: 11px; }
  .search-wrap { margin: 17px 0 15px; }
  .topics-group, .filter-tip { display: none; }
  .content-heading { padding-top: 26px; }
  .view-note { display: none; }
  .question-card { min-height: 245px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .study-modal { max-height: 94vh; border-radius: 22px 22px 0 0; }
  .modal-topbar { padding: 20px 20px 15px; }
  .modal-topbar h2 { font-size: 23px; }
  .modal-scroll { padding: 18px 20px 8px; }
  .modal-actions { padding: 12px 20px; }
  .modal-actions .button { padding: 0 11px; font-size: 11px; }
}
@media (max-width: 430px) {
  .topbar, main, .footer { padding-left: 16px; padding-right: 16px; }
  .hero { padding-left: 20px; padding-right: 20px; }
  .hero h1 { font-size: 31px; }
  .filter-group { width: 100%; margin-right: 0; }
  .filter-group select { padding: 0 5px; }
  .modal-actions .button:first-child, .modal-actions .button:last-child { font-size: 0; min-width: 36px; padding: 0; }
  .modal-actions .button:first-child::after { content: '←'; font-size: 16px; }
  .modal-actions .button:last-child::after { content: '→'; font-size: 16px; }
}

.topbar-nav { display: flex; align-items: center; gap: 5px; margin-inline-start: auto; margin-inline-end: 28px; }
.topbar-link { color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 800; padding: 9px 12px; border-radius: 9px; }
.topbar-link:hover, .topbar-link.is-active { color: var(--blue); background: var(--blue-soft); }
.card-reference-note { color: #8994a7; font-size: 10px; min-height: 16px; margin-top: 9px; }
.reference-block { margin: 0 0 24px; border: 1px solid #e4e8f0; border-radius: 14px; padding: 15px; background: #fbfcfe; }
.reference-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reference-heading .section-label { margin-bottom: 3px; }
.reference-subtitle { color: var(--muted); font-size: 10px; margin: 0; }
.reference-count { color: var(--blue); background: var(--blue-soft); border-radius: 99px; padding: 5px 9px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.reference-groups { display: grid; gap: 14px; margin-top: 14px; }
.reference-group h3 { color: var(--ink); font-size: 11px; margin: 0 0 6px; }
.reference-list { display: grid; gap: 5px; }
.reference-item { border: 1px solid #e5e9f1; border-radius: 9px; background: #fff; }
.reference-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; padding: 9px 11px; }
.reference-item summary::-webkit-details-marker { display: none; }
.reference-item summary::before { content: '+'; color: var(--blue); font-size: 14px; font-weight: 700; }
.reference-item[open] summary::before { content: '−'; }
.reference-item summary strong { color: var(--ink); font-size: 11px; margin-inline-end: auto; }
.reference-item summary span { color: var(--muted); font-size: 9px; text-align: left; }
.reference-evidence { color: #667286; border-top: 1px solid #eef0f4; padding: 9px 11px; margin: 0; font-size: 10px; line-height: 1.65; }
.reference-empty { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 9px 0 0; }
.reference-button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: start; cursor: pointer; color: inherit; padding: 10px 11px; }
.reference-button:hover, .reference-button:focus-visible { border-color: #aabcfb; background: #f7f9ff; outline: none; }
.reference-button-main { min-width: 0; display: grid; gap: 4px; }
.reference-button-main strong { color: var(--ink); font-size: 11px; }
.reference-nickname { color: var(--blue); font-size: 10px; font-weight: 750; }
.reference-button-meta { flex: 0 0 auto; color: var(--muted); font-size: 9px; text-align: left; }
.reference-detail-backdrop[hidden] { display: none; }
.reference-detail-backdrop { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(12, 22, 39, .67); backdrop-filter: blur(6px); }
.reference-detail-modal { width: min(780px, 100%); max-height: min(760px, calc(100vh - 40px)); display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border-radius: 20px; box-shadow: 0 28px 100px rgba(8, 18, 34, .3); }
.reference-detail-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 25px 17px; border-bottom: 1px solid var(--line); }
.reference-detail-topbar .eyebrow { margin-bottom: 7px; }
.reference-detail-topbar h2 { margin: 0; color: var(--ink); font-size: 25px; letter-spacing: -.04em; }
.reference-detail-scroll { overflow-y: auto; padding: 21px 25px 8px; }
.reference-detail-nickname { display: inline-flex; color: var(--blue); background: var(--blue-soft); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 850; }
.reference-detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.reference-detail-meta span { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; font-size: 9px; }
.reference-detail-page { margin: 2px 0 18px; }
.reference-detail-page-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.reference-detail-page-heading .section-label { margin: 0 0 9px; }
.reference-detail-page-heading span { color: var(--muted); font-size: 9px; }
.reference-detail-images { display: grid; gap: 12px; }
.reference-detail-page-figure { margin: 0; overflow: hidden; border: 1px solid #dfe5f0; border-radius: 13px; padding: 8px; background: #f5f7fb; box-shadow: 0 5px 18px rgba(31,45,74,.06); }
.reference-detail-page-figure a { display: block; cursor: zoom-in; }
.reference-detail-page-figure img { display: block; width: 100%; height: auto; border: 1px solid #e4e8ef; background: #fff; }
.reference-detail-content { border: 1px solid #dfe5f0; border-radius: 13px; background: #fbfcfe; padding: 16px; }
.reference-detail-content .section-label { margin-bottom: 10px; }
.reference-detail-text { direction: rtl; unicode-bidi: plaintext; white-space: pre-wrap; color: #344055; font-size: 14px; line-height: 1.9; }
.reference-formatted-line { min-height: 1.9em; direction: rtl; unicode-bidi: plaintext; text-align: right; }
.reference-formatted-line.is-math { direction: ltr; unicode-bidi: isolate; text-align: center; font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; letter-spacing: .01em; }
.reference-detail-text.is-unavailable { color: var(--muted); font-size: 12px; }
.reference-evidence-details { margin-top: 13px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; }
.reference-evidence-details summary { cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 800; }
.reference-evidence-details #reference-detail-evidence { direction: rtl; unicode-bidi: plaintext; color: #667286; font-size: 10px; line-height: 1.7; margin: 10px 0 0; }

/* Readable text fallback for mixed Hebrew and mathematical notation. */
.study-text { direction: rtl; unicode-bidi: plaintext; color: inherit; }
.study-line { display: block; direction: rtl; unicode-bidi: plaintext; min-height: 1.75em; text-align: right; white-space: pre-wrap; overflow-wrap: anywhere; }
.math-stack { display: grid; gap: 2px; direction: ltr; margin: 5px auto; }
.math-stack.matrix-stack { width: fit-content; max-width: 100%; padding: 6px 10px; border: 1px solid #dce3ef; border-radius: 10px; background: #f8faff; }
.math-stack.matrix-stack .math-line { margin: 0; padding: 1px 8px; border: 0; border-radius: 0; background: transparent; }
.study-line.math-line { direction: ltr; unicode-bidi: isolate; text-align: center; font-family: "Cambria Math", "STIX Two Math", "DejaVu Sans", "Times New Roman", serif; font-size: 1.04em; letter-spacing: .01em; line-height: 1.65; padding: 4px 10px; margin: 3px auto; border: 1px solid #e1e6f0; border-radius: 8px; background: #f7f9fd; }
.study-line.list-line { margin-top: 4px; }
.inline-math { display: inline-block; direction: ltr; unicode-bidi: isolate; font-family: "Cambria Math", "STIX Two Math", "DejaVu Sans", "Times New Roman", serif; font-variant-ligatures: none; letter-spacing: .01em; white-space: nowrap; margin-inline: .08em; }
.math-fraction { display: inline-flex; flex-direction: column; justify-content: center; min-width: 1.35em; vertical-align: middle; direction: ltr; unicode-bidi: isolate; margin: 0 .18em; font-family: "Cambria Math", "STIX Two Math", "DejaVu Sans", "Times New Roman", serif; font-size: .95em; line-height: 1.1; text-align: center; }
.math-fraction-top { display: block; padding: 0 .18em .08em; border-bottom: 1px solid currentColor; }
.math-fraction-bottom { display: block; padding: .08em .18em 0; }
.study-paragraph-break { height: .58rem; }
.study-empty-text { color: var(--muted); }
.fallback-text .study-line { min-height: 1.8em; }
.fallback-text .study-line.math-line { margin-block: 5px; }
.solution-content .study-line { min-height: 1.8em; }
.solution-content .study-line.math-line { margin-block: 6px; }
.reference-detail-text .study-line { min-height: 1.9em; }
.reference-detail-text .study-line.math-line { margin-block: 6px; }
.prompt-preview .study-line { min-height: 1.65em; }
.prompt-preview .study-line.math-line { font-size: .95em; padding: 2px 6px; margin: 2px 0; }

.reference-detail-actions { display: flex; justify-content: flex-start; gap: 9px; border-top: 1px solid var(--line); padding: 14px 25px; }
.reference-detail-actions .button { text-decoration: none; }
@media (max-width: 700px) {
  .reference-detail-backdrop { padding: 0; align-items: end; }
  .reference-detail-modal { max-height: 94vh; border-radius: 20px 20px 0 0; }
  .reference-detail-topbar, .reference-detail-scroll { padding-left: 20px; padding-right: 20px; }
  .reference-detail-topbar h2 { font-size: 22px; }
  .reference-button { align-items: flex-start; }
  .reference-button-meta { max-width: 42%; line-height: 1.5; }
  .reference-detail-actions { padding: 12px 20px; }
}

.topbar-feedback { appearance: none; border: 0; cursor: pointer; }
.button:disabled, .difficulty-option:disabled { cursor: wait; opacity: .65; transform: none; }
.community-block { margin-top: 25px; border: 1px solid #dfe5f0; border-radius: 15px; padding: 17px; background: #fbfcff; }
.community-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.community-heading h3 { margin: 0; color: var(--ink); font-size: 18px; letter-spacing: -.035em; }
.community-heading p:not(.section-label), .comments-heading p:not(.section-label) { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 5px 0 0; }
.community-meta { flex: 0 0 auto; color: var(--blue); font-size: 10px; font-weight: 800; white-space: nowrap; }
.difficulty-panel { margin-top: 16px; padding: 13px; border-radius: 12px; background: #fff; border: 1px solid #e7ebf3; }
.difficulty-label-row, .comments-heading, .comment-form-footer, .comment-item-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.difficulty-label-row .section-label, .comments-heading .section-label { margin: 0; }
.difficulty-label-row > span:last-child, .comments-heading > span { color: var(--muted); font-size: 10px; }
.difficulty-buttons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 11px; }
.difficulty-option { display: grid; justify-items: center; gap: 4px; min-height: 54px; border: 1px solid #dfe5f0; border-radius: 9px; padding: 7px 4px; color: var(--muted); background: #fff; transition: border .18s ease, background .18s ease, color .18s ease; }
.difficulty-option:hover, .difficulty-option:focus-visible { border-color: #9eb0ff; color: var(--blue); background: var(--blue-soft); outline: none; }
.difficulty-option.is-selected { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.difficulty-option strong { font-size: 16px; line-height: 1; }
.difficulty-option span { font-size: 9px; white-space: nowrap; }
.community-status { min-height: 1.2em; color: var(--muted); font-size: 10px; line-height: 1.5; margin: 8px 0 0; }
.comments-panel { margin-top: 15px; padding-top: 15px; border-top: 1px solid #e5eaf2; }
.comments-list { display: grid; gap: 7px; margin-top: 11px; }
.comments-empty { color: var(--muted); font-size: 11px; margin: 0; padding: 11px 0; }
.comment-item { border: 1px solid #e3e8f1; border-radius: 10px; padding: 10px 11px; background: #fff; }
.comment-item-header strong { color: var(--ink); font-size: 11px; }
.comment-item-header time { color: #9aa4b4; font-size: 9px; }
.comment-item p { color: #536075; font-size: 11px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }
.comment-form { display: grid; gap: 9px; margin-top: 14px; padding-top: 13px; border-top: 1px solid #e8ecf3; }
.comment-form label, .feedback-form label { display: grid; gap: 6px; color: var(--ink); font-size: 10px; font-weight: 800; }
.comment-form label > span, .feedback-form label > span { color: var(--muted); font-weight: 500; }
.comment-form input, .comment-form textarea, .feedback-form input, .feedback-form textarea, .feedback-form select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; color: var(--ink); background: #fff; outline: 0; font-size: 11px; }
.comment-form input, .feedback-form input, .feedback-form select { height: 38px; }
.comment-form textarea { min-height: 82px; resize: vertical; line-height: 1.55; }
.comment-form input::placeholder, .comment-form textarea::placeholder, .feedback-form input::placeholder, .feedback-form textarea::placeholder { color: #a0a9b7; }
.comment-form-footer { align-items: center; }
.comment-form-footer small, .feedback-privacy { color: #8a95a6; font-size: 9px; line-height: 1.5; }
.comment-form-footer .button { flex: 0 0 auto; }

.feedback-backdrop[hidden] { display: none; }
.feedback-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(12, 22, 39, .62); backdrop-filter: blur(6px); }
.feedback-modal { width: min(520px, 100%); max-height: min(700px, calc(100vh - 40px)); overflow: auto; border-radius: 18px; background: var(--surface); box-shadow: 0 28px 100px rgba(8, 18, 34, .3); }
.feedback-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.feedback-topbar .eyebrow { margin-bottom: 7px; }
.feedback-topbar h2 { margin: 0; font-size: 25px; letter-spacing: -.045em; }
.feedback-form { display: grid; gap: 13px; padding: 18px 24px 23px; }
.feedback-intro { color: var(--muted); font-size: 11px; line-height: 1.65; margin: 0 0 2px; }
.feedback-form textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.feedback-form .button { justify-self: start; }
.feedback-form .community-status { margin: -3px 0 0; }
@media (max-width: 700px) {
  .community-block { padding: 14px; }
  .difficulty-buttons { gap: 4px; }
  .difficulty-option { min-height: 51px; }
  .difficulty-option span { font-size: 8px; }
  .feedback-backdrop { padding: 0; align-items: end; }
  .feedback-modal { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .feedback-topbar, .feedback-form { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 430px) {
  .community-heading { display: block; }
  .community-meta { display: block; margin-top: 9px; }
  .difficulty-buttons { grid-template-columns: repeat(5, 1fr); }
  .difficulty-option strong { font-size: 14px; }
}



