/* TWELVE TIDES — UI as a woodcut broadside: cream paper, ink rules, a vermilion seal.
   Forked from LOOM's loom.css (Silver Drops Fall's cloth) and re-inked. */
:root {
  --indigo-0: #1a1512; --indigo-1: #2a231d; --indigo-2: #3a3129; --indigo-3: #5a4d40; --ink: #1a1512; --paper: #eee4ce; --paper-2: #e4d8bd;
  --bark: #8a6a4a; --bark-dk: #5a4330; --cream: #efe6d2; --snow: #f6f3ec;
  --vermilion: #b8341f; --ember: #e8833a; --gold: #d9a440; --silver: #c9d2dc;
  --moss: #5b6b45; --sea: #1f4a5a; --sea-lt: #4f8a94;
  --f-display: 'IM Fell English', 'EB Garamond', Georgia, serif;
  --f-text: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --stitch: repeating-linear-gradient(90deg, var(--cream) 0 7px, transparent 7px 13px);
}
html, body { margin: 0; height: 100%; background: var(--indigo-0); color: var(--cream); overflow: hidden; }
body { font-family: var(--f-text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }

.loom { position: fixed; inset: 0; overflow: hidden; background: var(--indigo-0); user-select: none; -webkit-user-select: none; --loom-size: 1; }
.loom.loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; border: 2px dashed var(--cream); opacity: .5; animation: loom-spin 6s linear infinite; }
@keyframes loom-spin { to { transform: rotate(360deg); } }
.loom-stage { position: absolute; inset: 0; }
.loom-stage > svg { width: 100%; height: 100%; display: block; }

.loom-ui { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .8s; cursor: pointer; }
.loom-ui.on { opacity: 1; pointer-events: auto; }

