:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #f3f6f1;
  --ink: #161b18;
  --muted: #657068;
  --line: #e2e7df;
  --accent: #0b7a5a;
  --accent-2: #0b7a5a;
  --accent-soft: #edf7f2;
  --warn-soft: #fff8ef;
  --shadow: 0 10px 26px rgba(22, 27, 24, 0.06);
  --shadow-strong: 0 16px 44px rgba(22, 27, 24, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app {
  min-height: 100vh;
  min-width: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 12px 22px;
  box-shadow: 0 8px 24px rgba(22, 27, 24, 0.04);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #d7e5dd;
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(22, 27, 24, 0.06);
}

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

.brand h1 {
  overflow: hidden;
  font-size: 20px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.top-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
}

.top-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.top-tab:hover {
  transform: translateY(-1px);
}

.top-tab.active {
  background: var(--accent);
  color: #fff;
}

.workspace {
  display: grid;
  gap: 16px;
  width: min(1440px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 18px 22px 40px;
}

.utility-row {
  display: flex;
  justify-content: flex-end;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.search-box input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 0 12px;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.view {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.flow-board {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-strong);
  padding: 16px 16px 18px;
  animation: riseIn 420ms ease both;
  backdrop-filter: blur(14px);
}

.flow-board::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
  content: "";
}

.flow-board::after {
  display: none;
}

.flow-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.flow-title h2 {
  margin-top: 3px;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.2;
}

.flow-title p {
  max-width: 520px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.flow-overview {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.flow-overview strong {
  color: var(--accent);
}

.flow-progress {
  position: relative;
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e8eee9;
}

.flow-progress i {
  position: relative;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: none;
  transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.flow-progress i::after {
  display: none;
}

.flow-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(9, minmax(112px, 1fr));
  gap: 9px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 1px 4px;
}

.flow-step {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px 11px;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  animation: flowStepIn 520ms ease both;
}

.flow-step:nth-child(1) { animation-delay: 20ms; }
.flow-step:nth-child(2) { animation-delay: 55ms; }
.flow-step:nth-child(3) { animation-delay: 90ms; }
.flow-step:nth-child(4) { animation-delay: 125ms; }
.flow-step:nth-child(5) { animation-delay: 160ms; }
.flow-step:nth-child(6) { animation-delay: 195ms; }
.flow-step:nth-child(7) { animation-delay: 230ms; }
.flow-step:nth-child(8) { animation-delay: 265ms; }
.flow-step:nth-child(9) { animation-delay: 300ms; }

.flow-step::after {
  position: absolute;
  right: -8px;
  top: 50%;
  width: 7px;
  height: 2px;
  background: var(--line);
  content: "";
}

.flow-step:last-child::after {
  display: none;
}

.flow-step.done {
  border-color: rgba(15, 106, 85, 0.32);
  background: #f8fcfa;
}

.flow-step.active {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 12px 28px rgba(11, 122, 90, 0.12);
  transform: translateY(-2px);
}

.flow-step.active::before {
  position: absolute;
  inset: auto 12px 8px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.flow-step.upcoming {
  background: #fff;
  opacity: 0.88;
}

.flow-step:hover {
  border-color: rgba(15, 106, 85, 0.45);
  box-shadow: 0 10px 24px rgba(31, 35, 31, 0.08);
  transform: translateY(-2px);
}

.flow-step strong {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--accent);
  font-size: 12px;
}

.flow-step strong b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: #eef2ee;
  color: var(--muted);
  font-size: 11px;
}

.flow-step.done strong b,
.flow-step.active strong b {
  background: var(--accent);
  color: #fff;
  animation: stepGlow 1400ms ease both;
}

.flow-step span {
  align-self: center;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.flow-step small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.reference-board {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 14px;
  animation: riseIn 440ms ease both;
  backdrop-filter: blur(10px);
}

.reference-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.reference-head h2 {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.2;
}

.reference-head p {
  max-width: 500px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.reference-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  min-width: 0;
}

.reference-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px;
  text-decoration: none;
  transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}

.reference-card:hover {
  border-color: rgba(15, 106, 85, 0.42);
  box-shadow: 0 10px 24px rgba(22, 27, 24, 0.07);
  transform: translateY(-2px);
}

.reference-thumb {
  display: block;
  overflow: hidden;
  width: 82px;
  height: 62px;
  border-radius: 6px;
  background: #eef3ef;
}

.reference-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-thumb-wiring {
  position: relative;
  background:
    linear-gradient(135deg, rgba(11, 122, 90, 0.12), rgba(255, 255, 255, 0.92)),
    linear-gradient(90deg, rgba(11, 122, 90, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(11, 122, 90, 0.08) 1px, transparent 1px);
  background-size: auto, 16px 16px, 16px 16px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.wire-node,
.wire-line {
  position: absolute;
  display: block;
}

.wire-node {
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 122, 90, 0.08);
}

.wire-node.n1 {
  left: 13px;
  top: 13px;
}

.wire-node.n2 {
  right: 14px;
  top: 15px;
}

.wire-node.n3 {
  left: 18px;
  bottom: 14px;
}

.wire-node.n4 {
  right: 18px;
  bottom: 13px;
}

.wire-line {
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  transform-origin: left center;
}

.wire-line.l1 {
  left: 23px;
  top: 20px;
  width: 42px;
}

.wire-line.l2 {
  left: 25px;
  top: 40px;
  width: 38px;
  transform: rotate(-23deg);
}

.wire-line.l3 {
  left: 30px;
  top: 49px;
  width: 34px;
}

.reference-thumb-wiring b {
  position: absolute;
  right: 8px;
  top: 28px;
  color: #0f5f49;
  font-size: 10px;
  letter-spacing: 0;
}

.reference-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.reference-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  gap: 16px;
  min-width: 0;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  animation: riseIn 420ms ease both;
  backdrop-filter: blur(10px);
}

.viewer-section {
  display: grid;
  grid-template-columns: minmax(190px, 0.36fr) minmax(0, 1.64fr);
  gap: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-strong);
  animation: riseIn 480ms ease both;
}

.viewer-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.viewer-copy h2 {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.08;
}

.viewer-copy p:not(.eyebrow) {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.viewer-shell {
  min-width: 0;
  background: #f8faf7;
  color: var(--ink);
}

.viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 12px;
}

.secondary-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 800;
  transition: border-color 170ms ease, background 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}

.secondary-btn:hover {
  border-color: rgba(15, 106, 85, 0.42);
  box-shadow: 0 10px 22px rgba(31, 35, 31, 0.08);
  transform: translateY(-1px);
}

.secondary-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.explode-control {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
}

.explode-control input {
  width: 100%;
  accent-color: var(--accent);
}

.viewer-status {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 13px;
}

.viewer-status-text {
  display: block;
  line-height: 1.45;
}

.viewer-progress {
  display: block;
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  background: #dfe8e2;
}

.viewer-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

.viewer-status.ok {
  background: #eef8f4;
  color: var(--accent);
  font-weight: 800;
}

.viewer-status.error {
  background: #fff2ed;
  color: #8a2f1b;
  font-weight: 800;
}

.viewer-canvas {
  width: 100%;
  height: min(78vh, 860px);
  min-height: 640px;
}

.viewer-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.stage-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  content: "";
}

