/* The same six directions, read as self and then self in a situation. */
#pixel-journey-dialog[data-legend=true] { display:grid;grid-template-rows:auto minmax(0,1fr); }
#pixel-journey-dialog[data-legend=true] > :is(.journey-layout,.journey-context,footer) { display:none!important; }
.personal-legend[hidden] { display:none; }
.personal-legend { min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:14px; }
.legend-mode-tabs { display:flex;justify-self:center;gap:5px;padding:4px;margin-top:16px;border:1px solid #dae1e280;border-radius:16px;background:#e8eef080; }
#pixel-journey-dialog .legend-mode-tabs button { display:grid;gap:2px;min-height:48px;min-width:110px;padding:6px 14px;border:1px solid transparent;border-radius:12px;background:transparent;color:#78868b; }
#pixel-journey-dialog .legend-mode-tabs [aria-pressed=true] { background:#fff;border-color:#edac7f80;color:#35444a;box-shadow:0 2px 5px #2339430a; }
.legend-mode-tabs b { font-size:14px;font-weight:550; }.legend-mode-tabs small { font-size:11px; }
.legend-workspace { display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:24px;align-items:center;min-height:0; }
.legend-scene { min-width:0; }.legend-scene > svg { display:block;width:100%;height:auto;max-height:330px;overflow:visible;touch-action:none; }
.legend-scene [data-legend-face] { cursor:pointer; }.legend-scene [data-legend-face]:focus-visible > polygon { stroke:#ee8b3c;stroke-width:1.2; }
.legend-scene text { font-family:var(--sans,system-ui);stroke:none; }
.legend-scene .journey-ground-axes text { font-size:4px; }.legend-scene .journey-ground-axes path { stroke-width:.5; }
.legend-scene-caption { display:grid;gap:3px;text-align:center;font-size:12px;color:#78858b;margin-top:2px; }
.legend-scene-caption b { font-weight:450;color:#56666d; }.legend-scene-caption span { font-size:11px; }
.legend-directions { display:grid;grid-template-columns:repeat(3,1fr);gap:3px;margin:10px auto 0;max-width:260px; }
#pixel-journey-dialog .legend-directions button { min-height:28px;padding:3px 5px;font-size:11px;background:transparent;border:1px solid transparent;border-radius:7px;color:#7b898e; }
#pixel-journey-dialog .legend-directions [aria-pressed=true] { border-color:#ebb38b77;color:#a66433;background:#fff7; }
.legend-explanation { min-width:0; }.legend-scope { font-size:10px;letter-spacing:.08em;color:#8b989e; }
#pixel-journey-dialog .legend-explanation h3 { margin:5px 0 9px;font-size:24px; }.legend-description { font-size:14px;line-height:1.55;color:#74838a;margin:0 0 12px; }
.legend-structure { display:flex;align-items:center;gap:9px;font-size:12px;color:#7a898e;margin-bottom:14px; }
.legend-structure > i { height:1px;flex:1;background:linear-gradient(90deg,#ce9b7250,#bbc9cd55); }.legend-structure:has(.legend-situation[hidden]) > i { display:none; }
.legend-structure [hidden] { display:none; }
.legend-face-inspector { padding:12px 14px;border:1px solid #d7e0e280;border-radius:15px;background:#ffffff85; }
.legend-face-inspector > strong { font-size:13px;font-weight:550;color:#a46c43; }.legend-face-inspector > p { margin:4px 0 10px;color:#819097;font-size:12px;line-height:1.4; }
.legend-face-items { display:flex;gap:8px; }.legend-face-items > * { min-width:0;flex:1;margin:0;box-sizing:border-box; }
.legend-face-items > span { display:flex;align-items:center;justify-content:center;gap:6px;font-size:12px;padding:9px 5px;border:1px dashed #ccd5d8;border-radius:8px;color:#869399; }
.legend-face-items > span b { font:450 17px Georgia; }.legend-face-items svg { width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.3; }
.legend-face-items img { width:50%;max-height:68px;object-fit:cover;border-radius:7px; }.legend-face-items > p { color:#53636b;font-size:12px;line-height:1.4;max-height:70px;overflow:hidden; }
.legend-appearance { display:flex;justify-content:space-between;gap:10px;margin-top:10px; }.legend-appearance > div { display:flex;gap:3px; }
#pixel-journey-dialog .legend-appearance button { display:grid;place-items:center;width:29px;min-height:29px;padding:4px;border-radius:8px;border:1px solid transparent;background:transparent;font-size:19px;color:#64747b; }
#pixel-journey-dialog .legend-appearance [aria-pressed=true] { border-color:#e7b08c;background:#fff; }
.legend-appearance [data-figure] svg { height:22px;width:15px;fill:#64747b; }.legend-appearance [data-style=black] { color:#101719; }.legend-appearance [data-style=white] { background:#e2e8e9!important;color:#fff!important; }
.legend-preview-footer { display:flex;justify-content:space-between;align-items:center;gap:14px;padding-top:10px;border-top:1px solid #d9e0e280; }
.legend-preview-footer > small { color:#89969c;font-size:11px;line-height:1.4;max-width:260px; }
#pixel-journey-dialog .legend-back { min-height:35px;white-space:nowrap;font-size:12px;padding:6px 12px;border-color:#e2b995;color:#9f6942;background:#ffffffb0; }
@media(max-width:700px) {
 .personal-legend { gap:8px; }.legend-mode-tabs { margin-top:8px;padding:3px;gap:3px; }
 #pixel-journey-dialog .legend-mode-tabs button { min-width:82px;min-height:41px;padding:4px 8px; }.legend-mode-tabs b { font-size:13px; }.legend-mode-tabs small { font-size:10px; }
 .legend-workspace { grid-template-columns:1fr;gap:8px;align-content:center; }
 .legend-scene > svg { height:210px;max-height:26dvh; }.legend-scene-caption { font-size:11px; }.legend-scene-caption span { font-size:10px; }
 .legend-directions { grid-template-columns:repeat(6,1fr);max-width:none;margin:5px 0 0;gap:1px; }
 #pixel-journey-dialog .legend-directions button { min-height:25px;padding:2px 0;font-size:10px; }
 .legend-scope { font-size:9px; }#pixel-journey-dialog .legend-explanation h3 { font-size:20px;margin:3px 0 5px; }
 .legend-description { font-size:13px;line-height:1.4;margin-bottom:7px; }.legend-structure { margin-bottom:7px;font-size:11px; }
 .legend-face-inspector { padding:8px 10px;border-radius:12px; }.legend-face-inspector > p { margin:3px 0 6px;font-size:11px; }
 .legend-face-items > span { font-size:11px;padding:5px 3px; }.legend-face-items img { max-height:44px; }.legend-face-items > p { max-height:44px;font-size:11px; }
 .legend-appearance { margin-top:6px; }.legend-preview-footer { padding-top:7px;gap:8px; }.legend-preview-footer > small { font-size:10px;max-width:190px; }
 #pixel-journey-dialog .legend-back { min-height:31px;font-size:11px;padding:5px 7px; }
}
@media(max-width:700px) and (max-height:690px) {
 .personal-legend { gap:5px; }.legend-mode-tabs { margin-top:5px; }#pixel-journey-dialog .legend-mode-tabs button { min-height:36px; }
 .legend-scene > svg { height:125px;max-height:24dvh; }.legend-scene-caption b { display:none; }.legend-directions { margin-top:1px; }
 .legend-description { font-size:12px;line-height:1.3;max-height:48px;overflow:hidden; }.legend-scope { display:none; }
 #pixel-journey-dialog .legend-explanation h3 { font-size:18px; }.legend-structure { margin-bottom:4px; }
 .legend-face-inspector { padding:5px 8px; }.legend-face-inspector > p { display:none; }.legend-face-items { margin-top:5px; }
 .legend-appearance { margin-top:4px; }#pixel-journey-dialog .legend-appearance button { width:26px;min-height:26px;padding:3px; }
 .legend-preview-footer > small { font-size:9px;max-width:150px; }
}
@media(min-width:701px) and (max-height:540px) {
 .personal-legend { gap:5px; }.legend-mode-tabs { margin-top:4px; }#pixel-journey-dialog .legend-mode-tabs button { min-height:32px;padding:3px 10px; }
 .legend-workspace { grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px; }.legend-scene > svg { max-height:175px; }
 .legend-scene-caption { display:none; }.legend-directions { grid-template-columns:repeat(6,1fr);margin-top:0;max-width:none; }
 #pixel-journey-dialog .legend-directions button { min-height:23px;font-size:9px; }.legend-scope { display:none; }
 #pixel-journey-dialog .legend-explanation h3 { font-size:18px;margin:0 0 3px; }.legend-description { font-size:12px;line-height:1.3;margin-bottom:5px; }.legend-structure { margin-bottom:5px; }
 .legend-face-inspector { padding:5px 8px; }.legend-face-inspector > p { display:none; }.legend-face-items { margin-top:5px; }.legend-face-items > span { padding:4px; }
 #pixel-journey-dialog .legend-appearance button { width:24px;min-height:24px;padding:3px; }.legend-preview-footer { padding-top:5px; }
 .legend-preview-footer > small { max-width:none; }#pixel-journey-dialog .legend-back { min-height:28px;padding:4px 8px; }
}
/* Keep the complete explanation visible; reserve separate rows for every control. */
#pixel-journey-dialog .legend-mode-tabs button { box-sizing:border-box;height:48px;line-height:1.15; }
.legend-structure:has(.legend-situation:not([hidden])) > i { flex:none;width:15px;height:auto;background:none; }
.legend-structure:has(.legend-situation:not([hidden])) > i::before { content:'+';color:#a4afb4; }
@media(max-width:700px) {
 #pixel-journey-dialog .legend-mode-tabs button { height:42px;min-height:42px; }
 .legend-workspace { grid-template-columns:140px minmax(0,1fr);gap:7px 12px;align-items:center; }
 .legend-scene,.legend-explanation { display:contents; }
 .legend-scene > svg { grid-area:1 / 1;width:140px;height:180px;max-height:none; }
 .legend-story { grid-area:1 / 2; }
 .legend-scene-caption { grid-area:2 / 1 / auto / -1;margin:0; }
 .legend-directions { grid-area:3 / 1 / auto / -1;margin:0; }
 .legend-face-inspector { grid-area:4 / 1 / auto / -1; }
 .legend-appearance { grid-area:5 / 1 / auto / -1;margin-top:0; }
 .legend-description { max-height:none;overflow:visible; }
}
@media(max-width:700px) and (max-height:690px) {
 #pixel-journey-dialog .legend-mode-tabs button { height:36px;min-height:36px;padding:3px 7px; }
 .legend-mode-tabs { margin-top:4px; }
 .legend-workspace { grid-template-columns:108px minmax(0,1fr);gap:4px 9px; }
 .legend-scene > svg { width:108px;height:140px; }
 .legend-description { font-size:11px;line-height:1.35;max-height:none; }
 #pixel-journey-dialog .legend-explanation h3 { font-size:17px; }
 .legend-structure { font-size:10px;gap:5px; }
 .legend-preview-footer { padding-top:5px; }
}
@media(min-width:701px) and (max-height:540px) {
 #pixel-journey-dialog .legend-mode-tabs button { height:32px;min-height:32px;gap:1px;padding:2px 10px; }
 .legend-mode-tabs b { font-size:12px; }.legend-mode-tabs small { font-size:9px; }
 .legend-workspace { position:relative; }
 .legend-scene { padding-bottom:27px; }
 .legend-scene > svg { max-height:142px; }
 .legend-appearance { position:absolute;bottom:0;left:0;width:calc((100% - 20px)/2);justify-content:center;gap:16px;margin:0; }
 .legend-description { font-size:11px;line-height:1.35; }
 .legend-face-items > span { padding:3px; }
}

@media(max-width:700px) and (max-height:690px) { .legend-description { font-size:12px; } }
@media(min-width:701px) and (max-height:540px) {
 .legend-scene { align-self:start;padding-bottom:0; }
 .legend-scene > svg { max-height:122px; }
 .legend-directions { margin-top:0; }
 .legend-face-items img { max-height:34px; }
 .legend-face-items > p { max-height:34px;font-size:11px; }
 .legend-appearance { bottom:0; }
}

.legend-shell-links line {stroke:#778992;stroke-width:.65;stroke-dasharray:1.6 1.4}
.legend-scene .journey-ground-axes text {
 font-size:5.5px;font-weight:700;paint-order:stroke;stroke:#f7f9f8;stroke-width:.9;stroke-linejoin:round;
}
.legend-scene .journey-ground-axes [data-axis=x] {fill:#a14735}
.legend-scene .journey-ground-axes [data-axis=y] {fill:#436e43}
.legend-scene .journey-ground-axes [data-axis=z] {fill:#296685}
.legend-scene .journey-ground-axes path[data-axis] {fill:none;stroke-width:.8}
.legend-face-side,.legend-shell-choice {display:flex;gap:5px;margin:6px 0}
.legend-face-side[hidden],.legend-shell-choice[hidden] {display:none}
#pixel-journey-dialog :is(.legend-face-side,.legend-shell-choice) button {
 flex:1;min-height:34px;padding:4px 6px;border-radius:8px;border:1px solid #d5dfe1;
 background:#f5f8f8;color:#4c5c62;font-size:11px;line-height:1.15;
}
#pixel-journey-dialog :is(.legend-face-side,.legend-shell-choice) [aria-pressed=true] {
 background:#fff;border-color:#d89160;color:#874c27;
}
@media(max-width:700px) and (max-height:690px) {
 .legend-face-side,.legend-shell-choice {margin:3px 0}
 #pixel-journey-dialog :is(.legend-face-side,.legend-shell-choice) button {min-height:27px}
}

@media(min-width:701px) and (min-height:541px) and (max-height:760px) {
 .legend-scene > svg {max-height:clamp(155px,calc(100dvh - 355px),280px)}
 .legend-directions {grid-template-columns:repeat(6,1fr);max-width:360px;margin-top:6px}
 .legend-description {margin-bottom:8px}
 .legend-structure {margin-bottom:8px}
 .legend-face-inspector {padding:8px 10px}
 .legend-appearance {margin-top:5px}
}
@media(max-width:700px) {
 .legend-scene .journey-ground-axes text {font-size:7.5px}
}
