@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,500;0,600;0,700;0,800;1,500;1,600&display=swap');

:root {
  --bg: #EFF9F0;
  --panel: #ffffff;
  --ink: #26332b;
  --muted: #6b7568;

  --dark: #353D2F;
  --green: #74B645;
  --green-text: #4B762D;
  --green-light: #E3F2DC;
  --gold: #F7E08D;
  --green-soft: #A7D289;

  --border: #dfe3da;

  /* pět prvků - barevné rozlišení orgánů (funkční systém, ne značka appky) */
  --wood: #3F6B4A;   --wood-bg: #EAF1EA;
  --fire: #A6412F;   --fire-bg: #F6E7E3;
  --earth: #A97A2E;  --earth-bg: #F5EDDD;
  --metal: #5B6470;  --metal-bg: #EAECEE;
  --water: #2F5770;  --water-bg: #E4EEF2;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; cursor: pointer; }

/* ---- Header ---- */
header {
  background: var(--panel);
  color: var(--ink);
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.header-inner { max-width: 900px; margin: 0 auto; }
.header-brand { display: flex; align-items: center; gap: 12px; background: none; border: none; padding: 0; text-align: left; width: 100%; }
.header-logo { height: 40px; width: 40px; flex-shrink: 0; object-fit: contain; }
.header-text { min-width: 0; }
header h1 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--dark); line-height: 1.25; }
header p { margin: 2px 0 0; color: var(--muted); font-size: .76rem; font-weight: 500; }

#updateBanner {
  display: none;
  background: var(--gold); color: var(--dark); text-align: center;
  padding: 10px 14px; font-size: .85rem; font-weight: 500; cursor: pointer;
}

