:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #5c6670;
  --paper: #f6f7f2;
  --panel: #ffffff;
  --line: #d9dfd4;
  --gold: #f2c14e;
  --green: #3ddc97;
  --blue: #4267ac;
  --red: #d1495b;
  --shadow: 0 16px 40px rgb(16 24 32 / 12%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(120deg, rgb(61 220 151 / 10%), transparent 32rem),
    radial-gradient(circle at 90% 10%, rgb(242 193 78 / 16%), transparent 28rem),
    var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--blue);
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1,
.section-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgb(246 247 242 / 88%);
  backdrop-filter: blur(14px);
}

.topbar-brand {
  flex: 1 1 auto;
}

.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.view-nav,
.lang-switch {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  background: white;
}

.view-nav button,
.lang-switch button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.view-nav button.is-active,
.lang-switch button.is-active {
  background: var(--ink);
  color: white;
}

.score-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: white;
}

.score-strip strong {
  font-size: 1.45rem;
}

.score-strip span {
  color: var(--muted);
  font-weight: 700;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 22px;
  padding: 22px clamp(16px, 4vw, 42px) 48px;
}

.mindmap-section,
.category-panel,
.tree-panel,
.tools-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 82%);
  box-shadow: var(--shadow);
}

.mindmap-section,
.tree-panel,
.category-panel {
  padding: clamp(16px, 3vw, 28px);
}

.tree-panel,
.category-panel {
  margin-top: 22px;
}

.section-head {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-head p,
.section-head strong {
  margin: 0;
  color: var(--muted);
}

.mindmap {
  position: relative;
  display: grid;
  min-height: 0;
  grid-template-areas:
    "node-7 node-1 node-2"
    "node-6 core node-3"
    "node-5 node-4 node-8";
  grid-template-columns: minmax(180px, 1fr) 170px minmax(180px, 1fr);
  gap: 16px 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(rgb(16 24 32 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(16 24 32 / 5%) 1px, transparent 1px);
  background-size: 32px 32px;
}

.mindmap-core,
.mind-node {
  position: relative;
  color: var(--ink);
  box-shadow: 0 10px 22px rgb(16 24 32 / 12%);
  text-align: left;
}

.mindmap-core {
  display: grid;
  width: 150px;
  height: 150px;
  justify-self: center;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
  transform: none;
  grid-area: core;
}

.mindmap-core span {
  color: var(--gold);
  font-size: 3.3rem;
  line-height: 0.8;
}

.mind-node {
  width: 100%;
  min-height: 104px;
  border: 1px solid var(--line);
  padding: 14px;
  background: white;
}

.mind-node::before {
  display: none;
}

.mind-node.is-selected {
  border-color: var(--blue);
  outline: 3px solid rgb(66 103 172 / 14%);
}

.node-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 900;
}

.node-tagline {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.node-progress,
.meter {
  display: block;
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ece5;
}

.node-progress span,
.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.node-1 { grid-area: node-1; }
.node-2 { grid-area: node-2; }
.node-3 { grid-area: node-3; }
.node-4 { grid-area: node-4; }
.node-5 { grid-area: node-5; }
.node-6 { grid-area: node-6; }
.node-7 { grid-area: node-7; }
.node-8 { grid-area: node-8; }

.node-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.node-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #f9faf6;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.learning-tree {
  display: grid;
  gap: 10px;
}

.tree-category {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.tree-category summary {
  display: flex;
  min-height: 48px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-weight: 900;
}

.tree-category summary strong {
  color: var(--blue);
  font-size: 0.9rem;
}

.tree-category ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 12px 12px 28px;
}

.tree-category li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.tree-category li.is-learned {
  color: var(--ink);
}

.tree-category li.is-learned > span {
  color: var(--green);
}

.tree-category li.is-bookmarked .tree-topic {
  border-color: rgb(242 193 78 / 70%);
  background: rgb(242 193 78 / 12%);
}

.tree-topic,
.bookmark-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #f9faf6;
  color: var(--ink);
}

.tree-topic {
  overflow: hidden;
  padding: 7px 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-button {
  padding: 0;
  color: #8a6412;
  font-size: 1.1rem;
}

.quiz-list {
  display: grid;
  gap: 14px;
}

.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: white;
}

.question.is-correct {
  border-color: rgb(61 220 151 / 70%);
}

.question.is-wrong {
  border-color: rgb(209 73 91 / 55%);
}

.question-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.question h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.question-head span {
  flex: 0 0 auto;
  color: var(--blue);
  font-weight: 900;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.options button {
  min-height: 46px;
  border: 1px solid var(--line);
  padding: 10px;
  background: #f9faf6;
  color: var(--ink);
  text-align: left;
}

.options button.is-picked {
  border-color: var(--blue);
  background: rgb(66 103 172 / 10%);
}

.explanation {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.tools-panel {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 18px;
}

.tools-panel dl {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.tools-panel dl div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.tools-panel dt {
  color: var(--muted);
}

.tools-panel dd {
  margin: 0;
  font-weight: 900;
}

.tools-panel button {
  width: 100%;
  margin-top: 10px;
}

.tools-panel .secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.source-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.source-list a {
  line-height: 1.4;
}

.reference-layout {
  padding: 22px clamp(16px, 4vw, 42px) 48px;
}

.reference-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
  background: rgb(255 255 255 / 82%);
  box-shadow: var(--shadow);
}

.reference-lead {
  margin: 0 0 18px;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.6;
}

.reference-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.reference-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #f9faf6;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.reference-search {
  flex: 1 1 220px;
  max-width: 320px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

.reference-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.reference-table thead th {
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #f3f5ee;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.reference-table tbody tr {
  border-bottom: 1px solid var(--line);
}

.reference-table tbody tr:nth-child(even) {
  background: rgb(243 245 238 / 50%);
}

.reference-table td,
.reference-table th[scope='row'] {
  padding: 10px 12px;
  vertical-align: top;
  text-align: left;
}

.cell-name {
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.cell-bits,
.cell-year {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-use {
  min-width: 180px;
}

.cell-note {
  min-width: 200px;
  color: var(--muted);
  line-height: 1.5;
}

.type-tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: #f9faf6;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.type-catCrypto { border-color: rgb(66 103 172 / 45%); color: var(--blue); }
.type-catXof { border-color: rgb(66 103 172 / 45%); color: #2f7d8a; }
.type-catKdf { border-color: rgb(61 220 151 / 55%); color: #1f9d6b; }
.type-catMac { border-color: rgb(138 100 18 / 45%); color: #8a6412; }
.type-catChecksum { border-color: var(--line); color: var(--muted); }
.type-catNoncrypto { border-color: var(--line); color: var(--muted); }

.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-good { background: rgb(61 220 151 / 18%); color: #1f9d6b; }
.status-ok { background: rgb(66 103 172 / 14%); color: var(--blue); }
.status-warn { background: rgb(242 193 78 / 22%); color: #8a6412; }
.status-bad { background: rgb(209 73 91 / 16%); color: var(--red); }
.status-info { background: #eceee8; color: var(--muted); }

.reference-empty {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
}

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

  .tools-panel {
    position: static;
  }
}

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

  .mindmap {
    display: grid;
    min-height: auto;
    gap: 10px;
    background-size: 24px 24px;
    padding: 12px;
  }

  .mindmap-core,
  .mind-node {
    position: static;
    width: 100%;
    min-height: auto;
    transform: none;
  }

  .mindmap-core {
    height: auto;
    min-height: 90px;
    border-radius: 8px;
  }

  .mind-node::before {
    display: none;
  }

  .options {
    grid-template-columns: 1fr;
  }
}
