/* Family app (Spieganzoni): clean and modern, for kids and teens on a shared tablet. Light and dark. */
:root {
  --bg: #f4f4f7; --card: #ffffff; --ink: #16161d; --muted: #6b6b78; --line: #e3e3ea; --soft: #ececf2;
  --accent: #5b4cf0; --accent-ink: #ffffff; --accent-soft: #ebe8ff; --pink: #ff5c7a; --ok: #1f9d6b; --warn: #f5a524;
  --mark: #fff1c2; --mark-line: #f5a524;
  --top: #16161d; --top-ink: #ffffff;
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 4px 16px rgba(20, 20, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f14; --card: #1a1a22; --ink: #f2f2f7; --muted: #9a9aa8; --line: #2a2a35; --soft: #23232d;
    --accent: #8b7dff; --accent-soft: #2a2550; --mark: #3d3418; --mark-line: #f5a524; --top: #000000;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f14; --card: #1a1a22; --ink: #f2f2f7; --muted: #9a9aa8; --line: #2a2a35; --soft: #23232d;
  --accent: #8b7dff; --accent-soft: #2a2550; --mark: #3d3418; --mark-line: #f5a524; --top: #000000; --shadow: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: .3em 0 .5em; }
h2 { font-size: 1.1rem; margin: 0 0 .6em; }
.center { text-align: center; }
.muted, small { color: var(--muted); }

.fam-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--top); color: var(--top-ink); }
.fam-brand { font-weight: 800; letter-spacing: -.01em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.fam-brand::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), var(--pink)); }
.fam-me { text-decoration: none; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .95rem;
  padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.12); }
.fam-me .face { font-size: 1.2rem; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.15); }
.fam-main { max-width: 880px; margin: 0 auto; padding: 16px 16px 120px; }

.icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 22px; background: var(--accent-soft); flex: none; }
.fam-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; box-shadow: var(--shadow); }
.fam-stack { display: flex; flex-direction: column; gap: 14px; }
.fam-stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
input, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input.code { font-size: 1.8rem; letter-spacing: .3em; text-align: center; max-width: 300px; margin: 0 auto; font-variant-numeric: tabular-nums; }
.fam-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.fam-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fam-btn.big { min-height: 56px; padding: 12px 26px; }
.fam-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.fam-btn:disabled { opacity: .45; }
.fam-btn.recording { background: var(--pink); border-color: var(--pink); color: #fff; }
.fam-back { text-decoration: none; font-weight: 600; color: var(--muted); font-size: .95rem; }
.fam-ok, .fam-error { border-radius: 12px; padding: 12px 16px; font-weight: 600; }
.fam-ok { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }
.fam-error { background: color-mix(in srgb, var(--pink) 14%, var(--card)); color: var(--pink); }
.fam-phase { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.fam-bar { display: block; height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; margin-top: 8px; }
.fam-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--pink)); border-radius: 999px; }
.spin { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: .7; } }

/* who is here */
.faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.faces form { width: 150px; }
.face-btn { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.face-btn .face { font-size: 2.6rem; width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); }

