/* rohin.me - page 8, "DVD / VHS": a bookcase of titles held on disc or tape (js/scenes/shelf.js, js/shelf-3d.js).
   One screen: a row to search and filter, the shelf (or the flat list), a row with the count and the place along the
   shelf. One title's card stands beside the shelf on wide screens and under it on upright tablets and phones.
   Colours: tokens only. The six type colours are named here once and read by the 3D code too. */
:root {
  --shelf-doc: var(--c-sea);
  --shelf-docs: var(--c-sky);
  --shelf-film: var(--c-yard);
  --shelf-tv: color-mix(in srgb, var(--c-warn) 58%, var(--c-sky));
  --shelf-sfilm: var(--accent);
  --shelf-sdoc: var(--c-quiet);
}
.sf-ty-doc { --ty: var(--shelf-doc); } .sf-ty-docs { --ty: var(--shelf-docs); } .sf-ty-film { --ty: var(--shelf-film); }
.sf-ty-tv { --ty: var(--shelf-tv); } .sf-ty-sfilm { --ty: var(--shelf-sfilm); } .sf-ty-sdoc { --ty: var(--shelf-sdoc); }
.sf-dot { flex: none; width: 9px; height: 9px; border-radius: 2px; background: var(--ty); }

/* a column: the search row, the count row, what is chosen, a kind's periods, the shelf (all that is left), the place along it */
.shelf { position: absolute; inset: 0; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.shelf > * { flex: none; min-width: 0; }
.shelf > .sf-main { flex: 1 1 0; min-height: 0; }

/* ---- search, filters */
.sf-find { display: flex; gap: var(--s-2); min-width: 0; }
.sf-find .sf-search { flex: 0 1 24rem; min-width: 0; }
.sf-back span, .sf-filter-btn span { white-space: nowrap; }
/* Filters: the one way to narrow the list, so it stands out from the row it is in (as on the Scarecrow page) */
.sf-filter-btn { border-color: var(--line-strong); font-weight: 600; }
.sf-filter-btn .ico { color: var(--accent); }
.sf-search { display: flex; align-items: center; gap: .55rem; padding: 0 1rem; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line); background: var(--glass); color: var(--ink-3); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); transition: box-shadow var(--fast); }
.sf-search:focus-within { box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink-2); }
.sf-q { flex: 1; min-width: 0; height: var(--tap); border: 0; padding: 0; background: none; color: var(--ink); font: inherit; font-size: 1rem; outline: none; appearance: none; -webkit-appearance: none; }
.sf-q::placeholder { color: var(--ink-3); opacity: 1; }
.sf-q::-webkit-search-cancel-button { -webkit-appearance: none; }
.sf-view { flex: none; min-height: var(--tap); padding: 0 1.1rem 0 .85rem; }
.sf-view .ico { color: var(--accent); }
.sf-filters { display: grid; gap: var(--s-2); align-content: start; min-width: 0; }
.sf-filters .chip-btn, .sf-on { display: inline-flex; align-items: center; gap: .45rem; }
.sf-k { font-size: var(--t-tiny); font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip-btn[aria-pressed="true"] .sf-k { color: inherit; }
.sf-filters .chip-btn:disabled, .sf-sheet .sheet-foot .btn:disabled { opacity: .38; cursor: default; }
.sf-filters .chip-btn:disabled:active { transform: none; }
.sf-pick { width: 100%; max-width: 20rem; }
/* what is chosen: chips to take off, one row that scrolls sideways when it must */
.sf-active { display: flex; gap: .35rem; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.sf-active::-webkit-scrollbar { display: none; }
.sf-active[hidden], .sf-side[hidden] { display: none; }
.sf-on { flex: none; padding-right: .6rem; }
.sf-on .ico { opacity: .7; }
/* wide screens: the filters stand beside the shelf */
.sf-side { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 6px 2px 2px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sf-side .sf-filters { gap: var(--s-3); }
.sf-side .chip-group { grid-template-columns: minmax(0, 1fr); }
.sf-side .chip-label { padding-top: 0; }
.sf-more { min-height: var(--tap); max-width: 100%; padding: 0 2rem 0 .85rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); color: var(--ink-2); font: inherit; font-size: var(--t-small); font-weight: 500; }
.sf-more[data-on] { border-color: color-mix(in srgb, var(--accent) 65%, transparent); background: var(--accent-soft); color: var(--ink); }

/* ---- the shelf, the list, the card */
.sf-main { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: var(--s-3); min-width: 0; min-height: 0; }
.shelf[data-open] .sf-main { grid-template-columns: minmax(0, 1fr) minmax(19rem, 23rem); }
.shelf[data-side] .sf-main { grid-template-columns: 14rem minmax(0, 1fr); }
.shelf[data-side][data-open] .sf-main { grid-template-columns: 14rem minmax(0, 1fr) minmax(19rem, 23rem); }
.sf-stage { position: relative; min-width: 0; min-height: 0; border-radius: var(--r-2); overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
.sf-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; border-radius: var(--r-2); }
.sf-canvas:active { cursor: grabbing; }
.sf-canvas:focus-visible { outline-offset: -3px; }
.sf-tip { position: absolute; z-index: 2; translate: -50% -100%; max-width: 15rem; padding: .3rem .7rem; border-radius: var(--r-1); border: 1px solid var(--line-strong); background: var(--bg-raise); color: var(--ink); font-size: var(--t-tiny); line-height: 1.3; text-align: center; pointer-events: none; box-shadow: var(--shadow); }
.sf-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; font-size: var(--t-tiny); }

/* the flat list: every title a spine lying down, its edge in the colour of its type */
.sf-list { position: relative; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sf-sizer { width: 1px; }
.sf-li { position: absolute; height: 44px; }
.sf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .7rem; height: 100%; padding: .2rem .8rem .2rem .9rem; border-radius: 4px; border-left: 6px solid var(--ty); background: color-mix(in srgb, var(--ty) 13%, var(--bg-raise)); color: var(--ink); font-size: var(--t-small); line-height: 1.25; transition: background var(--fast); }
.sf-row:hover { background: color-mix(in srgb, var(--ty) 22%, var(--bg-raise)); }
.sf-row[aria-current] { background: color-mix(in srgb, var(--ty) 30%, var(--bg-raise)); box-shadow: inset 0 0 0 1px var(--line-strong); }
.sf-row:focus-visible { outline-offset: -2px; }
.sf-rt { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; font-weight: 500; }
.sf-ry { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.sf-card { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: var(--s-2); padding: var(--s-3) var(--s-4) var(--s-3); border-radius: var(--r-2); background: var(--bg-raise); animation: drop var(--med) var(--ease); }
.sf-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); min-width: 0; padding-bottom: 2px; }
.sf-title { min-width: 0; padding-top: .55rem; font-family: var(--font-title); font-size: 1.1875rem; font-weight: 600; line-height: 1.22; letter-spacing: -.012em; overflow-wrap: anywhere; }
.sf-close { flex: none; width: var(--tap); min-height: var(--tap); padding: 0; }
.sf-card-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: var(--s-3); align-content: start; padding-right: .3rem; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sf-tags { gap: .35rem; }
.sf-tags .chip { min-height: 2rem; padding: .25rem .75rem; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--ink); }
.sf-facts { display: grid; gap: 0; font-size: var(--t-small); }
.sf-facts > div { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); gap: var(--s-3); padding: .42rem 0; border-top: 1px solid var(--line); }
.sf-facts > div:first-child { border-top: 0; padding-top: 0; }
.sf-facts dt { color: var(--ink-3); }
.sf-facts dd { color: var(--ink); overflow-wrap: anywhere; }
.sf-desc { color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; }
.sf-held, .sf-eps { display: grid; gap: .15rem; font-size: var(--t-small); color: var(--ink-2); padding-top: var(--s-2); border-top: 1px solid var(--line); }
.sf-held p { font-size: var(--t-tiny); line-height: 1.5; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sf-eps-h { margin: .35rem 0 .1rem; font-size: var(--t-tiny); font-weight: 600; color: var(--ink-3); }
.sf-eps-h:first-child { margin-top: 0; }
.sf-eps li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: var(--s-2); padding: .1rem 0; line-height: 1.32; }
.sf-epn, .sf-epy { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: var(--t-tiny); padding-top: .1rem; }
.sf-card-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2) var(--s-3); min-width: 0; }
.sf-ask-btn { flex: none; min-width: 6rem; margin-left: auto; }

