:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --ink: #111111;
  --ink-soft: #24272b;
  --muted: #666b72;
  --muted-2: #8a8f96;
  --faint: #c3c6ca;
  --red: #e4002b;
  --cobalt: #002fa7;
  --orange: #ff4f00;
  --stage: #f0f1f2;
  --rule: rgba(17, 17, 17, 0.14);
  --rule-strong: rgba(17, 17, 17, 0.28);
  --font-sans: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-condensed: "Bahnschrift", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}

::selection {
  background: var(--ink);
  color: #ffffff;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 240px;
  grid-template-rows: 64px minmax(0, 1fr) 104px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
}

.app > * {
  min-width: 0;
  min-height: 0;
}

/* ------------------------------------------------------------
   Masthead
------------------------------------------------------------ */
.masthead {
  grid-column: 1 / -1;
  grid-row: 1;
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

.brand-cn {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.brand-en {
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}

.page-title {
  margin: 0;
  font-size: clamp(18px, 1.45vw, 22px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  white-space: nowrap;
}

.header-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}

.header-meta span {
  position: relative;
}

.header-meta span + span::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 50%;
  width: 3px;
  height: 3px;
  background: var(--rule-strong);
  transform: translateY(-50%);
}

.header-meta a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 2px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  transition: color 160ms ease, border-color 160ms ease;
}

.header-meta a:hover {
  color: var(--red);
  border-color: var(--red);
}

.header-meta .arrow {
  font-size: 9px;
  line-height: 1;
}

/* ------------------------------------------------------------
   Panels
------------------------------------------------------------ */
.panel {
  position: relative;
  z-index: 12;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

.panel::-webkit-scrollbar {
  width: 4px;
}

.panel::-webkit-scrollbar-thumb {
  background: var(--faint);
}

.panel-left {
  grid-column: 1;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 18px;
  border-right: 1px solid var(--rule-strong);
  overflow-y: auto;
}

.panel-right {
  grid-column: 3;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 18px;
  border-left: 1px solid var(--rule-strong);
  overflow-y: auto;
}

.micro {
  margin: 0;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted-2);
  text-transform: uppercase;
  white-space: nowrap;
}

.rule-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.rule-head .micro {
  font-size: 7.5px;
  letter-spacing: 0.13em;
  color: var(--muted-2);
}

/* ------------------------------------------------------------
   Rotation panel
------------------------------------------------------------ */
.rotation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rotation-id {
  min-width: 0;
}

.rot-big {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 2px;
  font-family: var(--font-condensed);
  line-height: 0.82;
}

#rotBig {
  display: inline-block;
  font-size: clamp(76px, 6vw, 94px);
  font-weight: 600;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums;
  transition: opacity 120ms ease;
}

.rot-of {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  transform: translateY(-2px);
}

.rot-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding-top: 4px;
  flex-shrink: 0;
}

