:root {
  color-scheme: light;
  --bg: #f6f9fb;
  --surface: #ffffff;
  --surface-soft: #f0f7f8;
  --surface-blue: #eef5fb;
  --ink: #152233;
  --muted: #617080;
  --line: #dbe5eb;
  --line-strong: #c6d6dd;
  --teal: #087f86;
  --teal-dark: #075664;
  --green: #19945b;
  --amber: #c47a06;
  --red: #b64b3f;
  --blue: #216ab7;
  --shadow: 0 16px 42px rgba(21, 34, 51, 0.08);
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(21, 34, 51, 0.05);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #9fc8ce;
  border-radius: var(--radius);
  background: #edfafa;
  color: var(--teal);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  overflow: hidden;
  font-size: 19px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-strip {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.status-strip span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 34px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfe;
  color: #334253;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ok-dot,
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.top-actions a {
  padding: 8px 9px;
  border-radius: var(--radius);
}

.top-actions a:hover,
.top-actions a:focus-visible {
  background: var(--surface-soft);
  color: var(--teal-dark);
  outline: none;
}

.workshop-shell {
  display: grid;
  grid-template-columns: 280px minmax(460px, 1fr) minmax(330px, 430px);
  min-height: calc(100vh - 70px);
}

.sidebar,
.main-stage,
.scenario-panel {
  min-width: 0;
  background: var(--surface);
}

.sidebar {
  border-right: 1px solid var(--line);
}

.main-stage {
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(8, 127, 134, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(8, 127, 134, 0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
}

.scenario-panel {
  border-left: 1px solid var(--line);
  padding: 20px;
  overflow: auto;
}

.nav-section {
  padding: 18px 10px 16px;
  border-bottom: 1px solid var(--line);
}

.nav-section h2 {
  margin: 0 10px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
}

.mode-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 74px;
  gap: 12px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.mode-button > span:last-child {
  min-width: 0;
}

.mode-button:hover,
.mode-button:focus-visible {
  background: #f4fafb;
  outline: none;
}

.mode-button.active {
  border-color: #a8d0d5;
  background: linear-gradient(90deg, #eaf8f9, #f8fcfd);
  box-shadow: inset 3px 0 0 var(--teal);
}

.mode-button strong,
.mode-button small {
  display: block;
  min-width: 0;
}

.mode-button strong {
  font-size: 14px;
}

.mode-button small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.mode-icon {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 32px;
  color: var(--teal);
}

.mode-icon.people {
  background:
    radial-gradient(circle at 30% 35%, currentColor 0 4px, transparent 5px),
    radial-gradient(circle at 68% 35%, currentColor 0 4px, transparent 5px),
    radial-gradient(circle at 50% 72%, currentColor 0 6px, transparent 7px);
}

.mode-icon.route {
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 14px 2px 0 -10px currentColor, 2px 18px 0 -10px currentColor;
}

.mode-icon.code::before,
.mode-icon.code::after {
  content: "";
  position: absolute;
  top: 9px;
  width: 11px;
  height: 11px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.mode-icon.code::before {
  left: 4px;
  transform: rotate(-45deg);
}

.mode-icon.code::after {
  right: 4px;
  transform: rotate(135deg);
}

.mode-icon.flask {
  border-bottom: 3px solid currentColor;
}

.mode-icon.flask::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 4px;
  width: 12px;
  height: 21px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 12px 12px;
}

.compact-links a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: #3b4a59;
  font-size: 13px;
  font-weight: 650;
}

.compact-links a:hover,
.compact-links a:focus-visible {
  background: var(--surface-soft);
  color: var(--teal-dark);
  outline: none;
}

.session-card {
  margin: 16px 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fcfdfd;
}

.session-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.session-card div:last-of-type {
  border-bottom: 0;
}

.session-card span {
  color: var(--muted);
  font-size: 12px;
}

.session-card strong {
  font-size: 12px;
}

.session-card p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  color: #344453;
  font-size: 12px;
}

.stage-head,
.panel-head,
.packet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.stage-head {
  margin-bottom: 16px;
}

.label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 13px;
  line-height: 1.2;
}

.ghost-button,
.primary-button,
.icon-button {
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 780;
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: #9fc8ce;
  background: #eefafa;
  outline: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot.idle {
  background: #c7d0d7;
}

.dot.active {
  background: var(--teal);
}

.dot.good {
  background: var(--green);
}

.dot.locked {
  background: #9aa5ae;
}

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

.skill-card {
  display: grid;
  grid-template-columns: 56px 1fr 210px;
  gap: 14px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(21, 34, 51, 0.04);
}

.skill-card > div {
  min-width: 0;
}

.skill-list.compact .test-grid {
  display: none;
}

.skill-list.compact .skill-card {
  grid-template-columns: 52px 1fr 180px;
}

.skill-symbol {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-family: var(--mono);
  font-weight: 900;
}

.skill-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.skill-title-row h2 {
  font-size: 16px;
}

.skill-title-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.skill-percent {
  color: #0b2545;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 850;
}

.progress-track {
  position: relative;
  height: 8px;
  margin-top: 16px;
  border-radius: 999px;
  background: #dce5ea;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.progress-markers {
  display: flex;
  justify-content: space-between;
  margin-top: -12px;
}

.progress-markers i {
  width: 12px;
  height: 12px;
  border: 3px solid #dce5ea;
  border-radius: 50%;
  background: white;
}

.progress-markers i.done {
  border-color: var(--green);
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.test-tile {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fcfdfd;
}

.test-tile strong,
.test-tile span {
  display: block;
}

.test-tile strong {
  color: #233448;
  font-size: 11px;
  font-family: var(--mono);
}

.test-tile span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.skill-notes {
  display: grid;
  gap: 8px;
}

.skill-notes div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-blue);
}

.skill-notes span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.skill-notes strong {
  display: block;
  margin-top: 4px;
  color: #1e3a4c;
  font-size: 12px;
  line-height: 1.3;
}

.bottom-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.bottom-summary article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
}

.bottom-summary span,
.result-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.bottom-summary strong,
.result-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 18px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #a8d8bd;
  border-radius: var(--radius);
  background: #effaf3;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.scenario-copy {
  margin-top: 10px;
  color: #405060;
  font-size: 14px;
  line-height: 1.5;
}

