/* Spellbook (/spells/): the 08-spellbook list and the 09-spell-detail view. Type, padding and control
   lengths are CSS px at the mockups' 1086 px page (08's 1024 px mockup x 1.06, 09 1:1); the column itself
   is fluid (about 1066 to 1300 px, zoomed on wide windows), so rows, heroes and art size with grid
   fractions, percentages and aspect ratios. Phone lengths are half the 724 px phone mockups. The shell,
   frames, band, framed pictures, monster cards, buttons, links, fields and sheet come from /assets/site.css. */

.sp-view { display: flex; flex-direction: column; gap: var(--gap); }
.sp-view[hidden] { display: none; }
.sp-muted { color: var(--muted); font-style: italic; }
.sp-page :is(.sp-hero__title, .sp-hero__name, .sp-entry__name, .sp-group__title, .sp-farm__title, .sp-incant__words, .sp-section-title, .sp-state__title, .sp-extras h3) {
  font-family: var(--display); font-weight: 700; letter-spacing: 0;
}

/* Hero: the shared navy band. The arcane study fills the band right of the copy and melts into the navy
   behind it; the band keeps the mockup's proportions as the column grows, so the scene grows too. */
.sp-hero.band { --art-w: calc(100% - 360px); --art-pos: 50% 6%; min-height: auto; aspect-ratio: 1066 / 350; }
.sp-hero .band__art { --fade-l: 15%; --fade-r: 24px; --fade-t: 0%; --fade-b: 0%; }
.sp-hero .band__body { max-width: 430px; padding: 24px 0 30px 38px; }
.sp-hero__title { font-size: 68px; line-height: 1.02; color: var(--cream); }
.sp-hero__lede { max-width: 340px; margin-top: 16px; font: 500 24px/1.25 var(--sans); color: var(--cream); }

/* Search panel: the field and Search button, a rule, then the filter rail. */
.sp-search.panel { padding: 31px 48px 30px; }
.sp-search__form { display: flex; gap: 12px; }
.sp-search__field { position: relative; flex: 1; min-width: 0; }
.sp-search__icon.icon { position: absolute; left: 22px; top: 50%; width: 32px; height: 32px; color: var(--ink); transform: translateY(-50%); pointer-events: none; }
.sp-search__input.input { height: 68px; padding-left: 82px; border-width: 3px; border-radius: 4px; font-size: 24.5px; }
.sp-search__input::-webkit-search-cancel-button { cursor: pointer; }
.sp-search__go.btn { flex: none; width: 172px; min-height: 68px; font-size: 27px; }

/* The rail: seven equal columns divided by bronze lines, then Clear all, filling the panel's width. */
.sp-rail { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) auto; margin: 26px -29px 0; padding: 22px 8px 0 16px; border-top: 2px solid var(--bronze); }
.sp-rail .sp-field { padding: 0 16px; border-left: 2px solid var(--line); }
.sp-rail .sp-field:first-child { padding-left: 0; border-left: 0; }
.sp-rail .sp-field__label { font-size: 19px; }
.sp-rail .sp-select { width: 100%; height: 40px; font-size: 19px; }
.sp-rail__clear.link { display: flex; align-items: flex-end; padding: 0 0 9px 21px; border-left: 2px solid var(--line); font-size: 19px; line-height: 1; white-space: nowrap; }

/* A labelled select whose closed face shows the bare value; the options carry counts. */
.sp-field { display: grid; gap: 9px; align-content: start; min-width: 0; }
.sp-field__label { font: 700 20px/1.2 var(--sans); color: var(--ink); white-space: nowrap; }
.sp-select {
  position: relative; display: flex; align-items: center; min-width: 0; height: 41px; padding: 0 30px 0 14px; border: 2px solid var(--field-line); border-radius: 4px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' shape-rendering='crispEdges'%3E%3Cpath fill='%2322180f' d='M0 0h12v2h-2v2H8v2H6v2H6V6H4V4H2V2H0z'/%3E%3C/svg%3E") right 10px center / 12px 8px no-repeat;
  color: var(--ink); font: 500 20px/1 var(--sans); white-space: nowrap; box-shadow: inset 0 2px 0 rgb(80 50 20 / 0.08);
}
.sp-select:hover { border-color: var(--burgundy); }
.sp-select:focus-within { outline: 3px solid var(--burgundy); outline-offset: 2px; }
.sp-select__value { overflow: hidden; text-overflow: ellipsis; }
.sp-select select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; appearance: none; font-size: 16px; }

