/* The animation, title and controls share one open layout on the page. */
.cipher-walkthrough-host{display:flex;flex:1 1 0;align-items:flex-start;min-width:0;min-height:0;container-type:size;container-name:walkthrough-space}
.cw{
  --cw-encoded-bg:var(--cipher-encoded-bg,#282e35);--cw-encoded-fg:var(--cipher-encoded-fg,#fafbfc);
  --cw-decoded-bg:var(--cipher-decoded-bg,#e4f1ed);--cw-decoded-fg:var(--cipher-decoded-fg,#18584f);--cw-decoded-border:var(--cipher-decoded-border,#26796c);
  container-type:inline-size;width:100%;height:100%;max-height:none;min-width:0;min-height:0;padding:22px;
  display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:18px;
  border:0;border-radius:0;background:transparent;color:var(--bone,#282e35);
  font-family:var(--body,Georgia,serif);box-shadow:none;
}
.cw [hidden]{display:none!important}
.cw-head{text-align:center}
.cw-swipe-scene{touch-action:pan-y pinch-zoom}
.cw-swipe-hint{display:none;margin-top:3px;font-size:14px;line-height:1.3;color:var(--bone-2,#5b646e)}
.cw-legend{display:flex;justify-content:center;gap:18px;font-size:15px;line-height:1.3;color:var(--bone-2,#5b646e)}
.cw-legend-item{display:inline-flex;align-items:center;gap:6px}
.cw-swatch{display:inline-block;width:12px;height:15px;border-radius:0}
.cw .encoded{background:var(--cw-encoded-bg);color:var(--cw-encoded-fg);border:1px solid var(--cipher-encoded-border,#282e35);box-shadow:inset 0 1px 0 rgb(255 255 255 / 8%)}
.cw .decoded{background:var(--cw-decoded-bg);color:var(--cw-decoded-fg);border:1px solid var(--cw-decoded-border);box-shadow:inset 0 -2px 0 var(--cw-decoded-border)}
.cw-scene{position:relative;display:grid;align-items:center;min-height:0;min-width:0}
.cw-message{position:absolute;inset:0;display:flex;flex-wrap:wrap;justify-content:center;align-content:center;gap:10px 14px;min-width:0;padding:0 4px}
.cw-msg-row{display:flex;flex:0 0 100%;justify-content:center;gap:inherit}
.cw-msg-word,.cw-source-word{display:flex;gap:4px}
.cw-msg-letter{display:grid;place-items:center;padding-top:.09em;border-radius:0;box-sizing:border-box;font:400 clamp(20px,4.5cqw,28px)/1 var(--mono,monospace)}
.cw-msg-label{flex:0 0 100%;margin-bottom:0;opacity:0;transition:opacity .5s .2s}
.cw[data-finale="settled"] .cw-msg-label{opacity:1}
.cw[data-finale="moving"] .cw-message .cw-msg-letter{opacity:0}
/* Step 10: the message, the key passage and the cipher on one screen. */
.cw-overview{display:flex;flex-direction:column;justify-content:center;gap:clamp(10px,4cqh,22px);width:100%;min-height:0}
.cw-ov-block{display:flex;flex-direction:column;align-items:center;min-width:0}
.cw-ov-block .cw-scene-label{margin-bottom:8px}
.cw-ov-cards{display:flex;flex-wrap:wrap;justify-content:center;gap:6px 12px;width:100%}
.cw-ov-word{display:flex;gap:3px}
.cw-ov-letter{display:grid;place-items:center;flex:none;width:28px;height:31px;padding-top:.09em;border-radius:0;box-sizing:border-box;font:400 18px/1 var(--mono,monospace)}
.cw-ov-passage{margin:0 auto;max-width:34ch;font-size:clamp(14px,3.6cqw,17px);line-height:1.5;text-align:center;text-wrap:pretty}
@media(max-width:360px){.cw-ov-letter{width:22px;height:24px;font-size:14px}.cw-ov-passage{font-size:13px;line-height:1.4}.cw-ov-cards{gap:4px 8px}}
@container walkthrough-space (max-height:320px){.cw-overview{gap:6px}.cw-ov-block .cw-scene-label{margin-bottom:3px}.cw-ov-letter{width:19px;height:21px;font-size:13px;border-radius:0}.cw-ov-passage{font-size:12px;line-height:1.3;max-width:60ch}.cw-ov-cards{gap:3px 8px}}
.cw[data-finale="moving"] .cw-grid,.cw[data-finale="revealing"] .cw-grid{opacity:0}
/* On the last step the key words have done their work; only the cards flip. */
.cw[data-cipher] .cw-word{display:none}
.cw-finale-letter{position:absolute;display:block;text-align:center;white-space:nowrap;pointer-events:none;transform-origin:center;z-index:1}
.cw[data-finale="revealing"] .cw-finale-letter{opacity:0}
.cw-finale-letter.cw-msg-letter{display:grid;transition:none}
.cw-source,.cw-keyphrase{min-width:0}
.cw-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));align-content:center;justify-items:center;gap:17px 7px;width:100%;max-height:100%}
.cw-source-grid{display:flex;flex-wrap:wrap;justify-content:center;align-content:center;gap:12px 16px;width:100%;padding:0 4px}
.cw-source-letter,.cw-face,.cw-single{display:grid;place-items:center;padding-top:.09em;border-radius:0;box-sizing:border-box;font:400 clamp(20px,4.5cqw,28px)/1 var(--mono,monospace)}
.cw-source-letter{flex:none}
.cw-source-letter,.cw-card,.cw-msg-letter{width:min(100%,48px);height:54px}
.cw-prayer{margin:0 auto;max-width:29ch;font-size:clamp(19px,4.5cqw,24px);line-height:1.65;text-align:center;text-wrap:pretty}
.cw-prayer-word{display:inline-block}
.cw-prayer-word.is-repeat{position:relative;color:var(--bone-2,#5b646e);transition:color .35s}
.cw-prayer-word.is-repeat::after{content:"";position:absolute;left:0;right:0;top:calc(50% + .04em);height:1px;background:var(--bone-2,#5b646e);transform:scaleX(1);transform-origin:left center;transition:transform .35s cubic-bezier(.2,.7,.2,1);transition-delay:inherit}
.cw[data-stage="1"] .cw-prayer-word.is-repeat{color:inherit}
.cw[data-stage="1"] .cw-prayer-word.is-repeat::after{transform:scaleX(0)}
.cw-scene-label{margin:0 auto 14px;color:var(--bone-2,#5b646e);font-size:15px;line-height:1.45;text-align:center}
.cw-pair{min-width:0;display:flex;flex-direction:column;align-items:center;gap:6px;width:100%}
.cw-card{perspective:360px;flex:none}
.cw-card-turn{position:relative;width:100%;height:100%;transform-style:preserve-3d}
.cw-pair.is-flipped .cw-card-turn{transform:rotateY(180deg)}
.cw-face{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.cw-face.cw-back{transform:rotateY(180deg)}
.cw-word{display:block;width:max-content;max-width:none;white-space:nowrap;font-size:clamp(11px,2.55cqw,14px);line-height:1.25;text-align:center}
.cw-pair.is-decoded .cw-word{opacity:0}
.cw-focus,.cw-result,.cw-shift{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:22px;min-height:0}
.cw-focus-pair{display:flex;align-items:center;flex-direction:column;gap:10px}
.cw-single{width:82px;height:94px;font-size:56px;flex:none}
.cw-focus-word{font-size:20px;line-height:1.2}
.cw[data-compact] .cw-focus{gap:20px}
.cw[data-compact] .cw-focus-pair{gap:6px}
.cw[data-compact] .cw-single{width:45px;height:52px;font-size:32px}
.cw[data-compact] .cw-focus-word{font-size:15px}
/* The sum sits a little further below the card and its key word than the rows below it do. */
.cw[data-compact] .cw-math{margin-top:18px}
/* The three arithmetic lines share one gap, set once and read by the result line. */
.cw-math{--cw-math-gap:16px;display:flex;flex-direction:column;align-items:center;gap:var(--cw-math-gap);width:100%}
/* The gaps between terms equal a mono space, so the sum lines up with the lines below. */
.cw-sum{display:flex;justify-content:center;align-items:center;gap:.6em;font:400 22px/1 var(--mono,monospace)}
.cw-term{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:22px}
.cw-term-letter{color:var(--bone-2,#5b646e);font:400 15px/1 var(--body,Georgia,serif)}
.cw-term-value{font-size:22px;line-height:1;font-weight:400}
.cw-plus,.cw-equals{font-size:22px;line-height:1;padding-top:20px}
.cw-total{font-size:22px;line-height:1;font-weight:400;padding-top:20px}
.cw-reduction{font:400 22px/1 var(--mono,monospace);text-align:center;white-space:nowrap}
.cw-alpha{display:flex;flex-direction:column;align-items:center;gap:var(--cw-math-gap,16px)}
.cw-alpha-row{display:flex;gap:6px}
.cw-alpha-cell{display:flex;flex-direction:column;align-items:center;gap:5px}
.cw-alpha-card{box-sizing:border-box;width:32px;height:38px;border:1px solid var(--veil-2,#bcb7aa);color:var(--bone-2,#5e5b54);font:400 20px/36px var(--mono,monospace);text-align:center}
.cw-alpha-card.is-key{border-color:var(--bone,#000);color:var(--bone,#000)}
.cw-alpha-num{font:400 14px/1 var(--mono,monospace);color:var(--bone-2,#5e5b54)}
@media(max-width:360px){.cw-alpha-row{gap:4px}.cw-alpha-card{width:28px;height:32px;font:400 18px/30px var(--mono,monospace)}.cw-alpha-num{font-size:13px}}
.cw-key-letter{font:400 16px/1.4 var(--body,Georgia,serif);text-align:center}
.cw-result-label{font-size:16px;text-align:center;line-height:1.4}
.cw-shift-cards{display:flex;align-items:center;gap:clamp(18px,4cqw,30px)}
.cw-arrow{position:relative;display:flex;justify-content:center;align-items:center;min-width:65px;height:12px;color:var(--bone-2,#5b646e)}
.cw-arrow-label{position:absolute;bottom:calc(100% + 6px);font-size:15px;line-height:1.3;white-space:nowrap}
.cw-arrow-line{position:relative;display:block;width:52px;height:12px;font-size:0}
.cw-arrow-line::before{content:"";position:absolute;left:0;right:1px;top:50%;border-top:2px solid currentColor;transform:translateY(-50%)}
.cw-arrow-line::after{content:"";position:absolute;right:1px;top:50%;width:7px;height:7px;border-top:2px solid currentColor;border-right:2px solid currentColor;transform:translateY(-50%) rotate(45deg)}
.cw-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-top:12px;border-top:1px solid var(--veil,#e3e6e9)}
.cw-previous,.cw-next{appearance:none;-webkit-appearance:none;border:1px solid var(--veil-2,#d3d9df);background:var(--room,#fff);color:var(--bone,#282e35);font:400 15px/1 var(--body,Georgia,serif);border-radius:0;min-height:40px;min-width:74px;padding:0 14px;cursor:pointer;white-space:nowrap}
.cw-next{background:var(--room-2,#f0f2f4)}
.cw-step-count{font:400 14px/1 var(--mono,monospace);color:var(--bone-2,#5b646e);white-space:nowrap}
.cw-previous:disabled{color:var(--bone-2,#5b646e);border-color:transparent;opacity:.55;cursor:default}
.cw-previous:not(:disabled):hover,.cw-next:hover{border-color:var(--bone-2,#5b646e);background:var(--room-2,#f0f2f4)}
.cw-previous:focus-visible,.cw-next:focus-visible{outline:2px solid var(--cw-decoded-border);outline-offset:3px}
@media(max-width:900px){
  .cw-swipe-hint{display:block}
  .cw{padding:12px;gap:10px;max-height:none}
  .cw-legend{gap:16px}.cw-swatch{width:10px;height:12px;border-radius:0}
  .cw-source-grid,.cw-grid{gap:10px 4px}.cw-source-letter,.cw-card,.cw-msg-letter{width:35px;height:37px}.cw-source-letter,.cw-face,.cw-msg-letter{font-size:23px;border-radius:0}
  .cw-pair{gap:4px}.cw-word{font-size:10.5px}.cw-prayer{font-size:18px;line-height:1.55;max-width:31ch}
  .cw-single{width:59px;height:68px;font-size:42px}.cw-focus{gap:12px}.cw-focus-pair{gap:6px}.cw-focus-word{font-size:16px}
  .cw[data-compact] .cw-focus{gap:10px}.cw[data-compact] .cw-math{margin-top:20px}.cw[data-compact] .cw-single{width:32px;height:36px;font-size:24px}.cw[data-compact] .cw-focus-word{font-size:12px}
  .cw-math{--cw-math-gap:12px}.cw-sum{font-size:18px}.cw-term{gap:4px;min-width:18px}.cw-term-letter{font-size:13px}.cw-term-value{font-size:18px}.cw-plus,.cw-equals{font-size:18px;padding-top:17px}.cw-total{font-size:18px;padding-top:17px}.cw-reduction{font-size:18px}.cw-key-letter{font-size:15px}
  .cw-shift{gap:14px}.cw-result-label{font-size:13px}.cw-shift-cards{gap:16px}.cw-arrow-label{font-size:12px}.cw-result{gap:12px}
  .cw-controls{padding-top:8px}.cw-previous,.cw-next{min-height:36px;min-width:66px;font-size:12px;padding-inline:11px}
}
@media(max-width:360px){
  .cw{padding:8px;gap:6px}
  .cw-source-grid,.cw-grid{gap:5px 3px}.cw-source-letter,.cw-card,.cw-msg-letter{width:30px;height:29px}.cw-source-letter,.cw-face,.cw-msg-letter{font-size:19px}.cw-pair{gap:2px}.cw-word{font-size:10px;letter-spacing:-.025em}
  .cw-prayer{font-size:15px;line-height:1.4}
  .cw[data-compact] .cw-focus{gap:6px}.cw[data-compact] .cw-math{margin-top:12px}.cw[data-compact] .cw-focus-pair{gap:2px}.cw[data-compact] .cw-single{width:26px;height:28px;font-size:21px}.cw[data-compact] .cw-focus-word{font-size:11px}.cw-math{--cw-math-gap:8px}
  .cw-controls{padding-top:5px}.cw-previous,.cw-next{min-height:32px}
}
/* Browser chrome can leave a wide phone with a short reading viewport.
   Fit all eight scenes to the panel's actual space, preserving room for controls. */
@media(min-width:361px){
  @container walkthrough-space (max-height:320px){
    .cw{padding:8px;gap:6px}
    .cw-legend{font-size:10px}
    .cw-source-grid,.cw-grid{gap:6px 4px}
    .cw-source-letter,.cw-card,.cw-msg-letter{width:32px;height:31px}.cw-source-letter,.cw-face,.cw-msg-letter{font-size:21px}
    .cw-pair{gap:3px}.cw-word{font-size:10.5px}
    .cw-prayer{font-size:15px;line-height:1.4}
    .cw-single{width:52px;height:60px;font-size:36px}.cw-focus,.cw-result,.cw-shift{gap:10px}
    .cw[data-compact] .cw-focus{gap:6px}.cw[data-compact] .cw-math{margin-top:6px}.cw[data-compact] .cw-focus-pair{gap:2px}
    .cw[data-compact] .cw-single{width:26px;height:28px;font-size:21px}
    .cw[data-compact] .cw-focus-word{font-size:11px}.cw-math{--cw-math-gap:8px}
    .cw-controls{padding-top:5px}
  }
}
@media(prefers-reduced-motion:reduce){.cw *,.cw *::before,.cw *::after{scroll-behavior:auto;transition:none}.cw-prayer-word.is-repeat,.cw-prayer-word.is-repeat::after{transition:none}}
/* Cards inside a word group size from their height, since the group's width
   is indefinite and a percentage width would collapse them. */
.cw .cw-msg-word .cw-msg-letter{flex:none;width:auto;aspect-ratio:.92}
.cw .cw-source-word .cw-source-letter{flex:none;width:var(--cw-src-w,48px);aspect-ratio:auto;transition:width .6s,height .6s,background-color .6s,border-color .6s,box-shadow .6s}
@media(max-width:900px){.cw{--cw-src-w:35px}}
@media(max-width:360px){.cw{--cw-src-w:30px}}
@media(min-width:361px){@container walkthrough-space (max-height:320px){.cw{--cw-src-w:32px}}}
/* The message first reads as plain text; the cards then form around the letters. */
.cw-source-row{display:flex;flex:0 0 100%;justify-content:center;gap:inherit}
.cw-source-grid,.cw-source-word{transition:gap .6s}
.cw[data-intro="text"] .cw-source-grid{gap:10px .5em}
.cw[data-intro="text"] .cw-source-word{gap:0}
.cw[data-intro="text"] .cw-source-word .cw-source-letter{width:.68em;height:1.3em;background:transparent;border-color:transparent;box-shadow:none}
@media(prefers-reduced-motion:reduce){.cw .cw-source-word .cw-source-letter,.cw-source-grid,.cw-source-word{transition:none}}
