* { box-sizing: border-box; }
:root { color-scheme: light; --ink: #162f37; --muted: #526870; --teal: #12675f; --line: #cbd8d5; }
body { margin: 0; background: #f5f7f4; color: var(--ink); font: 16px/1.5 Inter, "Segoe UI", sans-serif; }
header { border-bottom: 1px solid var(--line); background: #fff; }
nav, main { width: min(1040px, calc(100% - 40px)); margin: auto; }
nav { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
a { color: inherit; text-decoration: none; }
nav a, .back { font-weight: 600; }
.brand { display: flex; align-items: center; gap: 12px; }
.mark { background: var(--ink); color: #fff; padding: 7px; border-radius: 8px; letter-spacing: -.05em; }
main { padding: clamp(32px, 6vw, 76px) 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(36px, 5.3vw, 64px); line-height: 1.07; letter-spacing: -.045em; max-width: 900px; }
h2 { font-size: clamp(21px, 2.5vw, 30px); line-height: 1.24; letter-spacing: -.025em; }
.intro, .hint, .group span { color: var(--muted); }
.intro { margin: 18px 0 34px; font-size: 18px; }
.catalog, .groups { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit,minmax(min(100%, 290px),1fr)); }
.course { display: flex; flex-direction: column; padding: clamp(22px, 4vw, 38px); min-height: 265px; border-radius: 20px; color: white; }
.a1 { background: #184d4a; }
.b71 { background: #293d60; }
.course-code { color: #cde4c9; font-size: 20px; font-weight: 700; }
.b71 .course-code { color: #cbdfff; }
.course h2 { margin: 16px 0 32px; max-width: 360px; }
.card-foot, .random { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid #ffffff45; }
.card-foot b, .random b { font-size: 24px; }
.course:hover, .random:hover { filter: brightness(1.1); }
.eyebrow { color: var(--teal); font-weight: 700; margin-bottom: 12px; }
.random { background: #184d4a; color: #fff; border-radius: 16px; padding: 24px 30px; margin: 32px 0; }
.random span, .group span { display: block; margin-top: 5px; }
.groups { margin-top: 18px; }
.group, .panel, .result { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.group:hover, .answer:hover { border-color: var(--teal); }
.group strong { font-size: 20px; }
.back { display: inline-block; color: var(--teal); margin-bottom: 18px; }
main:has(#quiz) { max-width: 840px; }
.panel, #results { margin-top: 28px; }
.panel { padding: clamp(18px,4vw,40px); }
progress { width: 100%; height: 8px; accent-color: var(--teal); margin-bottom: 18px; }
.hint { margin: 16px 0 10px; }
.answer { display: flex; align-items: baseline; gap: 12px; padding: 14px; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
input { accent-color: var(--teal); }
.answer:has(:checked) { background: #e8f4f0; border-color: var(--teal); }
.answer.right, .result.right { background: #edf7ed; border-color: #7ba58b; }
.answer.wrong, .result.wrong { background: #fff1ec; border-color: #c78c76; }
.controls { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 16px; color: var(--ink); background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { background: #f1f5f3; }
.primary { margin-left: auto; color: white; border-color: var(--teal); background: var(--teal); }
.primary:hover { background: #104c46; }
.check { margin-top: 10px; }
.feedback:not(:empty), #error:not(:empty) { margin-top: 12px; }
.result { margin-bottom: 12px; }
.result p { margin-top: 8px; }
:focus-visible { outline: 3px solid #d88420; outline-offset: 3px; }
[hidden] { display: none !important; }
.nav-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
#theme-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; font-size: 24px; line-height: 1; }
.sun, [data-theme="dark"] .moon { display: none; }
[data-theme="dark"] .sun { display: inline; }
:root[data-theme="dark"] { color-scheme: dark; --ink: #edf4f3; --muted: #b4c5c7; --teal: #80dbc8; --line: #455b60; }
[data-theme="dark"] body { background: #111b20; }
[data-theme="dark"] :is(header, .panel, .group, .result, button) { background: #1d2b31; }
[data-theme="dark"] .mark { background: #25645e; }
[data-theme="dark"] button:hover { background: #30454a; }
[data-theme="dark"] .primary { color: #102722; background: var(--teal); }
[data-theme="dark"] .primary:hover { background: #a3e7d9; }
[data-theme="dark"] .answer:has(:checked) { background: #21423f; }
[data-theme="dark"] :is(.answer, .result).right { background: #203f31; }
[data-theme="dark"] :is(.answer, .result).wrong { background: #4b302e; }
main { overflow-wrap: anywhere; }
@media (max-width: 550px) {
  nav, main { width: calc(100% - 28px); }
  nav { font-size: 14px; }
  .brand { gap: 8px; }
  .nav-actions { gap: 10px; }
  nav { gap: 8px; }
  .controls { flex-wrap: wrap; }
  .course { min-height: 210px; }
}