.stage-head {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.stage-code {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.stage-head h2 {
  font-size: clamp(25px, 4vw, 42px);
  font-weight: 900;
  line-height: 1.12;
}

.stage-head p,
.lead {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.section {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.section h3 {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 18px;
}

.section h3::before {
  width: 7px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.action-list {
  counter-reset: action;
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.action-list li {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 12px 12px 48px;
  line-height: 1.75;
  counter-increment: action;
}

.action-list li::before {
  position: absolute;
  left: 12px;
  top: 13px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  content: counter(action);
  font-size: 12px;
  font-weight: 900;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  line-height: 1.55;
}

.check-item:has(input:checked) {
  border-color: rgba(15, 106, 85, 0.42);
  background: #f1faf5;
}

.check-item input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-list li {
  border-radius: 999px;
  background: #f4f7f4;
  color: #26302a;
  padding: 7px 10px;
  font-size: 13px;
}

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

.risk-list li {
  border-left: 3px solid #d79a31;
  background: #fffaf0;
  padding: 8px 10px;
  line-height: 1.55;
}

.video-side {
  position: sticky;
  top: 92px;
  overflow: hidden;
}

.video-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.video-side-head h3 {
  margin-top: 3px;
  font-size: 20px;
}

.video-side-head > span {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
}

.video-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding: 14px;
}

.video-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.video-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 10px 24px rgba(22, 27, 24, 0.07);
  transform: translateY(-2px);
}

.video-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  height: 58px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
}

.video-thumb i {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.video-thumb i::before {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid #fff;
  content: "";
}

.video-card strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.video-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.training-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  align-items: start;
}

.training-index {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.training-index button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.training-index button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.training-main {
  display: grid;
  gap: 12px;
}

.training-group {
  padding: 16px;
}

.training-group h2 {
  font-size: 22px;
}

.training-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.training-video-grid .video-card {
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 86px;
}

.resource-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  animation: riseIn 360ms ease both;
}

.resource-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.resource-card::before {
  display: none;
}

.resource-card > * {
  position: relative;
}

.resource-card:hover {
  border-color: rgba(15, 106, 85, 0.38);
  box-shadow: 0 12px 30px rgba(22, 27, 24, 0.08);
  transform: translateY(-2px);
}

.resource-card h2 {
  margin-top: 3px;
  font-size: 22px;
}

.resource-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.resource-meta span {
  border: 1px solid rgba(223, 227, 220, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 6px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.resource-details {
  margin-top: 14px;
}

.resource-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 900;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.resource-details summary::-webkit-details-marker {
  display: none;
}

.resource-details summary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.resource-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  animation: softReveal 240ms ease both;
}

.resource-link,
.gap-line {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
  line-height: 1.5;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.resource-link:hover,
.gap-line:hover {
  border-color: rgba(15, 106, 85, 0.36);
  background: #fff;
  transform: translateX(2px);
}

.resource-link small,
.gap-line small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.empty-state {
  border: 1px dashed #b7c2b8;
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--muted);
  padding: 18px;
  line-height: 1.7;
}

.video-modal.hidden,
.hidden {
  display: none !important;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 20, 18, 0.58);
}

.modal-panel {
  position: relative;
  display: grid;
  width: min(1100px, 100%);
  max-height: min(86vh, 820px);
  overflow: hidden;
  border-radius: 8px;
  background: #111412;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  padding: 12px 14px;
}

.modal-head h2 {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

#modalVideo {
  width: 100%;
  max-height: calc(86vh - 62px);
  background: #111412;
}

.modal-image {
  display: none;
  width: 100%;
  height: calc(100vh - 72px);
  max-height: calc(100vh - 72px);
  object-fit: contain;
  background: #111412;
}

.image-mode .modal-panel {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}

.image-mode #modalVideo {
  display: none;
}

.image-mode .modal-image {
  display: block;
}

.video-mode .modal-image {
  display: none;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progressSheen {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes flowStepIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes stepGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 106, 85, 0.28);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(15, 106, 85, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 106, 85, 0);
  }
}

@media (max-width: 980px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-tabs {
    width: 100%;
  }

  .stage-layout,
  .training-layout,
  .viewer-section,
  .resource-dock {
    grid-template-columns: 1fr;
  }

  .video-side,
  .training-index {
    position: static;
  }

  .video-list {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-header,
  .workspace {
    gap: 12px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

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

  .brand p {
    display: none;
  }

  .utility-row {
    display: block;
  }

  .search-box {
    grid-template-columns: 1fr;
  }

  .flow-board,
  .stage-card {
    padding: 12px;
  }

  .flow-title {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  .reference-board {
    padding: 12px;
  }

  .reference-head {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .reference-head h2 {
    font-size: 18px;
  }

  .reference-head p {
    max-width: none;
    font-size: 12px;
  }

  .reference-strip {
    grid-template-columns: 1fr;
  }

  .flow-title h2 {
    font-size: 20px;
  }

  .flow-title p {
    max-width: none;
    font-size: 12px;
  }

  .flow-overview {
    grid-template-columns: auto minmax(80px, 1fr) auto;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 9px;
  }

  .flow-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
    padding: 0;
  }

  .flow-step {
    min-height: 68px;
    padding: 8px;
  }

  .flow-step::after,
  .flow-step small {
    display: none;
  }

  .flow-step strong {
    gap: 5px;
    font-size: 10px;
  }

  .flow-step strong b {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .flow-step span {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.25;
  }

  .check-grid,
  .training-video-grid {
    grid-template-columns: 1fr;
  }

  .video-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .video-thumb {
    height: 52px;
  }

  .modal-panel {
    width: 100%;
  }

  .viewer-copy {
    padding: 18px;
  }

  .viewer-canvas {
    height: 72vh;
    min-height: 560px;
  }
}
