/* Bardic for iPhone. Loaded after ../play/style.css and ../compagnie/compagnie.css: same themes, cards and table. */

/* ---------- Which face of the page ---------- */
.gate, .app { display: none; }
html.mode-other .gate-other, html.mode-install .gate-install { display: flex; }
html.mode-app .app { display: block; }

html.mode-app, html.mode-app body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.mode-app body {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  background: var(--bg);
}
html.mode-app input, html.mode-app textarea { -webkit-user-select: text; user-select: text; }
/* iOS zooms into any field under 16 px: keep them all at 16 px or more. */
html.mode-app input[type="text"], html.mode-app input[type="search"], html.mode-app input:not([type]), html.mode-app textarea { font-size: 16px; }

/* ---------- Gates (browser tab, other devices) ---------- */
.gate { min-height: 100dvh; align-items: center; justify-content: center; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
.gate-card { width: min(460px, 100%); text-align: center; }
.gate-card h1 { font-size: clamp(40px, 11vw, 56px); line-height: 1; margin: 0 0 14px; }
.gate-card > p { color: var(--muted); font-size: 18px; margin: 0 0 18px; }
.gate-card > p.small { font-size: 15px; }
.gate-card .btn { margin-top: 6px; }
.gate-icon { width: 84px; height: 84px; border-radius: 19px; display: block; margin: 0 auto 18px; box-shadow: 0 10px 30px var(--shadow); }
.back-link { color: var(--muted); font-size: 15px; }
.gate .eq { margin-bottom: 18px; }

/* ---------- Landscape only ---------- */
.rotate { display: none; }
@media (orientation: portrait) {
  html:not(.allow-portrait) .rotate {
    position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px;
  }
  .rotate b { font-family: 'Cormorant SC', serif; font-size: 30px; line-height: 1.1; }
  .rotate span { color: var(--muted); font-size: 17px; }
}
.phone-turn { width: 46px; height: 78px; border: 3px solid var(--text); border-radius: 10px; position: relative; margin-bottom: 18px; animation: turn 2.4s ease-in-out infinite; }
.phone-turn i { position: absolute; left: 50%; bottom: 6px; width: 10px; height: 3px; border-radius: 2px; background: var(--text); transform: translateX(-50%); }
@keyframes turn { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }

/* ---------- App frame: safe areas (notch on the left or right in landscape) ---------- */
.app .screen { position: fixed; inset: 0; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); background: var(--bg); }
.app .screen.stories { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.app .tbar, .app .sbar { padding-left: 12px; padding-right: 12px; }
.app .sbar { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
.app .table { height: 100%; }

.btn.slim { height: 38px; padding: 0 12px; font-size: 15px; gap: 6px; flex: none; }
.btn.danger { color: var(--evt); border-color: color-mix(in srgb, var(--evt) 45%, var(--line)); }
.btn.danger:hover { border-color: var(--evt); }
.ask .btn.danger, .btn.danger.solid { background: var(--evt); border-color: var(--evt); color: var(--on-z); }
.btn svg { flex: none; }
.ico svg { flex: none; }
.app .grow { flex: 1; }
@media (max-width: 700px) { .btn.slim .long { display: none; } .btn.slim { padding: 0 10px; } }

/* ---------- Library ---------- */
.lib-wrap { padding: 14px 14px max(24px, env(safe-area-inset-bottom)); }
.lib-wrap .lead.small { font-size: 15px; margin: 0 0 12px; max-width: none; }
.lib-grid { display: block; }
.lib-h { font-family: inherit; font-weight: 600; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 4px 2px 8px; }
.lib-h ~ .lib-h { margin-top: 18px; }
.hello { display: grid; justify-items: start; gap: 2px; padding: 4px 2px 14px; }
.hello .eq { height: 34px; margin: 0 0 8px; gap: 5px; }
.hello .eq i { width: 8px; }
.hello h1 { font-size: 32px; margin: 0; line-height: 1; }
.hello .lead { font-size: 16px; margin: 4px 0 0; }

/* Stories: equal columns, equal heights, actions lined up at the bottom. */
.lib-stories { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.scard {
  --z: var(--accent);
  display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 12px; border-radius: 16px; min-width: 0; height: 100%;
  background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--z);
}
.scard h2 {
  font-size: 24px; line-height: 1.05; margin: 0; min-height: 2.1em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.scard .by { margin: -4px 0 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-rows: repeat(3, 20px); gap: 2px; counter-reset: c; flex: 1; align-content: start; }
.scard li { counter-increment: c; display: flex; gap: 9px; font-size: 14px; line-height: 20px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard li::before { content: counter(c); font-family: 'Cormorant SC', serif; font-weight: 700; color: var(--z); width: 10px; flex: none; text-align: right; }
.scard li.more { color: var(--muted); }
.scard li.more::before { content: ""; }
.scard .meta { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard .acts { display: grid; grid-template-columns: minmax(0, 1fr) 38px 38px 38px; gap: 6px; }
.scard .acts .btn { height: 38px; padding: 0 12px; font-size: 15px; gap: 6px; justify-content: center; }
.scard .acts .ico.small { width: 38px; height: 38px; color: var(--muted); }

/* The four ways to add a story: one row of identical tiles (two rows on a narrow screen). */
.lib-doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .lib-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ldoor {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; margin: 0;
  text-align: left; padding: 12px 14px; border-radius: 14px; height: 104px; min-width: 0;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.3;
}
.ldoor .di { color: var(--accent); display: grid; place-items: center; height: 22px; }
.ldoor b { font-family: 'Cormorant SC', serif; font-size: 20px; line-height: 1; color: var(--text); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ldoor > span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ldoor:active { transform: scale(.98); }
.ldoor.d-new { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.ldoor.d-recueil b { color: var(--accent); }
.ldoor.d-discovery .di { color: var(--amb); }
.ldoor.d-import .di { color: var(--blue); }
.ldoor .di svg { width: 20px; height: 20px; }

/* ---------- Editor ---------- */
.ed { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.ed .tbar { gap: 6px; }
.ed-title {
  flex: 1; min-width: 0; font-family: 'Cormorant SC', serif !important; font-weight: 700; font-size: 22px !important; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 3px 8px; height: 40px;
}
.ed-title:focus { outline: none; border-color: var(--accent); background: var(--card); }
.saved { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }
.ed-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 0; }
.ed-body .rail { border-right: 1px solid var(--line); background: var(--bar); padding: 8px 8px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.ed-body .rail .chap:not(.sbchap) {
  position: relative; padding: 8px 8px 6px; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto;
  grid-template-areas: "n title title" "n cnt mv"; column-gap: 8px; row-gap: 2px; align-items: center;
}
/* Chapter names wrap fully in the editor rail; the move arrows sit on the sound count line. */
.ed-body .rail .chap:not(.sbchap) .n { grid-area: n; align-self: start; padding-top: 2px; }
.ed-body .rail .chap:not(.sbchap) .t { display: contents; }
.ed-body .rail .chap:not(.sbchap) .t > span:first-child {
  grid-area: title; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ed-body .rail .chap:not(.sbchap) .cnt { grid-area: cnt; margin: 0; }
.ed-body .rail .chap .mv { grid-area: mv; display: none; flex-direction: row; gap: 2px; }
.ed-body .rail .chap[aria-current="true"] .mv { display: flex; }
.ed-body .mv button { width: 30px; height: 26px; }
.ed-body .add-chap { height: 38px; margin: 4px 0 6px; font-size: 14px; }
.sbchap { border-top: 1px solid var(--line) !important; border-radius: 0 0 10px 10px !important; margin-top: 2px; }
.sbchap[aria-current="true"] { border-radius: 10px !important; }
.sbchap .n { color: var(--accent); width: 16px; }
.ed-body .editor { overflow-y: auto; padding: 10px 12px max(20px, env(safe-area-inset-bottom)); gap: 10px; }
.ed-top .chap-title { font-size: 21px !important; height: 40px; }
.ed-top .del { height: 40px; }
.ed-h { margin: 0; font-size: 24px; }
.star-n { display: grid; place-items: center; }
.ed-note { margin: -4px 0 0; }
.ed .zrow { flex: 0 0 auto; }
.ed .zl { min-height: 96px; }
.ed .dz { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); min-height: 96px; padding: 6px; gap: 6px; }
.ed .dz .hint { min-height: 44px; }
.sc { cursor: default; }
.sc input { font-size: 16px; padding: 3px 4px; }
.sc .pb { width: 34px; height: 34px; }
.sc .x { width: 32px; height: 32px; }
.mvh { display: flex; gap: 0; }
.mvh button { width: 28px; height: 30px; border: 0; background: transparent; color: var(--muted); padding: 0; display: grid; place-items: center; border-radius: 6px; }
.mvh button:disabled { opacity: .3; }
.sc .loop { height: 30px; min-width: 38px; }

/* shared soundbox screen */
#shared-list .dz { --z: var(--accent); grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* ---------- Mixing table on iPhone ---------- */
.table .tbar { padding-top: 4px; padding-bottom: 4px; }
.pad-g { grid-column: 1 / -1; margin: 6px 2px 0; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.pad-g:first-child { margin-top: 0; }
.pad { min-height: 64px; }
.soundbox { padding-right: env(safe-area-inset-right); }
.pads { padding-bottom: max(8px, env(safe-area-inset-bottom)); }

/* ---------- Dialogs ---------- */
.app dialog.settings { max-height: calc(100dvh - 16px); width: min(560px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))); overscroll-behavior: contain; }
.set-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.set-acts .btn, .set-acts a.btn { height: 42px; }
.store-info p { margin: 0 0 6px; font-size: 15px; }
.store-line b { color: var(--text); font-weight: 600; }
.store-prot.ok { color: var(--amb); }
.store-prot.warn { color: var(--evt); }
.small { font-size: 13px; }
.warn { color: var(--evt); }
.about a { color: var(--accent); }
.bard input { font-size: 16px !important; }

.sheet { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet #sheet-body > p { margin: 0 0 10px; }
.sheet .field { margin-bottom: 10px; }
.sheet textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; resize: none; }
.sheet textarea:focus { outline: none; border-color: var(--accent); }
.rlist { display: grid; gap: 8px; }
.rrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.rt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rt b { font-family: 'Cormorant SC', serif; font-size: 22px; line-height: 1.05; }
.rt small { color: var(--muted); font-size: 13px; }
.rt p { margin: 2px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rrow .btn { height: 40px; flex: none; }

.pick-top { display: flex; align-items: center; gap: 14px; }
.pick-top p { margin: 0; flex: 1; }
.picker .big-pick { justify-content: center; height: 46px; flex: none; }
@media (max-width: 520px) { .pick-top { flex-direction: column; align-items: stretch; } }
.pick-h { margin: 16px 0 8px !important; }
.pick-q { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; -webkit-appearance: none; }
.pick-q:focus { outline: none; border-color: var(--accent); }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.pick-row > i { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.pick-row input:checked + i { background: var(--accent); border-color: var(--accent); }
.pick-row input:checked + i::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--on-z); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.pt { flex: 1; min-width: 0; display: grid; }
.pt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-bar { position: sticky; bottom: -18px; display: flex; justify-content: flex-end; padding: 10px 0 0; background: var(--bar); }

.ask { width: min(440px, calc(100vw - 32px)) !important; padding: 18px 20px 16px !important; }
.ask h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.1; }
.ask p { margin: 0 0 14px; color: var(--muted); }
.ask-input { width: 100%; font: inherit; font-size: 17px !important; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin: 0 0 14px; }
.ask-input:focus { outline: none; border-color: var(--accent); }
.ask-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ask-acts .btn { height: 42px; }

.app .veil { z-index: 60; }
.app .forge .eq { height: 40px; margin: 0 0 8px; }
.app .forge .eq i { width: 9px; }
.app .toast { bottom: max(14px, env(safe-area-inset-bottom)); z-index: 70; max-width: calc(100vw - 40px); text-align: center; }
.fatal { position: fixed; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--evt); background: var(--bg); margin: 0; z-index: 200; }

@media (prefers-reduced-motion: reduce) { .phone-turn { animation: none; } }

/* ---------- Install page ---------- */
.gate-install { align-items: flex-start; padding-bottom: 110px; }
.inst { text-align: left; }
.inst-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.inst-hero .gate-icon { width: 72px; height: 72px; border-radius: 16px; margin: 0; flex: none; }
.inst-hero .kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: 3px; }
.inst h1 { font-size: 28px; line-height: 1.02; margin: 0; }
.inst-key {
  margin: 0 0 18px !important; padding: 12px 14px; border-radius: 14px; font-size: 16px !important; line-height: 1.4;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); color: var(--muted);
}
.inst-key b { color: var(--accent); }
.inst-inapp { padding: 14px; border-radius: 14px; border: 1px solid var(--evt); background: color-mix(in srgb, var(--evt) 10%, var(--card)); margin: 0 0 18px; }
.inst-inapp p { margin: 0 0 8px; color: var(--muted); }
.inst-inapp b { color: var(--text); }
html.in-app-browser .isteps { opacity: .45; }
html.arrow-top .gate-install { padding-top: max(64px, env(safe-area-inset-top)); }

.isteps { list-style: none; counter-reset: s; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.isteps li {
  counter-increment: s; display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.itxt { display: grid; gap: 3px; font-size: 14px; color: var(--muted); line-height: 1.35; }
.itxt > b { font-size: 16px; color: var(--text); font-weight: 600; }
.itxt > b::before { content: counter(s) ". "; font-family: 'Cormorant SC', serif; font-weight: 700; color: var(--accent); font-size: 19px; }
.itxt span b { color: var(--text); font-weight: 600; }

/* Little drawings of what the person will see. */
.mock { height: 84px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line); position: relative; overflow: hidden; font-size: 9px; color: var(--muted); }
.m-bar { display: flex; align-items: flex-end; }
.m-bar::before { content: ""; position: absolute; inset: 10px 10px 34px; border-radius: 6px; background: repeating-linear-gradient(180deg, var(--line) 0 4px, transparent 4px 10px); opacity: .5; }
.m-bar .m-dot { display: none; }
.m-bar .m-url { position: absolute; left: 8px; right: 34px; bottom: 7px; height: 20px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; font-size: 8px; }
.m-btn {
  position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 30%, transparent); animation: ping 1.6s ease-out infinite;
}
.m-btn:not(.dots) { background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 22' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 13V1.5M5 5l4-4 4 4'/%3E%3Cpath d='M5.5 8.5H3a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 3 20.5h12a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 15 8.5h-2.5'/%3E%3C/svg%3E") center / 11px 13px no-repeat; }
.m-btn svg { width: 12px; height: 12px; }
.m-bar.top::before { inset: 34px 10px 10px; }
.m-bar.top .m-url { top: 7px; bottom: auto; }
.m-bar.top .m-btn { top: 6px; bottom: auto; }
@keyframes ping { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--blue) 0%, transparent); } }

.m-sheet { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 6px; }
.m-sheet span { height: 22px; border-radius: 6px; background: var(--card); display: flex; align-items: center; padding: 0 7px; white-space: nowrap; }
.m-sheet span.hl { color: var(--text); font-weight: 600; font-size: 9px; outline: 2px solid var(--blue); gap: 5px; }
.m-plus { width: 11px; height: 11px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; flex: none; }
.m-plus::before, .m-plus::after { content: ""; position: absolute; left: 50%; top: 50%; background: currentColor; transform: translate(-50%, -50%); }
.m-plus::before { width: 6px; height: 1.5px; }
.m-plus::after { width: 1.5px; height: 6px; }

.m-add { display: flex; flex-direction: column; gap: 6px; padding: 7px 8px; }
.m-top { display: flex; justify-content: space-between; }
.m-top i { font-style: normal; color: var(--blue); }
.m-top em { font-style: normal; color: #fff; background: var(--blue); border-radius: 8px; padding: 1px 7px; font-weight: 600; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }
.m-name { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 11px; font-weight: 600; }
.m-name img { width: 22px; height: 22px; border-radius: 5px; }
.m-toggle { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 6px; padding: 4px 6px; }
.m-toggle i { width: 20px; height: 12px; border-radius: 6px; background: #34C759; position: relative; }
.m-toggle i::after { content: ""; position: absolute; right: 1px; top: 1px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }

.m-home { display: grid; grid-template-columns: repeat(4, 20px); gap: 8px 9px; justify-content: center; align-content: center; background: linear-gradient(160deg, color-mix(in srgb, var(--blue) 25%, var(--bg)), var(--bg)); }
.m-home i { width: 20px; height: 20px; border-radius: 5px; background: var(--line); opacity: .7; }
.m-home img { width: 20px; height: 20px; border-radius: 5px; box-shadow: 0 0 0 2px var(--accent); animation: tap 1.6s ease-in-out infinite; }
@keyframes tap { 50% { transform: scale(.85); } }

/* The arrow at the edge of the screen, pointing at the browser button to tap first. */
.to-share { position: fixed; z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 0; color: var(--blue); font-weight: 600; font-size: 14px; pointer-events: none; }
.to-share span { background: var(--blue); color: #fff; border-radius: 999px; padding: 4px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.to-share i { width: 16px; height: 16px; margin-top: -4px; border-right: 4px solid currentColor; border-bottom: 4px solid currentColor; transform: rotate(45deg); }
.to-share.at-top-right i { margin: 0 0 -4px; }
.to-share.at-bottom-center { left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); animation: nudge-c 1.4s ease-in-out infinite; }
.to-share.at-bottom-right { right: 14px; bottom: max(8px, env(safe-area-inset-bottom)); animation: nudge 1.4s ease-in-out infinite; }
.to-share.at-top-right { right: 14px; top: max(8px, env(safe-area-inset-top)); flex-direction: column-reverse; animation: nudge-up 1.4s ease-in-out infinite; }
.to-share.at-top-right i { transform: rotate(-135deg); }
.to-share.at-bottom-center { transform: translateX(-50%); }
@keyframes nudge-c { 50% { transform: translate(-50%, 8px); } }
@keyframes nudge { 50% { transform: translateY(8px); } }
@keyframes nudge-up { 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .to-share, .m-btn, .m-home img { animation: none !important; } }
@media (max-width: 360px) { .isteps li { grid-template-columns: 104px minmax(0, 1fr); } }

/* ---------- Volume sliders: a big touch area, no page scroll while dragging ---------- */
html.mode-app input[type="range"] { touch-action: none; height: 36px; cursor: pointer; }
html.mode-app input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; }
html.mode-app input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8px; transition: transform .1s; }
html.mode-app input[type="range"].dragging::-webkit-slider-thumb { transform: scale(1.15); }

/* ---------- Opening animation ---------- */
.splash {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; overflow: hidden;
  background: #0F0F13; transition: opacity .5s ease;
}
.splash.sp-out { opacity: 0; pointer-events: none; }

.sp-stage { position: relative; perspective: 900px; display: grid; place-items: center; }

/* The word: white, raised in relief (a carved golden edge under each letter), keeping its own font. */
.sp-word {
  position: relative; display: block; font-family: 'Cormorant SC', serif; font-weight: 700; font-size: 100px;
  line-height: 1; letter-spacing: .03em; white-space: nowrap; color: #F7F3EA;
  transform-origin: 50% 80%; opacity: 0; transform: rotateX(28deg) translateY(.12em);
  text-shadow:
    0 .010em 0 #E9DEC4, 0 .020em 0 #DCC79A, 0 .030em 0 #CCAE72, 0 .040em 0 #B8954F,
    0 .050em 0 #9E7B3A, 0 .060em 0 #81622C, 0 .070em 0 #634A20,
    0 .12em .10em rgba(0, 0, 0, .55), 0 .22em .30em rgba(0, 0, 0, .35);
}
/* Gold rising from below over the white face of the letters. */
.sp-word::before, .sp-word::after {
  content: attr(data-text); position: absolute; inset: 0; text-shadow: none; pointer-events: none;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sp-word::before {
  background-image: linear-gradient(0deg, #F2C66A 0%, #E7B355 22%, rgba(247, 230, 190, .85) 48%, rgba(247, 243, 234, 0) 72%);
  background-size: 100% 220%; background-position: 50% 0%; opacity: 0;
}
/* The golden glint that sweeps across the word. */
.sp-word::after {
  background-image: linear-gradient(105deg, rgba(255, 255, 255, 0) 38%, rgba(255, 236, 180, .95) 47%, #FFFFFF 50%, rgba(255, 220, 140, .9) 53%, rgba(255, 255, 255, 0) 62%);
  background-size: 260% 100%; background-position: 130% 0; opacity: 0;
}

/* Timeline: the word rises (0 to .8 s), the gold climbs the letters (.6 s), the glint sweeps (1.1 s);
   from 1.95 s the gold and the relief melt away, leaving a pure, bright white Bardic on obsidian. */
.sp-go .sp-word { animation: sp-rise .8s cubic-bezier(.2, .8, .2, 1) forwards, sp-pure .85s ease-in-out 1.95s forwards; }
.sp-go .sp-word::before { animation: sp-gold 1.35s ease-out .6s forwards, sp-ungild .75s ease-in-out 1.95s forwards; }
.sp-go .sp-word::after { animation: sp-glint .8s ease-in-out 1.1s forwards; }

@keyframes sp-rise {
  0% { opacity: 0; transform: rotateX(28deg) translateY(.12em); }
  100% { opacity: 1; transform: rotateX(12deg) translateY(0); }
}
@keyframes sp-pure {
  0% {
    opacity: 1; transform: rotateX(12deg); color: #F7F3EA;
    text-shadow:
      0 .010em 0 #E9DEC4, 0 .020em 0 #DCC79A, 0 .030em 0 #CCAE72, 0 .040em 0 #B8954F,
      0 .050em 0 #9E7B3A, 0 .060em 0 #81622C, 0 .070em 0 #634A20,
      0 .12em .10em rgba(0, 0, 0, .55), 0 .22em .30em rgba(255, 255, 255, 0);
  }
  100% {
    opacity: 1; transform: rotateX(0deg); color: #FFFFFF;
    text-shadow:
      0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(255, 255, 255, 0),
      0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(255, 255, 255, 0),
      0 0 .06em rgba(255, 255, 255, .55), 0 0 .35em rgba(255, 255, 255, .22);
  }
}
@keyframes sp-gold {
  0% { opacity: 0; background-position: 50% 0%; }
  25% { opacity: 1; background-position: 50% 70%; }
  100% { opacity: .9; background-position: 50% 45%; }
}
@keyframes sp-ungild {
  0% { opacity: .9; background-position: 50% 45%; }
  100% { opacity: 0; background-position: 50% 0%; }
}
@keyframes sp-glint {
  0% { opacity: 1; background-position: 130% 0; }
  100% { opacity: 1; background-position: -30% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-go .sp-word { animation: none; opacity: 1; transform: none; color: #FFFFFF; text-shadow: 0 0 .06em rgba(255, 255, 255, .55), 0 0 .35em rgba(255, 255, 255, .22); }
  .sp-go .sp-word::before, .sp-go .sp-word::after { animation: none; opacity: 0; }
}

/* A story imported by an older version, whose sounds need loading again. */
.scard.damaged { border-top-color: var(--evt); }
.scard.damaged .meta::after { content: "Its sounds all play the first one. Repair them to play this story."; display: block; white-space: normal; color: var(--evt); margin-top: 4px; }
.scard .btn.repair { height: 38px; justify-content: center; background: var(--evt); border-color: var(--evt); color: var(--on-z); }

/* ---------- Editor: default volume of each sound ---------- */
.sc .edvol { display: flex; align-items: center; gap: 8px; }
.sc .edvol .vl { font-size: 12px; color: var(--muted); }
.sc .edvol input[type="range"] { flex: 1; height: 28px; }
.sc .edvol .vp { width: 28px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-note { margin: -4px 0 6px; }

/* ---------- Upright phone (Lock landscape off) ---------- */
@media (orientation: portrait) and (max-width: 700px) {
  html.allow-portrait .ed-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  html.allow-portrait .ed-body .rail { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; }
  html.allow-portrait .ed-body .rail h3 { display: none; }
  html.allow-portrait .ed-body .rail .chap:not(.sbchap) { width: auto; flex: none; max-width: 70vw; grid-template-areas: "n title mv"; grid-template-columns: 16px auto auto; }
  html.allow-portrait .ed-body .rail .chap:not(.sbchap) .cnt { display: none; }
  html.allow-portrait .ed-body .rail .chap:not(.sbchap) .t > span:first-child { -webkit-line-clamp: 1; white-space: nowrap; }
  html.allow-portrait .ed-body .add-chap, html.allow-portrait .ed-body .sbchap { width: auto; flex: none; margin: 0; }
  html.allow-portrait .ed .dz { grid-template-columns: minmax(0, 1fr); }
  html.allow-portrait .lib-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.allow-portrait .sbar .tabs a { padding: 0 8px; }
}

#m-sheet-hl { font-style: normal; }
.inst-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 16px; }
