/* Bardic web edition. Same palettes and shapes as the Android app (Theme.kt) and the project page. */

/* ---------- Themes: 4 families × dark / light ---------- */
:root, [data-theme="obsidian"][data-mode="dark"] {
  --bg:#0F0F13; --bar:#15151B; --card:#1C1C24; --line:#2E2E39; --text:#ECE8DE; --muted:#A29FAE; --accent:#E0A84B;
  --music:#E0A84B; --amb:#4FB3A5; --evt:#E06A63; --blue:#2F8BFF; --on-z:#0F0F13; --shadow:rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-mode="dark"] { --music:#E0A84B; --amb:#4FB3A5; --evt:#E06A63; --blue:#2F8BFF; --shadow:rgba(0,0,0,.45); color-scheme: dark; }
[data-theme="parchment"][data-mode="dark"]  { --bg:#1E1912; --bar:#251F16; --card:#30281D; --line:#4A3D2B; --text:#F1E6CF; --muted:#BBA987; --accent:#E0B062; --on-z:#1E1912; }
[data-theme="blood"][data-mode="dark"]      { --bg:#140B0C; --bar:#1A0E10; --card:#261517; --line:#43242A; --text:#F2E4E2; --muted:#B79A9D; --accent:#F0606A; --on-z:#140B0C; }
[data-theme="divination"][data-mode="dark"] { --bg:#0B1020; --bar:#0F1529; --card:#18213D; --line:#2B3762; --text:#E6E9F8; --muted:#9EA6C8; --accent:#C9A7F5; --on-z:#0B1020; }

[data-mode="light"] {
  --music:#B37714; --amb:#1F857A; --evt:#C2443D; --blue:#1F6FE0; --on-z:#FFFFFF; --shadow:rgba(40,30,20,.16);
  color-scheme: light;
}
[data-theme="obsidian"][data-mode="light"]   { --bg:#F2F1F4; --bar:#FBFBFC; --card:#FFFFFF; --line:#DAD8E0; --text:#1A1A22; --muted:#6B6878; --accent:#B37714; }
[data-theme="parchment"][data-mode="light"]  { --bg:#F3EAD7; --bar:#EDE1C8; --card:#FBF5E8; --line:#D9C7A3; --text:#2E2416; --muted:#7A6A4E; --accent:#A06A16; }
[data-theme="blood"][data-mode="light"]      { --bg:#F7EDED; --bar:#F0E1E1; --card:#FFF9F9; --line:#E2C6CA; --text:#2A1416; --muted:#84636A; --accent:#B3303B; }
[data-theme="divination"][data-mode="light"] { --bg:#ECEFFA; --bar:#E3E8F7; --card:#FAFBFF; --line:#CBD2EE; --text:#141A33; --muted:#5D6590; --accent:#7450C2; }

/* ---------- Limited editions, offered until 31 December 2026 (themes.js). One look in dark and light. ---------- */
[data-theme="pumpkin"][data-mode]    { --bg:#120C08; --bar:#1A110B; --card:#24170F; --line:#46301E; --text:#F6E7D4; --muted:#BC9F84; --accent:#FF8A1E; --music:#FF8A1E; --amb:#8BD450; --evt:#B66BF0; --blue:#FFB347; --on-z:#120C08; --shadow:rgba(0,0,0,.5); color-scheme: dark; }
[data-theme="santa"][data-mode]      { --bg:#0B1811; --bar:#0F1F16; --card:#16291E; --line:#2A4634; --text:#F5F2EA; --muted:#A9BCAE; --accent:#E6B84E; --music:#E6B84E; --amb:#A9DCF0; --evt:#E5484D; --blue:#A9DCF0; --on-z:#0B1811; --shadow:rgba(0,0,0,.5); color-scheme: dark; }
[data-theme="pride"][data-mode]      { --bg:#D9EFFB; --bar:#E9F6FD; --card:#FFFFFF; --line:#B5DAF0; --text:#13233A; --muted:#4D6985; --accent:#7A35D8; --music:#E8590C; --amb:#0B8F3E; --evt:#D61F69; --blue:#1F5FE0; --on-z:#FFFFFF; --shadow:rgba(30,60,90,.16); color-scheme: light; }
[data-theme="dragonfire"][data-mode] { --bg:#130705; --bar:#1B0A07; --card:#28110B; --line:#4E2315; --text:#F9E7D9; --muted:#C49C87; --accent:#FF5A1F; --music:#FFB238; --amb:#B9A397; --evt:#FF3B2F; --blue:#FFD166; --on-z:#130705; --shadow:rgba(0,0,0,.55); color-scheme: dark; }
[data-theme="abyss"][data-mode]      { --bg:#020A13; --bar:#05101C; --card:#0A192A; --line:#163049; --text:#DCF4F8; --muted:#7EA3B6; --accent:#2EE6D6; --music:#2EE6D6; --amb:#4C86FF; --evt:#C76BFF; --blue:#4C86FF; --on-z:#020A13; --shadow:rgba(0,0,0,.55); color-scheme: dark; }
[data-theme="excalibur"][data-mode]  { --bg:#0D1310; --bar:#121A15; --card:#1A241D; --line:#2F3E33; --text:#EEF2EC; --muted:#A3AFA4; --accent:#C8D7E2; --music:#DCC37A; --amb:#7FBF8E; --evt:#72A9DE; --blue:#72A9DE; --on-z:#0D1310; --shadow:rgba(0,0,0,.5); color-scheme: dark; }
/* Pride: the flag runs along the top bars. */
[data-theme="pride"] .sbar, [data-theme="pride"] .tbar { border-bottom: 4px solid transparent; border-image: linear-gradient(90deg, #E40303 0 16.6%, #FF8C00 0 33.3%, #FFED00 0 50%, #008026 0 66.6%, #004DFF 0 83.3%, #750787 0) 1; }

/* ---------- Computer or phone ---------- */
/* .pc is set on <html> for a mouse and a screen of at least 900 px: the Story builder and playing your own files live there. */
html:not(.pc) .pc-only { display: none !important; }
html.pc .phone-only { display: none !important; }
/* .iphone is set on <html> by the pages that offer Bardic for iPhone (docs/ios/), only on an iPhone. */
html:not(.iphone) .iphone-only { display: none !important; }
html.iphone .not-iphone { display: none !important; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.35 'Barlow Semi Condensed', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  transition: background-color .3s, color .3s;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, .logo, .ttl b { font-family: 'Cormorant SC', serif; font-weight: 700; letter-spacing: .4px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }
.grow { flex: 1; }

.ico {
  width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; padding: 0;
}
.ico.small { width: 34px; height: 34px; border-radius: 9px; }
.ico:hover { border-color: var(--muted); }

/* ---------- Stories screen ---------- */
.stories { min-height: 100%; }
.sbar {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 max(16px, env(safe-area-inset-left));
  background: var(--bar); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs a {
  height: 36px; padding: 0 12px; border-radius: 9px; display: inline-flex; align-items: center;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; border: 1px solid transparent;
}
.tabs a:hover { color: var(--text); background: var(--card); }
.tabs a[aria-current="page"] { color: var(--text); background: var(--card); border-color: var(--line); }
@media (max-width: 480px) { .tabs .long { display: none; } .tabs { margin-left: 2px; } }
@media (max-width: 560px) { .tabs a { padding: 0 8px; font-size: 14px; } .sbar .edition { display: none; } }
.logo { font-size: 24px; color: var(--text); text-decoration: none; }
.edition { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.stories-wrap { max-width: 1240px; margin: 0 auto; padding: 36px 20px 48px; }
.stories-wrap h1 { font-size: clamp(34px, 5vw, 52px); margin: 0 0 8px; line-height: 1.05; }
.lead { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 0 28px; }
.note { color: var(--muted); font-size: 15px; margin-top: 28px; }
.discover { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 28px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: -12px 0 24px; font-size: 15px; color: var(--muted); }
.discover p { margin: 0; }
.discover b { color: var(--text); font-weight: 600; }

.story-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.story {
  --z: var(--accent);
  display: flex; flex-direction: column; text-align: left; padding: 20px 20px 18px; gap: 12px;
  border-radius: 16px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--z);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.story:hover { transform: translateY(-2px); box-shadow: 0 12px 30px var(--shadow); border-color: var(--z); }
.story:nth-child(1) { --z: var(--amb); }
.story:nth-child(2) { --z: var(--evt); }
.story:nth-child(3) { --z: var(--blue); }
.story:nth-child(4) { --z: var(--music); }
.story h2 { font-size: 30px; margin: 0; line-height: 1; color: var(--text); }
.story p { margin: 0; color: var(--muted); }
.story ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: c; flex: 1; }
.story li { counter-increment: c; display: flex; gap: 10px; font-size: 15px; }
.story li::before { content: counter(c); font-family: 'Cormorant SC', serif; font-weight: 700; color: var(--z); width: 12px; flex: none; text-align: right; }
.story .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.story .open { height: 38px; padding: 0 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; display: inline-flex; align-items: center; }

/* ---------- Mixing table ---------- */
.table { height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
.tbar {
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: 7px max(12px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left));
  background: var(--bar); border-bottom: 1px solid var(--line); min-width: 0;
}
.ttl { flex: 1; min-width: 0; }
.ttl b, .ttl span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttl b { font-size: 20px; line-height: 1.1; }
.ttl span { font-size: 13px; color: var(--muted); }

.chip {
  height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex: none;
}
.chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.load-bar { width: 44px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; display: block; }
.load-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.load.done .load-bar { display: none; }
.mini { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; display: grid; place-items: center; padding: 0; color: var(--text); }
.mini:hover { background: var(--line); }
.master #master { width: 120px; --z: var(--text); }
.master b { width: 22px; text-align: right; }
.sb-toggle { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.sb-toggle[aria-pressed="true"] { background: var(--accent); color: var(--on-z); }
.star { display: grid; place-items: center; }

.body { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; min-height: 0; position: relative; }

/* Chapter rail */
.rail { border-right: 1px solid var(--line); background: var(--bar); padding: 12px 10px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.rail h3 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 4px 8px 6px; font-family: inherit; font-weight: 600; }
.chap {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.chap:hover { background: var(--card); color: var(--text); }
.chap[aria-current="true"] { background: var(--card); border-color: var(--line); color: var(--text); }
.chap .n { font-family: 'Cormorant SC', serif; font-weight: 700; font-size: 18px; line-height: 1; color: var(--accent); width: 12px; flex: none; padding-top: 1px; }
.chap .t { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; }
.chap .live { width: 8px; height: 8px; border-radius: 50%; background: var(--amb); margin-top: 6px; flex: none; visibility: hidden; animation: pulse 1.6s ease-in-out infinite; }
.chap.playing .live { visibility: visible; }
@keyframes pulse { 50% { opacity: .35; } }

/* Zones */
.zones { overflow: auto; padding: 10px 12px 16px 10px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.zrow { display: flex; gap: 8px; flex: 1 0 auto; }
.zl { width: 26px; flex: none; border-radius: 8px; background: var(--bar); display: flex; align-items: center; justify-content: center; border-left: 3px solid var(--z); min-height: 108px; }
.zl span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: 'Cormorant SC', serif; font-weight: 700; font-size: 13px; letter-spacing: 1.5px; color: var(--z); }
.cards { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 8px; align-content: start; }
.empty { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; color: var(--muted); font-size: 14px; display: flex; align-items: center; min-height: 108px; grid-column: 1 / -1; }

/* Sound card (SlotCard) */
.c {
  border-radius: 12px; background: var(--card); border: 1px solid var(--line); padding: 8px 10px;
  display: flex; flex-direction: column; gap: 7px; transition: border-color .15s, box-shadow .15s;
}
.c.on { border-color: var(--z); box-shadow: 0 0 0 1px var(--z) inset; }
.ch { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.ch b { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch small.warn { color: var(--evt); font-weight: 600; }
.loop {
  min-width: 34px; height: 24px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); background: transparent;
  font-size: 12px; font-weight: 600;
}
.loop.inf { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 50%, var(--line)); }
.loop.rnd { color: var(--evt); border-color: color-mix(in srgb, var(--evt) 55%, var(--line)); }
.loop svg { display: block; }
.track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; border-radius: 3px; }
.c.loading .track { background: linear-gradient(90deg, var(--line) 0 40%, var(--muted) 50%, var(--line) 60% 100%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; opacity: .6; }
@keyframes shimmer { to { background-position: -150% 0; } }
.ctrl { display: flex; align-items: center; gap: 6px; }
.pb {
  width: 38px; height: 38px; border-radius: 10px; background: var(--line); border: 1px solid var(--line);
  display: grid; place-items: center; padding: 0; color: var(--text); flex: none;
}
.c.on .pb.play { background: var(--z); border-color: var(--z); color: var(--on-z); }
.pb.end { background: transparent; }
.pb:disabled { color: var(--muted); cursor: default; opacity: .6; }
.c.err { opacity: .6; }

/* Range (volume) */
input[type="range"] {
  --z: var(--text); --p: 50%;
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 28px; background: transparent; margin: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--z) var(--p), var(--line) var(--p)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--z); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--z); margin-top: -6px; border: 2px solid var(--card); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--z); border: 2px solid var(--card); }

/* Soundbox */
.soundbox { width: 320px; border-left: 1px solid var(--line); background: var(--bar); display: flex; flex-direction: column; min-height: 0; }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 16px; }
.sb-head h2 { margin: 0; font-size: 22px; color: var(--accent); }
.sb-vol { display: flex; align-items: center; gap: 10px; padding: 0 16px; font-size: 13px; color: var(--muted); }
.sb-vol input { --z: var(--accent); }
.pads { flex: 1; overflow: auto; padding: 8px 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; }
.pad {
  position: relative; min-height: 72px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 10px 30px 10px 10px; text-align: left; font-weight: 600; font-size: 14px; line-height: 1.2; display: flex; align-items: flex-end;
  transition: transform .06s, border-color .15s;
}
.pad:active { transform: scale(.97); }
.pad .k { position: absolute; left: 10px; top: 8px; font-size: 11px; color: var(--muted); font-weight: 500; }
.pad .pin { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border: 0; background: transparent; color: var(--muted); padding: 0; display: grid; place-items: center; border-radius: 6px; }
.pad.pinned .pin { color: var(--accent); }
.pad.fire { animation: flash .5s ease-out; }
.pad:disabled { color: var(--muted); }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 35%, var(--card)); border-color: var(--accent); } }
.sb-hint { font-size: 12px; color: var(--muted); padding: 4px 16px 14px; margin: 0; }
.sb-empty { grid-column: 1 / -1; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: 12px; padding: 14px; }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.35); z-index: 3; }

/* ---------- Settings ---------- */
.settings {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0 20px 18px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--bar); color: var(--text); box-shadow: 0 30px 80px var(--shadow);
}
.settings::backdrop { background: rgba(0,0,0,.45); }
.set-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bar); padding: 16px 0 8px; margin: 0; z-index: 1; }
.set-head h2 { margin: 0; font-size: 26px; }
.settings section { padding: 12px 0; border-top: 1px solid var(--line); }
.settings h3 { font-family: inherit; font-weight: 600; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.themes { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: thin; }
.themes .theme { flex: 0 0 108px; scroll-snap-align: start; }
.theme .swatch { position: relative; }
.theme.special .medal { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF4C2 0 18%, #F6C945 40%, #B8860B 100%); border: 1px solid #8A6410;
  box-shadow: 0 0 8px 2px rgba(246, 201, 69, .75); animation: medal-glow 2.4s ease-in-out infinite; }
.theme.special .medal::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #7A5408; line-height: 1; }
@keyframes medal-glow { 50% { box-shadow: 0 0 14px 4px rgba(246, 201, 69, .95); } }
@media (prefers-reduced-motion: reduce) { .theme.special .medal { animation: none; } }
.theme-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.theme {
  border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--card); display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px;
}
.theme[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.swatch { height: 44px; border-radius: 8px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 6px; border: 1px solid rgba(127,127,127,.25); }
.swatch i { display: block; height: 4px; border-radius: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; background: var(--card); flex: none; }
.seg button { border: 0; background: transparent; border-radius: 7px; height: 32px; padding: 0 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--text); color: var(--bg); }
.seg.small button { padding: 0 10px; height: 28px; font-size: 14px; }
.row-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.row-set small { display: block; color: var(--muted); font-size: 13px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; flex: none; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--card); }
.stepper button { width: 34px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 20px; line-height: 1; font-weight: 600; }
.stepper button:disabled { opacity: .35; }
.stepper b { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toggle { cursor: pointer; }
.bard input { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; width: 180px; min-width: 0; }
.bard input:focus { outline: none; border-color: var(--accent); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(18px); background: var(--on-z); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.about p { margin: 0 0 8px; font-size: 14px; }
.keys { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; font-size: 14px; }
.muted { color: var(--muted); }
kbd { font: 600 12px/1 ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 5px; background: var(--card); }

/* ---------- Responsive ---------- */
/* Medium: soundbox becomes a drawer over the table */
@media (max-width: 1180px) {
  .soundbox { position: absolute; right: 0; top: 0; bottom: 0; z-index: 4; box-shadow: -20px 0 50px var(--shadow); }
}
/* Narrow: chapters move to a strip above the zones */
@media (max-width: 900px) {
  .body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; overflow-x: auto; overflow-y: hidden; gap: 4px; scrollbar-width: none; }
  .rail h3 { display: none; }
  .chap { width: auto; flex: none; padding: 6px 10px; align-items: center; }
  .chap .t { white-space: nowrap; font-size: 14px; }
  .chap .n { font-size: 16px; }
  .chap .live { margin-top: 0; }
  .mlabel, .master b, .load > span { display: none; }
  .master #master { width: 80px; }
}
/* Phone (portrait or small landscape): compact top bar, rows scroll sideways like the app */
@media (max-width: 640px), (max-height: 520px) {
  .tbar { gap: 6px; }
  .ttl b { font-size: 17px; }
  .sb-label { display: none; }
  .load-bar { display: none; }
  .cards { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 2px; scrollbar-width: thin; }
  .c { width: 228px; flex: none; scroll-snap-align: start; align-self: flex-start; }
  .empty { flex: 1; min-height: 96px; }
  .zl { min-height: 96px; }
  .soundbox { width: min(320px, 88vw); }
}
/* Short landscape phones: three rows fit on one screen, like the app */
@media (max-height: 520px) {
  .tbar { min-height: 50px; padding-top: 4px; padding-bottom: 4px; }
  .ico, .chip { height: 38px; }
  .ico { width: 38px; }
  .rail { padding: 4px 8px; }
  .chap { padding: 4px 10px; }
  .zones { padding: 6px 8px 8px; gap: 6px; }
  .c { padding: 6px 9px; gap: 5px; }
  .ch { min-height: 22px; }
  .pb { width: 32px; height: 32px; border-radius: 9px; }
  .zl, .empty { min-height: 84px; }
  .empty { padding: 10px; }
}
@media (max-width: 480px) {
  .master #master { display: none; }
  .ttl span { display: none; }
  .load.done { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* opening animation: the three Bardic bars playing */
.eq { display: flex; align-items: flex-end; justify-content: center; gap: 7px; height: 56px; margin: 6px 0 14px; }
.eq i { width: 12px; border-radius: 6px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(1) { background: var(--music); height: 60%; animation-delay: -.2s; }
.eq i:nth-child(2) { background: var(--amb); height: 100%; animation-delay: -.55s; }
.eq i:nth-child(3) { background: var(--evt); height: 75%; animation-delay: -.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.eq i { transform-origin: bottom; }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; } }

/* ---------- More tales + Play a tale ---------- */
.more-tales {
  display: grid; gap: 4px; margin-top: 18px; padding: 18px 20px; border-radius: 16px; text-decoration: none; color: var(--muted);
  border: 1px dashed var(--line); background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%);
  transition: border-color .2s, transform .2s;
}
.more-tales:hover { border-color: var(--accent); transform: translateY(-2px); }
.more-tales .kick { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.more-tales b { font-family: 'Cormorant SC', serif; font-size: 28px; color: var(--text); line-height: 1.1; }
.import-wrap { max-width: 760px; }
.kicker { font-size: 14px; letter-spacing: 4px; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0 0 8px; }
.dropbig {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; cursor: pointer;
  min-height: 260px; border: 2px dashed var(--line); border-radius: 18px; padding: 28px; background: var(--card); transition: border-color .15s, background .15s;
}
.dropbig:hover, .dropbig.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.dropbig b { font-family: 'Cormorant SC', serif; font-size: 30px; color: var(--text); }
.dropbig > span { color: var(--muted); }
.dropbig .eq { margin: 0 0 6px; }
.dropbig:not(.busy) .eq i { animation-play-state: paused; }
.dropbig .bar { display: block; width: min(360px, 80%); height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.dropbig .bar[hidden] { display: none; }
.dropbig .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.dropbig.err > span#drop-sub { color: var(--evt); }
.btn-link { color: var(--accent); font-weight: 600; }

/* ---------- Table cards: volume modes (Settings), narrow cards, rolling titles. Shared with the iPhone app. ---------- */
/* Card width per row, from the volume mode chosen in Settings. */
.zrow { --cw: 228px; }
.zrow.vm-hidden { --cw: 148px; }
.zrow.vm-simple { --cw: 196px; }
.table .cards, .cards { grid-template-columns: repeat(auto-fill, var(--cw, 232px)); }
@media (max-width: 640px), (max-height: 520px) {
  .table .c { width: var(--cw, 228px); }
}
.c .ch { gap: 5px; }
.c .nm { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: clip; font-weight: 600; font-size: 15px; }
.c .nm > span { display: inline-block; }
/* A title too long for its card rolls back and forth inside it. */
.c .nm.roll { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%); }
.c .nm.roll > span { padding: 0 4px; animation: roll var(--rd, 5s) ease-in-out infinite alternate; }
@keyframes roll { 0%, 18% { transform: translateX(0); } 82%, 100% { transform: translateX(var(--roll, 0)); } }
@media (prefers-reduced-motion: reduce) { .c .nm.roll > span { animation: none; } }
.c.vm-hidden .ctrl small { flex: 1; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c.vm-hidden .ctrl small.warn { color: var(--evt); font-weight: 600; }
.c.vm-simple .ctrl { gap: 4px; }
.c .vb {
  width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: transparent;
  display: grid; place-items: center; padding: 0; color: var(--text);
}
.c .vb:active { background: var(--line); }
.c .lvl { flex: 1; min-width: 26px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.c .lvl.moving { color: var(--z); }

.set-note { margin: -4px 0 6px; font-size: 13px; }
