:root {
  --bg: #fff8e7;
  --ink: #3b2f2f;
  --card: #ffffff;
  --accent: #ff8fab;
  --accent-2: #4dabf7;
  --shadow: 0 6px 18px rgba(80, 50, 20, .15);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#app { height: 100%; display: flex; flex-direction: column; }

.top-right { display: flex; gap: 10px; align-items: center; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 6px; }
h1 { margin: 0; font-size: 1.9rem; letter-spacing: .5px; }
.tabs { display: flex; gap: 8px; padding: 10px 18px 14px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 12px 20px; font: inherit; font-weight: 600; background: #fff; color: var(--ink); box-shadow: var(--shadow); min-height: 48px; }
.tab.on { background: var(--accent); color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--accent); transform: scale(1.06); }
.panel h3 { margin: 14px 0 4px; font-size: 1rem; }
.tab.empty:not(.on) { opacity: .55; }
.soon { text-align: center; padding: 40px 20px; font-size: 1.2rem; opacity: .7; }

.grid { grid-auto-rows: max-content; flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; padding: 10px 18px 24px; align-content: start; }
.card { height: auto; overflow: visible; border: 0; background: var(--card); border-radius: 26px; padding: 14px 10px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 10px; font: inherit; color: inherit; min-height: 150px; transition: transform .08s; }
.card:active { transform: scale(.96); }
.card .icon { width: 96px; height: 96px; display: block; }
.card .icon svg { width: 100%; height: 100%; display: block; }
canvas.icon { width: 96px; height: 96px; display: block; }
.card .name { font-weight: 700; font-size: 1.05rem; text-align: center; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; justify-content: center; text-wrap: balance; overflow-wrap: anywhere; }

.screen { position: fixed; inset: 0; background: #fff; }
.stage { width: 100%; height: 100%; display: block; touch-action: none; }

.hold { --p: 0; position: relative; width: 56px; height: 56px; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: conic-gradient(var(--accent) calc(var(--p) * 360deg), rgba(255, 255, 255, .85) 0); box-shadow: var(--shadow); touch-action: none; }
.hold::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: rgba(255, 255, 255, .94); z-index: 0; }
.hold svg { position: relative; z-index: 1; }
.back { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); z-index: 5; opacity: .75; }

.overlay { position: fixed; inset: 0; background: rgba(40, 30, 20, .5); display: grid; place-items: center; padding: 16px; z-index: 10; }
.panel { width: min(440px, 100%); background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--shadow); max-height: 92vh; overflow-y: auto; }
.panel h2 { margin: 0 0 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid #f1e7d4; }
.row input[type=checkbox] { width: 28px; height: 28px; accent-color: var(--accent); }
.row input[type=range] { width: 50%; accent-color: var(--accent); }
.row select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid #ddd; }
.note { font-size: .9rem; opacity: .7; }
.close { width: 100%; margin-top: 6px; border: 0; border-radius: 16px; padding: 14px; font: inherit; font-weight: 700; background: var(--accent-2); color: #fff; min-height: 52px; }


.voicebtn { width: 100%; margin: 12px 0 4px; border: 2px solid var(--accent); border-radius: 16px; padding: 12px; font: inherit; font-weight: 700; background: #fff; color: var(--ink); min-height: 52px; }
.vlist { margin: 8px 0 14px; }
.vrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f1e7d4; }
.vrow .vword { flex: 1; font-weight: 600; }
.vrow.has .vword { color: #2b8a3e; }
.vrow button { border: 0; border-radius: 12px; min-width: 48px; min-height: 48px; font: inherit; font-weight: 700; padding: 6px 12px; }
.vrec { background: #ffe3e3; color: #c92a2a; }
.vrec.on { background: #2b8a3e; color: #fff; animation: vpulse 1s infinite; }
.vrow.recording { background: #ebfbee; border-radius: 12px; }
.vrow.recording .vword { color: #2b8a3e; }
@keyframes vpulse { 50% { opacity: .65; } }
.vplay { background: #e7f5ff; color: #1c7ed6; }
.vdel { background: #f1f3f5; color: #495057; }
.vpause { background: #f1f3f5; color: #adb5bd; opacity: .8; }
.vpause.on { background: #ff922b; color: #fff; opacity: 1; box-shadow: 0 0 0 3px #ffe0b3, 0 0 10px #ff922b; }
.vrow button:disabled { opacity: .35; }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } }

/* Značka Bystrohry */
.brand-splash { position: fixed; inset: 0; z-index: 100; background: #1f3a2b; display: grid; place-content: center; justify-items: center; gap: 18px; color: #f2f0e6; transition: opacity .6s; }
.brand-splash.out { opacity: 0; pointer-events: none; }
.brand-splash img { width: min(42vmin, 260px); height: auto; border-radius: 22%; }
.brand-splash p { margin: 0; font-size: 1.15rem; letter-spacing: .02em; }
.brand-splash b { color: #f3e08a; }
.brand-foot { --p: 0; touch-action: none; border-radius: 22px; background: linear-gradient(to right, rgba(31,58,43,.2) calc(var(--p) * 100%), transparent 0) !important; display: flex; align-items: center; gap: 10px; margin: 6px auto 14px; padding: 6px 14px; border: 0; background: transparent; color: #6b5b4b; font: inherit; font-size: .95rem; opacity: .85; }
.brand-foot img { width: 30px; height: 30px; border-radius: 22%; }
.brand-foot b { color: #1f3a2b; }

/* Nahrávání hlasu rodiče: skupiny slov */
.vsec { margin: 6px 0; border-radius: 14px; background: rgba(255, 255, 255, .6); padding: 4px 10px; }
.vsec > summary { cursor: pointer; font-weight: 800; padding: 10px 4px; }
.vcount { text-align: center; font-weight: 700; }
