
/* Layout: eine Spalte, grosse Kacheln, pro Bildschirm eine Aufgabe in 3 Schritten. Keine Inline-Styles (CSP). */
:root {
  --bg: #F3F6FB;
  --surface: #FFFFFF;
  --fg: #14213D;
  --muted: #4A5877;
  --line: #C9D3E6;
  --focus: #14213D;
  --on-c: #FFFFFF;
  --c-chat: #1D4ED8;
  --c-lesen: #15803D;
  --c-uebersetzen: #0F766E;
  --c-leicht: #C2410C;
  --c-bild: #BE185D;
  --c-musik: #7E22CE;
  --c-web: #4338CA;
  --c-scanner: #92400E;
  --font: "Atkinson Hyperlegible", Verdana, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1424; --surface: #171F36; --fg: #F1F4FB; --muted: #B4BFD8; --line: #34405F; --focus: #F1F4FB; --on-c: #0B1020;
    --c-chat: #60A5FA; --c-lesen: #4ADE80; --c-uebersetzen: #2DD4BF; --c-leicht: #FB923C;
    --c-bild: #F472B6; --c-musik: #C084FC; --c-web: #818CF8; --c-scanner: #FBBF24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1424; --surface: #171F36; --fg: #F1F4FB; --muted: #B4BFD8; --line: #34405F; --focus: #F1F4FB; --on-c: #0B1020;
  --c-chat: #60A5FA; --c-lesen: #4ADE80; --c-uebersetzen: #2DD4BF; --c-leicht: #FB923C;
  --c-bild: #F472B6; --c-musik: #C084FC; --c-web: #818CF8; --c-scanner: #FBBF24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 100%; }
html[data-size="2"] { font-size: 118%; }
html[data-size="3"] { font-size: 136%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 1.25rem; line-height: 1.5;
  padding-block: 1rem 2.5rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 64rem; margin-inline: auto; display: flex; flex-direction: column; gap: 1.5rem; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: .5rem; }

/* Kopf */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.5rem; background: none; border: 0; padding: .25rem; }
.brand .mark { width: 3rem; height: 3rem; border-radius: 1rem; background: var(--c-chat); color: var(--on-c); display: grid; place-items: center; }
.brand svg { width: 1.7rem; height: 1.7rem; }
.sizes { display: flex; align-items: center; gap: .5rem; }
.sizes span { font-size: 1rem; color: var(--muted); margin-right: .25rem; }
.sizes button { width: 3.25rem; height: 3.25rem; border-radius: .9rem; border: 3px solid var(--line); background: var(--surface); font-weight: 700; line-height: 1; }
.sizes button[aria-pressed="true"] { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.sizes button:nth-of-type(1) { font-size: 1rem; }
.sizes button:nth-of-type(2) { font-size: 1.35rem; }
.sizes button:nth-of-type(3) { font-size: 1.75rem; }

h1 { font-size: 2.2rem; line-height: 1.15; margin: 0; text-wrap: balance; }
.lead { margin: .25rem 0 0; color: var(--muted); font-size: 1.3rem; }

/* Start: Kacheln */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.tile {
  width: 100%; display: flex; align-items: center; gap: 1.1rem; text-align: left;
  padding: 1.1rem; min-height: 7.5rem;
  background: var(--surface); border: 3px solid var(--line); border-radius: 1.4rem;
  box-shadow: 0 3px 0 var(--line);
}
.tile:hover { border-color: var(--c); }
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.ico { flex: none; width: 5rem; height: 5rem; border-radius: 1.2rem; background: var(--c); color: var(--on-c); display: grid; place-items: center; }
.ico svg { width: 2.8rem; height: 2.8rem; }
.tile b { display: block; font-size: 1.6rem; line-height: 1.15; }
.tile small { display: block; margin-top: .25rem; font-size: 1.05rem; color: var(--muted); line-height: 1.3; }

/* Werkzeug-Seite */
.bar { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 4rem; padding: .6rem 1.4rem; border-radius: 1.1rem;
  border: 3px solid var(--c, var(--fg)); background: var(--c, var(--fg)); color: var(--on-c, var(--bg));
  font-weight: 700; font-size: 1.3rem; line-height: 1.2;
}
.btn svg { width: 1.6rem; height: 1.6rem; flex: none; }
.btn.alt { background: var(--surface); color: var(--fg); border-color: var(--line); }
.btn.alt:hover { border-color: var(--c, var(--fg)); }
.btn.big { min-height: 5rem; font-size: 1.6rem; width: 100%; }
.btn[aria-busy="true"] { opacity: .75; cursor: progress; }

.head { display: flex; align-items: center; gap: 1rem; }
.head .ico { width: 4.5rem; height: 4.5rem; }

.step { background: var(--surface); border: 3px solid var(--line); border-radius: 1.4rem; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.step > h2 { margin: 0; font-size: 1.6rem; display: flex; align-items: center; gap: .8rem; line-height: 1.2; }
.num { flex: none; width: 2.8rem; height: 2.8rem; border-radius: 50%; background: var(--c); color: var(--on-c); display: grid; place-items: center; font-weight: 700; font-size: 1.5rem; }
.step.wait { border-style: dashed; }
.step.wait > p { margin: 0; color: var(--muted); }

textarea {
  width: 100%; min-height: 8.5rem; resize: vertical;
  font: inherit; font-size: 1.35rem; line-height: 1.5; color: var(--fg);
  background: var(--bg); border: 3px solid var(--line); border-radius: 1rem; padding: 1rem;
}
textarea:focus-visible { border-color: var(--c); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip { border: 3px solid var(--line); background: var(--surface); border-radius: 999px; padding: .5rem 1.1rem; font-size: 1.1rem; font-weight: 700; min-height: 3rem; }
.chip:hover { border-color: var(--c); }
.choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr)); gap: .75rem; }
.choice button { min-height: 4.5rem; border: 3px solid var(--line); background: var(--surface); border-radius: 1.1rem; font-size: 1.3rem; font-weight: 700; padding: .5rem; line-height: 1.2; }
.choice button small { display: block; font-size: .95rem; font-weight: 400; color: var(--muted); }
.choice button[aria-pressed="true"] { border-color: var(--c); background: var(--c); color: var(--on-c); }
.choice button[aria-pressed="true"] small { color: inherit; }
.file-name { color: var(--muted); font-size: 1.1rem; margin: 0; }