/* ---- the count, and the place along the shelf */
.sf-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); min-height: var(--tap); min-width: 0; font-size: var(--t-small); color: var(--ink-2); }
.sf-tally { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.sf-count { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.sf-clear { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); min-width: var(--tap); padding: 0 .2rem; border-bottom: 0; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .25em; }
.sf-jump { min-height: var(--tap); min-width: 4.6rem; padding: 0 .5rem 0 .8rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); color: var(--ink); font: inherit; font-size: var(--t-small); font-weight: 500; font-variant-numeric: tabular-nums; }
.sf-jump:disabled { opacity: .4; }
.sf-pos { width: 100%; min-width: 0; height: var(--tap); margin: 0; background: none; appearance: none; -webkit-appearance: none; cursor: pointer; }
.sf-pos::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
.sf-pos::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
.sf-pos::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 14px; margin-top: -5px; border-radius: 7px; border: 0; background: var(--accent); }
.sf-pos::-moz-range-thumb { width: 34px; height: 14px; border-radius: 7px; border: 0; background: var(--accent); }
.sf-pos:disabled { opacity: .35; cursor: default; }
.shelf[data-view="list"] .sf-pos { visibility: hidden; }
.shelf:not([data-mode="section"]) .sf-foot { display: none; }      /* the place along a shelf: only inside a section */
.sf-row-plain { --ty: var(--line-strong); }
.shelf[data-mode="find"] .sf-card { display: none; }
.shelf[data-mode="find"] .sf-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.shelf[data-side][data-mode="find"] .sf-main { grid-template-columns: 14rem minmax(0, 1fr); }

