:root {
  color-scheme: light dark;
  --bg: #fafbfc;
  --fg: #18202d;
  --mut: #667182;
  --line: #dce2e9;
  --card: #fff;
  --acc: #2563eb;
  --acc-fg: #fff;
  --err: #b91c1c;
  --logo-sheet: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101319;
    --fg: #edf1f7;
    --mut: #a2adbd;
    --line: #343c49;
    --card: #171c24;
    --acc: #60a5fa;
    --acc-fg: #101319;
    --err: #f87171;
    --logo-sheet: #3b82f6;
  }
}
@media (min-width: 1600px) {
  html { font-size: 125%; } /* Fernseher: alles etwas grösser */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 48rem; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
a { color: var(--acc); }

header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.logo { display: inline-flex; align-items: center; gap: 0.55rem; font-size: 1.3rem; font-weight: 400; line-height: 1; color: var(--fg); text-decoration: none; letter-spacing: -0.025em; }
.logo b { color: var(--fg); font-weight: 650; }
.logo-mark { width: 1.8rem; height: 1.8rem; flex: none; }
.logo-mark .s { fill: var(--logo-sheet); }
.lang { font-size: 0.85rem; color: var(--mut); text-decoration: none; }
.lang:hover { color: var(--fg); }

#intro h1 { font-size: 2rem; font-weight: 650; line-height: 1.15; letter-spacing: -0.045em; margin: 0 0 0.65rem; }
#intro p { margin: 0 0 1.65rem; color: var(--mut); line-height: 1.65; }
/* Auf Notizseiten und nach dem Erstellen nur die App zeigen */
.note #intro, .note #open, .note #about, .note .lang, .done #intro, .done #open, .done #about { display: none; }

textarea, input, select {
  width: 100%;
  font: inherit; /* mind. 16px: iOS zoomt sonst beim Fokussieren */
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
}
textarea { min-height: 16rem; min-height: clamp(15rem, 30vh, 23rem); resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere; padding: 1rem 1.1rem; line-height: 1.65; box-shadow: 0 2px 10px rgb(20 35 60 / 3%); caret-color: var(--acc); }
textarea:focus, input:focus, select:focus { border-color: var(--acc); }
textarea:focus-visible, input:focus-visible, select:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(37 99 235 / 10%); }
#out { min-height: 50vh; }
textarea::placeholder { color: var(--mut); opacity: .85; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

.open { margin: 0 0 1.25rem; }
.open label { display: block; font-size: 0.85rem; color: var(--mut); margin-bottom: 0.3rem; }
.open .row { display: flex; gap: 0.5rem; }
.open input { flex: 1; min-width: 0; padding: 0.5rem 0.75rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; }
.open input::placeholder { letter-spacing: normal; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.open button { padding: 0.5rem 1rem; }

.count { margin: 0.4rem 0 1rem; text-align: right; color: var(--mut); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.count.over { color: var(--err); font-weight: 600; }

.opts { display: grid; gap: 0.9rem 1.25rem; grid-template-columns: 1fr 1fr; margin-bottom: 1.25rem; }
.opts label { display: flex; flex-direction: column; gap: 0.35rem; }
.opts label > span { font-size: .85rem; }
.opts .check > span { font-size: .9rem; }
.opts small { color: var(--mut); font-size: 0.75rem; }
.checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }
@media (max-width: 34rem) {
  .opts { grid-template-columns: 1fr; }
  .checks { flex-direction: column; }
}
.submit { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.trust { color: var(--mut); font-size: 0.8rem; }
.consent { margin: .7rem 0 0; color: var(--mut); font-size: .75rem; }
.consent a { color: inherit; text-underline-offset: 2px; }
.opts .check { flex-direction: row; align-items: center; gap: 0.6rem; }
.check input { width: 1.25rem; height: 1.25rem; flex: none; }
.check input:disabled + span { opacity: 0.45; }

button, .btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--acc); }
button, .btn { transition: border-color .15s, background-color .15s, box-shadow .15s; }
.primary:hover:not(:disabled) { box-shadow: 0 3px 9px rgb(37 99 235 / 17%); }
.primary { color: var(--acc-fg); background: var(--acc); border-color: var(--acc); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.link {
  margin: 0.5rem 0;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font: 1.15rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: all;
}
.created-info { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; margin-top: 1.25rem; }
.created-info > div { flex: 1; min-width: 14rem; }
.qr { flex: none; width: 10rem; padding: 0.4rem; background: #fff; border-radius: 0.5rem; }
.qr svg { display: block; width: 100%; height: auto; }
.code { margin: 0; font: 700 1.5rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.12em; }

.box { padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 0.5rem; }
.box label { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1rem; }
.hint { color: var(--mut); font-size: 0.9rem; margin: 0.5rem 0 0; }
#msg { min-height: 1.5rem; margin: 1rem 0 0; }
#msg.err { color: var(--err); font-weight: 600; }

#about { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 0.5rem; color: var(--mut); }
#about h2, #about b, #about summary { color: var(--fg); }
#about h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
#about ol, #about ul { padding-left: 1.25rem; margin: 0; }
#about li { margin: 0.35rem 0; }
#about details { border-bottom: 1px solid var(--line); padding: 0.6rem 0; }
#about summary { cursor: pointer; font-weight: 600; }
#about details p { margin: 0.5rem 0 0; color: var(--mut); }

.page h1 { font-size: 1.5rem; }
.page h2 { font-size: 1.1rem; margin-top: 1.75rem; }
.page p, .page li { color: var(--fg); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.75rem; margin: 0.5rem 0 0.5rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.9rem 1rem; }
.tile-n { font: 700 1.9rem/1.1 system-ui, sans-serif; letter-spacing: -0.02em; }
.tile-l { color: var(--mut); font-size: 0.85rem; margin-top: 0.2rem; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 7rem; margin: 0.5rem 0 0; padding: 0.4rem; background: var(--card); border: 1px solid var(--line); border-radius: 0.6rem; }
.chart .bar { flex: 1; min-height: 2px; background: var(--acc); border-radius: 2px 2px 0 0; opacity: 0.85; }

footer { margin-top: 2rem; color: var(--mut); font-size: 0.85rem; }
footer a { color: var(--mut); }
.offscreen { position: fixed; left: -9999px; top: 0; }

.report-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 24rem; overflow: auto; }
#report-form { margin: .6rem 0 0; }
.report { font-size: .75rem; }
.report summary { display: inline-block; cursor: pointer; list-style: none; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.report summary::-webkit-details-marker { display: none; }
.report summary:hover { color: var(--fg); }
.report-fields { max-width: 28rem; padding: .65rem 0 0; }
.report .hint, .report label { font-size: .8rem; }
.report label { display: block; margin: .6rem 0 .25rem; }
.report select { font-size: 1rem; }
.report button { margin-top: .65rem; padding: .5rem .8rem; font-size: .8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.note-total { margin: 0 0 .65rem; font-size: .75rem; font-variant-numeric: tabular-nums; }
.done .note-total { display: none; }
.site-footer { padding-top: .5rem; }
@media (max-width: 34rem) {
  main { padding: 1.2rem 1rem 2rem; }
  header { margin-bottom: 1.5rem; }
  #intro h1 { font-size: 1.7rem; }
  #intro p { font-size: .95rem; margin-bottom: 1.3rem; }
  textarea { min-height: 12rem; }
  .opts { gap: .85rem; }
}
@media (prefers-reduced-motion: reduce) { button, .btn { transition: none; } }
#reports .box { margin: 1rem 0; }
#reports button { margin: .25rem; }

#about .features { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.75rem; list-style: none; padding: 0; }
#about .features li { margin: 0; }
#about .features b { display: block; margin-bottom: .15rem; }
@media (max-width: 34rem) { #about .features { grid-template-columns: 1fr; gap: 1rem; } }

.audience-panel { position: fixed; z-index: 20; bottom: 1rem; left: 50%; transform: translateX(-50%); width: calc(100% - 2rem); max-width: 46rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--card); box-shadow: 0 8px 40px rgb(0 0 0 / 12%); }
.audience-panel h2 { font-size: 1rem; margin: 0 0 .35rem; }
.audience-panel p { font-size: .85rem; margin: .35rem 0 .75rem; color: var(--mut); }
.audience-choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.audience-choices button { font-size: .85rem; padding: .55rem .8rem; }
.audience-panel .audience-detail { font-size: .75rem; margin: .65rem 0 0; }
.audience-panel #audience-status:empty { display: none; }
.privacy-open { padding-bottom: 16rem; }
.insight-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem; margin-top: 1.3rem; }
.insight-controls label { display: grid; gap: .3rem; font-size: .8rem; color: var(--mut); }
.insight-controls select { min-width: 8rem; }
.insight-controls button { font-size: .85rem; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.25rem 0; }
.insight-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--card); }
.page .insight-card h2 { margin: 0 0 .65rem; font-size: .95rem; }
.insight-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; padding: .5rem 0; font-size: .85rem; border-bottom: 1px solid var(--line); }
.insight-row > span:first-child { overflow-wrap: anywhere; }
.insight-row strong { font-variant-numeric: tabular-nums; }
.insight-bar { position: absolute; bottom: -1px; left: 0; height: 2px; background: var(--acc); opacity: .5; }
.insight-detail { margin-top: .7rem; font-size: .85rem; }
.insight-detail summary, .admin-reports > summary { cursor: pointer; }
.table-wrap { overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; margin: .5rem 0; }
.table-wrap th, .table-wrap td { padding: .4rem .6rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .85rem; }
.cloudflare-links { margin: 1.5rem 0; }
.page .cloudflare-links h2 { margin-top: 0; }
.cloudflare-links p { font-size: .85rem; color: var(--mut); }
.admin-reports { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.admin-reports > summary { font-weight: 600; }
@media (max-width: 34rem) { .insight-grid { grid-template-columns: 1fr; } .audience-panel { bottom: .5rem; padding: .9rem; } .privacy-open { padding-bottom: 21rem; } }
