:root {
  color-scheme: light;
  --ink: #1f2632;
  --muted: #647080;
  --line: #e0e5ec;
  --blue: #2f6df0;
  --amber: #c7740d;
  --mono:
    ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: #f4f6f8;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button,
select,
input {
  min-height: 36px;
}
button {
  border: 1px solid #ccd3dd;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
}
button:hover {
  background: #f0f4fa;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}
h1 {
  font-size: 16px;
  letter-spacing: -0.2px;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 13px;
}
.mono {
  font-family: var(--mono);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
}
.skip-link:focus {
  transform: none;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: #ffffffef;
  backdrop-filter: blur(8px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font: 700 14px var(--mono);
}
.brand p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.complexity-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
select {
  border: 1px solid #ccd3dd;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
}
.button-primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}
.button-primary:hover {
  background: #2059cf;
}
.button-outline {
  color: #245dcc;
  border-color: #c4d6fb;
}
.button-quiet {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 26px 40px;
}
.panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px #141e320a;
}
.section-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.section-heading p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.task-chip {
  background: #f6f8fa;
  border: 1px solid #e7ebef;
  border-radius: 9px;
  padding: 7px 12px;
}
.task-chip dt {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.task-chip dd {
  font: 600 13px/1.6 var(--mono);
}
.blue {
  color: #245dcc;
}
.amber {
  color: var(--amber);
}
.learning-hints {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf0f4;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
summary {
  width: fit-content;
  cursor: pointer;
  color: #245dcc;
  font-weight: 600;
}
.learning-hints ol {
  padding-left: 22px;
  margin: 10px 0;
  max-width: 1000px;
}
.learning-hints li + li {
  margin-top: 5px;
}
.network-panel {
  padding: 14px 14px 12px;
}
.network-heading {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding: 0 4px;
}
.network-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.segmented {
  display: flex;
  background: #f0f2f5;
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 7px 13px;
  font-size: 12.5px;
}
.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px #141e321f;
}
.diagram-scroll {
  overflow-x: auto;
}
.diagram-scroll > svg {
  min-width: 950px;
}
.diagram-scroll > svg[data-layout="compact"] {
  min-width: 680px;
  max-height: 600px;
}
.diagram-scroll [role="button"]:focus-visible {
  outline: none;
}
.diagram-scroll [role="button"]:focus-visible > rect:last-child {
  stroke: var(--blue);
  stroke-width: 3;
}
.diagram-ip {
  cursor: pointer;
}
.diagram-ip > text {
  text-decoration: underline;
  text-decoration-style: dotted;
}
.diagram-ip:hover .ip-hit-area,
.diagram-ip:focus-visible .ip-hit-area {
  fill: #e7eefe;
  stroke: var(--blue);
  stroke-width: 1;
}
.ip-transfer-hint {
  margin: 8px 6px 0;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f0f5ff;
  color: #245dcc;
  font-size: 12px;
  line-height: 1.6;
}
.answer.is-ip-target {
  outline: 2px dashed var(--blue);
  outline-offset: 2px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 6px 6px;
  color: var(--muted);
  font-size: 11.5px;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--blue);
}
.legend .legend-return::before {
  background: #e08a1e;
}
.network-description {
  padding: 4px 6px 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}
.section-description {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 380px;
  font-size: 13px;
}
th,
td {
  text-align: left;
  border: 1px solid #dde2e8;
  padding: 9px 10px;
}
th {
  background: #eef1f4;
  color: #56616f;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.given-row {
  background: #f3f5f7;
  color: #586271;
  font-family: var(--mono);
}
.editable-cell {
  padding: 4px;
}
.feedback {
  margin: 0;
  border: 1px solid #f3d8bd;
  border-radius: 12px;
  background: #fff5ed;
  color: #99520c;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}
.feedback:empty {
  display: none;
}
.feedback.is-perfect {
  background: #e9f7ef;
  border-color: #bfe6cd;
  color: #1a7d46;
}
.feedback.is-revealed {
  background: #e7eefe;
  border-color: #c4d6fb;
  color: #245dcc;
}
.packet-paths {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.path {
  --path-color: var(--blue);
}
.path-return {
  --path-color: #e08a1e;
}
.path h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 2px 12px;
  font-size: 16px;
  line-height: 1.5;
}
.path h2::before {
  content: "";
  width: 9px;
  height: 18px;
  flex: none;
  border-radius: 3px;
  background: var(--path-color);
}
.packet-grid {
  display: grid;
  gap: 11px;
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
}
.packet-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  box-shadow: 0 1px 2px #141e320a;
  transition: box-shadow 0.2s;
  scroll-margin-top: 150px;
}
.packet-card.is-active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--path-color) 50%, transparent);
}
.packet-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}
.packet-heading > div {
  min-width: 0;
}
.packet-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  border-radius: 7px;
  background: var(--path-color);
  color: #fff;
  font: 700 13px var(--mono);
}
.packet-route {
  margin-top: 3px;
  font: 10.5px/1.6 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.packet-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.packet-field > label {
  width: 68px;
  flex: none;
  color: #56616f;
  font-size: 11.5px;
  font-weight: 500;
}
.field-control {
  position: relative;
  flex: 1;
  min-width: 0;
}
.answer {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 6px 24px 6px 8px;
  border: 1.5px solid #ccd3db;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: 12px var(--mono);
}
.answer:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #2f6df01f;
  outline: none;
}
.field-indicator {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 13px;
  font-weight: 700;
}
.answer[data-status="given"] {
  background: #eef1f4;
  border-color: #d9dee4;
  color: #647080;
}
.answer[data-status="revealed"] {
  background: #e7eefe;
  border-color: var(--blue);
  color: #245dcc;
}
.answer[data-status="correct"] {
  background: #e9f7ef;
  border-color: #1f9d57;
}
.answer[data-status="wrong"] {
  background: #fdeceb;
  border-color: #d6453d;
}
.answer[data-status="correct"] + span {
  color: #167240;
}
.answer[data-status="wrong"] + span {
  color: #ba322b;
}
.answer[data-status="revealed"] + span {
  color: #245dcc;
}
footer {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
  padding: 0 2px;
}
@media (max-width: 1050px) {
  .site-header {
    position: static;
  }
  .toolbar {
    width: 100%;
  }
}
@media (max-width: 600px) {
  .site-header {
    padding: 14px;
    gap: 14px;
  }
  .brand p {
    font-size: 10.5px;
  }
  .toolbar {
    gap: 7px;
  }
  .toolbar button {
    flex: 1 0 auto;
  }
  .complexity-label {
    width: 100%;
    justify-content: space-between;
    margin-bottom: 4px;
  }
  .complexity-label select {
    flex: 1;
    max-width: 250px;
  }
  .page {
    padding: 14px 12px 28px;
    gap: 14px;
  }
  .panel {
    padding: 14px;
  }
  .section-heading {
    gap: 6px;
  }
  .task-chips {
    gap: 7px;
  }
  .task-chip {
    flex: 1 0 auto;
    padding: 7px 10px;
  }
  .network-controls {
    gap: 7px;
  }
  .segmented button {
    padding: 7px 10px;
  }
  .network-heading {
    gap: 12px;
  }
  .packet-grid {
    grid-template-columns: 1fr;
  }
  .packet-card {
    scroll-margin-top: 16px;
  }
  .packet-route {
    font-size: 11px;
  }
  .answer {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