.control-card,
.packet-card,
.result-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.control-card h3,
.packet-card h3 {
  margin-bottom: 12px;
  color: #26394d;
  font-size: 12px;
  text-transform: uppercase;
}

.range-field {
  margin-top: 12px;
}

.range-field label,
.field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #2e4054;
  font-size: 13px;
  font-weight: 700;
}

output {
  color: var(--teal-dark);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
}

input[type="range"] {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--teal);
}

.field {
  display: block;
  margin-top: 12px;
}

select {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfe;
  color: var(--ink);
  font-size: 13px;
}

.check-list,
.risk-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li,
.risk-list li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  color: #374858;
  font-size: 13px;
  line-height: 1.35;
}

.check-list li::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-top: 1px;
  border-radius: 4px;
  background: var(--green);
  box-shadow: inset 0 0 0 3px #dff4e8;
}

.risk-list li::before {
  content: "!";
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  margin-top: 1px;
  border-radius: 50%;
  background: #fff5df;
  color: var(--amber);
  font-size: 11px;
  font-weight: 900;
}

.packet-head {
  align-items: center;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  background: #ffffff;
}

.icon-button span {
  width: 14px;
  height: 16px;
  border: 2px solid var(--muted);
  border-radius: 3px;
  box-shadow: 4px -4px 0 -1px white, 4px -4px 0 1px var(--muted);
}

pre {
  overflow: auto;
  min-height: 178px;
  max-height: 260px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: #1b3445;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.split-row p {
  color: #405060;
  font-size: 13px;
  line-height: 1.5;
}

.primary-button {
  width: 100%;
  min-height: 40px;
  margin-top: 12px;
  border: 0;
  background: var(--teal);
  color: white;
  box-shadow: 0 12px 24px rgba(8, 127, 134, 0.16);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--teal-dark);
  outline: none;
}

.result-card {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.result-card div {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

body.compact .scenario-copy,
body.compact .skill-notes {
  display: none;
}

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

  .status-strip {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .workshop-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .scenario-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 880px) {
  .topbar {
    position: static;
  }

  .workshop-shell {
    display: block;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-stage,
  .scenario-panel {
    padding: 16px;
  }

  .skill-card {
    grid-template-columns: 48px 1fr;
  }

  .skill-notes {
    grid-column: 1 / -1;
  }

  .test-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 12px;
    gap: 10px;
  }

  .brand strong {
    font-size: 17px;
  }

  .bottom-summary,
  .split-row,
  .result-card {
    grid-template-columns: 1fr;
  }

  .status-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .status-strip span {
    min-height: 30px;
    padding: 0 9px;
  }

  .top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-section:first-child {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 12px;
  }

  .nav-section:first-child h2 {
    grid-column: 1 / -1;
  }

  .compact-links,
  .session-card {
    display: none;
  }

  .mode-button {
    grid-template-columns: 28px 1fr;
    min-height: 58px;
    padding: 8px;
  }

  .mode-button strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mode-button small {
    overflow: hidden;
    margin-top: 2px;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mode-icon {
    width: 26px;
    height: 26px;
  }

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

  .skill-card {
    grid-template-columns: 1fr;
  }

  .skill-symbol {
    width: 42px;
    height: 42px;
  }

  .skill-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .stage-head,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }
}