/* ---- rarity: words only (11-16 UX round: bars read as a phone's signal): the level tiles above the sections, a word at the end of a row, the word on a card */
.sf-rooms.has-levels { grid-template-rows: auto; }      /* the row of levels takes the height it needs; the section rows share the rest */
.sf-levels { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: var(--s-2) var(--s-3); min-width: 0; }
.sf-level { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem; min-height: var(--tap); padding: .3rem .8rem; border-radius: var(--r-2); border: 1px solid var(--line-strong); background: var(--glass); color: var(--ink); text-align: left; transition: border-color var(--fast), transform var(--fast) var(--ease); }
.sf-level:hover { border-color: var(--accent); }
.sf-level:active { transform: scale(.985); }
.sf-level-name { font-size: var(--t-small); font-weight: 600; line-height: 1.2; }
.sf-level-n { font-size: var(--t-tiny); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sf-rare { display: grid; gap: .15rem; }
.sf-rare-mark { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--t-small); font-weight: 600; }
.sf-rare-why { font-size: var(--t-small); color: var(--ink-2); line-height: 1.4; }

/* ---- the sections: a room of small shelves, each with its name */
.sf-rooms { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr)); grid-auto-rows: minmax(5.6rem, 1fr); gap: var(--s-2) var(--s-3); align-content: start; padding: 1px .25rem 1px 1px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
button.sf-room { width: 100%; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sf-room * { pointer-events: none; }      /* the tile itself takes every touch, never a word inside it */
.sf-room { display: grid; grid-template-rows: minmax(2.1rem, 1fr) auto auto; gap: .1rem; min-height: 5.6rem; max-height: 9rem; padding: .55rem .8rem .6rem; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--glass); color: var(--ink); transition: border-color var(--fast), transform var(--fast) var(--ease); }
.sf-room:hover { border-color: var(--line-strong); }
.sf-room:active { transform: scale(.985); }
.sf-room-art { display: flex; align-items: flex-end; gap: 2px; min-height: 0; padding: 0 2px; border-bottom: 3px solid color-mix(in srgb, var(--ink) 26%, var(--bg-raise)); margin-bottom: .35rem; overflow: hidden; }
.sf-room-art i { flex: none; border-radius: 1.5px 1.5px 0 0; background: var(--ty); }
.sf-room-name { font-size: var(--t-small); font-weight: 600; line-height: 1.2; }
.sf-room-when { font-size: var(--t-tiny); color: var(--ink-2); font-variant-numeric: tabular-nums; line-height: 1.3; }

