:root {
  --sky: #01020a;                       /* musí odpovídat SPACE v nebula-worker.js */
  --glass: rgba(10, 14, 30, 0.72);      /* záloha bez rozmazání: tmavá, aby byl text čitelný */
  --glass-blur: rgba(10, 14, 30, 0.5);
  --glass-edge: rgba(255, 255, 255, 0.22);
  --text: #ffffff;
  --accent: #7aa8ff;
  --accent-light: #a9c6ff;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--sky);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* odsazení od výřezů a lišt telefonů */
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background-color: var(--sky);
  color: var(--text);
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Hvězdná obloha (stars.js + nebula-worker.js) ---- */
.sky-stack {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  background-color: var(--sky);
}
.sky {
  position: absolute;
  top: 0;
  left: 0;
}
/* mlhovina se objeví plynule, až je spočítaná */
#sky-nebula {
  opacity: 0;
  transition: opacity 1.6s ease;
}
#sky-nebula.is-ready {
  opacity: 1;
}
.sky-twinkle {
  will-change: opacity;
  animation: twinkle 5s ease-in-out infinite alternate;
}
#sky-b {
  animation-duration: 7.3s;
  animation-delay: -3s;
}
@keyframes twinkle {
  from { opacity: 0.3; }
  to   { opacity: 1; }
}
/* neviditelná sonda: stars.js z ní zjistí největší výšku okna (lišty prohlížeče skryté) */
.vh-probe {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 100vh;
  height: 100lvh;
  visibility: hidden;
  pointer-events: none;
}

/* ---- Hlavní karta ---- */
.callout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 36rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  line-height: 1.55;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  isolation: isolate;
}
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  .callout {
    background: var(--glass-blur);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}
.callout p {
  margin: 0;
  overflow-wrap: break-word;
}
.callout p + p { margin-top: 1rem; }      /* odstavce impulsu */
#quote p { text-wrap: balance; }

/* ---- Rozklikávací poznámka ---- */
.note {
  margin-top: 1.5rem;
  text-align: left;
  font-size: 0.98rem;
  background: rgba(122, 168, 255, 0.13);
  border-left: 3px solid var(--accent);
  border-radius: 0.5rem;
  overflow: hidden;
}
.note summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;                  /* pohodlné klepnutí prstem */
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--accent-light);
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.note summary::-webkit-details-marker { display: none; }
.note summary:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: -2px;
  border-radius: 0.35rem;
}
.note summary svg {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
}
.note summary::after {
  content: "";
  flex: none;
  margin-left: auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.note[open] summary::after { transform: rotate(45deg); }
.note-body {
  padding: 0 1rem 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;            /* dlouhý odkaz nesmí roztáhnout stránku */
}
.note-body p + p { margin-top: 0.8rem; }
.note-body ul { margin: 0.6rem 0 0; padding-left: 1.25rem; }
.note-body p + ul, .note-body ul + p { margin-top: 0.8rem; }
.note-body li + li { margin-top: 0.25rem; }
.note-body a { color: var(--accent-light); }

/* ---- Patička ---- */
.site-footer {
  position: relative;
  z-index: 1;
  justify-self: stretch;
  padding: 1.25rem 0.5rem 0.5rem;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
}
.site-footer a {
  display: inline-block;
  padding: 0.25rem 0.15rem;             /* větší dotyková plocha */
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  touch-action: manipulation;
}
.site-footer a:hover,
.site-footer a:focus-visible { color: #ffffff; }

/* ---- Přístupnost ---- */
@media (prefers-contrast: more) {
  .callout { background: rgba(0, 0, 0, 0.88); border-color: rgba(255, 255, 255, 0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .sky-twinkle { animation: none; will-change: auto; opacity: 0.85; }
  #sky-nebula { transition: none; }
  .note summary::after { transition: none; }
}