:root {
  --bg: #f4f1ea;
  --ink: #111111;
  --muted: rgba(17, 17, 17, .58);
  --line: rgba(17, 17, 17, .14);
  --panel: rgba(244, 241, 234, .72);
  --selected: #111111;
  --selected-text: #f4f1ea;
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

body {
  min-height: 100svh;
  overflow: hidden;
}

button, input, textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

#network {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(18px, env(safe-area-inset-top))
           max(18px, env(safe-area-inset-right))
           max(18px, env(safe-area-inset-bottom))
           max(18px, env(safe-area-inset-left));
}

.topbar, .footer {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  min-height: 62px;
}

.brand {
  font-weight: 950;
  letter-spacing: -.06em;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.progress-wrap {
  width: min(300px, 42vw);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.progress-text {
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .05em;
}

.progress-track {
  height: 4px;
  background: rgba(17, 17, 17, .12);
  overflow: hidden;
  border-radius: 99px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--ink);
  transition: width .35s ease;
}

.screen {
  width: min(1180px, 100%);
  margin: 0 auto;
  align-self: center;
  padding: 28px 0;
}

.screen.enter {
  animation: enter .36s cubic-bezier(.2,.8,.2,1);
}

@keyframes enter {
  from { opacity: 0; transform: translateY(16px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.intro {
  max-width: 880px;
}

.eyebrow {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .08em;
  margin-bottom: 20px;
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(10px);
}

h1, h2 {
  margin: 0;
  letter-spacing: -.055em;
  line-height: .95;
  font-weight: 950;
}

h1 {
  font-size: clamp(3.5rem, 10vw, 8.5rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(2.4rem, 7vw, 5.8rem);
  max-width: 13ch;
}

.lead {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.3;
  max-width: 720px;
  margin: 28px 0 10px;
}

.intro p:not(.lead) {
  max-width: 720px;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.55;
}

.muted {
  color: var(--muted);
}

.hero-btn {
  margin-top: 18px;
}

.question-head {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.question-number {
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.question-description {
  max-width: 760px;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.45;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  align-items: stretch;
}

.answer-card {
  grid-column: span 4;
  min-height: 108px;
  border: 1.5px solid rgba(17,17,17,.2);
  border-radius: var(--radius);
  background: rgba(244,241,234,.72);
  backdrop-filter: blur(14px);
  color: var(--ink);
  padding: 18px;
  text-align: left;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.answer-card:hover {
  transform: translateY(-3px);
}

.answer-card.selected {
  background: var(--selected);
  color: var(--selected-text);
  border-color: var(--selected);
  transform: translateY(-2px) scale(1.015);
}

.answer-card.wide { grid-column: span 6; }
.answer-card.full { grid-column: 1 / -1; }

.text-answer {
  width: 100%;
  min-height: min(38vh, 360px);
  resize: none;
  border: 1.5px solid rgba(17,17,17,.2);
  background: rgba(244,241,234,.74);
  backdrop-filter: blur(14px);
  border-radius: 28px;
  padding: 24px;
  outline: none;
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  line-height: 1.25;
  font-weight: 750;
  color: var(--ink);
}

.text-answer:focus {
  border-color: rgba(17,17,17,.55);
}

.text-answer::placeholder {
  color: rgba(17,17,17,.28);
}

.sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(2.2rem, 7vw, 6rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.05em;
}

.sentence input {
  flex: 1 1 340px;
  min-width: 0;
  border: 0;
  border-bottom: 4px solid var(--ink);
  background: transparent;
  outline: none;
  font-weight: 950;
  color: var(--ink);
  padding: 0 0 6px;
}

.primary-btn, .ghost-btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease;
}

.primary-btn {
  background: var(--ink);
  color: var(--bg);
}

.ghost-btn {
  background: rgba(244,241,234,.7);
  color: var(--ink);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.primary-btn:hover, .ghost-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.footer {
  min-height: 72px;
}

.hidden { visibility: hidden; pointer-events: none; }

.thanks {
  max-width: 920px;
}

.thanks h2 {
  font-size: clamp(3.2rem, 9vw, 8rem);
}

.thanks p {
  max-width: 680px;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.45;
}

.micro {
  margin-top: 16px;
  font-size: .82rem;
  color: var(--muted);
}

.other-wrap {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.other-input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid rgba(17,17,17,.3);
  background: transparent;
  outline: none;
  padding: 14px 4px;
  font-size: 1.1rem;
  font-weight: 700;
}

@media (max-width: 820px) {
  body { overflow: auto; }

  .app-shell {
    min-height: 100svh;
  }

  .screen {
    align-self: start;
    padding-top: 20px;
  }

  .progress-wrap {
    width: min(210px, 50vw);
  }

  .answer-card,
  .answer-card.wide {
    grid-column: span 6;
    min-height: 92px;
  }

  .text-answer {
    min-height: 32vh;
  }

  .footer {
    position: sticky;
    bottom: 0;
    padding-top: 8px;
    background: linear-gradient(to top, var(--bg) 62%, transparent);
  }
}

@media (max-width: 520px) {
  .brand { font-size: 1.4rem; }

  .progress-text { display: none; }

  .progress-wrap {
    width: 42vw;
    display: block;
  }

  .answer-card,
  .answer-card.wide {
    grid-column: 1 / -1;
    min-height: 76px;
  }

  .question-head {
    margin-bottom: 20px;
  }

  .primary-btn, .ghost-btn {
    padding: 13px 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* --- KŘEČ 0.1.4: navigation stays in the top bar --- */
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.top-actions .progress-wrap {
  width: min(250px, 25vw);
}

.top-actions .primary-btn,
.top-actions .ghost-btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .topbar {
    gap: 10px;
  }

  .top-actions {
    gap: 7px;
  }

  .top-actions .progress-wrap {
    width: 88px;
  }

  .top-actions .primary-btn,
  .top-actions .ghost-btn {
    padding: 10px 12px;
    font-size: .82rem;
  }

  .top-actions .progress-text {
    display: none;
  }
}

@media (max-width: 440px) {
  .brand {
    font-size: 1.2rem;
  }

  .top-actions .progress-wrap {
    width: 48px;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions .primary-btn,
  .top-actions .ghost-btn {
    padding: 9px 10px;
  }
}