/* ---- the light shelf (js/shelf-flat.js): cases as plain elements in a strip the browser scrolls itself */
.sfc { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; border-radius: var(--r-2); background: color-mix(in srgb, var(--ink) 7%, var(--bg-sunk)); touch-action: pan-x; }
.sfc::-webkit-scrollbar { display: none; }
.sfc:focus-visible { outline-offset: -3px; }
.sfc-run { position: relative; height: 100%; --wood: color-mix(in srgb, var(--c-yard) 14%, color-mix(in srgb, var(--ink) 20%, var(--bg-raise)));
  background:
    repeating-linear-gradient(to right, color-mix(in srgb, var(--wood) 86%, var(--bg-sunk)) 0 12px, transparent 12px var(--bay, 100%)),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--paper-ink) 26%, transparent) 0, transparent 22px, transparent calc(var(--row, 50%) - 14px), var(--wood) calc(var(--row, 50%) - 14px), var(--wood) var(--row, 50%)); }
.sfc-s { position: absolute; height: var(--case); box-sizing: border-box; contain: layout paint style; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; padding: 7px 0 6px; overflow: hidden; cursor: pointer; border-top: 3px solid var(--paper-ink); border-bottom: 3px solid var(--paper-ink); border-radius: 1.5px;
  background-image: linear-gradient(to right, color-mix(in srgb, var(--paper-ink) 34%, transparent), transparent 22%, transparent 74%, color-mix(in srgb, var(--paper-ink) 38%, transparent)); line-height: 1; font-weight: 600; -webkit-user-select: none; user-select: none; transition: transform var(--med) var(--ease), box-shadow var(--med); }