/* Phone-only opener for the filter sheet. */
.sp-sheet-open { display: none; }

/* Results panel: a slim bar (count, sort, more filters), then the entries divided by bronze lines. */
.sp-results.panel { padding: 8px 26px 6px; }
.sp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px; border-bottom: 2px solid var(--line); }
.sp-bar__count { margin-right: auto; font: 700 18px/1.2 var(--sans); color: var(--ink-2); }
.sp-bar .sp-field { display: flex; align-items: center; gap: 10px; }
.sp-bar .sp-field__label { font-size: 17px; }
.sp-bar .sp-select { width: 236px; height: 36px; font-size: 17px; }
.sp-bar__more { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 2px solid var(--burgundy); border-radius: 3px; background: var(--surface); color: var(--burgundy); font: 700 17px/1 var(--sans); cursor: pointer; }
.sp-bar__more::after { content: ''; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform var(--hover); }
.sp-bar__more[aria-expanded="true"]::after { transform: rotate(-135deg) translate(-1px, -1px); }
.sp-more { display: grid; gap: 14px; padding: 14px 14px 16px; border-bottom: 2px solid var(--line); }
.sp-more[hidden] { display: none; }
.sp-more .sp-field--by { display: flex; align-items: center; gap: 10px; }
.sp-more .sp-field__label { font-size: 17px; }
.sp-more .sp-select { width: 200px; height: 36px; font-size: 17px; }
.sp-cardfilters { display: grid; gap: 10px; }
.sp-cardfilters__note { font-size: 15px; color: var(--muted); }
.sp-chips { margin: 0; padding: 0; border: 0; min-width: 0; }
.sp-chips .sp-field__label { margin-bottom: 6px; padding: 0; font-size: 17px; }
.sp-chips__row { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-chip { cursor: pointer; }
.sp-chip__n { opacity: 0.7; font-weight: 500; }
.sp-chip.is-zero { opacity: 0.5; }
.sp-notice { margin: 12px 14px 0; padding: 10px 14px; border: 2px solid var(--burgundy); color: var(--burgundy); background: var(--surface); }

.sp-group__title { display: flex; align-items: baseline; gap: 12px; padding: 18px 14px 4px; font-size: 30px; line-height: 1.2; color: var(--ink); }
.sp-group__n { font: 600 16px/1 var(--sans); color: var(--muted); }
.sp-group + .sp-group { border-top: 2px solid var(--line); }

/* An entry: the spell's picture in the small bronze frame, its text, its element between two rules and
   View spell. The picture takes a quarter of the row and keeps the mockup's 3:2 window. */
.sp-entry { display: grid; grid-template-columns: 25% minmax(0, 1fr) 116px auto; align-items: center; padding: 20px 12px 18px 14px; cursor: pointer; }
.sp-entry + .sp-entry { border-top: 2px solid var(--line); }
.sp-entry__art.pic { aspect-ratio: 3 / 2; }
.sp-entry__art--glyph > img { padding: 10% 0; object-fit: contain; background: radial-gradient(circle at 50% 55%, #24406b, #0c1a33 70%); filter: drop-shadow(0 3px 0 rgb(0 0 0 / 0.35)); }
.sp-entry__text { min-width: 0; padding: 0 6px 0 36px; }
.sp-entry__name { font-size: 40px; line-height: 1.1; color: var(--ink); }
.sp-entry__words { margin-top: 3px; font: 700 25px/1.3 var(--sans); }
.sp-words-text { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.sp-entry__words .sp-muted { font-size: 20px; font-weight: 500; }
.sp-entry__line { font: 500 22.5px/1.4 var(--sans); color: var(--ink); }
.sp-entry__el { position: relative; display: grid; place-items: center; height: 127px; border-inline: 2px solid var(--line); }
.sp-entry__elicon { width: 72px; height: 98px; object-fit: contain; filter: drop-shadow(0 2px 0 rgb(0 0 0 / 0.25)); }
/* Physical: two swords crossed. */
.sp-crossed { position: relative; display: block; width: 84px; height: 84px; }
.sp-crossed .sp-entry__elicon { position: absolute; top: 0; width: 66px; height: 66px; }
.sp-crossed .sp-entry__elicon:first-child { left: 0; }
.sp-crossed .sp-entry__elicon:last-child { right: 0; transform: scaleX(-1); }
.sp-entry__go.btn { width: 191px; min-height: 55px; margin-left: 28px; font-size: 25px; }

.sp-showmore { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; padding: 16px 14px 18px; border-top: 2px solid var(--line); }
.sp-showmore__left { font-size: 16px; color: var(--muted); }

/* Feedback states (loading, no matches, could not connect, unknown spell): art at left, copy at right. */
.sp-state { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 36px 20px 40px; }
.sp-state[hidden] { display: none; }
.sp-state__art { flex: none; width: 236px; height: auto; }
.sp-state__text { display: grid; justify-items: start; max-width: 260px; }
.sp-state__title { font-size: 36px; line-height: 1.1; color: var(--ink); }
.sp-rule { display: flex; align-items: center; gap: 6px; width: 100%; margin: 10px 0 12px; }
.sp-rule::before, .sp-rule::after { content: ''; flex: 1; height: 2px; background: var(--bronze); opacity: 0.8; }
.sp-rule > i { width: 14px; height: 14px; background: url(/assets/art/ornament.svg) center / 14px no-repeat; }
.sp-state__body { font-size: 21px; line-height: 1.3; color: var(--ink-2); }
.sp-state__btn.btn { margin-top: 20px; min-width: 226px; min-height: 52px; font-size: 22px; }

/* Farm band: navy frame, cream heading link at left, the watering vignette standing on the frame's floor
   at right. The vignette is one box whose pieces are placed in percentages of it. */
.sp-farm.frame-navy { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 38%, 420px); align-items: center; column-gap: 20px; min-height: 166px; padding: 12px 28px 7px 68px; }
.sp-farm__title { max-width: 600px; font-size: 49px; line-height: 1.05; color: var(--cream); }
.sp-farm__title a { color: inherit; text-decoration: none; text-underline-offset: 6px; }
.sp-farm__title a:hover { text-decoration: underline; text-decoration-color: var(--link-navy); }
.sp-farm__art { position: relative; align-self: end; aspect-ratio: 418 / 150; pointer-events: none; }
.sp-farm__art img { position: absolute; height: auto; filter: drop-shadow(0 3px 0 rgb(0 0 0 / 0.3)); }
/* The sprout sprite has a stray bar under its transparent bottom fifth: clip it and sink the soil to the floor. */
.sp-farm__sprout { bottom: -11%; width: 23%; clip-path: inset(0 0 4% 0); }
.sp-farm__sprout--a { left: 2%; }
.sp-farm__sprout--b { left: 25%; width: 21%; }
.sp-farm__can { left: 34%; top: 6%; width: 32%; transform: rotate(-28deg); }
.sp-farm__bag { right: 0; bottom: 0; width: 30.5%; }

/* ---- Spell detail ---- */
.sp-hero--detail.band { --art-w: calc(100% - 480px); aspect-ratio: 1066 / 300; }
.sp-hero--detail .band__body { max-width: 480px; padding: 22px 0 24px 31px; }
.sp-crumb { font: 500 20.5px/1.4 var(--sans); color: var(--cream); }
.sp-crumb a { color: var(--cream); text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--link-navy); }
.sp-hero__name { margin-top: 8px; font-size: 60px; line-height: 1.05; color: var(--cream); }
/* The title takes focus when a detail opens, for screen readers; a heading needs no visible ring. */
.sp-hero__name:focus, .sp-state__title:focus { outline: none; }
.sp-badge {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; min-height: 52px; margin: 12px 0 0 6px; padding: 4px 34px;
  color: var(--cream); font: 700 24px/1.1 var(--sans); text-shadow: 0 1px 0 rgb(60 8 18 / 0.6);
}
.sp-badge::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border: 7px solid transparent; border-image: url(/assets/art/frame-btn.svg) 20 / 20px; clip-path: var(--notch);
  background: linear-gradient(var(--burgundy-top), var(--burgundy-bottom)); background-origin: border-box; box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.12), inset 0 -3px 0 rgb(0 0 0 / 0.18);
}
.sp-hero--detail .sp-hero__lede { max-width: 400px; margin: 16px 0 0 6px; font-size: 22px; line-height: 1.26; }