/* home */
.hello { margin-bottom: 4px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius); text-decoration: none;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tile .txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tile b { font-size: 1.05rem; }
.tile small { font-size: .9rem; }
.tile::after { content: "›"; color: var(--muted); font-size: 1.6rem; }
.tile.main { grid-column: 1 / -1; background: linear-gradient(135deg, var(--accent), var(--pink)); border: 0; color: #fff; padding: 22px; }
.tile.main small, .tile.main::after { color: rgba(255,255,255,.85); }
.tile.main .icon { background: rgba(255,255,255,.2); }


/* lists */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); margin: 0 0 16px; }
.seg a { text-decoration: none; padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: .95rem; color: var(--muted); }
.seg a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 42vw), 1fr)); gap: 14px; }
.cover { display: flex; flex-direction: column; gap: 6px; }
.cover-link { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.cover .art { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: var(--soft); display: grid; place-items: center; font-size: 2rem; }
.cover b { font-size: .98rem; line-height: 1.3; }
.cover .meta { color: var(--muted); font-size: .85rem; }
.working { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.working a { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; box-shadow: var(--shadow); }
.working .what { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.working .what span { color: var(--muted); font-size: .95rem; }
.by { font-size: 1.2rem; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); }
.kind-tag { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }

/* one song */
.langs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); margin-bottom: 12px; }
.langs a { font-size: 1.4rem; text-decoration: none; padding: 2px 12px; border-radius: 9px; opacity: .55; }
.langs a.on { opacity: 1; background: var(--card); box-shadow: var(--shadow); }
.player { width: 100%; border-radius: var(--radius); background: #000; display: block; }
.reactions { display: flex; gap: 10px; margin: 12px 0 20px; }
.reactions button { font-size: 1.3rem; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.reactions button.on { border-color: var(--accent); background: var(--accent-soft); }
/* song text + comments, like a shared doc: text on the left, threads in the margin aligned to their lines */
.doc { display: block; }
.doc-text { position: relative; }
.doc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.lyrics { margin: 0; padding: 0; list-style: none; }
.lyrics li { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin: 1px -10px; border-radius: 8px;
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .12s; }
.lyrics li.gap { height: .8em; padding: 0; cursor: default; }
.lyrics li .l { flex: 1; }
.lyrics li:hover { background: var(--soft); }
.lyrics li:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lyrics li.has-comments { background: var(--mark); }
.lyrics li.has-comments.first { box-shadow: inset 3px 0 0 var(--mark-line); }
.lyrics li.lit { background: color-mix(in srgb, var(--mark-line) 35%, var(--mark)); }
.lyrics li.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.marker { flex: none; font-size: .78rem; font-weight: 700; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px; border: 0;
  background: var(--mark-line); color: #2b1d00; cursor: pointer; display: inline-grid; place-items: center; }
.add-comment { position: absolute; right: -6px; z-index: 3; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit;
  font-weight: 600; font-size: .95rem; white-space: nowrap; box-shadow: 0 4px 14px rgba(91, 76, 240, .35); cursor: pointer; }

.doc-rail { margin-top: 16px; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rail-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.count-pill { font-size: .8rem; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.rail-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.empty { color: var(--muted); font-size: .95rem; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; }
.rail-anchored { position: relative; }
.thread { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, top .2s; }
.thread.active { border-color: var(--mark-line); box-shadow: 0 6px 20px rgba(20, 20, 40, .12); }
.thread.orphaned .t-quote { text-decoration: line-through; opacity: .7; }
.thread.resolved { opacity: .75; }
.t-quote { margin: 0 0 8px; padding: 4px 10px; border-left: 3px solid var(--mark-line); background: var(--mark); border-radius: 0 8px 8px 0;
  white-space: pre-line; font-size: .9rem; max-height: 5.4em; overflow: auto; }
.resolved-by { margin: 0 0 6px; font-size: .85rem; color: var(--ok); font-weight: 600; }
.msg { display: flex; gap: 10px; padding: 6px 0; }
.msg + .msg { border-top: 1px solid var(--line); }
.av { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: 1rem; }
.av.admin { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .85rem; }
.msg-body { flex: 1; min-width: 0; }
.meta { display: flex; align-items: baseline; gap: 8px; font-size: .88rem; }
.meta time { color: var(--muted); }
.meta form { margin-left: auto; }
.msg p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg audio { width: 100%; height: 36px; margin-top: 6px; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; }
.link.danger:hover { color: var(--pink); }
.reply { display: flex; gap: 8px; margin-top: 8px; }
.reply input { padding: 8px 12px; font-size: .95rem; }
.reply button { display: none; }
.reply:focus-within button, .reply.dirty button { display: inline-flex; }
.resolved summary { cursor: pointer; color: var(--muted); font-weight: 600; margin: 16px 0 8px; }
.fam-btn.small { min-height: 38px; padding: 6px 14px; font-size: .92rem; border-radius: 10px; }

/* composer: bottom sheet on tablets and phones, a card in the margin on wide screens */
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(0,0,0,.14);
  padding: 14px max(16px, calc((100vw - 880px) / 2)) max(14px, env(safe-area-inset-bottom)); }
.composer[hidden] { display: none; }
.composer-head { display: flex; align-items: center; gap: 8px; }
.composer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.composer-foot .grow { flex: 1; }
.composer-foot audio { height: 36px; max-width: 220px; }
.composer-error { margin: 0; color: var(--pink); font-weight: 600; font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 960px) {
  .fam-main { max-width: 1180px; }
  .doc { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; position: relative; }
  .doc-rail { margin-top: 0; }
  .thread.anchored { position: absolute; left: 0; right: 0; margin: 0; }
  .thread.anchored .t-quote { display: none; }
  .thread.anchored.active { transform: translateX(-12px); }
  .composer { position: absolute; left: auto; right: 0; bottom: auto; width: 360px; border: 1px solid var(--accent);
    border-radius: 12px; padding: 12px; box-shadow: 0 10px 30px rgba(20, 20, 40, .18); }
}
@media (prefers-reduced-motion: reduce) { .thread, .lyrics li { transition: none; } }

/* upload */
.hint { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.group { scroll-margin-top: 70px; }
.group.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
.group .title { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 4px; }
.group .title input { font-weight: 700; }
.group-n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .9rem; }
.photos { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo { position: relative; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: none; cursor: pointer; display: block; }
.photo:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo .n { position: absolute; left: 6px; top: 6px; background: var(--top); color: var(--top-ink); border-radius: 999px; min-width: 24px; padding: 0 6px; font-weight: 700; font-size: .8rem; line-height: 24px; }

/* loading images: shimmer, then fade in */
.img-wrap { display: block; position: relative; aspect-ratio: 3 / 4; background: var(--soft); overflow: hidden; }
.img-wrap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.55) 50%, transparent 80%);
  transform: translateX(-100%); animation: shimmer 1.2s infinite; }
@media (prefers-color-scheme: dark) { .img-wrap::after { background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.08) 50%, transparent 80%); } }
.img-wrap.loaded::after { display: none; }
.img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.img-wrap.loaded img { opacity: 1; }
.img-wrap.square { aspect-ratio: 1; border-radius: 14px; }
.img-wrap.big { aspect-ratio: auto; min-height: 50vh; border-radius: 12px; }
.img-wrap.big img { object-fit: contain; height: auto; max-height: 62vh; }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .img-wrap::after { animation: none; } }

