/* Layout: full-screen intro scene (bamboo, hills, mist, panda on a branch) slides up; below it a single-column app with large elements for reading on a phone. */

/* Self-hosted fonts (latin + latin-ext for Czech diacritics). Fredoka is a variable font. */
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url("fonts/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url("fonts/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/atkinson-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/atkinson-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --bg: #e9f0e6;
  --surface: #f8fbf6;
  --fg: #1c2a23;
  --muted: #53645a;
  --line: #c3d2c4;
  --accent: #b9481a;
  --accent-fg: #ffffff;
  --accent-soft: #f6e0d2;
  --leaf: #3d7a54;
  --title: #b4451a;

  --sky-top: #cfe2d4;
  --sky-bot: #f1f5e3;
  --orb: #fbe3a6;
  --hill1: #acd0b3;
  --hill2: #86b898;
  --hill3: #5e9b79;
  --bamboo: #6fa77a;
  --bamboo-node: #4d8760;
  --blade: #4f9161;
  --mist: #ffffff;
  --mist-o: .45;
  --leaf-fall: #d9863f;
  --bark: #735c47;

  --fur: #d4591f;
  --fur-light: #e8975a;
  --fur-dark: #8c3412;
  --belly: #3a1a12;
  --cream: #fbf0e2;
  --ink: #22110c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1914; --surface: #16251e; --fg: #e7f0e9; --muted: #9db3a6; --line: #28403460;
    --accent: #f08850; --accent-fg: #1d0f07; --accent-soft: #3a2316; --leaf: #7cc593; --title: #f4a06a;
    --sky-top: #09130f; --sky-bot: #17332a; --orb: #e8efd6; --hill1: #1e3b32; --hill2: #16302a; --hill3: #0f241f;
    --bamboo: #2c5a47; --bamboo-node: #1d4132; --blade: #2f6a50; --mist: #9fc4b2; --mist-o: .12;
    --leaf-fall: #e08a4a; --bark: #3b3328;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1914; --surface: #16251e; --fg: #e7f0e9; --muted: #9db3a6; --line: #28403460;
  --accent: #f08850; --accent-fg: #1d0f07; --accent-soft: #3a2316; --leaf: #7cc593; --title: #f4a06a;
  --sky-top: #09130f; --sky-bot: #17332a; --orb: #e8efd6; --hill1: #1e3b32; --hill2: #16302a; --hill3: #0f241f;
  --bamboo: #2c5a47; --bamboo-node: #1d4132; --blade: #2f6a50; --mist: #9fc4b2; --mist-o: .12;
  --leaf-fall: #e08a4a; --bark: #3b3328;
  color-scheme: dark;
}
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 18px; line-height: 1.5; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- intro scene ---------- */
#intro { position: fixed; inset: 0; z-index: 20; background: var(--sky-top); overflow: hidden;
  transition: transform .9s cubic-bezier(.6,0,.2,1), opacity .9s; }
#intro.gone { transform: translateY(-102%); opacity: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.bamboo { transform-box: fill-box; transform-origin: 50% 100%; animation: bsway var(--d, 6s) ease-in-out infinite alternate; }
@keyframes bsway { from { transform: rotate(-1.3deg); } to { transform: rotate(1.3deg); } }
.mist { animation: drift 16s ease-in-out infinite alternate; }
.mist.b { animation-duration: 22s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-40px); } to { transform: translateX(50px); } }
.leaf { position: absolute; top: -8%; left: var(--x); width: 16px; height: 16px; background: var(--leaf-fall);
  border-radius: 0 100% 0 100%; opacity: .85; animation: fall var(--dur) linear var(--dly) infinite; }
@keyframes fall { 0% { transform: translate3d(0, 0, 0) rotate(0); } 50% { transform: translate3d(28px, 55vh, 0) rotate(260deg); }
  100% { transform: translate3d(-18px, 112vh, 0) rotate(540deg); } }