.sfc-t { flex: 1 1 auto; min-height: 0; writing-mode: vertical-rl; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sfc-y { flex: none; writing-mode: vertical-rl; font-size: 11px; font-weight: 500; opacity: .82; font-variant-numeric: tabular-nums; }
.sfc-s[data-cursor] { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 2; }
.sfc-s[aria-selected="true"] { transform-origin: 50% 100%; transform: translateY(-3px) scale(1.045); z-index: 3; box-shadow: 0 10px 18px -6px var(--shade), 0 0 0 2px var(--accent); }


/* ---- ask */
.sf-ask-what { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.sf-ask-form { display: grid; gap: var(--s-3); }
.sf-ask-form label { display: grid; gap: .3rem; font-size: var(--t-small); color: var(--ink-2); }
.sf-ask-form input { height: var(--tap); padding: 0 .9rem; border-radius: var(--r-1); border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font: inherit; font-size: 1rem; }
.sf-ask-form input:focus-visible { outline-offset: 1px; }
.sf-ask-form input[aria-invalid] { border-color: var(--c-warn); }
.sf-ask-go { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); }
.sf-ask-go .btn { min-width: 7rem; }
.sf-ask-msg { font-size: var(--t-small); color: var(--ink-2); }

/* ---- upright tablets and phones: the card goes under the shelf */
@media (max-width: 1000px) {
  .sf-find .sf-search { flex: 1 1 0; }
  .shelf[data-open] .sf-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 58fr) minmax(0, 42fr); gap: var(--s-2); }
}
@media (max-width: 720px) {
  .shelf[data-open] .sf-main { grid-template-rows: minmax(0, 46fr) minmax(0, 54fr); }
  .sf-card { padding: var(--s-2) var(--s-3) var(--s-3); }
  .sf-title { font-size: 1.0625rem; }
  .sf-facts > div { padding: .3rem 0; }
  .sf-tags .chip { min-height: 1.75rem; padding: .15rem .55rem; gap: .35rem; font-size: var(--t-tiny); }
  .sf-card-bar { gap: var(--s-2); }
  .sf-ask-btn { min-width: 4.5rem; padding: 0 1rem; }
  .sf-card-body { gap: var(--s-2); }
  .sf-foot { gap: var(--s-2); }
  .sf-back { padding: 0 .8rem 0 .45rem; }      /* "‹ Sections" in words on a phone too: one way back on every page */
  .sf-filter-btn { padding: 0 .8rem 0 .7rem; }
  @media (max-width: 380px) { .sf-back { padding: 0 .6rem 0 .3rem; } .sf-filter-btn .ico { display: none; } .sf-filter-btn { padding: 0 .75rem; } }      /* the narrowest phones: "‹ Sections" and the search both keep room */
  @media (max-width: 340px) { .sf-find:has(.sf-back:not([hidden])) { flex-wrap: wrap; } .sf-find:has(.sf-back:not([hidden])) .sf-search { order: 3; flex: 1 1 100%; } }      /* 320px: in a section the search takes its own row under "‹ Sections" and Filters */
  .sf-count { white-space: normal; line-height: 1.25; font-size: var(--t-tiny); }
  .sf-tally { max-width: 10rem; }
  .sf-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--s-2); }
  .sf-level { padding: .3rem .6rem; gap: .5rem; }
  .sf-level-name { font-size: .8125rem; }
  .sf-rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; gap: 6px var(--s-2); }
  .sf-room { grid-template-columns: 2.6rem minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; column-gap: .6rem; min-height: 3.4rem; max-height: none; padding: .3rem .6rem; }      /* a long name takes a third line, never cut */
  .sf-room-art { grid-row: 1 / 3; align-self: center; height: 2rem; margin: 0; gap: 1px; border-bottom-width: 2px; }
  .sf-room-art i:nth-child(n+8) { display: none; }
  .sf-room-name { align-self: end; font-size: .8125rem; }
  .sf-room-when { align-self: start; }
}

/* r12: the rarity word at the end of a row; the sheet opens on its heading */
.sf-rr { grid-column: 3; font-size: var(--t-tiny); color: var(--ink-2); white-space: nowrap; }      /* its own column, also when a title has no year */
.sf-row .sf-rt { grid-column: 1; } .sf-row .sf-ry { grid-column: 2; }
.sf-sheet .sheet-head h4:focus { outline: none; }
/* r12: on a phone a tile's art is a narrow stack of five spines, so the name and its line (period · count) keep one line each */
@media (max-width: 699px) {
  .sf-room { grid-template-columns: 1.7rem minmax(0, 1fr); column-gap: .55rem; padding: .3rem .55rem; }
  .sf-room-art { padding: 0; }
  .sf-room-art i:nth-child(n+6) { display: none; }
  .sf-room-when { white-space: nowrap; }
}

/* ---- r13: depth. CSS only (no WebGL on the first view); still under reduced motion, which stops every transition here */
/* the sections: each tile's spines stand at an angle on a little shelf, lit from the left; a touch turns them a little */
.sf-room { box-shadow: 0 7px 14px -12px var(--shade); }
.sf-room-art { perspective: 140px; perspective-origin: 20% 30%; }
.sf-room-art i { transform: rotateY(-24deg); transform-origin: 0 100%; transition: transform var(--med) var(--ease);
  background-image: linear-gradient(to right, color-mix(in srgb, var(--bg-raise) 34%, transparent), transparent 40%, color-mix(in srgb, var(--paper-ink) 30%, transparent));
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--paper-ink) 40%, transparent), 2px 0 3px -1px var(--shade); }
/* the turn is for a mouse only. On a phone a hover rule that moves content makes iOS Safari treat the first tap as a hover
   (its content-change check), so a tap on a tile did nothing (live 11-15). The picture never takes a touch: the tile does. */