.install-card {
  background: #fff; border: 1.5px solid var(--gold); border-radius: 14px;
  padding: 10px 16px; font-size: .8rem; font-weight: 500; color: var(--dark); margin: 12px auto; max-width: 900px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.install-card button {
  background: var(--dark); color: #fff; border: none; padding: 7px 16px;
  border-radius: 999px; font-size: .78rem; font-weight: 700; font-family: inherit; cursor: pointer;
}
.install-note {
  max-width: 900px; margin: 0 auto 12px; padding: 0 16px;
  font-size: .74rem; color: var(--muted); line-height: 1.4;
}

.loading { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---- Page shells ---- */
.page { max-width: 720px; margin: 0 auto; padding: 40px 20px 60px; }
.narrow-page { max-width: 620px; margin: 0 auto; padding: 60px 20px; }
.page-title { font-size: 1.7rem; font-weight: 800; color: var(--dark); margin: 6px 0; }
.page-sub { color: var(--muted); font-size: .92rem; margin-bottom: 26px; line-height: 1.5; }
.eyebrow { font-size: .74rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.link-btn { background: none; border: none; color: var(--muted); font-size: .85rem; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---- Home ---- */
.home-page { max-width: 900px; padding-top: 56px; }
.hero { text-align: center; margin-bottom: 44px; }
.hero-title { font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 800; color: var(--dark); line-height: 1.15; margin: 14px 0; }
.accent-em { font-style: italic; color: var(--green-text); }
.hero-sub { max-width: 520px; margin: 0 auto; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .home-grid { grid-template-columns: 1fr; } }
.tile {
  border: 1px solid var(--border); border-radius: 18px; padding: 26px 24px; text-align: left;
  background: var(--panel); position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 12px 28px -14px rgba(53,61,47,.25); }
.tile-green::before, .tile-gold::before { content: ""; position: absolute; top: -40px; right: -40px; width: 130px; height: 130px; border-radius: 999px; }
.tile-green::before { background: var(--green-light); }
.tile-gold::before { background: #FBF1D2; }
.tile-eyebrow { font-size: 11.5px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; position: relative; }
.tile-green .tile-eyebrow { color: #4C7A2E; }
.tile-gold .tile-eyebrow { color: #8A6D1E; }
.tile-title { font-size: 1.35rem; font-weight: 800; margin: 9px 0; color: var(--dark); position: relative; }
.tile-desc { font-size: .85rem; color: var(--muted); line-height: 1.5; position: relative; max-width: 280px; }
.tile-cta { margin-top: 16px; font-weight: 700; position: relative; }
.tile-green .tile-cta { color: #4C7A2E; }
.tile-gold .tile-cta { color: #8A6D1E; }
.element-legend { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 40px 0 20px; }
.element-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.element-legend-item .dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

/* ---- Sekce dotazníku ---- */
.section-card { border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; background: var(--panel); overflow: hidden; }
.section-head { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; background: none; border: none; font-size: .92rem; font-weight: 700; text-align: left; color: var(--ink); }
.section-head-left { display: flex; align-items: center; gap: 10px; }
.section-head-right { display: flex; align-items: center; gap: 10px; }
.section-num { width: 22px; height: 22px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.tag-optional { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.badge-count { background: var(--dark); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.chevron { transition: transform .15s; display: inline-block; }
.chevron-open { transform: rotate(180deg); }
.section-body { padding: 0 18px 18px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 7px 14px; border-radius: 999px; font-size: .85rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink);
  font-weight: 500; transition: all .15s ease;
}
.pill:hover { border-color: var(--green-soft); }
.pill-active { background: var(--dark); border-color: var(--dark); color: #fff; }

.sticky-bar {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #fff; border-radius: 999px; padding: 12px 12px 12px 22px;
  display: flex; align-items: center; gap: 16px; box-shadow: 0 14px 30px -10px rgba(0,0,0,.35); z-index: 20;
  font-size: .85rem; max-width: calc(100vw - 32px);
}
.primary-btn { background: var(--green); color: var(--dark); border: none; border-radius: 999px; padding: 10px 20px; font-weight: 700; font-size: .85rem; }
.primary-btn:disabled { opacity: .4; cursor: not-allowed; }
.sticky-bar .primary-btn { background: var(--gold); flex-shrink: 0; }

/* ---- Otázky (klastry, anamnéza) ---- */
.question-title { font-size: 1.5rem; font-weight: 700; color: var(--dark); margin: 12px 0 22px; line-height: 1.3; }
.choice-list, .choice-row { display: flex; flex-direction: column; gap: 10px; }
.choice-row { flex-direction: row; }
.choice-btn { text-align: left; padding: 14px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); font-size: .92rem; color: var(--ink); }
.choice-btn:hover { border-color: var(--green); }
.choice-active { border-color: var(--dark); background: var(--dark); color: #fff; }

/* ---- Karty obrazů (výsledek, filtr) ---- */
.result-label { font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.pattern-card-list { display: flex; flex-direction: column; gap: 12px; }
.pattern-card { border: 1.5px solid; border-radius: 16px; width: 100%; text-align: left; display: block; background: var(--panel); }
.pattern-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.element-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 700; font-style: italic; flex-shrink: 0; }
.pattern-card-name { font-weight: 800; color: var(--dark); }
.pattern-card-pinyin { font-style: italic; }
.pattern-card-meta { font-size: .78rem; color: var(--muted); }

.confidence-badge { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 5px 12px; margin-bottom: 10px; }
.confidence-hint { font-size: .82rem; color: var(--muted); line-height: 1.5; margin: 0 0 16px; }

.advisory-banner { background: #FBF1D2; border: 1px solid var(--gold); color: #5C4A1E; border-radius: 14px; padding: 18px 20px; margin: 16px 0 26px; font-size: .85rem; line-height: 1.6; }
.advisory-title { font-weight: 800; font-size: 1rem; color: #5C4A1E; margin-bottom: 6px; }
.advisory-banner ul { margin: 8px 0 0; padding-left: 18px; }

/* ---- Filtr ---- */
.search-input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); font-size: 1rem; background: var(--panel); font-family: inherit; color: var(--ink); }
.search-input:focus { outline: 2px solid var(--dark); }
.browse-box { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; max-height: 420px; overflow-y: auto; background: var(--panel); margin-top: 10px; }
.browse-letter { font-style: italic; font-weight: 700; font-size: .95rem; color: var(--muted); margin-bottom: 6px; }
.browse-item { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 5px 11px; font-size: .78rem; color: var(--ink); }
.browse-item:hover { border-color: var(--dark); }

/* ---- Detail obrazu ---- */
.detail-page { max-width: 680px; }
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.detail-name { font-size: 1.7rem; font-weight: 800; color: var(--dark); line-height: 1.15; }
.detail-pinyin { font-style: italic; font-size: 1.05rem; margin-top: 2px; }
.detail-section { margin-bottom: 24px; }
.detail-section-title { font-size: .74rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 7px; }
.detail-section-body { font-size: .95rem; line-height: 1.65; color: var(--ink); }
.accent-body { padding: 13px 15px; border-radius: 10px; }
.symptom-list { margin: 0; padding-left: 20px; line-height: 1.85; font-size: .95rem; }
.related-chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: .78rem; color: var(--ink); }
.detail-divider { font-size: .74rem; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 34px 0 14px; border-top: 1px solid var(--border); padding-top: 22px; }
.food-pill { border: 1px solid var(--green-soft); background: var(--green-light); color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: .8rem; }
.food-note { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: #F6F0E4; border: 1px solid var(--gold); font-size: .8rem; line-height: 1.6; color: #5C4A1E; }