/* sheet for one page: bottom sheet on phones, a centred card elsewhere */
.sheet-dialog { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); max-height: 92dvh; background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sheet-dialog::backdrop { background: rgba(10, 10, 20, .55); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px 12px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.sheet-head form { margin: 0; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--soft); color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.sheet-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.sheet-label { margin: 6px 0 0; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sheet-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-row .fam-btn { width: 100%; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-list form { margin: 0; }
.sheet-option { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.sheet-option small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; }
.sheet-option:hover { border-color: var(--accent); }
.sheet-option.new .group-n { background: var(--soft); color: var(--ink); }
@media (max-width: 600px) {
  .sheet-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 94dvh; }
  .sheet-body { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .img-wrap.big { min-height: 40vh; }
  .img-wrap.big img { max-height: 50vh; }
}
.fam-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-top: 8px; }
.picked { min-height: 1.4em; }

/* to do */
.todo-banner { display: flex; align-items: center; gap: 14px; padding: 18px 20px; margin: 0 0 18px; border-radius: var(--radius); text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--pink)); color: #fff; box-shadow: var(--shadow); }
.todo-banner .icon { background: rgba(255,255,255,.2); }
.todo-banner .txt { flex: 1; display: flex; flex-direction: column; }
.todo-banner b { font-size: 1.15rem; }
.todo-banner small { color: rgba(255,255,255,.9); }
.todo-banner::after { content: "›"; font-size: 1.8rem; opacity: .85; }
.list-title { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.review { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 18px; }
.review-item { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.review-item.done { background: color-mix(in srgb, var(--ok) 10%, var(--card)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.review-txt { flex: 1; min-width: 220px; display: flex; flex-direction: column; }
.review-txt span { color: var(--muted); font-size: .95rem; }
.done-check { font-size: 1.4rem; color: var(--ok); font-weight: 800; }

.problem-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.problem-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { font-weight: 600; margin-bottom: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: .95rem; }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.problem-tag { margin: 0 0 6px; font-size: .88rem; font-weight: 600; color: var(--pink); }

/* the admin looking as a child */
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 8px 16px; background: var(--warn); color: #2b1d00; font-size: .92rem; }
.preview-actions { display: flex; gap: 14px; font-weight: 700; }
.preview-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--top); color: var(--top-ink);
  padding: 10px 16px; border-radius: 12px; font-size: .95rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* search and filters */
.browse { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.search { position: relative; }
.search input { padding-left: 44px; min-height: 48px; background: var(--card); font-size: 1rem; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1rem; opacity: .6; }
.chips-row { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row .chip { flex: none; scroll-snap-align: start; }
.chips-row .chip span { min-height: 38px; padding: 6px 14px; }
.chips-label { flex: none; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.results-head a { font-weight: 600; color: var(--accent); }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.working li > .topics { padding: 8px 4px 0; }
.topic { font-size: .8rem; text-decoration: none; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.topic.subject { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topic:hover { color: var(--ink); }

/* photo tips (upload) */
.tips { margin: 0 0 16px; }
.tips h2 { margin-bottom: 10px; }
.tips-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: tip; }
.tips-list li { counter-increment: tip; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px 14px; box-shadow: var(--shadow); }
.tips-list li::before { content: counter(tip); position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.tips-list svg { width: 72px; height: 72px; margin-bottom: 4px; }
.tips-list b { font-size: .98rem; }
.tips-list span { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.tips-note { margin: 10px 2px 0; }
.tips svg .fill-soft { fill: var(--soft); }
.tips svg .fill-card { fill: var(--card); }
.tips svg .fill-ink { fill: var(--ink); }
.tips svg .fill-accent { fill: var(--accent); }
.tips svg .fill-warn { fill: var(--warn); }
.tips svg .stroke { stroke: var(--ink); stroke-width: 2; fill-opacity: 1; }
.tips svg .thin { stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.tips svg .stroke-white { stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.tips svg .stroke-accent { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.tips svg .stroke-warn { stroke: var(--warn); stroke-width: 2.5; stroke-linecap: round; fill: none; }
@media (max-width: 860px) { .tips-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------------------------------------
   Phones (and small tablets in portrait). Touch targets at least 44px (Apple HIG / WCAG 2.5.5),
   nothing wider than the screen, one column, primary actions full width and within thumb reach. */
.touch-only { display: none; }
@media (pointer: coarse) {
  .touch-only { display: inline; }
  .pointer-only { display: none; }
  .lyrics li { min-height: 44px; }
  .fam-btn.small, .langs a, .seg a, .fam-me { min-height: 44px; }
  .link { min-height: 44px; padding: 0 6px; }
  .fam-back { display: inline-flex; align-items: center; min-height: 44px; }
  .marker { min-height: 28px; min-width: 34px; }
  .chip span, .chips-row .chip span { min-height: 44px; }
  .topic { padding: 6px 11px; }
  .fam-brand { min-height: 44px; }
}
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  h1 { font-size: 1.4rem; }
  .fam-main { padding: 10px 14px 120px; }
  .fam-top { padding-left: 14px; padding-right: 14px; }
  .fam-card { padding: 14px; border-radius: 14px; }
  .tiles { grid-template-columns: 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .todo-banner { padding: 14px 16px; }
  .seg { display: flex; width: 100%; }
  .seg a { flex: 1; text-align: center; padding: 8px 6px; display: inline-flex; align-items: center; justify-content: center; }
  .langs { display: flex; width: 100%; }
  .langs a { flex: 1; text-align: center; }
  .player { border-radius: 12px; }
  .review-item { padding: 12px 14px; gap: 10px 12px; }
  .review-item > form, .review-item > form .fam-btn { width: 100%; }
  .review-txt { min-width: 0; flex-basis: calc(100% - 60px); }
  .problem-bar { justify-content: stretch; }
  .problem-bar .fam-btn { width: 100%; }
  .doc-head { flex-direction: column; gap: 2px; }
  .rail-head { flex-wrap: wrap; }
  .add-comment { position: fixed; top: auto !important; right: auto; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
    transform: translateX(-50%); height: 52px; padding: 0 22px; font-size: 1rem; }
  .composer { gap: 8px; max-height: 85dvh; overflow: auto; border-radius: 16px 16px 0 0; }
  .composer-foot audio { max-width: 100%; flex-basis: 100%; order: 5; }
  .composer-foot .fam-btn.primary { flex: 1; }
  .fam-actions { flex-direction: column; align-items: stretch; }
  .fam-actions .fam-btn, .fam-actions form, .fam-actions form .fam-btn { width: 100%; }
  .fam-stack .fam-btn.big { width: 100%; }
  .tips-list { gap: 8px; }
  .tips-list li { padding: 12px 8px 10px; }
  .tips-list svg { width: 56px; height: 56px; }
  .tips-list span { font-size: .82rem; }
  .working a { padding: 12px; gap: 12px; }
  .preview-bar { font-size: .85rem; padding: 8px 14px; }
  input.code { font-size: 1.5rem; letter-spacing: .2em; }
}
@media (max-width: 360px) {
  .fam-brand { font-size: .95rem; }
  .face-btn .face { width: 64px; height: 64px; font-size: 2.2rem; }
  .faces form { width: calc(50% - 7px); }
  .chip span { padding: 6px 10px; font-size: .9rem; }
}