.rot-name {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tag {
  display: inline-block;
  padding: 3px 6px;
  background: var(--ink);
  color: #ffffff;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.tag-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: 2px 5px;
}

.rot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.rot-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 61px;
  padding: 9px 8px 8px;
  border: 0;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.rot-btn:hover {
  background: #ececee;
}

.rot-btn .rot-num {
  font-family: var(--font-condensed);
  font-size: 25px;
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.rot-btn .rot-cell-meta {
  font-size: 7.5px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.rot-btn.is-active {
  background: var(--ink);
  color: #ffffff;
  box-shadow: inset 0 3px 0 var(--red);
}

.rot-btn.is-active .rot-cell-meta {
  color: rgba(255, 255, 255, 0.62);
}

.rot-btn.is-active:hover {
  background: #1c1c1c;
}

.rot-btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -3px;
  z-index: 2;
}

.variant-block {
  margin-top: 14px;
}

.variant-head {
  margin-bottom: 7px;
}

.variant-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.variant-btn {
  position: relative;
  min-width: 0;
  padding: 8px 7px 7px;
  border: 0;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.variant-btn:hover {
  background: #ececee;
}

.variant-btn.is-active {
  background: var(--ink);
  color: #ffffff;
  box-shadow: inset 0 3px 0 var(--red);
}

.variant-btn.is-active:hover {
  background: #1c1c1c;
}

.variant-btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -3px;
  z-index: 2;
}

.rot-summary {
  display: none;
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.5;
  color: #4a4e54;
}

.brief {
  margin-top: 18px;
  padding-top: 0;
}

.brief-lead {
  margin: 0 0 11px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.brief-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brief-list li {
  position: relative;
  padding-left: 13px;
  font-size: 10.5px;
  line-height: 1.65;
  color: #4b4f55;
  text-wrap: pretty;
}

.brief-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 4px;
  height: 4px;
  background: var(--red);
}

.meta-list {
  margin: 14px 0 0;
  padding: 7px 0 0;
  border-top: 1px solid var(--rule);
}

.meta-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.meta-list dt {
  font-size: 9px;
  letter-spacing: 0.02em;
  color: var(--muted-2);
  white-space: nowrap;
}

.meta-list dd {
  margin: 0;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.4;
  text-align: right;
  color: var(--ink);
}

.source-line {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 9px;
  line-height: 1.55;
  color: var(--muted-2);
}

.source-line .micro {
  margin-bottom: 6px;
}

.source-line a {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: color 160ms ease, border-color 160ms ease;
}

.source-line a:hover {
  color: var(--red);
  border-color: var(--red);
}

.source-line p:last-child {
  margin: 0;
}

/* ------------------------------------------------------------
   Right panel
------------------------------------------------------------ */
.roster-block {
  flex: 0 0 auto;
}

.live-roster {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

.roster-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.roster-item:hover,
.roster-item:focus-visible {
  background: rgba(17, 17, 17, 0.035);
  outline: none;
}

.roster-item.is-highlighted {
  background: rgba(17, 17, 17, 0.05);
}

.roster-swatch {
  width: 8px;
  height: 17px;
  background: var(--swatch);
  display: block;
}

.roster-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.roster-role {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.roster-code {
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.roster-task {
  overflow: hidden;
  max-width: 82px;
  font-size: 8.5px;
  line-height: 1.3;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-block {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid var(--ink);
}

.phase-block h2 {
  margin: 1px 0 7px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.phase-block > p {
  margin: 0;
  font-size: 10px;
  line-height: 1.7;
  color: #4b4f55;
  text-wrap: pretty;
}

.move-list {
  margin-top: 11px;
  padding-top: 7px;
  border-top: 1px solid var(--rule);
}

.move-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 3.5px 0;
  font-size: 8.5px;
  line-height: 1.3;
  border-bottom: 1px dotted rgba(17, 17, 17, 0.12);
}

.move-item:last-child {
  border-bottom: 0;
}

.move-role {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.move-dest {
  overflow: hidden;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-block {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.key-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  font-size: 8.5px;
  color: var(--muted);
}

.key-row:last-child {
  margin-bottom: 0;
}

.key-line {
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--red);
  flex-shrink: 0;
}

.key-dash {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 1px dashed #8a8f96;
  flex-shrink: 0;
}

.key-square {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 9px;
  margin-right: 9px;
  border: 1px solid var(--ink);
  background: #ffffff;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   Stage
------------------------------------------------------------ */
.stage {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 36%, #ffffff 0%, #f5f6f7 48%, #eceeef 100%);
  isolation: isolate;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(17, 17, 17, 0.075), transparent 34%);
  pointer-events: none;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(17, 17, 17, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(17, 17, 17, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at 50% 48%, #000 0%, rgba(0, 0, 0, 0.55) 62%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 48%, #000 0%, rgba(0, 0, 0, 0.55) 62%, transparent 100%);
  pointer-events: none;
}

.stage-corners {
  position: absolute;
  inset: 14px;
  z-index: 2;
  pointer-events: none;
}

.stage-corners i {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(17, 17, 17, 0.24);
  border-style: solid;
}

.stage-corners i:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}

.stage-corners i:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 1px 1px 0 0;
}

.stage-corners i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-width: 0 0 1px 1px;
}

.stage-corners i:nth-child(4) {
  right: 0;
  bottom: 0;
  border-width: 0 1px 1px 0;
}

.ghost-num {
  position: absolute;
  top: -0.17em;
  right: -0.025em;
  z-index: 0;
  font-family: var(--font-condensed);
  font-size: clamp(260px, 27vw, 480px);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.075em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(17, 17, 17, 0.09);
  pointer-events: none;
  user-select: none;
  font-variant-numeric: tabular-nums;
  transition: opacity 160ms ease;
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  outline: none;
}

#scene.is-dragging {
  cursor: grabbing;
}

.serve-chip {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid var(--rule-strong);
  background: rgba(247, 247, 248, 0.88);
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  color: var(--ink);
  transform: translateX(-50%);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 260ms ease, transform 260ms ease;
  pointer-events: none;
}

.serve-chip i {
  font-style: normal;
  color: var(--red);
  font-size: 10px;
  line-height: 1;
}

.serve-chip.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-5px);
}

.serve-dot {
  width: 4px;
  height: 4px;
  background: var(--red);
  border-radius: 50%;
  display: block;
}

.label-leaders {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.label-leaders line {
  stroke: rgba(17, 17, 17, 0.28);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.label-leaders circle {
  stroke: #ffffff;
  stroke-width: 1;
}

.player-labels {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.player-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform;
  opacity: 0;
  transition: opacity 180ms ease;
}

.player-label.is-visible {
  opacity: 1;
}

.player-label .label-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 4px 7px 4px 9px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(17, 17, 17, 0.7);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.player-label .label-inner::before {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 3px;
  background: var(--accent);
}

.label-top {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1.2;
  white-space: nowrap;
}

.label-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.label-task {
  font-size: 8px;
  line-height: 1.3;
  color: #4c5056;
  white-space: nowrap;
}

.player-label.is-highlighted .label-inner {
  border-color: var(--accent);
  background: #ffffff;
}

.player-label.is-dimmed {
  opacity: 0.38 !important;
}

.stage-foot {
  position: absolute;
  right: 20px;
  bottom: 12px;
  left: 20px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.stage-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid var(--rule);
  background: rgba(247, 247, 248, 0.82);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.stage-phase i {
  display: block;
  width: 4px;
  height: 4px;
  background: var(--red);
}

.stage-hint {
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--muted-2);
}

.stage-fallback {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--stage);
  text-align: center;
}

.stage-fallback p {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stage-fallback span {
  max-width: 300px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* ------------------------------------------------------------
   Transport
------------------------------------------------------------ */
.transport {
  display: flex;
  align-items: center;
  gap: 18px;
  grid-column: 2;
  grid-row: 3;
  padding: 0 20px;
  border-top: 1px solid var(--rule-strong);
  background: var(--bg);
  position: relative;
  z-index: 12;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.btn-play {
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-play:hover {
  background: var(--red);
  border-color: var(--red);
}

.btn-play:focus-visible,
.btn-replay:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.btn-play svg {
  width: 22px;
  height: 22px;
  display: block;
}

.btn-play .icon-pause {
  display: none;
}

.btn-play.is-playing .icon-play {
  display: none;
}

.btn-play.is-playing .icon-pause {
  display: block;
}

.btn-replay {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.btn-replay:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.btn-replay svg {
  width: 17px;
  height: 17px;
  display: block;
}

.timeline-wrap {
  flex: 1;
  min-width: 0;
}

.timeline-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  font-size: 8.5px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: var(--muted);
}

#phaseCaption {
  overflow: hidden;
  font-weight: 600;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#phaseTime {
  flex-shrink: 0;
  font-size: 8px;
  color: var(--muted-2);
}

.timeline {
  position: relative;
  height: 18px;
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.timeline:focus-visible::before {
  content: "";
  position: absolute;
  inset: 0;
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.timeline-track {
  position: absolute;
  top: 8px;
  right: 0;
  left: 0;
  height: 1px;
  background: #a8acb1;
}

.timeline-progress {
  position: absolute;
  top: 7px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--red);
}

.timeline-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-ticks i {
  position: absolute;
  top: 5px;
  width: 1px;
  height: 6px;
  background: rgba(17, 17, 17, 0.35);
}

.timeline-knob {
  position: absolute;
  top: 3px;
  left: 0;
  width: 11px;
  height: 11px;
  background: var(--red);
  border: 1px solid var(--bg);
  transform: translateX(-50%);
  pointer-events: none;
}

.phase-labels {
  position: relative;
  height: 14px;
  margin-top: 1px;
}

.phase-jump {
  position: absolute;
  top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7e8389;
  font-size: 7.5px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  transform: translateX(-50%);
  transition: color 140ms ease;
}

.phase-jump.phase-first {
  left: 0 !important;
  transform: none;
}

.phase-jump.phase-last {
  right: 0;
  left: auto !important;
  transform: none;
}

.phase-jump:hover {
  color: var(--ink);
}

.phase-jump.is-active {
  color: var(--ink);
  font-weight: 600;
}

.phase-jump.is-active::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 4px;
  background: var(--red);
  vertical-align: 1px;
}

.timecode {
  flex-shrink: 0;
  font-family: var(--font-condensed);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
}

.time-sep {
  margin: 0 4px;
  color: var(--muted-2);
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding-left: 12px;
  border-left: 1px solid var(--rule);
}

.speed-title {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.speed-bound {
  font-family: var(--font-condensed);
  font-size: 7px;
  line-height: 1;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

#speedRange {
  -webkit-appearance: none;
  appearance: none;
  width: 76px;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#speedRange::-webkit-slider-runnable-track {
  height: 1px;
  background: #a8acb1;
}

#speedRange::-moz-range-track {
  height: 1px;
  background: #a8acb1;
}

#speedRange::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border: 0;
  border-radius: 0;
  background: var(--red);
  cursor: pointer;
}

#speedRange::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 0;
  background: var(--red);
  cursor: pointer;
}

#speedRange:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

#speedValue {
  width: 30px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Entrance motion
------------------------------------------------------------ */
.masthead {
  animation: reveal-down 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel-left {
  animation: reveal-side 620ms 60ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel-right {
  animation: reveal-side-right 620ms 100ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stage {
  animation: reveal-fade 700ms 120ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.transport {
  animation: reveal-up 560ms 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes reveal-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes reveal-side {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes reveal-side-right {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes reveal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------
   Responsive
------------------------------------------------------------ */
@media (max-width: 1240px) {
  .app {
    grid-template-columns: 276px minmax(0, 1fr) 218px;
  }

  .panel-left {
    padding-right: 18px;
    padding-left: 18px;
  }

  .panel-right {
    padding-right: 16px;
    padding-left: 16px;
  }

  #rotBig {
    font-size: 78px;
  }

  .rot-btn {
    min-height: 58px;
  }

  .brief-lead {
    font-size: 11.5px;
  }

  .brief-list li {
    font-size: 10px;
  }
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .panel-right {
    display: none;
  }

  .transport {
    grid-column: 2;
  }

  .ghost-num {
    font-size: 420px;
  }
}

@media (max-width: 980px) {
  .app {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .masthead {
    order: 0;
    flex: 0 0 56px;
    height: 56px;
    padding: 0 16px;
    gap: 12px;
  }

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

  .brand-en {
    display: none;
  }

  .brand-cn {
    font-size: 10px;
  }

  .page-title {
    font-size: 16px;
    letter-spacing: -0.02em;
  }

  .header-meta {
    display: none;
  }

  .panel-left {
    order: 1;
    display: block;
    flex: 0 0 auto;
    width: 100%;
    padding: 9px 16px 11px;
    border-right: 0;
    border-bottom: 1px solid var(--rule-strong);
    overflow: visible;
  }

  .rotation-head {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .rotation-id {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }

  .rotation-id .micro {
    font-size: 7px;
    letter-spacing: 0.1em;
  }

  #rotBig {
    font-size: 30px;
    letter-spacing: -0.05em;
  }

  .rot-of {
    font-size: 7px;
    transform: translateY(0);
  }

  .rot-meta {
    flex-direction: row;
    align-items: center;
    gap: 5px;
    padding-top: 0;
    margin-left: auto;
  }

  .rot-name {
    font-size: 9.5px;
  }

  .tag {
    font-size: 7px;
    padding: 2px 4px;
    letter-spacing: 0.06em;
  }

  .tag-outline {
    padding: 1px 3px;
  }

  .rot-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-top: 0;
  }

  .rot-btn {
    align-items: center;
    min-height: 44px;
    padding: 6px 3px 5px;
    gap: 2px;
  }

  .rot-btn .rot-num {
    font-size: 18px;
  }

  .rot-btn .rot-cell-meta {
    display: none;
  }

  .variant-block {
    margin-top: 8px;
  }

  .variant-head {
    margin-bottom: 5px;
    padding-bottom: 4px;
  }

  .variant-btn {
    padding: 5px 6px;
    font-size: 8.5px;
    line-height: 1.3;
  }

  .rot-summary {
    display: -webkit-box;
    margin-top: 8px;
    overflow: hidden;
    font-size: 9.5px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .brief,
  .source-line {
    display: none;
  }

  .panel-right {
    display: none;
  }

  .stage {
    order: 2;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
  }

  .stage-corners {
    inset: 8px;
  }

  .stage-corners i {
    width: 12px;
    height: 12px;
  }

  .ghost-num {
    top: -0.12em;
    right: -0.04em;
    font-size: clamp(210px, 57vw, 320px);
    -webkit-text-stroke-color: rgba(17, 17, 17, 0.07);
  }

  .serve-chip {
    top: 10px;
    padding: 3px 6px;
    font-size: 7.5px;
    letter-spacing: 0.06em;
  }

  .stage-foot {
    display: none;
  }

  .player-label .label-inner {
    padding: 3px 5px 3px 7px;
  }

  .label-role {
    font-size: 9px;
  }

  .label-task {
    font-size: 7.5px;
  }

  .transport {
    order: 3;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-content: center;
    height: auto;
    min-height: 76px;
    row-gap: 0;
    column-gap: 10px;
    padding: 8px 14px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--rule-strong);
  }

  .transport-controls {
    gap: 6px;
  }

  .btn-play {
    width: 42px;
    height: 42px;
  }

  .btn-play svg {
    width: 20px;
    height: 20px;
  }

  .btn-replay {
    width: 32px;
    height: 32px;
  }

  .btn-replay svg {
    width: 15px;
    height: 15px;
  }

  .timeline-caption {
    margin-bottom: 4px;
    font-size: 8px;
  }

  .timeline {
    height: 16px;
  }

  .timeline-track {
    top: 7px;
  }

  .timeline-progress {
    top: 6px;
    height: 3px;
  }

  .timeline-ticks i {
    top: 4px;
    height: 6px;
  }

  .timeline-knob {
    top: 2px;
    width: 10px;
    height: 10px;
  }

  .phase-labels {
    display: none;
  }

  .timecode {
    display: none;
  }

  #phaseTime {
    font-size: 7.5px;
  }

  .speed-control {
    order: 4;
    flex: 1 0 100%;
    justify-content: flex-end;
    height: 16px;
    margin-top: -1px;
    padding-left: 0;
    border-left: 0;
    gap: 5px;
  }

  #speedRange {
    width: 118px;
    height: 16px;
  }

  #speedValue {
    width: 30px;
    font-size: 8.5px;
  }
}

@media (max-width: 560px) {
  .masthead {
    padding: 0 12px;
    gap: 9px;
  }

  .brand {
    gap: 7px;
  }

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

  .brand-cn {
    font-size: 9px;
    letter-spacing: 0.02em;
  }

  .page-title {
    font-size: 15px;
  }

  .panel-left {
    padding: 8px 12px 10px;
  }

  .rotation-id .micro {
    display: none;
  }

  #rotBig {
    font-size: 27px;
  }

  .rot-name {
    font-size: 9px;
  }

  .variant-block {
    margin-top: 6px;
  }

  .variant-btn {
    padding: 4px 5px;
    font-size: 8px;
  }

  .rot-summary {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    font-size: 8.5px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rot-btn {
    min-height: 41px;
  }

  .rot-btn .rot-num {
    font-size: 17px;
  }

  .transport {
    padding-right: 12px;
    padding-left: 12px;
    gap: 8px;
  }

  .btn-play {
    width: 40px;
    height: 40px;
  }

  .btn-replay {
    width: 30px;
    height: 30px;
  }

  .timeline-caption {
    font-size: 7.5px;
  }

  .label-task {
    display: none;
  }

  .label-role {
    font-size: 8.5px;
  }

  .player-label .label-inner {
    padding: 3px 5px 3px 7px;
  }
}

@media (max-height: 820px) and (min-width: 981px) {
  .app {
    grid-template-rows: 56px minmax(0, 1fr) 94px;
  }

  .masthead {
    padding: 0 20px;
  }

  .panel-left {
    padding-top: 16px;
  }

  #rotBig {
    font-size: 68px;
  }

  .rot-btn {
    min-height: 52px;
  }

  .brief-list li {
    line-height: 1.55;
  }

  .source-line {
    display: none;
  }
}

@media (max-height: 560px) and (min-width: 700px) and (orientation: landscape) {
  .app {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: 44px minmax(0, 1fr) 66px;
    height: 100vh;
    height: 100dvh;
  }

  .masthead {
    order: 0;
    grid-column: 1 / -1;
    grid-row: 1;
    height: 44px;
    flex: 0 0 auto;
    padding: 0 14px;
    gap: 10px;
  }

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

  .brand-cn {
    font-size: 9px;
  }

  .brand-en {
    display: none;
  }

  .page-title {
    font-size: 15px;
  }

  .header-meta {
    display: none;
  }

  .panel-left {
    display: flex;
    grid-column: 1;
    grid-row: 2 / 4;
    flex-direction: column;
    width: auto;
    height: auto;
    padding: 10px 12px;
    border-right: 1px solid var(--rule-strong);
    border-bottom: 0;
    overflow-y: auto;
  }

  .rotation-head {
    align-items: flex-start;
    margin-bottom: 9px;
  }

  .rotation-id {
    display: block;
  }

  .rotation-id .micro {
    display: block;
    font-size: 6.5px;
  }

  #rotBig {
    font-size: 46px;
  }

  .rot-of {
    font-size: 7px;
  }

  .rot-meta {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-top: 2px;
  }

  .rot-name {
    font-size: 9px;
  }

  .tag {
    font-size: 6.5px;
    padding: 2px 4px;
  }

  .rot-grid {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 0;
  }

  .rot-btn {
    align-items: flex-start;
    min-height: 39px;
    padding: 5px 6px;
  }

  .rot-btn .rot-num {
    font-size: 16px;
  }

  .rot-btn .rot-cell-meta {
    display: block;
    font-size: 6.5px;
    line-height: 1.3;
  }

  .rot-summary {
    display: -webkit-box;
    margin-top: 7px;
    overflow: hidden;
    font-size: 8px;
    line-height: 1.45;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .brief,
  .source-line {
    display: none;
  }

  .panel-right {
    display: none;
  }

  .stage {
    order: 0;
    grid-column: 2;
    grid-row: 2;
    width: auto;
    height: auto;
    min-height: 0;
  }

  .stage-corners {
    inset: 7px;
  }

  .stage-corners i {
    width: 10px;
    height: 10px;
  }

  .ghost-num {
    display: none;
  }

  .serve-chip {
    top: 7px;
    padding: 2px 5px;
    font-size: 6.5px;
  }

  .stage-foot {
    display: none;
  }

  .player-label .label-inner {
    padding: 1.5px 3px 1.5px 5px;
  }

  .label-role {
    font-size: 7.5px;
    line-height: 1.15;
  }

  .label-task {
    display: none;
  }

  .transport {
    order: 0;
    grid-column: 2;
    grid-row: 3;
    flex-wrap: nowrap;
    height: 66px;
    min-height: 66px;
    padding: 5px 14px;
    gap: 10px;
  }

  .btn-play {
    width: 38px;
    height: 38px;
  }

  .btn-replay {
    width: 30px;
    height: 30px;
  }

  .timeline-caption {
    margin-bottom: 2px;
    font-size: 7.5px;
  }

  .timeline {
    height: 14px;
  }

  .timeline-track {
    top: 6px;
  }

  .timeline-progress {
    top: 5px;
  }

  .timeline-ticks i {
    top: 3px;
    height: 5px;
  }

  .timeline-knob {
    top: 1px;
    width: 9px;
    height: 9px;
  }

  .phase-labels {
    display: none;
  }

  .timecode {
    display: flex;
    font-size: 9px;
  }

  #phaseTime {
    display: none;
  }

  .speed-control {
    order: initial;
    flex: 0 0 auto;
    height: auto;
    margin-top: 0;
    padding-left: 8px;
    border-left: 1px solid var(--rule);
  }

  .speed-bound {
    display: none;
  }

  .speed-title {
    font-size: 7px;
  }

  #speedRange {
    width: 54px;
    height: 16px;
  }

  #speedValue {
    width: 25px;
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .masthead,
  .panel-left,
  .panel-right,
  .stage,
  .transport {
    animation: none;
  }

  .player-label,
  .serve-chip,
  .player-label .label-inner,
  .rot-btn,
  .roster-item,
  .btn-play,
  .btn-replay {
    transition: none;
  }
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  background: var(--bg);
  font-size: 14px;
}
