/* Diagrams sit directly on the page, like the opening walkthrough. */
.graphic:not(.walkthrough-graphic) .gbody{
  flex:1 1 0;max-height:490px;min-height:0;padding:22px;
  border:0;border-radius:0;background:transparent;
  box-shadow:none;gap:0;
}
.graphic:not(.walkthrough-graphic) .tiles{
  order:-1;gap:3px;margin-bottom:14px;perspective:500px;
}
.graphic:not(.walkthrough-graphic) .tiles .t{
  font-size:clamp(10px,1.4vw,17px);transition:none;
  transform-origin:center;will-change:auto;
}
.graphic:not(.walkthrough-graphic) .sub:empty,
.graphic:not(.walkthrough-graphic) .legend:empty{display:none}
.graphic:not(.walkthrough-graphic) canvas{min-height:0;flex:1 1 0}
.graphic:not(.walkthrough-graphic) .legend{
  min-height:0;margin-top:14px;padding-top:0;justify-content:center;
  font-size:12px;line-height:1.3;gap:6px 16px;
}
.graphic[data-state="reading"] .tiles,
.graphic[data-state="checks"] .tiles,
.graphic[data-state="luck"] .tiles{display:none}
@media(max-width:900px){
  .graphic:not(.walkthrough-graphic) .gbody{padding:12px;max-height:none}
  .graphic:not(.walkthrough-graphic) .tiles{gap:2px;margin-bottom:9px}
  .graphic:not(.walkthrough-graphic) .tiles .t{font-size:11px}
  .graphic:not(.walkthrough-graphic) .legend{gap:4px 11px;padding-top:0;margin-top:8px}
  .graphic:not(.walkthrough-graphic) .legend i{width:7px;height:7px}
}
@media(max-width:360px){
  .graphic:not(.walkthrough-graphic) .gbody{padding:8px}
  .graphic:not(.walkthrough-graphic) .tiles{gap:1px;margin-bottom:6px}
  .graphic:not(.walkthrough-graphic) .tiles .t{font-size:10px}
  .graphic:not(.walkthrough-graphic) .legend{padding-top:0;margin-top:5px}
}
@media(prefers-reduced-motion:reduce){
  .graphic:not(.walkthrough-graphic) .tiles .t{transform:none!important}
}

/* The pinned graphic gives the canvas the screen space above the cards. The
   caption and cipher stay compact; the chart's labels stay readable. */
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .gbody{
  flex:1 1 0;min-height:0;max-height:none;padding:12px;gap:0;
}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles{
  flex:none;width:100%;max-width:none;gap:2px;margin-bottom:14px;
}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .sub{gap:1px;margin-top:-6px;margin-bottom:8px}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .sub span{font-size:10px}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles .t{
  height:25px;aspect-ratio:auto;border-radius:0;font-size:clamp(10px,2.9vw,15px);
}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) canvas{
  min-height:0;flex:1 1 0;
}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .legend{
  flex:none;font-size:12px;line-height:1.35;gap:6px 16px;
  padding-top:0;margin-top:10px;
}
.pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .legend i{
  width:9px;height:9px;margin-right:6px;
}
@media(max-width:360px){
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .gbody{padding:8px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles{gap:1px;margin-bottom:10px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles .t{height:23px}
}
/* Short screens: the chart keeps its labels; the cipher strip yields its space. */
@media(max-width:900px) and (max-height:640px) and (orientation:portrait){
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .gbody{padding:6px 8px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles{margin-bottom:8px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles .t{height:20px;font-size:12px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .legend{padding-top:0;margin-top:6px}
}
@media(max-width:900px) and (max-height:480px) and (orientation:landscape){
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles{display:none}
}
@media(max-width:900px) and (orientation:landscape){
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .gbody{padding:4px 12px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .tiles{margin-bottom:8px}
  .pinned-chapter > .pin > .graphic:not(.walkthrough-graphic) .legend{padding-top:0;margin-top:6px}
}
