:root {
  color-scheme: light;
  --blue: #163292;
  --paper: #e9e0cf;
  --ink: #06266f;
  --red: #c41711;
  --light: #eee7d8;
  --form: #fffbf0;
  --muted: #0b3689;
  --line: color-mix(in srgb, var(--ink) 18%, var(--paper));
  font: 400 16px/1.5 "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
  background: var(--blue);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.55; }
button, input, textarea, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }
h1, h2, p { margin: 0; }

.app { height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
.site-header { flex-shrink: 0; background: var(--paper); }
.header-inner {
  width: min(100%, 1200px);
  margin: 0 auto;
  min-height: 94px;
  padding: 23px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}
.logo { display: block; width: 197px; max-width: 100%; height: auto; }
#nova {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
}
#nova:hover:not(:disabled) { background: var(--light); }

.page-layout {
  --edge: 35px;
  width: 100%;
  margin: 0;
  padding: 28px 0 32px;
  display: grid;
  /* Stejná mezera vlevo, mezi výšivkou a chatem i vpravo. Chat (1fr) bere zbytek šířky. */
  grid-template-columns: var(--edge) max-content var(--edge) minmax(0, 1fr) var(--edge);
  column-gap: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}
.heritage { grid-column: 2; min-width: 0; min-height: 0; overflow: auto; padding: 31px 0 0; display: flex; color: var(--paper); }
.heritage-mark { width: max-content; max-width: 100%; display: flex; flex-direction: column; gap: 72px; }
#slogan { font-size: clamp(2.6rem, 5.6vw, 3.7rem); font-weight: 600; line-height: 1.03; letter-spacing: -0.047em; }
#slogan span { display: block; width: max-content; white-space: nowrap; }
/* Only the slogan contributes intrinsic width; the image follows "Minulost". */
.embroidery-frame { width: 100%; aspect-ratio: 300 / 305; position: relative; margin-top: auto; flex-shrink: 0; }
.embroidery { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }

.chat-panel {
  grid-column: 4;
  min-width: 0;
  min-height: 0;
  padding: 39px 35px 27px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border-radius: 19px;
}
#bot { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
#uvod h2 { font-size: 2.75rem; line-height: 1.08; font-weight: 500; letter-spacing: -0.043em; }
.podnety { margin-top: 37px; }
.podnet {
  width: 100%;
  padding: 17px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
}
.podnet:last-child { border-bottom: 1px solid var(--line); }
.podnet > span:last-child { flex-shrink: 0; font-size: 1.3rem; }
.podnet:hover:not(:disabled) { color: var(--red); }

.compose-area { flex-shrink: 0; margin-top: auto; padding-top: 36px; }
.composer { padding: 12px 12px 12px 16px; background: var(--form); border: 1px solid var(--line); border-radius: 12px; }
.composer label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.compose-row { display: flex; align-items: center; gap: 12px; }
#zprava {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 44px;
  max-height: 240px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.5;
  resize: vertical;
}
#zprava::placeholder { color: var(--muted); opacity: 1; }
#zprava:focus,
#zprava:focus-visible,
#heslo:focus,
#heslo:focus-visible { outline: none; }
#odeslat, #vstoupit { border: 0; background: var(--red); color: var(--form); }
#odeslat { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; font-size: 1.6rem; line-height: 1; }
#odeslat:hover:not(:disabled), #vstoupit:hover:not(:disabled) { background: #b30a08; }
.verification:not(:empty) { margin-top: 14px; }
.privacy { margin-top: 14px; color: var(--muted); font-size: 0.75rem; line-height: 1.65; }
.chyba-form { margin-top: 14px; color: var(--red); font-size: 0.85rem; line-height: 1.65; }

#vlakno { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 27px; }
#vlakno > li { min-width: 0; overflow-wrap: anywhere; }
#vlakno > .user { width: fit-content; max-width: 91%; margin-left: auto; padding: 12px 17px; border-radius: 12px 12px 3px 12px; background: var(--light); font-size: 0.9rem; }
#vlakno > .user p { white-space: pre-wrap; }
.autor { display: flex; align-items: center; gap: 7px; margin-bottom: 13px; font-size: 0.75rem; font-weight: 600; }
.autor::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
#vlakno > .ceka { color: var(--muted); }
@keyframes premysli {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-2px); }
}
#vlakno > .ceka .autor::before { animation: premysli 0.9s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  #vlakno > .ceka .autor::before { animation: none; }
}
.odpoved { min-width: 0; overflow-x: auto; font-size: 0.95rem; line-height: 1.75; }
.odpoved > :first-child { margin-top: 0; }
.odpoved > :last-child { margin-bottom: 0; }
.odpoved p { margin: 0.65rem 0; }
.odpoved h1, .odpoved h2, .odpoved h3, .odpoved h4 { font-size: 1.3rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; margin: 1.2rem 0 0.6rem; }
.odpoved ul, .odpoved ol { margin: 0.65rem 0; padding-left: 1.4rem; }
.odpoved li { margin: 0.3rem 0; }
.odpoved table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; font-size: 0.85rem; }
.odpoved th, .odpoved td { border-bottom: 1px solid var(--line); padding: 0.45rem 0.65rem; text-align: left; vertical-align: top; }
.odpoved th:first-child, .odpoved td:first-child { padding-left: 0; }
.odpoved a { color: var(--ink); text-underline-offset: 3px; }
.odpoved a:hover { color: var(--red); }
.odpoved pre { white-space: pre-wrap; }

