.roy-hero {
  --roy-paper: #fbf6eb;
  --roy-gold: #f4cc87;
  --roy-muted: #c3c0b6;
  background: #141715;
  color: var(--roy-paper);
  font-variant-numeric: tabular-nums;
}
.roy-scene { background: #141715; }
.roy-stage { --roy-media-height: min(76svh, 56.25vw); position: relative; display: grid; gap: clamp(12px, 2vw, 26px); padding-block: clamp(24px, 4vw, 48px) clamp(22px, 3vw, 38px); }
.roy-copy { min-width: 0; }
.roy-kicker { display: flex; align-items: center; gap: 10px; color: #ecd7b1; font-size: .94rem; font-weight: 620; }
.roy-kicker::before { content: ""; width: 22px; height: 2px; background: #e8bd77; }
.roy-hero h1 {
  color: var(--roy-paper); margin: 19px 0 15px; font-weight: 730;
  font-size: clamp(2.15rem, 4vw, 3.8rem); letter-spacing: -.018em;
  line-height: 1.18; word-break: keep-all; overflow-wrap: anywhere;
}
.roy-hero h1 > span { display: block; }
.roy-hero h1 em { color: #ffd48b; font-style: normal; }
.roy-question { color: #e4dfd7; line-height: 1.6; font-size: clamp(1.03rem,1.35vw,1.38rem); text-wrap: pretty; }
.roy-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.roy-outcome { display: flex; gap: 8px 15px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.roy-primary, .roy-secondary {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 46px; line-height: 1.35; font-weight: 670; font-size: 1rem;
  border-radius: 8px; padding: 11px 20px;
}
.roy-primary { background: #f1cc8c; color: #241d15; border: 1px solid #f5d79f; box-shadow: 0 4px 18px #0a0b0d27; }
.roy-primary:hover { background: #ffdeaa; }
.roy-secondary { border: 1px solid #a39682; color: var(--roy-paper); background: #201f20c9; }
.roy-secondary:hover { border-color: var(--roy-gold); }
.roy-feedback { margin: 10px 0 0; color: #fae0b2; line-height: 1.55; font-size: .96rem; }
.roy-feedback:empty { display: none; }
.roy-media { margin: 0; min-width: 0; }
.roy-visual {
  position: relative; block-size: var(--roy-media-height);
  isolation: isolate; overflow: hidden; background: #101210;
}
.roy-still {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  object-fit: contain; pointer-events: none;
}
.roy-look { opacity: 0; transition: opacity .7s ease; }
.roy-hero:not([data-beat="writing"]) .roy-look { opacity: 1; }
.roy-film { visibility: hidden; background: #101210; }
.roy-hero[data-video] .roy-film { visibility: visible; }
.roy-hero[data-video] .roy-visual > :not(.roy-film) { visibility: hidden; }
.roy-caption {
  margin-top: 9px; padding-top: 9px; min-width: 0;
  border-top: 1px solid #b8a98d48; color: var(--roy-paper);
  font-size: .95rem; line-height: 1.55;
}
.roy-caption p:first-child { font-size: .8rem; color: #ffe1ab; font-weight: 700; }
.roy-caption p:first-child span { font-weight: 470; color: #e5ded0; }
#royLine:not([hidden]) { min-height: 1.55em; }
.roy-playback { display: flex; align-items: center; gap: 9px; }
#royPlayback { color: #f0dfbc; min-width: 86px; min-height: 44px; padding-inline: 10px; font-size: .86rem; font-weight: 640; border-radius: 6px; background: #282620; }
#royPlayback:hover { background: #383226; }
.roy-progress { flex: 1; height: 2px; background: #b8a98d50; }
.roy-progress i { display: block; height: 100%; background: #e6c391; transform-origin: left; transform: scaleX(var(--roy-progress,0)); }

.roy-plan {
  --roy-overrun: #ffac93;
  --roy-overrun-fill: #4b2c29;
  background: #181b19; border-block: 1px solid #dbcead30;
}
.roy-plan-inner { padding-block: 19px 15px; }
.roy-plan-head, .roy-plan-title, .roy-times { display: flex; align-items: baseline; }
.roy-plan-head { justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.roy-plan-title { gap: 13px; flex-wrap: wrap; }
.roy-plan h2 { margin: 0; font-size: clamp(1.15rem,1.5vw,1.65rem); line-height: 1.4; font-weight: 680; }
.roy-plan-title > span { color: #bbbdb4; font-size: .875rem; }
.roy-plan-summary {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px clamp(10px, 1.6vw, 24px);
}
.roy-deadline-status {
  padding: 4px 9px; border: 1px solid #81a687; border-radius: 99px;
  background: #263c2e; color: #d0ebd1; font-size: .82rem; font-weight: 660; white-space: nowrap;
}
.roy-deadline-status[data-late] { border-color: var(--roy-overrun); background: var(--roy-overrun-fill); color: var(--roy-overrun); }
.roy-times { margin: 0; gap: clamp(14px,2.8vw,45px); }
.roy-times > div { display: grid; gap: 4px; }
.roy-times > div + div { padding-inline-start: clamp(12px,2vw,28px); border-inline-start: 1px solid #f4cc8755; }
.roy-times dt { color: #c5c5b9; font-size: .85rem; }
.roy-times dd {
  margin: 0; color: #f6efe3; font-size: clamp(1.8rem,3.1vw,2.75rem);
  font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.035em; line-height: 1.1;
}
#royForecast { color: #fac88f; }
.roy-hero[data-mode="result"] #royForecast { color: #b9ddbc; }
.roy-timeline {
  --script: 36.8421%; --recording: 21.0526%; --edit: 42.1053%; --deadline: 94.7368%; --spill: 5.2632%;
  --script-color: #e9b981; --record-color: #8cb4c7; --edit-color: #b3a6c9;
  margin-top: 16px;
}
.roy-track { display: flex; height: 10px; position: relative; background: #393b36; border-radius: 3px; }
.roy-track i { height: 100%; transition: width .36s ease; border-right: 3px solid #181b19; }
.roy-track i:nth-child(1) { width: var(--script); background: var(--script-color); border-radius: 3px 0 0 3px; }
.roy-track i:nth-child(2) { width: var(--recording); background: var(--record-color); }
.roy-track i:nth-child(3) { width: var(--edit); background: var(--edit-color); border-radius: 0 3px 3px 0; border: 0; }
.roy-stop { position: absolute; top: -5px; bottom: -3px; left: var(--deadline); width: 2px; background: #fff3d6; }
.roy-spill {
  position: absolute; top: 0; bottom: 0; left: var(--deadline); width: var(--spill);
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(122deg, var(--roy-overrun-fill) 0 2px, var(--roy-overrun) 2px 5px);
  transition: width .42s ease-out;
}
.roy-tasks { display: grid; grid-template-columns: var(--script) var(--recording) 1fr; margin: 10px 0 0; }
.roy-tasks > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 9px; }
.roy-tasks dt { color: #f4f0e6; font-size: .98rem; font-weight: 680; }
.roy-tasks dd { margin: 0; font-size: .94rem; color: #e0dfd4; }
.roy-tasks s { font-size: .84rem; color: #abad9f; }
.roy-tasks b { font-weight: 550; }
.roy-tasks > div:last-child { justify-content: flex-end; }
.roy-adjust {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  min-height: 44px; padding: 0 9px; border: 1px solid #f4cc8766;
  border-radius: 7px; background: #f4cc8715; color: var(--roy-paper);
}
.roy-adjust span { color: var(--roy-gold); font-size: .8rem; }
.roy-adjust:enabled:hover { border-color: var(--roy-gold); background: #f4cc8733; }
.roy-adjust:focus-visible { outline: 2px solid var(--roy-gold); outline-offset: 2px; }
.roy-adjust:disabled { border-color: transparent; background: transparent; color: inherit; cursor: default; }
.roy-adjust:disabled span { visibility: hidden; }
.roy-hero[data-mode="result"] .roy-adjust { padding-inline: 0; }
.roy-hero[data-mode="result"] .roy-adjust span { display: none; }
.roy-hero[data-adjusted="edit"] #royEdit,
.roy-hero[data-adjusted="recording"] #royRecording {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #f4cc8770;
  border-radius: 6px;
  background: #f4cc8717;
  color: #ffda9d;
  font-size: 1.2em;
  font-weight: 740;
  line-height: 1.25;
  white-space: nowrap;
}
.roy-plan-close { color: #f1d5a6; font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; }
#retryRoy { margin-top: 8px; }
.roy-budget { margin: 10px 0 0; font-size: .9rem; line-height: 1.5; color: #c1c1b6; }
.roy-budget b { font-weight: 610; color: #ece7d9; }
.roy-links { display: flex; align-items: center; gap: 1.8rem; min-height: 44px; color: #c6c8be; }
.roy-links button { display: inline-flex; align-items: center; gap: 7px; font-size: .88rem; padding-block: 10px; }
.roy-links button:hover { color: var(--roy-gold); }
.roy-links .sound { margin-left: auto; }
.roy-links .play { border-left-color: var(--roy-gold); }

@media (min-width: 1024px) and (min-height: 520px) {
  .roy-stage { padding-top: 0; }
  .roy-copy {
    position: absolute; z-index: 1; inset: 0 0 auto;
    block-size: var(--roy-media-height); display: flex; flex-direction: column;
    justify-content: center; pointer-events: none;
  }
  .roy-copy > * { max-inline-size: min(47%, 650px); }
  .roy-copy .roy-actions > * { pointer-events: auto; }
  .roy-still {
    --roy-image-width: min(100%, calc(var(--roy-media-height) * 1816 / 866));
    --roy-edge: calc(100% - var(--roy-image-width));
    object-position: right center;
    mask-image: linear-gradient(to right, transparent var(--roy-edge), #000 calc(var(--roy-edge) + clamp(70px, 11vw, 180px)));
  }
  video.roy-still { --roy-image-width: min(100%, calc(var(--roy-media-height) * 16 / 9)); }
  .roy-visual::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, #101210 0%, #101210ef 20%, #101210bf 36%, #10121054 49%, transparent 61%);
  }
}
@media (max-width:720px) {
  .roy-stage { padding-bottom: 20px; gap: 15px; }
  .roy-hero h1 { font-size: clamp(2rem, 7.4vw, 3rem); margin-block: 9px; }
  .roy-kicker { font-size: .86rem; }
  .roy-question { font-size: 1rem; }
  .roy-primary, .roy-secondary { min-height: 44px; padding: 9px 14px; font-size: .94rem; }
  .roy-caption { font-size: .87rem; }
  .roy-plan-inner { padding-block: 14px; }
  .roy-plan-head { align-items: start; }
  .roy-plan-title { display: grid; gap: 2px; }
  .roy-plan h2 { font-size: 1.05rem; }
  .roy-plan-title > span, .roy-times dt { font-size: .82rem; }
  .roy-times { gap: 14px; }
  .roy-timeline { margin-top: 12px; }
  .roy-track { height: 8px; }
  .roy-tasks { margin-top: 7px; }
  .roy-tasks { grid-template-columns: 1fr 1fr 1fr; }
  .roy-tasks > div { display: block; }
  .roy-adjust { gap: 4px; padding-inline: 5px; }
  .roy-tasks dt,.roy-tasks dd { font-size: .88rem; }
  .roy-tasks s { font-size: .77rem; }
  .roy-budget { margin-top: 8px; font-size: .86rem; }
  .roy-links { gap: 15px; flex-wrap: wrap; padding-block: 4px; }
  .roy-links button { padding-block: 6px; font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  .roy-look, .roy-track i, .roy-spill { transition: none; }
}