/* Words panel: the incantation with Copy words, the headline stats, then the effects or requirements. */
.sp-words.panel { padding: 18px 55px 14px; }
.sp-incant { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; min-height: 84px; margin: 0 28px; padding: 6px 39px 6px 24px; }
.sp-incant::before { content: ''; position: absolute; inset: 0; z-index: -1; border: 4px solid transparent; border-image: url(/assets/art/frame-sm.svg) 8 / 8px; clip-path: var(--notch-sm); pointer-events: none; }
.sp-incant__words { font-size: 55px; line-height: 1.05; color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.sp-copy.btn { width: 222px; min-height: 50px; padding-inline: 18px; font-size: 21.5px; font-weight: 600; }
.sp-copy__icon.icon { width: 26px; height: 26px; }
.sp-copy-note:not(.is-visible) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sp-copy-note.is-visible { margin: 10px 30px 0; padding: 8px 14px; border: 2px solid var(--burgundy); background: var(--surface); color: var(--burgundy); font-weight: 600; text-align: center; }
.sp-stats { display: flex; flex-wrap: wrap; justify-content: center; row-gap: 10px; margin-top: 17px; }
.sp-stat { display: flex; align-items: center; gap: 22px; padding: 0 50px; font: 700 25.5px/1.2 var(--sans); color: var(--ink); }
.sp-stat + .sp-stat { border-left: 2px solid var(--line); }
.sp-stat:first-child { padding-left: 0; }
.sp-stat:last-child { padding-right: 0; }
.sp-stat__icon { width: auto; height: 62px; }
.sp-stat__icon--svg { width: 74px; height: 35px; }
.sp-words__rule.rule { margin: 12px 0 6px; }
.sp-effects { display: grid; gap: 10px; padding: 0 20px; }
.sp-effects--row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 0; padding: 0; }
.sp-effect { display: flex; align-items: center; gap: 20px; font: 500 24px/1.3 var(--sans); color: var(--ink); }
.sp-effects--row .sp-effect { padding: 0 53px; font-size: 27px; }
.sp-effects--row .sp-effect + .sp-effect { border-left: 2px solid var(--line); }
.sp-effects--row .sp-effect:first-child { padding-left: 0; }
.sp-effects--row .sp-effect:last-child { padding-right: 0; }
.sp-effect b, .sp-power { font-weight: 700; }
.sp-effect__icon { flex: none; width: 60px; height: 66px; object-fit: contain; }
.sp-effect__trail { position: relative; display: block; width: 48px; }
.sp-trail { position: absolute; width: 18px; height: auto; transform: rotate(28deg); }
.sp-trail--a { left: 0; top: 30px; }
.sp-trail--b { left: 16px; top: 14px; width: 21px; }
.sp-trail--c { left: 30px; top: 0; }
.sp-reqs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 0; }
.sp-reqs > div { display: flex; gap: 8px; padding: 0 22px; font-size: 21px; line-height: 1.3; }
.sp-reqs > div + div { border-left: 2px solid var(--line); }
.sp-reqs dt { color: var(--muted); }
.sp-reqs dd { font-weight: 700; color: var(--ink); }