.hodnoceni { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hodnoceni .otazka { width: 100%; margin: 0; color: var(--muted); font-size: 0.8rem; }
.hodnoceni button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 12px;
}
.hodnoceni button[aria-pressed="true"] { border-color: var(--red); color: var(--red); }
.hodnoceni form { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 4px; }
.hodnoceni select, .hodnoceni textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--form);
  color: var(--ink);
}
.hodnoceni form button { align-self: flex-start; background: var(--red); color: var(--form); border: 0; }
.hodnoceni .diky, .hodnoceni .meta { width: 100%; margin: 0; color: var(--muted); font-size: 0.75rem; line-height: 1.5; }
.hodnoceni.ikony form,
.hodnoceni.ikony .doplnit,
.hodnoceni.ikony .otazka { display: none; }

.chart-figure { min-width: 0; margin: 1.4rem 0 0; }
.chart-title { margin: 0 0 0.55rem; font-size: 1.15rem; font-weight: 600; line-height: 1.4; }
.chart-source { margin: 0.45rem 0 0.9rem; color: var(--muted); font-size: 0.75rem; line-height: 1.65; }
.chart-container { position: relative; width: 100%; min-width: 0; height: 320px; }
.chart-container canvas { display: block; max-width: 100%; }
.chart-warning { margin-top: 12px; color: var(--red); font-size: 0.8rem; line-height: 1.65; }
.chart-data { margin-top: 14px; }
.chart-data summary { min-height: 44px; padding: 8px 0; cursor: pointer; font-size: 0.8rem; line-height: 1.5; }
.chart-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 0.8rem; line-height: 1.6; }
.chart-table caption { margin-bottom: 8px; text-align: left; font-size: 0.75rem; }
.chart-table th, .chart-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.chart-table th:first-child, .chart-table td:first-child { padding-left: 0; }
.chart-table tr > :last-child { text-align: right; font-variant-numeric: tabular-nums; }

#dvere { margin: auto 0; min-height: 0; max-height: 100%; overflow: auto; padding: 8px 0 28px; }
#dvere .veta { max-width: 19ch; font-size: 2rem; font-weight: 500; line-height: 1.2; letter-spacing: -0.035em; }
#vstup { margin-top: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
#vstup label { font-size: 0.8rem; font-weight: 500; }
#heslo { width: 100%; max-width: 360px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--form); color: var(--ink); }
#vstoupit { margin-top: 8px; padding: 11px 18px; border-radius: 9px; display: flex; gap: 18px; align-items: center; }
#vstup .chyba-form { margin-top: 7px; }

@media (max-width: 760px) {
  .page-layout { --edge: 27px; padding: 23px 0 26px; }
  #slogan { font-size: 2.7rem; }
  .chat-panel { padding: 32px 26px 24px; }
  #uvod h2 { font-size: 2.35rem; }
  .podnet { font-size: 0.85rem; }
}

@media (max-width: 560px) {
  .header-inner { min-height: 87px; padding: 24px 23px; gap: 16px; }
  .logo { width: 177px; }
  #nova { font-size: 0.75rem; padding: 8px 11px; }
  .page-layout { display: flex; flex-direction: column; padding: 0 13px 15px; }
  .heritage { display: block; flex: none; overflow: visible; padding: 22px 8px 22px; }
  .heritage-mark {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
  }
  #slogan { font-size: 2.25rem; }
  .embroidery-frame { margin: 0; width: min(46%, 168px); flex-shrink: 1; }
  .chat-panel { flex: 1; min-height: 0; padding: 29px 21px 24px; border-radius: 15px; }
  #uvod h2 { font-size: 2.25rem; }
  .podnety { margin-top: 29px; }
  .podnet { padding: 15px 0; gap: 10px; font-size: 0.85rem; }
  .compose-area { padding-top: 30px; }
  .composer { padding: 12px; }
  .compose-row { gap: 9px; }
  .odpoved { font-size: 0.9rem; }
  .odpoved h1, .odpoved h2, .odpoved h3, .odpoved h4 { font-size: 1.2rem; }
  .chart-container { height: 280px; }
  #dvere .veta { font-size: 1.75rem; }
}

@media (pointer: coarse) {
  #nova { min-height: 44px; }
}
