:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(800px 500px at -10% 0%, rgba(16, 185, 129, 0.08), transparent 55%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

.survey-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 32px 20px 140px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Intro ---------- */
.intro-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px;
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}
.intro-panel h1 { margin: 0 0 10px; font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -0.02em; }
.lead { margin: 0; color: var(--muted); max-width: 60ch; font-size: 15px; }

.progress-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), #4f46e5);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}
.progress-card span { font-size: 12px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; }
.progress-card strong { font-size: 30px; font-weight: 800; line-height: 1.1; }
.progress-card small { font-size: 12px; opacity: 0.9; }

/* ---------- Section headings ---------- */
.section-heading h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.01em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }

.age-panel, .design-list { display: flex; flex-direction: column; gap: 16px; }
.design-list { margin: 0; }

/* ---------- Age chips ---------- */
.age-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.age-option {
  appearance: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.age-option:hover { border-color: var(--brand); transform: translateY(-1px); }
.age-option.is-selected {
  background: linear-gradient(135deg, var(--brand), #4f46e5);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.3);
}

/* ---------- Cards grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

.design-card {
  --accent: #2563eb;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  animation: cardIn 0.45s both ease;
}
.design-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Živý náhled (scaled iframe thumbnail) */
.design-card__preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  cursor: zoom-in;
  overflow: hidden;
}
.design-card__frame {
  position: absolute;
  top: 0; left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: #fff;
}
.design-card__hint {
  position: absolute;
  inset: auto 0 0 0;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.72));
  opacity: 0;
  transition: opacity 0.15s ease;
}
.design-card__preview:hover .design-card__hint,
.design-card__preview:focus-visible .design-card__hint { opacity: 1; }
.design-card__preview::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 3px 0 0 var(--accent);
  pointer-events: none;
}

/* Card body */
.design-card__body { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.design-card__head { display: flex; gap: 14px; align-items: flex-start; }
.design-card__num {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 17px; font-weight: 800;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 45%, transparent);
}
.design-card__titles h3 { margin: 0 0 2px; font-size: 17px; letter-spacing: -0.01em; }
.design-card__titles p { margin: 0; color: var(--muted); font-size: 13.5px; }
.design-card__focus {
  margin: 0;
  font-size: 13px;
  color: #334155;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ---------- Rating ---------- */
.rating { display: flex; flex-direction: column; gap: 8px; }
.rating__row { display: flex; align-items: center; gap: 10px; }
.rating__emoji { font-size: 22px; line-height: 1; }
.rating__label { font-size: 14px; font-weight: 600; color: var(--muted); flex: 1; }
.rating__badge {
  min-width: 42px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  transition: background 0.15s ease, color 0.15s ease;
}
.rating__badge.is-set { color: #fff; border-color: transparent; }
.rating__range {
  width: 100%;
  height: 8px;
  cursor: pointer;
  accent-color: var(--accent);
}
.rating__scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

/* ---------- Note ---------- */
.note { border-top: 1px dashed var(--border); padding-top: 10px; }
.note summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand); list-style: none; }
.note summary::-webkit-details-marker { display: none; }
.note summary::before { content: "＋ "; }
.note[open] summary::before { content: "－ "; }
.note textarea {
  width: 100%;
  margin-top: 8px;
  font: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  background: var(--surface-2);
}
.note textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }

/* ---------- Submit bar (sticky) ---------- */
.submit-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.submit-bar strong { display: block; font-size: 15px; }
.submit-bar span { font-size: 13px; color: var(--muted); }

.primary-button {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  padding: 13px 26px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--brand), #4f46e5);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.primary-button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }
.primary-button:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }

.secondary-button {
  appearance: none;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.secondary-button:hover { border-color: var(--brand); transform: translateY(-1px); }

/* ---------- Thank you ---------- */
.thank-you {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.thank-you h2 { margin: 0; }
.ranking-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ranking-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.ranking-list li:first-child {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb, #fff);
}
.rank-pos { font-weight: 800; color: var(--brand); min-width: 26px; }
.ranking-list strong { flex: 1; }
.rank-score {
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 14px;
}

/* ---------- Preview modal ---------- */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}
.preview-modal[hidden] { display: none; }
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: #0f172a;
  color: #fff;
}
.preview-toolbar span { display: block; font-size: 12px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.preview-toolbar strong { font-size: 17px; }
.preview-actions { display: flex; gap: 10px; }
.preview-actions .secondary-button { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
#previewFrame { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 90vw;
  padding: 12px 20px;
  background: #0f172a;
  color: #fff;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}
.toast[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .survey-shell { padding: 20px 14px 88px; }
  .intro-panel { grid-template-columns: 1fr; padding: 22px; }
  .progress-card { flex-direction: row; align-items: center; justify-content: space-between; }
  .cards-grid { grid-template-columns: 1fr; }
  /* Mobil: kompaktní lišta (jeden řádek), ať nezabírá třetinu obrazovky a netlačí
     se na hodnocení. Verbose „Chybí…" skryt — počet je v horní kartě, stav nese
     i (de)aktivované tlačítko. */
  .submit-bar { gap: 10px; padding: 9px 12px; bottom: 8px; }
  .submit-bar #submitDetail { display: none; }
  .submit-bar > div { min-width: 0; }
  .submit-bar strong { font-size: 12.5px; line-height: 1.25; }
  .primary-button { flex: 0 0 auto; padding: 11px 18px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .design-card { animation: none; }
  * { transition: none !important; }
}