/* Section panels with a centred title and the narrow rule. */
.sp-section-title { font-size: 44px; line-height: 1.15; color: var(--ink); text-align: center; }
.sp-area.panel { padding: 12px 40px 19px; }
.sp-source.panel { padding: 12px 40px 14px; }
.sp-area .rule, .sp-source .rule { margin: 0 auto; }

/* Area of effect: live tiles from the spell's area data, row labels for forward shapes, legend at right. */
.sp-area__body { display: flex; justify-content: center; align-items: center; margin-top: 12px; }
.sp-tiles { display: grid; grid-template-columns: repeat(var(--cols), 46px); grid-auto-rows: 38px; gap: 3px 4px; align-items: center; }
.sp-tiles--forward { grid-template-columns: 190px repeat(var(--cols), 46px); margin-left: -60px; }
.sp-tiles__label { grid-column: 1; font: 500 19px/1 var(--sans); color: var(--ink); white-space: nowrap; }
.sp-tile { display: block; width: 46px; height: 38px; border: 2px solid #3a1418; border-radius: 3px; background: #b3202f; box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.16), inset 0 -3px 0 rgb(0 0 0 / 0.22); }
.sp-tile--caster { border-color: #102a57; background: #2f6fd6; }
.sp-tile--target { background: #b3202f; outline: 3px solid var(--ink); outline-offset: -9px; }
.sp-tile--maybe { background: #d98a8f; }
.sp-legend { display: grid; gap: 28px; align-self: stretch; align-content: start; margin-left: 84px; padding: 40px 0 0 60px; border-left: 2px solid var(--bronze); }
.sp-legend__item { display: flex; align-items: center; gap: 23px; font: 700 21px/1.2 var(--sans); color: var(--ink); }
.sp-legend__item .sp-tile { width: 44px; }
.sp-legend__note { max-width: 260px; font-size: 18px; color: var(--ink-2); }

/* Where this power comes from: the monster card (the shared .mcard) or the vocations at left, the
   sentences and links at right. */
.sp-source__body { display: flex; justify-content: center; align-items: flex-start; gap: 51px; margin-top: 16px; }
.sp-source__art { flex: none; width: 185px; }
.sp-source__text { display: grid; align-content: start; min-height: 168px; max-width: 600px; margin-top: 18px; padding: 10px 0 0 37px; border-left: 2px solid var(--bronze); font: 500 23px/1.43 var(--sans); color: var(--ink); }
.sp-source__lines > span { display: block; }
.sp-source__links { display: flex; flex-wrap: wrap; align-items: center; margin-top: 30px; font-size: 22.5px; }
.sp-source__sep { width: 2px; height: 34px; margin: 0 34px; background: var(--bronze); }
.sp-vocs { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sp-vocs__icon { width: 84px; height: auto; }
.sp-vocs__icon:only-child { width: 150px; }

/* Disclosure buttons under the links (every source card, full details) and the sections they open. */
.sp-toggles { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: 12px; }
.sp-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; padding: 0; border: 0; background: none; font: 700 19px/1.2 var(--sans); color: var(--ink); text-align: left; cursor: pointer; }
.sp-toggle::before { content: ''; flex: none; width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 9px; border-color: transparent transparent transparent var(--burgundy); transition: transform var(--hover); }
.sp-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.sp-toggle:hover { color: var(--burgundy); }
.sp-more-body { display: grid; gap: 10px; padding: 10px 0 4px; font-size: 17px; line-height: 1.45; }
.sp-more-body[hidden] { display: none; }
.sp-extras h3 { margin-top: 6px; font-size: 21px; line-height: 1.2; color: var(--ink); }
.sp-extras code, .sp-formula { font-size: 15px; }
.sp-formula { margin: 0; padding: 10px 12px; overflow-x: auto; border: 2px solid var(--line); background: var(--surface); }
.sp-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.sp-facts dt { color: var(--muted); }
.sp-facts dd { color: var(--ink); font-weight: 600; }
.sp-flavor { font-style: italic; }
.sp-note { color: var(--ink-2); }
.sp-tablewrap { overflow-x: auto; }
.sp-table { border-collapse: collapse; min-width: 320px; }
.sp-table :is(th, td) { padding: 6px 14px; border: 2px solid var(--line); text-align: left; }
.sp-table thead th { background: var(--parchment-2); }
.sp-mons { display: grid; gap: 8px; }
.sp-mon { display: grid; gap: 2px; }
.sp-mon__name { font-weight: 700; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.sp-mon__cards { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.sp-cardref { color: var(--ink); }
.sp-cardref:hover { color: var(--burgundy); }
.sp-cardref__use { display: block; font-size: 15px; color: var(--muted); }
.sp-allmon { margin-top: 6px; justify-self: start; }

.sp-missing.panel { padding: 24px 40px; }

/* Filter sheet: the shared sheet with the board's chevron selects; sorting and the card filters fold into
   one accordion row so Clear all and Show results stay right under the seven filters. */
.sp-sheet .sheet__body { gap: 10px; }
.sp-sheet .sp-field { gap: 4px; }
.sp-sheet .sp-field__label { font-size: 15px; }
.sp-sheet .sp-select {
  width: 100%; height: 34px; padding: 0 40px 0 12px; font-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1.5 1.5 8 8l6.5-6.5' fill='none' stroke='%237d1f2c' stroke-width='2.6'/%3E%3C/svg%3E");
  background-position: right 14px center; background-size: 16px 10px;
}
.sp-sheet__more { margin-top: 4px; }
.sp-sheet__more > summary { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.sp-sheet__more .accordion__body { display: grid; gap: 10px; padding: 12px 14px 14px; }
.sp-sheet .sp-chip { min-height: 30px; font-size: 14px; }
.sp-sheet__art img { object-position: 46% 74%; }

/* Narrower desktop windows (about 1000 to 1100 px): a long spell name still fits on one line. */
@media (max-width: 1100px) {
  .sp-entry__name { font-size: 34px; }
  .sp-entry__go.btn { width: 172px; margin-left: 22px; }
}

/* Tablets (768 to 960 px): the rail folds into two rows of four, and the rows and panels tighten. */
@media (max-width: 960px) {
  .sp-hero.band { --art-w: calc(100% - 320px); }
  .sp-hero--detail.band { --art-w: calc(100% - 400px); }
  .sp-hero__title { font-size: 58px; }
  .sp-hero__lede { max-width: 280px; font-size: 20px; }
  .sp-hero__name { font-size: 48px; }
  .sp-hero--detail .band__body { max-width: 380px; }
  .sp-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 18px; }
  .sp-rail .sp-field:nth-child(4n + 1) { padding-left: 0; border-left: 0; }
  .sp-entry { grid-template-columns: 24% minmax(0, 1fr) 84px auto; padding-inline: 6px; }
  .sp-entry__text { padding-left: 22px; }
  .sp-entry__name { font-size: 28px; }
  .sp-entry__words { font-size: 19px; }
  .sp-entry__words .sp-muted { font-size: 16px; }
  .sp-entry__line { font-size: 17px; }
  .sp-entry__el { height: 96px; }
  .sp-entry__elicon { width: 54px; height: 70px; }
  .sp-crossed { width: 64px; height: 64px; }
  .sp-crossed .sp-entry__elicon { width: 50px; height: 50px; }
  .sp-entry__go.btn { width: auto; min-height: 48px; margin-left: 16px; padding-inline: 18px; font-size: 19px; }
  .sp-farm.frame-navy { padding-left: 40px; }
  .sp-farm__title { font-size: 38px; }
  .sp-words.panel { padding-inline: 30px; }
  .sp-incant { margin: 0; padding-right: 20px; }
  .sp-incant__words { font-size: 42px; }
  .sp-stat { gap: 14px; padding: 0 22px; font-size: 22px; }
  .sp-stat__icon { height: 48px; }
  .sp-effects--row .sp-effect { padding: 0 22px; font-size: 22px; }
  .sp-section-title { font-size: 38px; }
  .sp-tiles--forward { margin-left: 0; grid-template-columns: 160px repeat(var(--cols), 46px); }
  .sp-tiles__label { font-size: 17px; }
  .sp-legend { margin-left: 32px; padding-left: 28px; }
  .sp-source__body { gap: 28px; }
  .sp-source__art { width: 160px; }
  .sp-source__text { padding-left: 26px; font-size: 20px; }
}

/* ---- Phones ---- */
@media (max-width: 767px) {
  .sp-page .rule { height: 12px; }
  .sp-page .rule > i { width: 10px; height: 10px; background-size: 10px; }
  .sp-hero.band { aspect-ratio: auto; margin-bottom: -4px; }
  .sp-hero .band__body { max-width: none; padding: 7px 12px 0 15px; }
  .sp-hero .band__art { height: auto; min-height: 0; aspect-ratio: 2.27; max-height: 300px; --fade-l: 3%; --fade-r: 3%; --fade-t: 18%; --fade-b: 0%; }
  .sp-hero__title { font-size: 34px; line-height: 1.05; }
  .sp-hero__lede { max-width: none; margin-top: 3px; font-size: 14.3px; line-height: 1.2; }

  .sp-search.panel { padding: 16px 18px 13px; }
  .sp-search__form { flex-direction: column; gap: 10px; }
  .sp-search__input.input { height: 33px; min-height: 0; padding-left: 37px; font-size: 12px; }
  .sp-search__icon.icon { left: 12px; width: 16px; height: 16px; }
  .sp-search__go.btn { width: 100%; min-height: 32px; font-size: 15.5px; }
  .sp-rail { display: none; }
  .sp-sheet-open {
    display: flex; align-items: center; gap: 18px; width: 100%; min-height: 36px; margin-top: 24px; padding: 0 12px 0 19px; position: relative;
    border: 2px solid var(--field-line); border-radius: 4px; background: var(--surface); color: var(--ink); font: 700 15.5px/1 var(--sans); cursor: pointer;
  }
  .sp-sheet-open::before { content: ''; position: absolute; left: -4px; right: -4px; top: -13px; height: 2px; background: var(--bronze); }
  .sp-sheet-open::after { content: ''; width: 10px; height: 10px; margin: -5px 6px 0 auto; border: solid var(--ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
  .sp-sheet-open .icon { width: 22px; height: 22px; }

  /* Each entry becomes its own parchment panel on the navy. */
  .sp-results.panel { padding: 0; }
  .sp-results.panel::before { display: none; }
  .sp-bar, .sp-more { display: none; }
  .sp-entries { display: grid; gap: var(--gap); }
  .sp-group + .sp-group { border-top: 0; }
  .sp-group__title { padding: 10px 6px 6px; font-size: 20px; color: var(--cream); text-shadow: 0.05em 0.05em 0 rgb(2 6 15 / 0.85); }
  .sp-group__n { color: var(--cream-muted); text-shadow: none; }
  .sp-entry {
    position: relative; isolation: isolate; grid-template-columns: minmax(96px, 35%) minmax(0, 1fr); grid-template-areas: 'art text' 'el el' 'go go';
    align-items: start; padding: 13px 14px 12px;
  }
  .sp-entry::before {
    content: ''; position: absolute; inset: 0; z-index: -1; border: 6px solid transparent; border-image: url(/assets/art/frame.svg) 20 / 20px;
    clip-path: var(--notch); background: var(--parchment-bg); background-origin: border-box; pointer-events: none;
  }
  .sp-entry + .sp-entry { border-top: 0; }
  .sp-entry__art { grid-area: art; margin-top: -1px; }
  .sp-entry__art.pic { aspect-ratio: 5 / 3; padding: 3px; }
  .sp-entry__text { grid-area: text; padding: 0 0 0 10px; }
  .sp-entry__name { font-size: 21px; line-height: 1; }
  .sp-entry__words { margin: 2px 0 0; font-size: 12.5px; line-height: 1.3; }
  .sp-entry__words .sp-muted { font-size: 12px; }
  .sp-words-text { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
  .sp-entry__line { font-size: 12px; line-height: 1.3; }
  .sp-entry__el { grid-area: el; display: flex; align-items: center; gap: 10px; height: auto; margin: 1px 0 0; border: 0; }
  .sp-entry__el::before, .sp-entry__el::after { content: ''; flex: 1; height: 1px; background: var(--bronze); }
  .sp-entry__elicon { width: 26px; height: 28px; }
  .sp-crossed { width: 30px; height: 30px; }
  .sp-crossed .sp-entry__elicon { width: 24px; height: 24px; }
  .sp-entry__go.btn { grid-area: go; width: 100%; min-height: 26px; margin: 8px 0 0; padding-block: 0; font-size: 13.5px; }
  .sp-showmore { flex-direction: column; gap: 6px; padding: 12px 0 4px; border-top: 0; }
  .sp-showmore .btn { width: 100%; }
  .sp-showmore__left { color: var(--cream-muted); font-size: 13px; }
  .sp-notice { margin: 0 0 6px; }

  .sp-state { position: relative; isolation: isolate; flex-direction: row; gap: 12px; padding: 18px 14px; }
  #state-box { background: var(--parchment-bg); border: 2px solid var(--line); }
  .sp-state__art { width: 120px; }
  .sp-state__title { font-size: 21px; }
  .sp-state__body { font-size: 14px; }
  .sp-rule { margin: 6px 0 8px; }
  .sp-state__btn.btn { min-width: 0; width: 100%; min-height: 32px; margin-top: 12px; font-size: 14px; }

  .sp-farm.frame-navy { grid-template-columns: minmax(0, 1fr) 46%; column-gap: 6px; min-height: 74px; padding: 8px 10px 5px 17px; }
  .sp-farm__title { font-size: 18px; line-height: 1.08; }

  .sp-hero--detail.band { margin-bottom: 0; }
  .sp-hero--detail .band__body { padding: 4px 12px 0 17px; }
  .sp-hero--detail .band__art { aspect-ratio: 2.4; margin: 8px 7px 0 12px; }
  .sp-crumb { font-size: 11.5px; }
  .sp-hero__name { margin-top: 2px; font-size: 32px; }
  .sp-badge { min-height: 27px; margin: 5px 0 0 2px; padding: 2px 17px; font-size: 14px; }
  .sp-badge::before { border-width: 4px; border-image: url(/assets/art/frame-sm.svg) 8 / 8px; clip-path: var(--notch-sm); }
  .sp-hero--detail .sp-hero__lede { max-width: none; margin: 8px 0 0 2px; font-size: 12px; line-height: 1.25; }

  .sp-words.panel { padding: 8px 16px 14px; }
  .sp-incant { grid-template-columns: 1fr; justify-items: center; gap: 3px; min-height: 0; margin: 0; padding: 4px 12px 4px; }
  .sp-incant__words { font-size: 27px; }
  .sp-copy.btn { width: auto; min-height: 24px; padding: 0 18px; font-size: 14px; }
  .sp-copy__icon.icon { width: 15px; height: 15px; }
  .sp-copy-note.is-visible { margin: 8px 0 0; font-size: 13px; }
  .sp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 0; margin-top: 8px; }
  .sp-stat, .sp-stat:first-child, .sp-stat:last-child { justify-content: center; gap: min(14px, 3vw); padding: 0 6px; font-size: 13.2px; white-space: nowrap; }
  .sp-stat:nth-child(3) { grid-column: 1 / -1; justify-content: flex-start; padding-left: 26px; border-left: 0; }
  .sp-stat__icon { height: 30px; }
  .sp-stat__icon--svg { width: 36px; height: 17px; }
  .sp-words__rule.rule { margin: 4px 0 -3px; height: 14px; }
  .sp-effects, .sp-effects--row { display: grid; justify-content: start; gap: 0; padding: 0 0 0 26px; }
  .sp-effects--row .sp-effect { padding: 0; }
  .sp-effects--row .sp-effect + .sp-effect { border-left: 0; }
  .sp-effect, .sp-effects--row .sp-effect { gap: 22px; font-size: 14.5px; }
  .sp-effect__icon { width: 30px; height: 30px; }
  .sp-effect__trail { width: 30px; }
  .sp-trail { width: 10px; }
  .sp-trail--a { top: 16px; }
  .sp-trail--b { left: 9px; top: 8px; width: 12px; }
  .sp-trail--c { left: 18px; }
  .sp-reqs { justify-content: flex-start; padding: 0 4px; }
  .sp-reqs > div, .sp-reqs > div + div { padding: 0 10px; border-left: 0; font-size: 13px; }

  .sp-section-title { font-size: min(21px, 5.8vw); }
  .sp-area.panel, .sp-source.panel { padding: 8px 16px 10px; }
  .sp-area__body { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 0; margin-top: 2px; padding-left: 25px; }
  .sp-tiles { --tile: min(24px, calc((100vw - 90px) / var(--cols) / 1.6)); grid-template-columns: repeat(var(--cols), var(--tile)); grid-auto-rows: calc(var(--tile) * 0.72); gap: 2px; margin: 0; }
  .sp-tiles--forward { grid-template-columns: 0 repeat(var(--cols), var(--tile)); margin-left: -2px; }
  .sp-tiles__label { display: none; }
  .sp-tile { width: 100%; height: 100%; border-width: 1px; box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.16), inset 0 -2px 0 rgb(0 0 0 / 0.22); }
  .sp-tile--target { outline-width: 2px; outline-offset: -6px; }
  .sp-legend { grid-column: 2; grid-row: 1; gap: 12px; margin-left: 28px; padding: 30px 0 0 16px; }
  .sp-legend__item { gap: 10px; font-size: 12px; }
  .sp-legend__item .sp-tile { width: 22px; height: 17px; }
  .sp-legend__note { font-size: 11px; }
  .sp-tiles { grid-column: 1; grid-row: 1; }
  .sp-rows { grid-column: 1 / -1; grid-row: 2; margin: 4px 0 0 -15px; font-size: 10px; line-height: 1.2; }

  .sp-source__body { gap: 0; margin-top: 8px; }
  .sp-source__art { width: 88px; }
  .sp-source__text { min-height: 0; margin: 0 0 0 20px; padding: 4px 0 0 20px; font-size: 12.5px; line-height: 1.3; }
  .sp-source__lines > span { display: inline; }
  .sp-source__links { display: grid; justify-items: start; gap: 6px; margin-top: 8px; font-size: 13px; }
  .sp-source__sep { display: none; }
  .sp-vocs { gap: 4px; }
  .sp-vocs__icon { width: 38px; }
  .sp-vocs__icon:only-child { width: 70px; }
  .sp-toggles { display: grid; gap: 0; margin-top: 6px; }
  .sp-toggle { min-height: 30px; gap: 8px; font-size: 12.5px; }
  .sp-toggle::before { border-width: 5px 0 5px 7px; }
  .sp-more-body { padding-top: 4px; font-size: 13px; }
  .sp-extras h3 { font-size: 15px; }
  .sp-facts { grid-template-columns: 1fr; gap: 0; }
  .sp-facts dd { margin-bottom: 4px; }
}