.sf-room-art, .sf-room-art i { pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .sf-room:hover .sf-room-art i { transform: rotateY(-8deg); } }
.sf-room-art { border-bottom-color: color-mix(in srgb, var(--ink) 34%, var(--bg-raise)); box-shadow: 0 3px 4px -3px var(--shade); }
/* the light shelf: a lip on every board, the cases cast a little shade on the next, the chosen one is pulled out towards you */
.sfc-run { background:
    repeating-linear-gradient(to right, color-mix(in srgb, var(--wood) 86%, var(--bg-sunk)) 0 12px, transparent 12px var(--bay, 100%)),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--paper-ink) 34%, transparent) 0, transparent 26px, transparent calc(var(--row, 50%) - 22px), color-mix(in srgb, var(--paper-ink) 18%, transparent) calc(var(--row, 50%) - 14px), color-mix(in srgb, var(--bg-raise) 32%, var(--wood)) calc(var(--row, 50%) - 14px), color-mix(in srgb, var(--bg-raise) 32%, var(--wood)) calc(var(--row, 50%) - 11px), var(--wood) calc(var(--row, 50%) - 11px), color-mix(in srgb, var(--paper-ink) 22%, var(--wood)) var(--row, 50%)); }
.sfc-s { contain: layout style; box-shadow: 3px 0 4px -2px var(--shade); }
.sfc-s[aria-selected="true"] { transform-origin: 50% 100%; transform: perspective(520px) translate3d(0, 0, 22px) rotateY(-20deg); box-shadow: 0 0 0 2px var(--accent), 10px 14px 20px -8px var(--shade); }
/* the card comes out like a case taken off the shelf: it turns towards you as it opens */
.shelf[data-view="shelf"] .sf-card.sf-pulled { transform-origin: 0 50%; animation: sf-pull .26s var(--ease); }
@keyframes sf-pull { from { opacity: 0; transform: perspective(900px) rotateY(12deg) translate3d(0, 6px, -24px); } }      /* it turns in from behind, so it is never wider than its box on the way */
/* its case: a spine in the kind's colour with a side and a top, as thick as the shelf draws it */
.sf-card-head { justify-content: flex-start; }
.sf-card-head .sf-close { margin-left: auto; }
.sf-case { flex: none; position: relative; width: var(--cw, 9px); height: 2.6rem; margin: .35rem .5rem 0 .1rem; border-radius: 1.5px; background: var(--ty);
  background-image: linear-gradient(to right, color-mix(in srgb, var(--bg-raise) 30%, transparent), transparent 45%, color-mix(in srgb, var(--paper-ink) 30%, transparent));
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--paper-ink) 45%, transparent), inset 0 -2px 0 color-mix(in srgb, var(--paper-ink) 45%, transparent), 3px 4px 6px -3px var(--shade); }
.sf-case::after { content: ''; position: absolute; top: 0; left: 100%; width: .55rem; height: 100%; transform-origin: 0 0; transform: skewY(-38deg); border-radius: 0 1.5px 1.5px 0; background: color-mix(in srgb, var(--ty) 62%, var(--paper-ink)); }
/* the jump names a level when sorted by rarity ("Not for sale"): on a small phone it gives way so the slider keeps 44 px */
@media (max-width: 420px) { .sf-jump { max-width: 8.5rem; text-overflow: ellipsis; } .sf-pos { min-width: 48px; } .sf-tally { max-width: 8.5rem; } }
/* not streaming: the same mark as Scarecrow's card */
.sf-flag { justify-self: start; display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .25rem .75rem; border-radius: var(--r-pill); border: 1px solid var(--line-strong); font-size: var(--t-tiny); font-weight: 500; color: var(--ink); }
.sf-flag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c-good); }
@media (max-width: 699px) { .sf-level[data-level="0"] { grid-column: 1 / -1; } }

