.overlay-root {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 16, 0.44);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
}

.study-sheet {
  position: fixed;
  inset: 16px;
  max-width: 1500px;
  margin-inline: auto;
  height: calc(100dvh - 32px);
  overflow: hidden;
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  transform-origin: center center;
  will-change: transform, border-radius;
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
}

.sheet-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  flex: none;
  height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.sheet-close {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  transition: background-color var(--dur-2), color var(--dur-2);
}

.sheet-close:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.sheet-close-icon {
  font-size: 16px;
  line-height: 1;
  transition: transform var(--dur-2) var(--ease-out);
}

.sheet-close:hover .sheet-close-icon {
  transform: translateX(-2px);
}

.sheet-crumb {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.sheet-steps {
  justify-self: end;
  display: flex;
  gap: 6px;
}

.sheet-step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  transition: border-color var(--dur-2), color var(--dur-2), transform var(--dur-2) var(--ease-out);
}

.sheet-step:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: scale(1.06);
}

.sheet-body {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.82fr);
  flex: 1;
  min-height: 0;
}

.sheet-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px 0 16px 16px;
}

.stage-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 6px;
}

.stage-hint {
  color: var(--ink-3);
  font-size: 11px;
}

.stage-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #30d158;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.stage-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: live-pulse 2s var(--ease-in-out) infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.study-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 360px;
  padding: clamp(18px, 3vw, 44px);
  overflow: hidden;
  border-radius: var(--r-lg);
  background:
    radial-gradient(110% 100% at 50% 0%, #202024, var(--stage) 62%);
  color: var(--stage-ink);
  isolation: isolate;
}

.study-stage > * {
  max-width: 100%;
}

.stage-note {
  display: none;
}

.sheet-inspector {
  min-width: 0;
  padding: 26px 24px 48px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface-2);
}

.inspector-head h2 {
  font-size: clamp(26px, 2.4vw, 34px);
  letter-spacing: -0.02em;
  outline: none;
}

.sheet-summary {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

.sheet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag {
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.inspector-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.inspector-title {
  margin-bottom: 14px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.principle-text {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: border-color var(--dur-2), color var(--dur-2), transform var(--dur-2) var(--ease-out);
}

.related-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.related-chip span {
  opacity: 0.5;
}

.stage-loading,
.stage-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--stage-muted);
  font-size: 13px;
  text-align: center;
}

.stage-loading {
  flex-direction: row;
}

.stage-loading-mark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--stage-ink);
  border-radius: 50%;
  animation: stage-spin 0.8s linear infinite;
}

@keyframes stage-spin {
  to {
    transform: rotate(360deg);
  }
}

.stage-error {
  color: var(--stage-ink);
}

.stage-error-detail {
  color: var(--stage-muted);
  font-size: 12.5px;
}

.stage-retry {
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--stage-ink);
  font-size: 12.5px;
}

.controls-loading {
  color: var(--ink-3);
  font-size: 13px;
}

.overlay-root.is-closing .study-sheet,
.overlay-root.is-closing .overlay-backdrop {
  pointer-events: none;
}

@media (max-width: 980px) {
  .study-sheet {
    inset: 10px;
    height: calc(100dvh - 20px);
  }

  .sheet-body {
    display: block;
    overflow-y: auto;
  }

  .sheet-stage-wrap {
    height: 56vh;
    min-height: 380px;
    padding: 12px 12px 0;
  }

  .sheet-inspector {
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .study-sheet {
    inset: 0;
    height: 100dvh;
    border-radius: 0;
  }

  .sheet-bar {
    height: 56px;
    padding: 0 10px;
  }

  .sheet-crumb {
    font-size: 9.5px;
  }

  .sheet-stage-wrap {
    height: 50vh;
    min-height: 330px;
  }

  .stage-hint {
    display: none;
  }

  .sheet-inspector {
    padding: 22px 18px 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-loading-mark {
    animation-duration: 1.6s;
  }
}
.study-playback { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:2px 4px; }
.study-playback > span { color:var(--ink-3); font-size:10px; }
.playback-speed,.motion-setting { padding:7px 10px; border:1px solid var(--line); border-radius:var(--r-pill); background:var(--surface); color:var(--ink-2); font:inherit; font-size:11px; max-width:100%; }
.study-teaching { margin-top:16px; display:grid; gap:12px; }
.study-teaching p { font-size:12px; color:var(--ink-2); line-height:1.7; }
.study-teaching strong { display:block; color:var(--ink); font-size:11px; }
.code-host::before { content:attr(data-kind); display:block; color:var(--ink-3); font-size:11px; line-height:1.6; margin-bottom:10px; }
@media(max-width:600px) { .motion-setting { max-width:108px; font-size:10px; } .sheet-stage-wrap { min-height:450px; } }
.study-rules { margin-top:18px; border-top:1px solid var(--line); padding-top:14px; }
.study-rules summary { cursor:pointer; font-size:12px; color:var(--ink); }
.study-rules .study-rules-note { margin-top:12px; color:var(--ink-3); font-size:10px; }
.study-rules a { display:inline-block; margin-top:12px; font-size:11px; }
.study-case-link { display:block; margin-top:18px; padding:12px; border:1px solid var(--line); border-radius:12px; color:var(--accent-ink); font-size:12px; }
