.spec-intro {
  margin: 0 0 8px;
  max-width: 38em;
}

.entry.spec-hero {
  flex: none;
  padding: 28px 0 12px;
}

.entry.spec-hero h1 {
  font-size: clamp(36px, 6vw, 52px);
  max-width: none;
}

.entry.spec-hero .summary {
  margin-top: 10px;
  font-size: 16px;
}

.spec-bench {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  align-items: start;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto 48px;
  min-height: calc(100dvh - 220px);
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 50%, white);
}

.spec-rail {
  position: sticky;
  top: 80px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  padding: 18px 12px 20px;
  overflow: visible;
  background: color-mix(in srgb, var(--paper) 82%, white);
}

.spec-rail-kicker {
  margin: 0 8px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--mute);
}

.spec-rail-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  margin: 0 0 2px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.spec-rail-no {
  font-size: 11px;
  color: var(--mute);
}

.spec-rail-item[aria-current="true"] {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  font-weight: 600;
}

.spec-pane {
  min-width: 0;
  padding: 22px 28px 48px;
  border-left: 1px solid var(--rule);
}

.spec-pane-body {
  min-width: 0;
}

.spec-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.spec-pane-head h2 {
  margin: 0;
  font-size: 20px;
}

.spec-pane-head p {
  margin: 0;
  min-width: 0;
  color: var(--mute);
  font-size: 13px;
}

.spec-story-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--rule);
}

.spec-story-tabs button {
  appearance: none;
  position: relative;
  margin: 0;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--mute);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.spec-story-tabs button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.spec-story-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
}

.spec-study-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.spec-study {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.spec-study:hover {
  box-shadow: 0 14px 32px rgba(18, 17, 15, 0.08);
}

.spec-study[aria-current="true"] {
  box-shadow: 0 0 0 1px currentColor;
}

.spec-study-head {
  padding: 14px 16px 10px;
}

.spec-study-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.spec-study-en {
  margin: 3px 0 0;
  font-size: 12px;
  color: color-mix(in srgb, currentColor 58%, transparent);
}

.spec-study-stripe {
  display: flex;
  height: 6px;
}

.spec-study-stripe span {
  flex: 1;
}

.spec-study-ui {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 148px;
  border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.spec-study-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  border-right: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  background: color-mix(in srgb, currentColor 7%, transparent);
  font-size: 10px;
}

.spec-study-side .is-on {
  font-weight: 600;
}

.spec-study-body {
  padding: 14px;
}

.spec-study-panel {
  padding: 12px;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  background: color-mix(in srgb, currentColor 5%, transparent);
}

.spec-study-line {
  display: block;
  width: 42%;
  height: 7px;
  border-radius: 99px;
  background: currentColor;
  opacity: 0.78;
}

.spec-study-line.mute {
  width: 70%;
  margin-top: 8px;
  opacity: 0.28;
}

.spec-study-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.spec-study-btn,
.spec-study-ghost {
  padding: 5px 10px;
  font-size: 10px;
}

.spec-study-ghost {
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.spec-study-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 10px;
  border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  font-size: 11px;
  color: color-mix(in srgb, currentColor 58%, transparent);
}

.spec-study .spec-copy-hint {
  margin: 0;
  color: inherit;
}

.spec-style {
  margin-top: 28px;
}

.spec-style-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.spec-copy-hint {
  margin: 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--mute);
}

.spec-toast {
  position: fixed;
  left: 50%;
  top: 80px;
  bottom: auto;
  z-index: 30;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  box-shadow: 0 10px 28px rgba(18, 17, 15, 0.18);
}

.spec-toast.is-bad {
  background: #8a2a1a;
}

.spec-stage-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  margin-top: 8px;
  align-items: start;
}

.spec-namelist {
  position: sticky;
  top: 80px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: 4px;
  max-height: calc(100dvh - 176px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 12px 0;
  background: color-mix(in srgb, var(--paper) 50%, white);
}

.spec-namelist-group {
  margin: 12px 0 4px;
  font-size: 12px;
  color: var(--mute);
}

.spec-namelist-group:first-child {
  margin-top: 0;
}

.spec-namelist button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
}

