:root { color-scheme: dark; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #202124; color: #eee; line-height: 1.6; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: #b7d5ff; }
button, input, a.button { font: inherit; }
button, .button { border: 1px solid #719fef; border-radius: 8px; padding: 8px 16px; background: #3167bd; color: white; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { background: #3d76d1; }
button:disabled { cursor: default; opacity: .55; }
.secondary { background: #30343b; border-color: #626b78; }
.secondary:hover { background: #414955; }
input { border: 1px solid #687180; border-radius: 8px; padding: 10px 12px; background: #242830; color: #fff; min-width: 0; }
input::placeholder { color: #adb5c1; }
:focus-visible { outline: 3px solid #9ac2ff; outline-offset: 3px; }
.navbar { background: #2b2d31; border-bottom: 1px solid #464b55; padding: 16px max(20px, calc((100% - 1060px) / 2)); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { color: #fff; font-size: 21px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand span { display: block; font-size: 12px; font-weight: 400; color: #aeb8c8; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
nav a { color: #d1d6df; padding: 9px 12px; text-decoration: none; border-radius: 8px; }
nav a[aria-current="page"] { background: #364767; color: #fff; }
nav a span { font-size: 12px; color: #c8d5e8; margin-left: 4px; }
main, footer { max-width: 1060px; margin: auto; padding: 30px 20px; }
main { min-height: 65vh; }
footer { border-top: 1px solid #454b55; color: #b7bfcb; font-size: 13px; }
.eyebrow { color: #9cb2d2; font-size: 13px; margin: 0; }
h1 { font-size: 27px; margin: 3px 0 18px; }
h2 { margin: 0; font-size: 21px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 16px; flex-wrap: wrap; }
.section-heading h1 { margin-bottom: 0; }
.badge { background: #303845; border-radius: 30px; padding: 5px 12px; color: #c6d4e8; font-size: 13px; }
fieldset { border: 0; padding: 0; margin: 20px 0; display: flex; gap: 10px; flex-wrap: wrap; }
legend { position: absolute; width: 1px; height: 1px; overflow: hidden; }
fieldset label { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: #2d323a; border-radius: 8px; cursor: pointer; }
fieldset input { accent-color: #91b7ff; }
.quiz-card, .result-card { background: #2b2f36; border: 1px solid #465063; border-radius: 12px; padding: 26px; }
.quiz-card { text-align: center; }
#question { font-size: clamp(34px, 7vw, 60px); margin: 18px 0 24px; overflow-wrap: anywhere; }
#answer-form { max-width: 530px; margin: auto; }
#answer-form label { display: block; text-align: left; color: #bfc9d9; font-size: 13px; margin-bottom: 6px; }
.answer-row { display: flex; gap: 10px; }
.answer-row input { flex: 1; }
.result-card { margin-top: 20px; }
#solution.correct { color: #94d7a5; }
#solution.incorrect { color: #ffa0a0; }
dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
dt { color: #aebacc; font-size: 13px; }
dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.notice { border: 1px solid #6283b5; background: #2f405a; border-radius: 8px; padding: 10px 14px; }
.notice.error, .form-error { color: #ffd0d0; border-color: #ab7777; background: #4b3034; }
.search-label { display: block; font-size: 13px; color: #bbc5d3; margin-bottom: 6px; }
.search { width: min(100%, 470px); }
.table-scroll { overflow-x: auto; margin-top: 20px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 12px 14px; border-bottom: 1px solid #464e5a; text-align: left; }
th { color: #b6c4d7; font-size: 13px; background: #2c3139; white-space: nowrap; }
td { overflow-wrap: anywhere; }
td:last-child { width: 1%; white-space: nowrap; }
tbody tr:nth-child(even) { background: #272c33; }
.delete-button { color: #ffc0c0; background: #3c2f33; border-color: #85626a; font-size: 13px; padding: 5px 12px; }
.empty { color: #b6c2d3; padding: 24px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
dialog { border: 1px solid #59687d; border-radius: 12px; background: #2b3038; color: #eee; padding: 24px; width: min(460px, calc(100% - 32px)); }
dialog::backdrop { background: #0009; }
#custom-form label { display: block; margin: 16px 0 5px; }
#custom-form input { width: 100%; }
#custom-form button { margin-top: 20px; width: 100%; }
.form-error { padding: 8px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 650px) {
  .navbar { align-items: flex-start; flex-direction: column; gap: 10px; padding: 14px 16px; }
  nav { gap: 2px; width: 100%; }
  nav a { padding: 8px 10px; font-size: 14px; }
  .brand span { display: inline; margin-left: 7px; }
  main, footer { padding: 24px 16px; }
  .quiz-card, .result-card { padding: 20px 16px; }
  .answer-row { flex-direction: column; }
  dl { grid-template-columns: 1fr; }
  th, td { padding: 10px 8px; }
  table { min-width: 470px; }
}

/* Keep the application inside the viewport; lists and long details use pages. */
html, body { height: 100%; overflow: hidden; }
body { height: 100dvh; display: flex; flex-direction: column; }
.navbar { flex: none; position: relative; padding-top: 10px; padding-bottom: 10px; }
.brand { margin-right: auto; }
.gear { display: grid; place-items: center; width: 40px; height: 40px; padding: 6px; flex: none; }
.gear svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
main { width: 100%; margin: 0 auto; padding: 18px 20px; min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
section { min-height: 0; display: flex; flex-direction: column; flex: 1; }
h1 { font-size: 25px; margin: 2px 0 0; }
h3 { margin: 18px 0 6px; font-size: 16px; }
.section-heading { flex: none; flex-wrap: nowrap; margin-bottom: 12px; }
fieldset { flex: none; margin: 0 0 14px; gap: 7px; }
fieldset label { padding: 5px 8px; font-size: 14px; }
fieldset label:has(input:checked) { background: #364767; }
fieldset input { margin: 0; }
.quiz-content { min-height: 0; display: flex; flex-direction: column; gap: 12px; flex: 1; justify-content: center; }
.quiz-card, .result-card { padding: 18px 24px; min-height: 0; margin: 0; }
#question { font-size: clamp(30px, 6vw, 54px); margin: 10px 0 16px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#answer-form label { margin-bottom: 4px; }
.answer-row { flex-direction: row; gap: 8px; }
.answer-row input { width: 0; }
.answer-row button { flex: none; }
dl { grid-template-columns: 1fr 1fr; gap: 8px 24px; }
dl > div { min-width: 0; }
dd { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice { flex: none; margin: 0; padding: 7px 10px; font-size: 13px; }
.search-label, .search { flex: none; }
.table-scroll { margin-top: 12px; min-height: 0; overflow: visible; }
table { min-width: 0; table-layout: fixed; }
th, td { padding: 10px 12px; }
td { height: 72px; }
th:last-child, td:last-child { width: 82px; }
#bookmark-table th:first-child { width: 60px; }
.cell-content { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.word-link { border: 0; border-radius: 2px; padding: 0; color: #b7d5ff; text-decoration: underline; text-align: left; background: none; max-width: 100%; }
.word-link:hover { background: none; color: #fff; }
.actions { flex-wrap: nowrap; gap: 8px; }
.pagination { flex: none; display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 12px; font-size: 13px; }
.pagination button { padding: 6px 12px; }
dialog { padding: 22px; max-height: calc(100dvh - 28px); overflow: hidden; }
dialog p { margin: 8px 0; font-size: 14px; }
.source-note { color: #b7bfcb; font-size: 12px; }
.source-links { font-size: 13px; margin-top: 12px; }
#custom-form label { margin: 12px 0 4px; font-size: 14px; }
#custom-form button { margin-top: 16px; }
.word-detail { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 180px; }
@media (max-width: 650px) {
  .navbar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; }
  .brand { font-size: 18px; height: 30px; display: flex; align-items: center; }
  .brand span { display: none; }
  .gear { position: absolute; right: 12px; top: 6px; width: 34px; height: 34px; }
  nav { width: 100%; gap: 4px; justify-content: space-between; }
  nav a { padding: 6px 9px; font-size: 13px; white-space: nowrap; }
  main { padding: 12px; gap: 6px; }
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  .section-heading { gap: 8px; margin-bottom: 10px; }
  .section-heading .eyebrow { display: none; }
  .section-heading .actions { gap: 5px; }
  button, .button { padding: 7px 9px; font-size: 13px; }
  fieldset { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px; }
  fieldset label { font-size: 12px; padding: 5px 4px; justify-content: center; white-space: nowrap; }
  .quiz-content { gap: 10px; }
  .quiz-card, .result-card { padding: 14px; }
  #question { font-size: 32px; margin: 8px 0 12px; }
  .answer-row input { font-size: 14px; padding: 9px; }
  dl { gap: 8px 12px; font-size: 14px; }
  .notice { padding: 6px 8px; font-size: 12px; }
  .table-scroll { margin-top: 10px; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr 58px; grid-template-rows: 28px 48px; gap: 0 8px; border-bottom: 1px solid #464e5a; height: 88px; padding: 6px 2px; }
  td { display: block; border: 0; height: auto; padding: 0; font-size: 13px; min-width: 0; }
  td:last-child { width: auto; grid-column: 3; grid-row: 1 / 3; align-self: center; }
  #custom-table td:nth-child(3) { grid-row: 2; grid-column: 1 / 3; color: #b6c2d3; }
  #bookmark-table tbody tr { grid-template-columns: 36px 1fr 1fr 58px; }
  #bookmark-table td:first-child { font-size: 11px; color: #9cb2d2; }
  #bookmark-table td:nth-child(4) { grid-row: 2; grid-column: 2 / 4; color: #b6c2d3; }
  #bookmark-table td:last-child { grid-column: 4; }
  .pagination { padding-top: 10px; }
  dialog { padding: 16px; }
  dialog p { font-size: 13px; }
  dialog h3 { margin-top: 14px; }
}
@media (max-height: 650px) {
  main { padding-top: 8px; padding-bottom: 8px; }
  .quiz-content { gap: 8px; }
  .quiz-card, .result-card { padding: 10px 14px; }
  #question { font-size: 28px; margin: 4px 0 8px; }
  .section-heading { margin-bottom: 6px; }
  dl { gap: 4px 12px; font-size: 13px; }
  dialog { padding: 12px 16px; }
  dialog p { margin: 6px 0; font-size: 12px; }
  dialog h3 { margin: 10px 0 4px; }
}
@media (min-width: 651px) and (max-height: 650px) {
  .quiz-content:has(.result-card:not([hidden])) { display: grid; grid-template-columns: 1fr 1fr; align-content: center; }
}
@media (max-height: 480px) {
  #settings-dialog { width: min(640px, calc(100% - 28px)); }
  #custom-dialog { width: min(600px, calc(100% - 28px)); }
  #custom-form { display: grid; grid-template-columns: 65px 1fr; align-items: center; gap: 8px; }
  #custom-form label { margin: 0; }
  #custom-form button, #custom-error { grid-column: 1 / 3; margin: 0; }
}

/* One shared card for the next question and the previous answer. */
.quiz-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: none; }
.quiz-controls fieldset { flex: 1; margin: 0; }
.quiz-controls .badge { margin-left: auto; white-space: nowrap; }
.quiz-content { gap: 0; display: flex; }
.quiz-card { padding: 0; }
.question-panel { padding: 22px 24px; text-align: center; }
.result-card { border: 0; border-top: 1px solid #465063; border-radius: 0; background: none; padding: 20px 24px; text-align: left; }
#solution { font-size: 36px; line-height: 1.2; }
.result-card .result-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; }
.result-heading #solution { grid-column: 2; text-align: center; }
.result-heading .actions { grid-column: 3; justify-self: end; }
@media (max-width: 650px) {
  .quiz-controls { gap: 8px; }
  .quiz-controls fieldset { flex-basis: 100%; }
  .question-panel, .result-card { padding: 16px 14px; }
  #solution { font-size: 28px; }
  .result-card .result-heading { grid-template-columns: 1fr; gap: 4px; }
  .result-heading #solution, .result-heading .actions { grid-column: 1; }
}
@media (max-height: 650px) {
  .question-panel, .result-card { padding: 12px 14px; }
}
@media (min-width: 651px) and (max-height: 650px) {
  .quiz-content:has(.result-card:not([hidden])) { display: flex; }
  .quiz-card:has(.result-card:not([hidden])) { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .quiz-card:has(.result-card:not([hidden])) .result-card { border-top: 0; border-left: 1px solid #465063; }
  #solution { font-size: 30px; }
}
@media (max-width: 650px) and (max-height: 650px) {
  .quiz-controls { gap: 4px 8px; }
  .result-card .result-heading { gap: 2px; }
  .question-panel, .result-card { padding: 6px 14px; }
  #question { margin: 2px 0 6px; }
  .result-heading .actions button { padding: 4px 8px; font-size: 12px; }
  .quiz-controls fieldset label { padding-top: 4px; padding-bottom: 4px; }
  .quiz-controls .badge { padding-top: 3px; padding-bottom: 3px; }
}