/* ---------- the verse box ---------- */
.loom-box {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  width: min(1060px, calc(100% - 32px)); transform: translate(-50%, 14px);
  min-height: calc(8.4em * var(--loom-size)); box-sizing: border-box;
  padding: 1.35em 2.1em 1.45em; opacity: 0; transition: opacity .55s, transform .55s;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(58,79,134,.28), transparent 60%),
    linear-gradient(180deg, rgba(21,28,56,.94), rgba(13,18,38,.97));
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--indigo-0), 0 0 0 4px rgba(239,230,210,.82), 0 0 0 7px var(--indigo-1), 0 18px 50px rgba(0,0,0,.55);
}
.loom-box.on { opacity: 1; transform: translate(-50%, 0); }
.loom-box::before { /* inner running stitch */
  content: ''; position: absolute; inset: 8px; border-radius: 3px; pointer-events: none;
  border: 1.5px dashed rgba(239,230,210,.42);
}
.loom-box::after { /* aiushi corner ornaments */
  content: ''; position: absolute; inset: -14px; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M4 36 V12 Q4 4 12 4 H36 M12 36 V20 Q12 12 20 12 H36 M20 28 Q20 20 28 20' fill='none' stroke='%23efe6d2' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") left top / 34px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M36 36 V12 Q36 4 28 4 H4 M28 36 V20 Q28 12 20 12 H4 M20 28 Q20 20 12 20' fill='none' stroke='%23efe6d2' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") right top / 34px no-repeat;
  opacity: .8;
}
.loom-name {
  position: absolute; left: 1.6em; top: 0; transform: translateY(-62%);
  padding: .32em 1.1em .36em; background: var(--name-bg, var(--bark-dk)); border-radius: 4px;
  box-shadow: 0 0 0 2px var(--indigo-0), 0 0 0 3.5px var(--who, var(--cream));
  font-family: var(--f-display); font-weight: 600; letter-spacing: .06em; font-size: calc(1.08rem * var(--loom-size));
  color: var(--snow); transition: opacity .3s;
}
.loom-name::before { content: ''; position: absolute; inset: 4px; border: 1px dashed rgba(239,230,210,.45); border-radius: 2px; pointer-events: none; }
.loom-box.narration .loom-name { background: var(--indigo-2); font-style: italic; font-weight: 500; }
.loom-name.empty { opacity: 0; }
.loom-text {
  position: relative; font-size: calc(clamp(1.06rem, 1.55vw + .55rem, 1.42rem) * var(--loom-size)); line-height: 1.5;
  color: var(--snow); text-shadow: 0 1px 2px rgba(0,0,0,.5); min-height: 4.5em;
}
.loom-text .ln { display: block; padding-left: 1.2em; text-indent: -1.2em; }
.loom-box.narration .loom-text { color: #efe9da; }
.loom-text .c { opacity: 0; transition: opacity .18s; }
.loom-text .c.on { opacity: 1; }
.loom-text em { font-style: italic; color: #f3dfb0; }
.loom-text strong { font-weight: 600; color: #f6e6c2; }
.loom-note {
  display: inline-block; vertical-align: super; font-size: .62em; line-height: 1; margin: 0 .12em; padding: .18em .38em .12em;
  border: 1px solid rgba(217,164,64,.7); border-radius: 999px; background: rgba(217,164,64,.15); color: var(--gold); cursor: help;
}
.loom-note:hover, .loom-note:focus-visible { background: var(--gold); color: var(--indigo-0); outline: none; }
.loom-gloss { background: none; border: 0; padding: 0; cursor: help; color: inherit; border-bottom: 1px dotted rgba(217,164,64,.85); font-style: inherit; }
.loom-next { position: absolute; right: 1.4em; bottom: .9em; width: 14px; height: 14px; opacity: 0; transition: opacity .3s; }
.loom-next::before { content: ''; position: absolute; inset: 0; background: var(--gold); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); animation: loom-bob 1.8s ease-in-out infinite; }
.loom-box.done .loom-next { opacity: .9; }
@keyframes loom-bob { 50% { transform: translateY(4px); } }

/* ---------- sakehe band ---------- */
.loom-band {
  position: absolute; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 9.6em * var(--loom-size)); transform: translate(-50%, 8px);
  width: min(1060px, calc(100% - 32px)); text-align: center; opacity: 0; transition: opacity .7s, transform .7s; pointer-events: none;
}
.loom-band.on { opacity: 1; transform: translate(-50%, 0); }
.loom-band.on.dim { opacity: .5; }
.loom-ui:not(:has(.loom-box.on)) .loom-band.on { bottom: 34vh; }
.loom-band-line { border-radius: 999px; background: radial-gradient(closest-side, rgba(13,18,38,.62), rgba(13,18,38,.35) 70%, transparent); display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0 .02em; font-family: var(--f-display); font-style: italic; font-weight: 500;
  font-size: calc(clamp(1.5rem, 3.6vw, 2.9rem) * var(--loom-size)); letter-spacing: .03em; padding: .2em .8em; }
.loom-band-gloss { font-family: var(--f-display); font-style: italic; font-size: calc(clamp(1rem, 1.8vw, 1.35rem) * var(--loom-size)); color: #f3dfb0; opacity: .85; margin-top: .1em; }
.syl { color: rgba(239,230,210,.22); transition: color .35s, text-shadow .5s; white-space: pre; }
.syl.lit { color: var(--snow); text-shadow: 0 0 18px rgba(217,164,64,.65), 0 0 2px rgba(255,255,255,.6); }

/* ---------- cards ---------- */
.loom-card { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .9s; background: radial-gradient(70% 60% at 50% 50%, rgba(13,18,38,.62), rgba(13,18,38,.9)); }
.loom-card.on { opacity: 1; pointer-events: auto; }
.loom-card-inner { text-align: center; padding: 2rem 1.5rem; max-width: 46rem; }
.loom-card h2 { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.7rem, 4.2vw, 3.2rem); margin: .6rem 0 .3rem; letter-spacing: .03em; color: var(--snow); text-wrap: balance; }
.loom-card-sub { font-family: var(--f-display); font-style: italic; font-size: clamp(1.05rem, 2.2vw, 1.6rem); color: #f3dfb0; text-wrap: balance; }
.loom-card-inner.end { background: radial-gradient(closest-side, rgba(13,18,38,.94), rgba(13,18,38,.86) 75%, rgba(13,18,38,0)); padding: 2.5rem 3rem; border-radius: 50%; }
.loom-card-inner.end h2 { font-size: clamp(2rem, 5vw, 3.6rem); }
.loom-card-inner.end p { font-size: clamp(1rem, 1.6vw, 1.22rem); line-height: 1.6; color: #e9e1cf; margin: .8rem auto; max-width: 38rem; }
.loom-card-inner.end p.couplet { font-family: var(--f-display); font-style: italic; font-size: clamp(1.15rem, 2vw, 1.5rem); color: #f3dfb0; }

/* ---------- ornament (moreu) ---------- */
.loom-orn { width: 220px; height: 54px; margin: 0 auto; opacity: .9;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 54'%3E%3Cg fill='none' stroke='%23efe6d2' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M110 50 V30 M110 30 C110 12 92 6 82 14 C72 22 80 36 92 30 C99 26 96 18 90 20'/%3E%3Cpath d='M110 30 C110 12 128 6 138 14 C148 22 140 36 128 30 C121 26 124 18 130 20'/%3E%3Cpath d='M70 40 H20 Q8 40 8 28 Q8 18 18 18 Q26 18 26 26' /%3E%3Cpath d='M150 40 H200 Q212 40 212 28 Q212 18 202 18 Q194 18 194 26'/%3E%3C/g%3E%3Cg fill='none' stroke='%23d9a440' stroke-width='1.6' stroke-dasharray='4 4'%3E%3Cpath d='M70 46 H24 Q2 46 2 28'/%3E%3Cpath d='M150 46 H196 Q218 46 218 28'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
.loom-orn.small { width: 150px; height: 38px; }

/* ---------- top bar ---------- */
.loom-bar { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 4px; opacity: .55; transition: opacity .3s; }
.loom-bar:hover { opacity: 1; }
.loom-bar button { background: rgba(13,18,38,.55); border: 1px solid rgba(239,230,210,.3); border-radius: 4px; padding: .3em .7em; font-size: .86rem; letter-spacing: .04em; cursor: pointer; }
.loom-bar button:hover, .loom-bar button.on { border-color: var(--gold); color: var(--gold); }
.loom-ui.hidden-text .loom-box, .loom-ui.hidden-text .loom-band, .loom-ui.hidden-text .loom-bar { opacity: 0 !important; }

/* ---------- popover ---------- */
.loom-pop { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8,10,22,.55); opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 30; }
.loom-pop.on { opacity: 1; pointer-events: auto; }
.loom-pop-inner { position: relative; max-width: 34rem; max-height: 80vh; overflow: auto; padding: 1.5rem 1.7rem 1.1rem; background: #f1e8d3; color: #2a2116; border-radius: 4px;
  box-shadow: 0 0 0 3px #f1e8d3, 0 0 0 5px var(--bark-dk), 0 20px 60px rgba(0,0,0,.6); font-size: 1.08rem; line-height: 1.55; }
.loom-pop-inner::before { content: ''; position: absolute; inset: 7px; border: 1.5px dashed rgba(90,67,48,.45); border-radius: 2px; pointer-events: none; }
.pop-head { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; color: var(--vermilion); margin-bottom: .45rem; }
.pop-body em { color: #6b3a1c; }
.pop-foot { margin-top: .9rem; font-size: .8rem; opacity: .55; text-align: right; font-style: italic; }

/* ---------- panels ---------- */
.loom-panel { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8,10,22,.7); opacity: 0; pointer-events: none; transition: opacity .4s; z-index: 20; }
.loom-panel.on { opacity: 1; pointer-events: auto; }
.loom-panel-inner { position: relative; width: min(720px, 100%); max-height: 86vh; overflow: auto; box-sizing: border-box; padding: 1.8rem 2rem 1.6rem;
  background: linear-gradient(180deg, var(--indigo-1), var(--indigo-0)); border-radius: 6px; box-shadow: 0 0 0 2px var(--indigo-0), 0 0 0 4px rgba(239,230,210,.75), 0 30px 80px rgba(0,0,0,.6); }
.loom-panel-inner::before { content: ''; position: absolute; inset: 9px; border: 1.5px dashed rgba(239,230,210,.35); border-radius: 3px; pointer-events: none; }
.loom-panel h2 { font-family: var(--f-display); font-weight: 500; font-size: 2rem; margin: 0 0 1rem; text-align: center; letter-spacing: .06em; }
.loom-close { position: absolute; top: .6rem; right: .8rem; width: 2.2rem; height: 2.2rem; border: 0; background: none; font-size: 1.7rem; line-height: 1; cursor: pointer; opacity: .7; }
.loom-close:hover { opacity: 1; color: var(--gold); }
.loom-contents { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.loom-contents li + li { border-top: 1px dashed rgba(239,230,210,.18); }
.loom-contents button { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; width: 100%; text-align: left; background: none; border: 0; padding: .7rem .4rem; cursor: pointer; }
.loom-contents button:hover { background: rgba(239,230,210,.06); }
.c-title { font-family: var(--f-display); font-size: 1.22rem; font-weight: 600; }
.c-sub { grid-column: 1; font-style: italic; color: #f3dfb0; font-size: 1rem; opacity: .85; }
.c-mark { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--gold); font-size: .8rem; }
.loom-settings label { display: grid; grid-template-columns: 11rem 1fr; align-items: center; gap: 1rem; margin: .7rem 0; }
.loom-settings label.ck { grid-template-columns: auto 1fr; gap: .6rem; }
.loom-settings input[type=range] { accent-color: var(--gold); width: 100%; }
.loom-settings input[type=checkbox] { accent-color: var(--gold); width: 1.1rem; height: 1.1rem; }
.loom-keys { opacity: .6; font-size: .9rem; margin-top: 1.3rem; text-align: center; }
.loom-log { max-height: 62vh; overflow: auto; padding-right: .4rem; }
.log-item { padding: .6rem 0; border-bottom: 1px dashed rgba(239,230,210,.14); }
.log-name { font-family: var(--f-display); font-weight: 600; color: var(--gold); font-size: .95rem; letter-spacing: .05em; }
.log-text { line-height: 1.45; opacity: .92; }
.loom-prose { line-height: 1.62; font-size: 1.08rem; }
.loom-prose p { margin: .7rem 0; }
.loom-prose a { color: var(--gold); }
.loom-prose h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; margin: 1.4rem 0 .3rem; color: #f3dfb0; }

/* ---------- title ---------- */
.loom-title { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity 1.2s; z-index: 10; background: radial-gradient(46% 40% at 50% 50%, rgba(13,18,38,.86), rgba(13,18,38,.55) 70%, rgba(13,18,38,.4)); }
.loom-title.on { opacity: 1; pointer-events: auto; }
.loom-title-inner { text-align: center; padding: 1.5rem; }
.loom-title h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(2.6rem, 8vw, 6rem); letter-spacing: .08em; margin: .6rem 0 .2rem; color: var(--snow); text-shadow: 0 0 40px rgba(217,164,64,.35), 0 2px 4px rgba(0,0,0,.6); line-height: 1.05; }
.loom-title-sub { font-family: var(--f-display); font-style: italic; font-size: clamp(1.1rem, 2.6vw, 1.7rem); color: #f3dfb0; }
.loom-title-by { margin-top: .4rem; font-size: clamp(.95rem, 1.6vw, 1.1rem); opacity: .8; letter-spacing: .04em; }
.loom-title-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 2rem; }
.loom-title-nav button { background: rgba(13,18,38,.6); border: 0; border-radius: 4px; padding: .6em 1.3em; cursor: pointer; font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; letter-spacing: .05em;
  box-shadow: 0 0 0 1.5px rgba(239,230,210,.55); position: relative; }
.loom-title-nav button::before { content: ''; position: absolute; inset: 4px; border: 1px dashed rgba(239,230,210,.3); border-radius: 2px; pointer-events: none; }
.loom-title-nav button:hover, .loom-title-nav button:focus-visible { box-shadow: 0 0 0 1.5px var(--gold); color: var(--gold); outline: none; }
.loom-title-foot { margin-top: 2.2rem; font-size: .85rem; opacity: .55; line-height: 1.6; }
@media (min-aspect-ratio: 4/3) { .loom-title-foot { position: absolute; left: 0; right: 0; bottom: 6.5%; margin: 0; opacity: .7; } }
.loom-title-foot a { color: inherit; }

.reduce-motion *, .reduce-motion *::before { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }

@media (max-width: 640px) {
  .loom-box { padding: 1.15em 1.15em 1.25em; min-height: 9.5em; }
  .loom-name { left: 1em; }
  .loom-bar button { padding: .25em .5em; font-size: .78rem; }
  .loom-settings label { grid-template-columns: 1fr; gap: .2rem; }
  .loom-box::after { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .loom-box { min-height: 6em; padding: .8em 1.4em .9em; }
  .loom-text { font-size: calc(1rem * var(--loom-size)); min-height: 3em; }
}


/* ================================================================ TWELVE TIDES overrides */
body, .loom { background: var(--ink); }
.tt-host { position: absolute; inset: 0; background: var(--paper); }
.tt-host > .tt-svg, .tt-host > .tt-particles { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tt-particles { pointer-events: none; }
.tt-svg .tt-flicker { animation: tt-flick 1.1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes tt-flick { from { opacity: .82; transform: scale(.97, 1.02); } to { opacity: 1; transform: scale(1.02, .97); } }
.tt-svg .tt-smoke { animation: tt-smoke 9s linear infinite; }
@keyframes tt-smoke { to { stroke-dashoffset: -240; } }
.tt-still .tt-svg * { animation: none !important; }
.tt-pup { transition: filter .5s, opacity .5s; }
.tt-pup.dim { filter: brightness(.82) contrast(.9); }

/* the text box: a slip of paper printed with ink rules */
.loom-box {
  background: linear-gradient(180deg, #f1e8d4, #e9dec6);
  color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px #f1e8d4, 0 0 0 8px var(--ink), 0 16px 40px rgba(0,0,0,.45);
  border-radius: 2px;
}
.loom-box::before { border: 1px solid rgba(26,21,18,.55); inset: 7px; border-radius: 0; }
.loom-box::after { display: none; }
.loom-text { color: var(--ink); text-shadow: none; font-size: calc(clamp(1.08rem, 1.5vw + .6rem, 1.44rem) * var(--loom-size)); }
/* a phone on its side: the words must not swallow the picture (this comes after the rule above, so it wins) */
@media (max-height: 520px) and (orientation: landscape) { .loom-text { font-size: calc(clamp(.84rem, 1vw + .42rem, 1rem) * var(--loom-size)); line-height: 1.42; } }
.loom-box.narration .loom-text { color: #2a221b; font-style: normal; }
.loom-text em { color: #6b2416; }
.loom-text strong { color: #12100e; }
.loom-name {
  background: var(--vermilion); color: #fbf3e2; border-radius: 3px;
  box-shadow: 0 0 0 2px #f1e8d4, 0 0 0 3.5px var(--ink);
  font-family: var(--f-display); font-style: normal; letter-spacing: .08em;
}
.loom-name::before { border: 1px solid rgba(251,243,226,.6); inset: 3px; }
.loom-box.narration .loom-name { background: var(--ink); font-style: italic; }
.loom-next::before { background: var(--vermilion); }
.loom-gloss { border-bottom: 1.5px solid rgba(184,52,31,.75); color: inherit; }
.loom-note { border-color: var(--vermilion); background: rgba(184,52,31,.08); color: var(--vermilion); }
.loom-note:hover { background: var(--vermilion); color: #fbf3e2; }

/* lined-out song: the leader's line, then the house's echo */
.loom-box[data-style="leader"] .loom-text { font-style: italic; text-align: center; }
.loom-box[data-style="leader"] .loom-text .ln { padding-left: 0; text-indent: 0; }
.loom-box[data-style="echo"] { background: linear-gradient(180deg, #2a231d, #1a1512); }
.loom-box[data-style="echo"]::before { border-color: rgba(238,228,206,.35); }
.loom-box[data-style="echo"] .loom-text { color: #f1e8d4; font-style: italic; text-align: center; letter-spacing: .01em; }
.loom-box[data-style="echo"] .loom-text .ln { padding-left: 0; text-indent: 0; }
.loom-box[data-style="echo"] .loom-name { background: #f1e8d4; color: var(--ink); }
.loom-box[data-style="scripture"] .loom-text { font-family: var(--f-display); font-size: calc(clamp(1.12rem, 1.5vw + .66rem, 1.5rem) * var(--loom-size)); }

/* cards (chapter titles) as a printed title page */
.loom-card { background: radial-gradient(70% 60% at 50% 50%, rgba(238,228,206,.92), rgba(228,216,189,.97)); color: var(--ink); }
.loom-card h2 { color: var(--ink); font-family: var(--f-display); }
.loom-card-sub { color: var(--vermilion); }
.loom-card-inner { border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); }
.loom-card-inner.end { background: rgba(241,232,212,.96); border-radius: 0; color: var(--ink); }
.loom-card-inner.end p { color: #2a221b; }
.loom-card-inner.end p.couplet { color: var(--vermilion); }
.loom-orn { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 54'%3E%3Cg fill='none' stroke='%231a1512' stroke-width='3'%3E%3Cpath d='M10 27 H88 M132 27 H210'/%3E%3Ccircle cx='110' cy='27' r='17'/%3E%3C/g%3E%3Ctext x='110' y='35' text-anchor='middle' font-size='22' fill='%23b8341f' font-family='serif'%3E%E7%81%AB%3C/text%3E%3C/svg%3E") center / contain no-repeat; }

/* title */
.loom-title { background: radial-gradient(46% 42% at 50% 46%, rgba(238,228,206,.82), rgba(238,228,206,.35) 70%, rgba(238,228,206,0)); }
.loom-title h1 { color: var(--ink); text-shadow: none; font-family: var(--f-display); letter-spacing: .04em; }
.loom-title-sub { color: var(--vermilion); }
.loom-title-by { color: var(--ink); opacity: .8; }
.loom-title-foot { color: var(--ink); }
.loom-title-nav button { background: #f1e8d4; color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.loom-title-nav button::before { border-color: rgba(26,21,18,.4); }
.loom-title-nav button:hover, .loom-title-nav button:focus-visible { box-shadow: 0 0 0 2px var(--vermilion); color: var(--vermilion); }

/* top bar */
.loom-bar button { background: rgba(241,232,212,.86); color: var(--ink); border: 1px solid rgba(26,21,18,.55); }
.loom-bar button:hover, .loom-bar button.on { border-color: var(--vermilion); color: var(--vermilion); }

/* panels and popovers on paper */
.loom-panel-inner { background: linear-gradient(180deg, #f1e8d4, #e7dbc1); color: var(--ink); box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px #f1e8d4, 0 0 0 8px var(--ink), 0 30px 80px rgba(0,0,0,.55); border-radius: 2px; }
.loom-panel-inner::before { border: 1px solid rgba(26,21,18,.4); border-radius: 0; }
.loom-panel h2 { color: var(--ink); font-family: var(--f-display); }
.loom-close { color: var(--ink); }
.c-sub { color: var(--vermilion); }
.c-mark, .log-name { color: var(--vermilion); }
.loom-prose a { color: var(--vermilion); }
.loom-prose h3 { color: var(--vermilion); }
.loom-contents li + li, .log-item { border-color: rgba(26,21,18,.18); }
.loom-settings input { accent-color: var(--vermilion) !important; }
.pop-head { color: var(--vermilion); font-family: var(--f-display); }
.loom-pop-inner { background: #f1e8d4; box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px #f1e8d4, 0 0 0 8px var(--ink), 0 20px 60px rgba(0,0,0,.6); border-radius: 2px; }
.loom-pop-inner::before { border: 1px solid rgba(26,21,18,.4); border-radius: 0; }

/* word-hoard */
.hoard-count { text-align: center; opacity: .75; font-style: italic; margin: -.4rem 0 1rem; }
.loom-hoard { max-height: 60vh; overflow: auto; padding-right: .4rem; }
.hoard-item { padding: .5rem 0; border-bottom: 1px solid rgba(26,21,18,.14); line-height: 1.45; }
.hoard-word { font-family: var(--f-display); font-weight: 700; color: var(--vermilion); }

/* the Wheel */
.tides-wheel { display: grid; place-items: center; }
.tides-wheel svg { width: min(440px, 80vw); height: auto; }
.wh-rim { fill: none; stroke: var(--ink); stroke-width: 5; }
.wh-hub { fill: var(--ink); }
.wh-g line { stroke: var(--ink); stroke-width: 2; opacity: .35; }
.wh-g circle { fill: #f1e8d4; stroke: var(--ink); stroke-width: 3; }
.wh-g.on circle { fill: var(--gc); stroke: var(--ink); }
.wh-g.on line { opacity: .9; }
.wh-rune { text-anchor: middle; font-size: 26px; font-family: serif; fill: var(--ink); }
.wh-g.on .wh-rune { fill: #fbf3e2; }
.wh-name { text-anchor: middle; font-size: 15px; font-family: var(--f-display); fill: var(--ink); }
.wh-thread { fill: none; stroke: var(--vermilion); stroke-width: 3; opacity: .85; }

/* choices and asks */
.tides-choose { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px; background: rgba(26,21,18,.35); opacity: 0; transition: opacity .45s; }
.tides-choose.on { opacity: 1; }
.tides-choose-inner { display: flex; flex-direction: column; gap: .7rem; width: min(640px, 100%); }
.tides-choose-prompt { background: #f1e8d4; color: var(--ink); padding: 1rem 1.3rem; font-size: 1.2rem; line-height: 1.45; text-align: center; box-shadow: 0 0 0 2px var(--ink); font-style: italic; }
.tides-choose button { background: #f1e8d4; color: var(--ink); border: 0; padding: .85rem 1.2rem; font-size: 1.15rem; line-height: 1.35; text-align: left; cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px #f1e8d4, 0 0 0 7.5px rgba(26,21,18,.5); transition: transform .2s, box-shadow .2s; }
.tides-choose button:hover, .tides-choose button:focus-visible { box-shadow: 0 0 0 2px var(--vermilion), 0 0 0 6px #f1e8d4, 0 0 0 7.5px var(--vermilion); color: var(--vermilion); outline: none; transform: translateX(4px); }
.tides-ask input, .tides-ask textarea { font: inherit; font-size: 1.25rem; padding: .7rem 1rem; background: #fbf5e6; color: var(--ink); border: 0; box-shadow: inset 0 0 0 2px var(--ink); border-radius: 0; }
.tides-ask button { text-align: center; font-family: var(--f-display); font-size: 1.2rem; letter-spacing: .06em; }

/* the toast: a slip with a red seal */
.tides-toast { position: absolute; left: 50%; top: 12%; transform: translate(-50%, -10px); z-index: 15; background: #f1e8d4; color: var(--ink); padding: .5rem 1.1rem .5rem 2.6rem; font-style: italic; font-size: 1.05rem;
  box-shadow: 0 0 0 2px var(--ink), 0 10px 30px rgba(0,0,0,.35); opacity: 0; transition: opacity .6s, transform .6s; pointer-events: none; }
.tides-toast::before { content: '火'; position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); width: 1.5rem; height: 1.5rem; display: grid; place-items: center; background: var(--vermilion); color: #fbf3e2; font-style: normal; font-size: .95rem; }
.tides-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* the house's echo of a lined-out line */
.loom-band-line.tides-echo { font-family: var(--f-display); font-style: italic; font-weight: 400; color: #f1e8d4; background: radial-gradient(closest-side, rgba(26,21,18,.78), rgba(26,21,18,.5) 70%, transparent);
  font-size: calc(clamp(1.15rem, 2.2vw, 1.8rem) * var(--loom-size)); padding: .35em 1.4em; border-radius: 999px; animation: tides-echo 1.6s ease-out both; }
@keyframes tides-echo { from { opacity: 0; transform: translateY(10px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
.loom-band.on.dim .tides-echo { opacity: .35; }

/* ---------------------------------------------------------------- rites: printed cards laid over the stage */
.rite { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(26,21,18,.45); opacity: 0; transition: opacity .4s; }
.rite.on { opacity: 1; }
.rite-card { width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -9px; box-shadow: 0 18px 50px rgba(0,0,0,.45); padding: 26px 26px 20px; display: flex; flex-direction: column; gap: .8rem; }
.rite-card.wide { width: min(860px, 100%); }
.rite-dark .rite-card { background: #14100d; color: var(--paper); border-color: var(--paper); outline-color: var(--paper); }
.rite-title { font-family: var(--f-display); font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: .04em; text-align: center; }
.rite-title::after { content: ''; display: block; width: 46px; height: 4px; margin: .5rem auto 0; background: var(--vermilion); }
.rite-hint { font-family: var(--f-display); font-style: italic; text-align: center; font-size: 1.05rem; opacity: .85; min-height: 1.3em; }
.rite-body { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.rite-svg { width: 100%; height: auto; display: block; }
.rite-foot { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .2rem; }
.rite-btn { font: 600 1rem/1.2 var(--f-display); letter-spacing: .03em; padding: .7rem 1.2rem; min-height: 44px; border: 2px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
.rite-btn.go { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rite-dark .rite-btn.go { background: var(--vermilion); border-color: var(--vermilion); color: var(--paper); }
.rite-btn:disabled { opacity: .35; cursor: default; }
.rite-btn:focus-visible, .rite-hit:focus-visible, .rite-ember:focus-visible, .rite-cog:focus-visible, .rite-banner:focus-visible { outline: 3px solid var(--vermilion); outline-offset: 3px; }
.rite-hit, .rite-ember { cursor: pointer; }
.rite-hit.spent { opacity: .35; cursor: default; }
/* banners */
.rite-banners { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.rite-banner { display: flex; flex-direction: column; gap: .4rem; padding: 18px 14px; border: 3px solid var(--ink); cursor: pointer; font: 700 1rem/1.25 var(--f-display); color: var(--paper); }
.rite-banner b { font-size: 1.5rem; letter-spacing: .12em; }
.rite-banner.red { background: var(--vermilion); } .rite-banner.blue { background: #2b3a66; }
.rite-banner:disabled { cursor: default; opacity: .7; } .rite-banner.chosen { opacity: 1; outline: 4px solid var(--ink); outline-offset: 3px; }
.rite-reveal { text-align: center; width: 100%; font-family: var(--f-display); font-style: italic; }
/* cognates */
.rite-cogs { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.rite-cog-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rite-cog-root { flex: 0 0 9.5rem; font-family: var(--f-display); font-size: 1.1rem; }
.rite-cog { position: relative; flex: 1 1 8rem; min-height: 52px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font: 1rem var(--f-display); cursor: pointer; }
.rite-cog .face { display: none; } .rite-cog .back { font-size: 1.4rem; opacity: .6; }
.rite-cog.on { background: var(--paper); color: var(--ink); animation: rite-flip .45s ease-out; } .rite-cog.on .face { display: inline; } .rite-cog.on .back { display: none; }
@keyframes rite-flip { from { transform: rotateY(90deg); } to { transform: none; } }
/* pages */
.rite-page { width: 100%; min-height: 200px; border: 2px solid var(--ink); padding: 26px 22px; display: flex; flex-direction: column; gap: .7rem; align-items: center; justify-content: center; text-align: center; background: repeating-linear-gradient(0deg, transparent 0 26px, rgba(26,21,18,.06) 26px 27px); animation: rite-turn .5s ease-out; }
.rite-page-date { font-family: var(--f-display); font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--vermilion); }
.rite-page-text { font-family: var(--f-display); font-size: 1.2rem; text-wrap: balance; }
.rite-page-n { font-size: .85rem; opacity: .6; }
@keyframes rite-turn { from { transform: perspective(800px) rotateY(-40deg); opacity: .2; } to { transform: none; opacity: 1; } }
/* the wall and the thoughts */
.rite-wall { position: relative; width: 100%; height: 230px; background: #241d17; border: 2px solid var(--paper); overflow: hidden; background-image: repeating-linear-gradient(90deg, transparent 0 60px, rgba(238,228,206,.06) 60px 62px); }
.rite-thought { position: absolute; bottom: 10px; padding: .35rem .7rem; border: 1px solid rgba(238,228,206,.5); background: rgba(20,16,13,.85); color: var(--paper); font: italic 1rem var(--f-display); cursor: pointer; white-space: nowrap; }
.rite-breath { font: italic 1.1rem var(--f-display); opacity: .75; animation: rite-breathe 8s ease-in-out infinite; }
@keyframes rite-breathe { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
/* rivers and weaving: lines drawn on */
.rite-rivers .rv, .rite-weave .wv-thread { stroke-dasharray: 1; stroke-dashoffset: 1; animation: rite-draw 1.6s ease-in-out forwards; }
.rite-rivers .rv-l, .rite-weave .wv-runes { opacity: 0; animation: rite-fade .8s ease-out forwards; }
.rite-rivers text { font-family: var(--f-display); font-size: 17px; fill: var(--ink); }
.rite-rivers .rv-h { font-style: italic; opacity: .6; } .rite-rivers .rv-meet { fill: var(--vermilion); font-size: 22px; }
@keyframes rite-draw { to { stroke-dashoffset: 0; } }
@keyframes rite-fade { to { opacity: 1; } }
/* the print */
.rite-print { position: relative; width: min(400px, 100%); }
.rite-paper { position: absolute; inset: 0; background: #f6efdc; border: 1px solid rgba(26,21,18,.3); transform-origin: top center; box-shadow: 0 4px 10px rgba(0,0,0,.15); }
/* the sayings */
.rite-saying { width: 100%; min-height: 180px; display: flex; flex-direction: column; justify-content: center; gap: .8rem; text-align: center; animation: rite-fade .4s ease-out both; }
.rite-saying-group { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.rite-saying-text { font-family: var(--f-display); font-size: clamp(1.15rem, 2.6vw, 1.55rem); line-height: 1.4; text-wrap: balance; }
@media (max-width: 560px) { .rite-card { padding: 20px 14px 14px; } .rite-banners { grid-template-columns: 1fr; } .rite-cog-root { flex-basis: 100%; } }
@media (prefers-reduced-motion: reduce) { .rite *, .rite { animation-duration: .01s !important; transition-duration: .01s !important; } }
.rite-svg.rite-weave { max-height: min(62dvh, 600px); width: auto; max-width: 100%; }
.rite-svg.rite-rivers { max-height: 46dvh; }
@media (max-width: 560px) {
  .loom-bar { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); justify-content: flex-end; flex-wrap: wrap; gap: 3px; }
  .loom-bar button { font-size: .72rem; padding: .3em .5em; white-space: nowrap; }
}

/* ---------------------------------------------------------------- the stage in motion (quiet; all of it stops for reduced motion) */
.tt-svg .tt-sway { animation: tt-sway 8s ease-in-out infinite alternate; }
@keyframes tt-sway { from { transform: rotate(-.7deg); } to { transform: rotate(.7deg); } }
.tt-svg .tt-drift { animation: tt-drift 90s ease-in-out infinite alternate; }
@keyframes tt-drift { from { transform: translateX(-40px); } to { transform: translateX(40px); } }
.tt-svg .tt-twinkle { animation: tt-twinkle 3.6s ease-in-out infinite alternate; }
@keyframes tt-twinkle { from { opacity: .35; } to { opacity: 1; } }
.tt-svg .tt-swing { animation: tt-swing 4.5s ease-in-out infinite alternate; }
@keyframes tt-swing { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.tt-svg .tt-fly { animation: tt-fly 60s linear infinite; }
@keyframes tt-fly { from { transform: translate(-260px, 30px); } to { transform: translate(1880px, -40px); } }
.tt-svg .tt-flap { animation: tt-flap .7s ease-in-out infinite alternate; transform-box: fill-box; }
@keyframes tt-flap { from { transform: scaleY(1); } to { transform: scaleY(-.4); } }
.tt-svg .tt-shimmer { animation: tt-shimmer 5s ease-in-out infinite alternate; }
@keyframes tt-shimmer { from { opacity: .25; } to { opacity: .7; } }
.tt-svg .tt-ripple { animation: tt-ripple 6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes tt-ripple { from { transform: scale(.94); } to { transform: scale(1.06); } }
.tt-svg .tt-fall { animation: tt-fall 1.2s linear infinite; }
@keyframes tt-fall { to { stroke-dashoffset: -56; } }
.tt-svg .tt-turn { animation: tt-turn 40s linear infinite; }
@keyframes tt-turn { to { transform: rotate(360deg); } }
.tt-svg .tt-breathe { animation: tt-breathe 5.5s ease-in-out infinite alternate; }
@keyframes tt-breathe { from { transform: translateY(0); } to { transform: translateY(-5px); } }
.tt-svg .tt-rise { animation: tt-rise 5s linear infinite; }
@keyframes tt-rise { from { transform: translate(0, 0); opacity: .9; } to { transform: translate(30px, -260px); opacity: 0; } }
.tt-pup:nth-child(2n) .tt-breathe { animation-duration: 6.4s; animation-delay: -2s; }
.tt-pup:nth-child(3n) .tt-breathe { animation-duration: 5s; animation-delay: -3.5s; }
.tt-still .tt-svg *, .tt-still .tt-breathe { animation: none !important; }
.tides-seal { width: min(230px, 42vw); margin: 0 auto .5rem; animation: tides-seal-in 1.2s ease-out both; }
.tides-seal svg { width: 100%; height: auto; display: block; }
@keyframes tides-seal-in { from { transform: scale(.86) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.loom-card-inner.chapter { border: 0; }

/* Back: in the bar, and on the choice and question cards */
.loom-bar button:disabled { opacity: .35; cursor: default; }
.tides-choose-inner .tides-back { background: #f1e8d4; color: var(--ink); box-shadow: 0 0 0 2px var(--ink); font-size: .95rem; padding: .45rem .95rem; margin-top: .2rem; align-self: flex-start; text-align: center; }
.tides-choose-inner .tides-back::before { display: none; }
.tides-choose-inner .tides-back:hover, .tides-choose-inner .tides-back:focus-visible { color: var(--vermilion); box-shadow: 0 0 0 2px var(--vermilion); transform: none; }