.spec-namelist button[aria-current="true"] {
  background: var(--ink);
  color: var(--paper);
}

.spec-stage {
  min-width: 0;
}

.spec-play,
.spec-page-play {
  border: 1px solid var(--rule);
  background: #fff;
  min-height: 280px;
}

.spec-play {
  padding: 28px 24px;
  color: var(--foreground, #161513);
  background: var(--background, #fff);
  font-family: var(--font-sans, inherit);
}

.spec-play-inner {
  display: grid;
  gap: 20px;
  justify-items: start;
}

.spec-live-frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 420px;
  border: 0;
  background: #fff;
}

.spec-motion-play {
  border: 1px solid var(--rule);
  background: #fff;
  min-height: 360px;
}

.spec-motion-stage-live {
  min-height: 320px;
  overflow: hidden;
}

.spec-motion-live-hint {
  margin: 0;
  padding: 10px 14px 14px;
  font-size: 12px;
  color: var(--mute);
  text-align: center;
}

.spec-motion-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.spec-motion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rule);
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.spec-motion[aria-current="true"] {
  border-color: var(--ink);
}

.spec-motion > span {
  padding: 0 10px 10px;
  font-size: 14px;
}

.spec-motion-stage {
  min-height: 140px;
  display: grid;
  place-items: center;
  background: #f4f1ea;
}

.spec-motion-box {
  position: relative;
  width: min(220px, 80%);
  min-height: 72px;
  padding: 16px;
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.spec-asset-sheet {
  display: block;
  width: 100%;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--rule);
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.spec-asset-sheet[aria-current="true"] {
  border-color: var(--ink);
}

.spec-asset-sheet h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.spec-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
}

.spec-icon-grid figure {
  margin: 0;
  padding: 10px 4px;
  text-align: center;
}

.spec-icon-grid img {
  width: 24px;
  height: 24px;
}

.spec-icon-grid figcaption {
  margin-top: 6px;
  font-size: 11px;
  color: var(--mute);
  word-break: break-all;
}

.spec-asset-note {
  margin: 0;
  color: var(--mute);
}

.spec-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  border-top: 1px solid var(--ink);
  background: color-mix(in srgb, var(--paper) 92%, white);
  box-shadow: 0 -18px 40px rgba(18, 17, 15, 0.08);
}

.spec-dock-inner {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 14px 0 16px;
}

.spec-dock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.spec-dock-title {
  margin: 0;
  font-size: 20px;
}

.spec-dock-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--mute);
}

body.spec-dock-on {
  padding-bottom: 96px;
}

body.spec-dock-open {
  padding-bottom: 220px;
}

body.spec-dock-on .spec-namelist {
  max-height: calc(100dvh - 256px);
}

body.spec-dock-open .spec-namelist {
  max-height: calc(100dvh - 380px);
}

.spec-dock .spec-actions {
  margin: 0;
  flex-shrink: 0;
}

.spec-dock .spec-prompt {
  margin-top: 12px;
  max-height: 120px;
}

.spec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.spec-actions button,
.spec-actions a {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.spec-actions a.ghost,
.spec-actions button.ghost {
  background: transparent;
  color: var(--ink);
}

.spec-prompt {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--rule);
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

@media (max-width: 860px) {
  .spec-stage-layout {
    grid-template-columns: 1fr;
  }

  .spec-namelist {
    position: static;
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: none;
    overflow: visible;
  }

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

  .spec-bench {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .spec-rail {
    position: static;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 2px;
    padding: 12px;
    border-bottom: 1px solid var(--rule);
  }

  .spec-rail-item {
    width: 100%;
  }

  .spec-pane {
    padding: 18px 16px 48px;
    border-left: 0;
  }

  .spec-study-grid {
    grid-template-columns: 1fr;
  }

  .spec-palette-grid {
    grid-template-columns: 1fr;
  }

  .spec-dock-head {
    flex-direction: column;
  }
}
