:root {
  --bg: #0c1118;
  --panel: #141c27;
  --ink: #ecf2ff;
  --soft: #a9b5c8;
  --line: #29384b;
  --accent: #ff7a2f;
  --accent-2: #1fb0ad;
  --ok: #33c27f;
  --warn: #e1a53b;
  --bad: #dd5858;
  --mono: "JetBrains Mono", monospace;
  --sans: "Atkinson Hyperlegible", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color-scheme: dark;
}

body {
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, #1b2b3f 0, transparent 38%),
    radial-gradient(circle at 90% 15%, #16393d 0, transparent 34%),
    linear-gradient(145deg, #0b1118 0%, #0f1723 100%);
  padding: 1.2rem;
  position: relative;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(58px);
  pointer-events: none;
  opacity: 0.26;
  z-index: 0;
}

.bg-a {
  width: 220px;
  height: 220px;
  background: #6a3b20;
  right: -40px;
  top: -30px;
}

.bg-b {
  width: 260px;
  height: 260px;
  background: #1e5c5b;
  left: -90px;
  bottom: -80px;
}

.bg-c {
  width: 180px;
  height: 180px;
  background: #3b2a4f;
  right: 22%;
  top: 42%;
}

.top,
.grid {
  position: relative;
  z-index: 1;
}

.top {
  max-width: 1380px;
  margin: 0 auto 0.9rem;
}

.label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  color: var(--accent-2);
}

h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.8rem, 3.3vw, 2.9rem);
  line-height: 1;
}

.subtitle {
  margin: 0;
  max-width: 880px;
  color: var(--soft);
}

.top-controls {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 250px minmax(240px, 1fr) auto auto;
  gap: 0.65rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--soft);
}

select,
input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.58rem 0.68rem;
  font-family: var(--sans);
  color: var(--ink);
  background: #0f1823;
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  font-size: 0.9rem;
  color: var(--soft);
  margin-bottom: 0.38rem;
}

.switch input {
  accent-color: var(--accent-2);
}

button {
  border: 0;
  border-radius: 11px;
  padding: 0.58rem 0.8rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button.ghost {
  background: #1b2635;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.bad {
  background: var(--bad);
}

button.warn {
  background: var(--warn);
}

button.ok {
  background: var(--ok);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin-top: 0.82rem;
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 30, 44, 0.86);
  padding: 0.3rem 0.58rem;
  font-size: 0.76rem;
  font-family: var(--mono);
}

.grid {
  max-width: 1380px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 315px minmax(0, 1fr) 340px;
  gap: 0.95rem;
}

.panel {
  background: var(--panel);
  border: 1px solid #243245;
  border-radius: 17px;
  padding: 0.88rem;
  box-shadow:
    0 14px 24px rgba(4, 8, 14, 0.45),
    0 2px 7px rgba(4, 8, 14, 0.35);
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
}

.panel h3 {
  margin: 0.95rem 0 0.4rem;
  font-size: 0.9rem;
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
}

.module-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101826;
  padding: 0.55rem 0.62rem;
  cursor: pointer;
}

.module-item.active {
  border-color: rgba(255, 122, 47, 0.72);
  background: #1a2535;
}

.module-title {
  font-weight: 700;
  line-height: 1.2;
}

.module-meta {
  margin-top: 0.3rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--soft);
  font-family: var(--mono);
}

.lesson-panel {
  overflow: auto;
}

.lesson {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0f1823;
  padding: 0.85rem;
  margin-bottom: 0.82rem;
}

.lesson:last-child {
  margin-bottom: 0;
}

.lesson-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.lesson-head h2 {
  margin: 0;
  font-size: 1.12rem;
}

.priority {
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: 0.75rem;
}

.plain {
  border-left: 4px solid var(--accent-2);
  background: #112a31;
  padding: 0.56rem 0.63rem;
  border-radius: 10px;
  margin: 0.62rem 0;
  line-height: 1.42;
}

.section-title {
  margin: 0.72rem 0 0.3rem;
  font-family: var(--mono);
  color: var(--soft);
  font-size: 0.78rem;
}

.flat-list {
  margin: 0;
  padding-left: 1rem;
}

.flat-list li {
  margin-bottom: 0.3rem;
  line-height: 1.35;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.43rem;
  margin-top: 0.25rem;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.52rem;
  font-size: 0.76rem;
  background: #162131;
  cursor: pointer;
  color: var(--ink);
}

.score-row {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.check-list details,
.exam-list details,
.formula-card details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #162132;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.45rem;
}

.check-list details summary,
.exam-list details summary,
.formula-card details summary {
  cursor: pointer;
  color: #c9d5e6;
  font-size: 0.9rem;
}

.formula-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, #0f1a29 0%, #101f31 100%);
  padding: 0.72rem;
  margin-bottom: 0.7rem;
  box-shadow:
    inset 0 0 0 1px rgba(80, 116, 161, 0.08),
    0 8px 16px rgba(2, 8, 18, 0.35);
}

.formula-name {
  margin: 0;
  font-weight: 700;
  font-size: 1.03rem;
}