.badge { margin-left: auto; font-size: .95rem; font-weight: 700; border: 2px solid var(--line); border-radius: 999px; padding: .15rem .75rem; color: var(--muted); white-space: nowrap; }
.result { display: flex; flex-direction: column; gap: 1rem; }
.result p, .result ol, .result ul { margin: 0; font-size: 1.45rem; line-height: 1.55; }
.result ol, .result ul { padding-left: 1.6rem; display: flex; flex-direction: column; gap: .5rem; }
.result .big { font-size: 1.9rem; line-height: 1.35; font-weight: 700; }
.result .src { font-size: 1.05rem; color: var(--muted); }
.result .alt-lang { display: block; font-size: 1.05rem; color: var(--muted); margin-top: .25rem; font-weight: 400; }
.pic { width: 100%; max-width: 30rem; border-radius: 1rem; display: block; border: 3px solid var(--line); }

.player-unused { display: flex; align-items: center; gap: 1rem; background: var(--bg); border: 3px solid var(--line); border-radius: 1.2rem; padding: 1rem; }
.play { flex: none; width: 5rem; height: 5rem; border-radius: 50%; border: 0; background: var(--c); color: var(--on-c); display: grid; place-items: center; }
.play svg { width: 2.2rem; height: 2.2rem; }
.wave { flex: 1; display: flex; align-items: center; gap: 4px; height: 4rem; }
.wave i { flex: 1; background: var(--c); border-radius: 3px; height: var(--h); opacity: .55; }
.playing .wave i { opacity: 1; animation: bounce .9s ease-in-out infinite alternate; animation-delay: calc(var(--i) * 55ms); }
@keyframes bounce { to { transform: scaleY(.35); } }
.cam { position: relative; aspect-ratio: 4 / 3; max-width: 30rem; width: 100%; border-radius: 1.2rem; background: #0B1020; display: grid; place-items: center; color: #F1F4FB; text-align: center; padding: 1rem; font-size: 1.2rem; }
.cam::before, .cam::after { content: ""; position: absolute; inset: 18% 20%; border: 0 solid #F1F4FB; }
.cam::before { border-width: 6px 0 0 6px; width: 3rem; height: 3rem; inset: 18% auto auto 20%; border-radius: .5rem 0 0 0; }
.cam::after { border-width: 0 6px 6px 0; width: 3rem; height: 3rem; inset: auto 20% 18% auto; border-radius: 0 0 .5rem 0; }
.cam.found { background: var(--c); color: var(--on-c); }

.note { font-size: 1rem; color: var(--muted); border-top: 2px solid var(--line); padding-top: 1rem; margin: 0; }

@media (max-width: 30rem) {
  h1 { font-size: 1.9rem; }
  .ico { width: 4.2rem; height: 4.2rem; }
  .tile b { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  .playing .wave i { animation: none; }
  .tile:active { transform: none; }
}
[data-t="chat"] { --c: var(--c-chat); }
[data-t="lesen"] { --c: var(--c-lesen); }
[data-t="uebersetzen"] { --c: var(--c-uebersetzen); }
[data-t="leicht"] { --c: var(--c-leicht); }
[data-t="bild"] { --c: var(--c-bild); }
[data-t="musik"] { --c: var(--c-musik); }
[data-t="web"] { --c: var(--c-web); }
[data-t="scanner"] { --c: var(--c-scanner); }

.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.stack-s { display: flex; flex-direction: column; gap: 1rem; }
.hidden { display: none !important; }
.sizes-wrap { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; font-size: 1.05rem; color: var(--muted); text-decoration: underline; padding: .5rem; min-height: 3rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-weight: 700; font-size: 1.3rem; }
.field input { font: inherit; font-size: 1.35rem; color: var(--fg); background: var(--bg); border: 3px solid var(--line); border-radius: 1rem; padding: .9rem 1rem; min-height: 4rem; width: 100%; }
.field input:focus-visible { border-color: var(--c, var(--fg)); outline-offset: 2px; }
.err { background: #FDECEC; color: #8A1C1C; border: 3px solid #E8A5A5; border-radius: 1rem; padding: .9rem 1rem; font-size: 1.25rem; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .err { background: #3A1A1F; color: #FFD3D3; border-color: #8A3B44; } }
.status { margin: 0; font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: .8rem; }
.spin { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--c, var(--fg)); animation: turn 1s linear infinite; flex: none; }
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.result img { max-width: 100%; border-radius: 1rem; border: 3px solid var(--line); }
.result a { color: var(--c, var(--fg)); font-weight: 700; }
.result audio { width: 100%; height: 4rem; }
.result table { border-collapse: collapse; font-size: 1.2rem; display: block; overflow-x: auto; }
.result td, .result th { border: 2px solid var(--line); padding: .4rem .6rem; }
.result h1, .result h2, .result h3 { font-size: 1.6rem; margin: 0; }
.cam { position: relative; overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .hint { position: relative; z-index: 1; background: rgba(11,16,32,.75); border-radius: .8rem; padding: .5rem 1rem; }
.mic.rec { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.badge-real { margin-left: auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mt { margin-top: 1.25rem; }
