#dialog:is([data-kind="echo-guide"],[data-kind="echo-result"]) {
  --echo-ink: #353342; --echo-paper: #f8f1dd; --echo-border: #b8ac95;
  width: min(615px, calc(100% - max(10px,var(--safe-left)) - max(10px,var(--safe-right))));
  max-height: calc(100dvh - max(12px,var(--safe-top)) - max(12px,var(--safe-bottom)));
  border: 2px solid #3c3547; border-radius: 14px; background: var(--echo-paper);
  color: var(--echo-ink); box-shadow: 0 4px 0 #453a4c, 0 18px 64px #211e3a5e;
}
#dialog:is([data-kind="echo-guide"],[data-kind="echo-result"]) .dialog-content { padding: 0; }
#dialog:is([data-kind="echo-guide"],[data-kind="echo-result"]) .dialog-close {
  z-index: 1; display: grid; place-items: center; top: 11px; right: 11px;
  width: 44px; height: 44px; padding: 0; border: 1px solid #c8bcb49c; color: #fff5dc; background: #353241;
}
.echo-title {
  position: relative; isolation: isolate; overflow: hidden; padding: 17px 64px 15px 21px;
  color: #fff3d3; background: linear-gradient(100deg,#342f45 36%,#55445e);
  border-bottom: 3px double #dcb48c;
}
.echo-title::before,.echo-title::after {
  content: ""; position: absolute; z-index: -1; top: -78px; right: 86px; width: 153px; height: 153px;
  border: 1px solid #e8c8a36e; transform: rotate(45deg); box-shadow: 0 0 0 7px #c8aab811,0 0 0 8px #a5dfd933;
}
.echo-title::after { right: 57px; top: -87px; border-color: #9de1de67; }
.echo-title > span { color: #e0c7b1; font-size: 12px; font-weight: 720; letter-spacing: .09em; }
.dialog-content .echo-title h2 { margin: 3px 0 0; font-size: clamp(25px,4.1vw,37px); line-height: 1.12; letter-spacing: .02em; }
.echo-sheet { padding: 15px 19px; }
.echo-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.echo-acts button,.echo-action {
  min-width: 0; min-height: 44px; border: 1px solid var(--echo-border); border-radius: 5px;
  color: #4b4650; background: #fff9eb; font-size: 13px; font-weight: 780;
}
.echo-acts button { display: flex; justify-content: center; align-items: baseline; gap: 7px; padding: 10px 7px; color: #686068; font-size: 11px; }
.echo-acts b { font-size: 15px; font-weight: 880; letter-spacing: .03em; color: var(--echo-ink); }
.echo-acts [aria-pressed="true"] { border-color: #51465a; background: #e7ddcf; box-shadow: inset 0 -3px #6b4d66; }
.echo-finished { color: #2b6a62; align-self: center; }
.echo-reading,.echo-receipt { display: grid; grid-template-columns: minmax(140px,.8fr) minmax(0,1.2fr); align-items: center; gap: 20px; margin: 15px 0; }
.echo-plan {
  --left-lamp:#78e8ef; --right-lamp:#ffc482; margin: 0; padding: 10px 14px 7px;
  border-radius: 5px; color: #ffefd4; background: #373445;
  box-shadow: inset 0 0 0 1px #272334;
}
.echo-plan-stage {
  position: relative; height: 111px; max-width: 210px; margin: 0 auto;
  border: 1px solid #9b8e9c96; border-radius: 4px; background:
    linear-gradient(90deg,transparent calc(50% - .5px),#e1c79e17 50%,transparent calc(50% + .5px)),
    repeating-linear-gradient(0deg,#cab1bd0c 0 1px,transparent 1px 13px),#464152;
}
.echo-plan-row { position: absolute; inset-inline: 12%; display: flex; align-items: center; justify-content: space-between; }
.echo-plan-row[data-row="near"] { bottom: 23%; }
.echo-plan-row[data-row="far"] { top: 12%; }
.echo-plan:not(.is-relay) [data-row="far"] { opacity: .24; }
.echo-plan-row::before { content: ""; position: absolute; inset: 50% 15px auto; border-top: 1px dashed #dbc8a263; }
.echo-plan-row.is-focus::before { border-top: 2px solid #ffda9b; }
.echo-plan-row.is-focus small { color: #ffe1a4; }
.echo-plan-row small { position: relative; padding: 0 3px; background: #464152; color: #f5e6cb; font-size: 10px; font-weight: 700; }
.echo-plan-pad {
  display: grid; place-items: center; width: 26px; height: 19px; border: 1px solid currentColor;
  background: #3d5059; color: var(--left-lamp); box-shadow: 0 3px #252c39; transform: skewY(-4deg);
}
.echo-plan-pad.is-right { color: var(--right-lamp); background: #65514d; transform: skewY(4deg); }
.echo-plan-pad.is-target { outline: 2px solid #fff1b7; outline-offset: 3px; }
.echo-plan-pad::after,.echo-symbol { content: ""; display: inline-block; width: 8px; height: 8px; }
.echo-plan-pad.is-left::after,.echo-symbol.is-left { transform: rotate(45deg); border: 1.5px solid currentColor; }
.echo-plan-pad.is-right::after,.echo-symbol.is-right { border-inline: 2px solid currentColor; width: 6px; }
.echo-plan-span { position: absolute; inset: auto calc(12% + 12px) 9%; height: 26%; border: dashed #bbb3ad; border-width: 0 1px 1px; border-radius: 0 0 4px 4px; }
.echo-plan.is-relay .echo-plan-span { height: 67%; }
.echo-plan-console { position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); padding: 1px 5px; border: 1px solid #d7b090; background: #54464e; color: #fff0d0; font-size: 10px; font-weight: 720; }
.echo-plan figcaption { display: flex; justify-content: center; gap: 18px; padding-top: 7px; color: #f8e8d2; font-size: 11px; font-weight: 720; }
.echo-plan figcaption span { display: inline-flex; gap: 6px; align-items: center; }
.echo-symbol.is-left { color: var(--left-lamp); }
.echo-symbol.is-right { color: var(--right-lamp); }
.echo-steps { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; counter-reset: echo-steps; }
.echo-steps li { position: relative; padding-left: 26px; counter-increment: echo-steps; }
.echo-steps li::before {
  content: counter(echo-steps); position: absolute; left: 0; top: 2px; display: grid; place-items: center;
  width: 17px; height: 17px; border: 1px solid #a89586; color: #63505c; border-radius: 50%;
  font: 800 10px/1 system-ui,sans-serif;
}
.echo-steps li::after { content: ""; position: absolute; left: 8px; top: 22px; bottom: -7px; border-left: 1px solid #c4b5a1; }
.echo-steps li:last-child::after { display: none; }
.echo-steps strong { font-size: 14px; color: #3a3540; }
.dialog-content .echo-steps p { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: #615760; font-weight: 600; }
.echo-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px dashed #bfaf99; }
.echo-foot > small { flex: 1 1 130px; font-size: 12px; color: #685b62; font-weight: 680; }
.echo-foot-review { padding-left: 9px; border-left: 3px solid #b97c44; line-height: 1.4; }
.echo-foot-review strong { display: block; margin-bottom: 1px; color: #574052; }
.echo-action { display: inline-flex; gap: 4px; align-items: center; justify-content: center; padding: 7px 13px; line-height: 1.25; }
.echo-action.echo-main { color: #fff6da; border-color: #3e3b4f; background: #50415b; box-shadow: inset 0 -2px #342e41; }
.echo-acts button:hover,.echo-action:hover { border-color: #615169; }
.echo-action.echo-main:hover { background: #66506c; }
.echo-sheet button:focus-visible,.echo-hud-head:focus-visible,.echo-return:focus-visible { outline: 3px solid #c17c50; outline-offset: 1px; }
.echo-result-title { background: linear-gradient(106deg,#2d494e,#485666 56%,#72545a); }
.echo-receipt { grid-template-columns: minmax(135px,1fr) minmax(0,1fr); margin: 1px 0 14px; }
.echo-plan.is-lit .echo-plan-pad { box-shadow: 0 0 9px -1px currentColor; }
.echo-receipt-line { color: #326052; font-size: 15px; }
.echo-result-time { margin: 8px 0; }
.echo-result-time small,.echo-result-time b { display: block; }
.echo-result-time small { color: #6b5e65; font-size: 11px; font-weight: 650; }
.echo-result-time b { font: 800 clamp(22px,4.6vw,33px)/1.2 system-ui,sans-serif; color: #494253; font-variant-numeric: tabular-nums; }
.echo-result-time b small { display: inline; }
.dialog-content .echo-reward { margin: 0; color: #785130; font-size: 12px; }

#app[data-echo-stage] .festival-card { display: none; }
#app[data-echo-stage] .race-place { justify-self: start; }
#festival-echo-hud {
  width: min(265px,100%); overflow: hidden; border: 1px solid #c6b7ae; border-radius: 8px;
  color: #fff5dd; background: #2e2d3ff5; box-shadow: 0 3px 0 #28233880;
}
.echo-hud-head {
  display: flex; align-items: center; gap: 7px; width: 100%; min-height: 44px; padding: 4px 10px;
  text-align: left; pointer-events: auto; touch-action: manipulation; border-bottom: 1px solid #cfc0a64d;
  background: linear-gradient(104deg,#514659,#3e374c 74%,#4b4150);
}
.echo-hud-head strong { font-size: 14px; font-weight: 870; color: #fff2cc; }
.echo-open { margin-left: auto; color: #ecdfd3; font-size: 11px; font-weight: 720; }
.echo-open .glyph { width: 13px; height: 13px; }
.echo-hud-lamp { flex: none; width: 13px; height: 13px; transform: rotate(45deg); border: 1px solid #efbf89; box-shadow: inset 0 0 0 2px #363047,inset 0 0 0 3px #9ed6cc; }
.echo-hud-body { padding: 5px 10px 8px; }
.echo-hud-phase,.echo-occupancy { display: flex; align-items: center; gap: 8px; }
.echo-hud-phase b { color: #eadbbe; font-size: 11px; }
.echo-hud-phase b::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border: 1px solid currentColor; border-radius: 50%; }
[data-phase="recording"] .echo-hud-phase b { color: #ffb6aa; }
[data-phase="recording"] .echo-hud-phase b::before { background: currentColor; }
[data-phase="replay"] .echo-hud-phase b { color: #b5f5dd; }
[data-phase="replay"] .echo-hud-phase b::before { border-width: 4px 0 4px 6px; border-radius: 0; border-color: transparent transparent transparent currentColor; width: 0; height: 0; }
#festival-echo-hud[data-review] .echo-hud-phase b { color: #ffda9b; }
#festival-echo-hud[data-review] .echo-hud-phase b::before { width: 6px; height: 6px; border-radius: 1px; transform: rotate(45deg); }
.echo-hud-phase time,.echo-occupancy b { margin-left: auto; color: #efdfc8; font: 720 11px/1.4 system-ui,sans-serif; font-variant-numeric: tabular-nums; }
.echo-hud-phase time { white-space: nowrap; }
.echo-timeline { position: relative; margin: 5px 1px; }
.echo-track { display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; }
.echo-track > span { font-size: 10px; font-weight: 650; color: #e2d6d4; }
.echo-track > i { position: relative; height: 8px; border-radius: 2px; overflow: hidden; background: repeating-linear-gradient(90deg,#7f7181a3 0px 1px,transparent 1px 25%),#514956; }
.echo-track b { position: absolute; top: 0; height: 100%; min-width: 1px; background: #78dce5; }
.echo-track b.is-right { background: repeating-linear-gradient(115deg,#ffc482 0px 3px,#dd996d 3px 4px); }
.echo-track.is-current > span { color: #b5f5dd; }
.echo-track.is-focus > span { color: #ffda9b; font-weight: 850; }
.echo-track > i.has-range::after {
  content: ""; position: absolute; inset: 0 var(--range-end) 0 var(--range-start); min-width: 3px;
  border: 1px solid #fff5d1; border-inline-width: 2px;
  background: repeating-linear-gradient(135deg,#41394380 0 2px,transparent 2px 5px);
}
.echo-cursor { position: absolute; inset: -1px 0 -1px 28px; }
.echo-cursor i { position: absolute; width: 2px; top: 0; bottom: 0; background: #fffcef; box-shadow: 0 0 0 1px #393341; }
.echo-cursor i::before { content: ""; position: absolute; top: -1px; left: -2px; border: solid transparent; border-width: 4px 3px 0; border-top-color: #fffcef; }
.echo-occupancy { gap: 9px; margin-top: 4px; font-size: 11px; font-weight: 730; }
.echo-occupancy span:first-child { color: #a6eed9; }
.echo-occupancy span:nth-child(2) { color: #fff0cd; }
.echo-occupancy b { font-size: 10px; }
.echo-hold { height: 3px; margin: 4px 0; border-radius: 4px; background: #686177; overflow: hidden; }
.echo-hold i { display: block; height: 100%; background: #c4f4a5; }
.echo-cue { margin: 3px 0 0; font-size: 12px; font-weight: 650; line-height: 1.4; color: #fff0dd; }
.echo-return {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  width: 100%; min-height: 44px; margin-top: 6px; pointer-events: auto; touch-action: manipulation;
  border: 1px solid #b8aaa2; border-radius: 4px; color: #fff1ce; background: #54475c; font-size: 12px; font-weight: 780;
}
.echo-return[data-action="echo-reset"] { background: #f5d598; border-color: #fff0c8; color: #41313b; }

@media (orientation: portrait) and (max-width: 520px) {
  .echo-title { padding: 14px 60px 12px 15px; }
  .echo-sheet { padding: 11px 12px; }
  .echo-reading { grid-template-columns: 1fr; gap: 12px; margin: 10px 0 13px; }
  .echo-reading .echo-plan { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 7px 14px; }
  .echo-reading .echo-plan-stage { width: 100%; height: 94px; }
  .echo-reading .echo-plan figcaption { flex-direction: column; gap: 7px; padding: 0; }
  .echo-steps { gap: 6px; }
  .echo-steps li::after { bottom: -5px; }
  .echo-foot > small { flex-basis: 100%; }
  .echo-receipt { gap: 12px; }
  .echo-receipt .echo-plan { padding-inline: 7px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .echo-title { padding: 9px 64px 9px 16px; }
  .dialog-content .echo-title h2 { display: inline; margin-left: 10px; font-size: 24px; vertical-align: middle; }
  #dialog:is([data-kind="echo-guide"],[data-kind="echo-result"]) .dialog-close { top: 0; right: 3px; border-color: transparent; background: transparent; }
  .echo-sheet { padding: 7px 13px 8px; }
  .echo-reading { gap: 14px; margin: 7px 0; }
  .echo-steps { gap: 3px; }
  .echo-steps li::after { bottom: -1px; }
  .echo-plan-stage { height: 95px; }
  .echo-foot { padding-top: 5px; }
  #festival-echo-hud { width: min(244px,100%); }
  .echo-hud-body { padding: 3px 7px 5px; }
  .echo-hud-head { padding-inline: 7px; }
  .echo-return { margin-top: 3px; }
}
@media (orientation: landscape) and (max-height: 365px) {
  #dialog[data-kind="echo-guide"] { width: min(740px,calc(100% - max(12px,var(--safe-left)) - max(12px,var(--safe-right)))); }
  #dialog[data-kind="echo-guide"] .echo-sheet {
    display: grid; grid-template-columns: minmax(180px,.84fr) minmax(0,1.16fr); gap: 6px 14px;
  }
  #dialog[data-kind="echo-guide"] .echo-reading { display: contents; }
  .echo-acts { grid-column: 1; grid-row: 1; }
  .echo-reading .echo-plan { grid-column: 1; grid-row: 2; padding: 5px 9px; }
  .echo-reading .echo-plan-stage { height: 84px; }
  .echo-reading .echo-plan figcaption { padding-top: 3px; }
  .echo-reading .echo-steps { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .echo-foot { grid-column: 1 / -1; }
}