.formula-top {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.formula-read {
  margin: 0;
  color: #c8d7ed;
  font-size: 0.88rem;
}

.formula-display {
  font-family: var(--mono);
  background: linear-gradient(135deg, #0a131d 0%, #0f1a28 100%);
  border-radius: 10px;
  border: 1px solid #314860;
  padding: 0.62rem 0.68rem;
  display: block;
  margin: 0.24rem 0 0.55rem;
  line-height: 1.35;
  font-size: 0.97rem;
  letter-spacing: 0.01em;
  color: #d7e4ff;
  overflow-x: auto;
}

.formula-why {
  margin: 0 0 0.65rem;
  color: #d3e1f8;
}

.formula-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.formula-panel {
  border: 1px solid #2a3d52;
  border-radius: 10px;
  background: #102032;
  padding: 0.55rem 0.6rem;
}

.formula-panel h4 {
  margin: 0 0 0.38rem;
  font-size: 0.83rem;
  letter-spacing: 0.03em;
  color: #9cb6d7;
  text-transform: uppercase;
}

.var-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.var-table th,
.var-table td {
  border-bottom: 1px solid #2c4056;
  padding: 0.34rem 0.28rem;
  text-align: left;
  vertical-align: top;
}

.var-table th {
  color: #9cb6d7;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.var-table td code {
  font-family: var(--mono);
  font-weight: 700;
  color: #f0d2b2;
}

.var-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.var-list li {
  margin-bottom: 0.28rem;
  line-height: 1.3;
}

.var-list code {
  font-family: var(--mono);
  font-weight: 700;
}

.exam-question {
  border: 1px solid #2a3c50;
  border-radius: 10px;
  background: #101d2d;
  padding: 0.55rem 0.62rem;
}

.exam-question p {
  margin: 0.28rem 0;
}

.exam-subtitle {
  margin: 0.2rem 0 0.32rem;
  color: #9cb6d7;
  font-size: 0.8rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.exam-subparts {
  margin: 0.15rem 0 0.3rem;
  padding-left: 0.2rem;
}

.exam-subparts li {
  margin-bottom: 0.35rem;
  line-height: 1.38;
  list-style: none;
  position: relative;
  padding-left: 2.1rem;
}

.subpart-label {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 1.8rem;
  font-family: var(--mono);
  color: #f0d2b2;
}

.subpart-body {
  display: block;
}

.subpart-body p {
  margin: 0.12rem 0 0.28rem;
}

.exam-table-wrap {
  margin: 0.42rem 0 0.55rem;
  overflow-x: auto;
}

.exam-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  border: 1px solid #324861;
  border-radius: 8px;
  overflow: hidden;
}

.exam-table th,
.exam-table td {
  border-bottom: 1px solid #2b4159;
  padding: 0.4rem 0.48rem;
  text-align: left;
}

.exam-table th {
  background: #11263a;
  color: #b2c8e5;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.exam-table td {
  background: #0f1d2d;
}

.reg-card {
  margin: 0.45rem 0 0.55rem;
  border: 1px solid #395473;
  border-radius: 10px;
  background: linear-gradient(150deg, #0f1f32 0%, #10263c 100%);
  padding: 0.5rem 0.58rem;
}

.reg-card p {
  margin: 0.22rem 0;
}

.reg-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.28rem;
  margin: 0.38rem 0 0.22rem;
}

.reg-metrics span {
  border: 1px solid #324c68;
  border-radius: 8px;
  background: #0f2134;
  padding: 0.26rem 0.38rem;
  font-size: 0.82rem;
}

.exam-figure {
  margin: 0.6rem 0 0.5rem;
  border: 1px solid #324861;
  border-radius: 10px;
  background: #0e1a29;
  overflow: hidden;
}

.exam-figure img {
  width: 100%;
  display: block;
  background: #0a121c;
}

.exam-figure figcaption {
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  color: #b3c8e5;
  border-top: 1px solid #2b4159;
  font-family: var(--mono);
}

.figure-note {
  margin: 0.55rem 0 0.45rem;
  border: 1px dashed #35506c;
  background: #122338;
  color: #c9d9ef;
  border-radius: 9px;
  padding: 0.4rem 0.48rem;
  font-size: 0.88rem;
}

.answer-block {
  border: 1px solid #2a425c;
  border-radius: 10px;
  background: #112235;
  padding: 0.52rem 0.62rem;
}

.answer-part {
  border: 1px solid #2d4865;
  border-radius: 9px;
  background: #0f2134;
  padding: 0.45rem 0.52rem;
  margin-bottom: 0.48rem;
}

.answer-part:last-child {
  margin-bottom: 0;
}

.answer-mini-title {
  margin: 0.2rem 0 0.25rem;
  color: #9cb6d7;
  font-size: 0.78rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.workings-list {
  margin: 0.1rem 0 0.1rem;
  padding-left: 1rem;
}

.workings-list li {
  margin-bottom: 0.32rem;
  line-height: 1.35;
}

.workings-list code {
  display: inline-block;
  background: #0b1726;
  border: 1px solid #314a66;
  border-radius: 6px;
  padding: 0.12rem 0.28rem;
  color: #d5e5ff;
  white-space: pre-wrap;
}

.workings-steps {
  margin: 0.18rem 0 0.12rem;
  padding-left: 1.1rem;
}

.workings-steps li {
  margin-bottom: 0.4rem;
}

.step-label {
  display: inline-block;
  margin-right: 0.28rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: #9cb6d7;
}

.workings-steps code {
  display: inline-block;
  margin-top: 0.12rem;
  padding: 0.18rem 0.34rem;
  border-radius: 7px;
  border: 1px solid #335070;
  background: #0b1829;
  color: #dce9ff;
  white-space: pre-wrap;
}

.right-note {
  margin: -0.35rem 0 0.6rem;
  color: var(--soft);
  font-size: 0.86rem;
}

.metric {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding: 0.44rem 0;
}

.metric strong {
  font-family: var(--mono);
}

#weakList {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
}

#weakList li {
  margin-bottom: 0.3rem;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  color: var(--soft);
  background: #111b29;
}

@media (max-width: 1200px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .top-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .switch {
    margin-bottom: 0;
  }
}

@media (min-width: 980px) {
  .formula-grid {
    grid-template-columns: 1fr 1fr;
  }
}