.intro-inner { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: max(7vh, 36px) 24px max(5vh, 32px); text-align: center; }
.intro-title { color: var(--title); font-family: var(--font-display); font-weight: 600; font-size: clamp(3rem, 14vw, 5rem); line-height: 1; margin: 0; letter-spacing: .01em; }
.intro-sub { margin: .6rem 0 0; color: var(--muted); font-size: 1.15rem; }
#pandaStage { width: clamp(210px, 72vw, 340px); min-height: 0; flex: 0 1 auto; }
#pandaStage svg { width: 100%; height: auto; display: block; overflow: visible; }
.btn-start { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 999px; min-height: 60px; padding: 0 3rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; box-shadow: 0 8px 24px #00000030; animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.tail { transform-box: fill-box; transform-origin: 0% 100%; animation: sway 3.4s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(8deg); } }
.head { transform-box: fill-box; transform-origin: 50% 95%; animation: bob 5s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: rotate(0); } 30% { transform: rotate(-3.5deg); } 65% { transform: rotate(3.5deg); } }
.eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 5.2s infinite; }
@keyframes blink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }

.wave { transform-box: fill-box; transform-origin: 0% 100%; animation: wave 4s ease-in-out infinite; }
@keyframes wave { 0%,50%,100% { transform: rotate(0); } 56% { transform: rotate(-16deg); } 63% { transform: rotate(10deg); } 70% { transform: rotate(-16deg); } 77% { transform: rotate(10deg); } 84% { transform: rotate(-8deg); } 92% { transform: rotate(0); } }

/* ---------- app ---------- */
#app { width: 100%; max-width: 460px; margin-inline: auto; padding-inline: 16px; padding-block: 18px 40px; display: flex; flex-direction: column; gap: 20px; }
.top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--line); padding: 0; overflow: hidden; flex: none; }
.avatar svg { width: 100%; height: 100%; display: block; }
.brand { color: var(--title); font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; line-height: 1.1; margin: 0; }
.brand small { display: block; color: var(--muted); font-family: var(--font-body); font-weight: 400; font-size: .95rem; color: var(--muted); }
.field-label { font-size: .95rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; }
.chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: 22px; padding: 16px; }
#src { width: 100%; min-height: 128px; resize: vertical; border: 0; background: transparent; color: var(--fg);
  font: inherit; font-size: 1.45rem; line-height: 1.35; padding: 0; }
#src:focus { outline: none; }
.card:focus-within { border-color: var(--accent); }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.round { width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; color: var(--accent);
  display: grid; place-items: center; flex: none; }
.round svg { width: 28px; height: 28px; }
.round.on { background: var(--accent); color: var(--accent-fg); animation: pulse 1.2s ease-in-out infinite; }
.text-btn { background: none; border: 0; color: var(--muted); font-weight: 700; min-height: 48px; padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; }
.btn-main { width: 100%; min-height: 64px; border-radius: 20px; border: 0; background: var(--accent); color: var(--accent-fg);
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; }
.btn-main:disabled { opacity: .6; cursor: progress; }
#status { margin: 0; min-height: 1.5em; color: var(--muted); font-size: 1rem; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#tr { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.9rem, 8vw, 2.5rem); line-height: 1.2; margin: 10px 0 14px; overflow-wrap: anywhere; text-wrap: balance; }
.phon { background: var(--accent-soft); border-radius: 16px; padding: 12px 14px; }
.phon p { margin: 0; }
.phon .lbl { font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
#ph { font-size: 1.5rem; font-weight: 700; overflow-wrap: anywhere; }
.ai-note { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.play-row { margin-top: 14px; }
.play { width: 100%; min-height: 60px; border-radius: 18px; border: 2px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; gap: 8px; }
.play.primary { background: var(--accent); color: var(--accent-fg); }
.play svg { width: 24px; height: 24px; flex: none; }
.theme { margin-left: auto; flex: none; min-height: 48px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--fg); display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .95rem; }
.theme svg { width: 22px; height: 22px; flex: none; }
.brand { min-width: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