/* 15 Nov (live): on a touch screen no 3D at all. iPhone Safari still missed taps on the section and level tiles after the
   hover fix, and composited 3D layers (perspective, rotateY, translate3d) are the one thing left that only it treats
   differently. The look stays (the spines lean in 2D, the chosen case lifts, the card rises). */
@keyframes sf-rise { from { opacity: 0; transform: translateY(8px); } }
@media (hover: none), (pointer: coarse) {
  .sf-room-art { perspective: none; }
  .sf-room-art i { transform: skewY(-7deg); transition: none; }
  .sfc-s[aria-selected="true"] { transform: translateY(-6px); }
  .shelf[data-view="shelf"] .sf-card.sf-pulled { animation: sf-rise .22s var(--ease); }
}

/* ---- 11-16 (UX round): the count at the top with Random (as on Scarecrow), one tile per kind and its periods inside,
   "Ask to watch" in the title row, and the Ask sheet's picker */
.sf-bar { display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap); }
.sf-bar .sf-tally { flex: 1 1 auto; max-width: none; }
.sf-bar .sf-view .ico { color: var(--accent); }
.sf-bar .pick[hidden] { display: none; }
.sf-count { font-size: var(--t-small); color: var(--ink-2); }
.sf-periods { display: flex; gap: .35rem; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.sf-periods::-webkit-scrollbar { display: none; }
.sf-periods[hidden] { display: none; }
.sf-period { flex: none; }
.sf-ask-top { flex: none; min-height: var(--tap); padding: 0 1.1rem; white-space: nowrap; }
.sf-ask-row { display: flex; align-items: baseline; gap: var(--s-3); min-width: 0; }
.sf-ask-row .sf-ask-what { flex: 1 1 auto; min-width: 0; }
.sf-ask-what[hidden] { display: none; }
.sf-ask-change { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .25em; }
.sf-ask-change[hidden] { display: none; }
.sf-ask-pick { display: grid; gap: var(--s-2); }
.sf-ask-pick[hidden] { display: none; }
.sf-ask-find { display: flex; gap: var(--s-2); min-width: 0; }
.sf-ask-find .sf-search { flex: 1 1 0; min-width: 0; }
.sf-ask-hits { display: grid; gap: 2px; }
.sf-ask-hit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: .25rem .8rem; border-radius: var(--r-1); color: var(--ink); font-size: var(--t-small); text-align: left; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.sf-ask-hit:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.sf-ask-hit span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-ask-none { font-size: var(--t-small); color: var(--ink-2); }
.sf-ask .btn[disabled] { opacity: .45; cursor: default; }
@media (max-width: 720px) {
  .sf-bar .pick { padding: 0 .8rem; }
  .sf-ask-top { padding: 0 .9rem; }
}
.sf-rooms { grid-auto-rows: minmax(5.6rem, 9rem); }      /* twelve tiles now (one per kind): rows grow to a tile's height, not to the page's */
@media (max-width: 720px) { .sf-rooms { grid-auto-rows: auto; } }
/* a short phone (320 x 568) with a title open: the shelf's slider, the jump and the period row give their room to the
   card, so its Ask bar never lies over the slider (11-16, the shell's test at "se"); the shelf keeps a strip of cases */
@media (max-width: 720px) and (max-height: 640px) {
  .shelf[data-open] .sf-foot, .shelf[data-open] .sf-periods { display: none; }
  .shelf[data-open] .sf-main { grid-template-rows: minmax(0, 34fr) minmax(0, 66fr); }
}
.sf-card { overflow: hidden; }      /* the body scrolls inside; nothing of the card spills over what is under it */
