:root {
  --pozadi: #f6f5f1;
  --karta: #ffffff;
  --text: #1d1c1a;
  --tlumeny: #6d6a63;
  --linka: #e2dfd7;
  --akcent: #2f6fde;
  --akcent-text: #ffffff;
  --chyba: #c23b2a;
  --ok: #23824a;
  --zaobleni: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pozadi: #161615;
    --karta: #222220;
    --text: #f1efe9;
    --tlumeny: #a19e96;
    --linka: #34332f;
    --akcent: #5b8ff0;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--pozadi);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 1.35rem; margin: 0; letter-spacing: -0.01em; }
button, input, select, .cip, .hlavni { font: inherit; color: inherit; }
input, select {
  border: 1px solid var(--linka);
  background: var(--karta);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  min-height: 44px;
  width: 100%;
}
label { display: grid; gap: 0.3rem; font-size: 0.92rem; color: var(--tlumeny); }
button { cursor: pointer; }
.hlavni {
  background: var(--akcent);
  color: var(--akcent-text);
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
  min-height: 44px;
}
.hlavni:disabled { opacity: 0.6; }
.velke { width: 100%; padding: 0.95rem 1.2rem; font-size: 1.05rem; }
.tichy {
  background: none;
  border: 0;
  color: var(--akcent);
  padding: 0.6rem 0.4rem;
  min-height: 44px;
  text-align: left;
}
.nebezpecne { color: var(--chyba); }
.cip {
  border: 1px solid var(--linka);
  background: var(--karta);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}
.cip[aria-pressed="true"] { background: var(--akcent); color: var(--akcent-text); border-color: var(--akcent); }
.souborove { position: relative; display: inline-flex; justify-content: center; align-items: center; cursor: pointer; }
.souborove input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.karta {
  background: var(--karta);
  border: 1px solid var(--linka);
  border-radius: var(--zaobleni);
  padding: 1rem;
}
.karta.vnorena { background: var(--pozadi); }
details.karta > summary { font-weight: 650; cursor: pointer; list-style: none; }
details.karta > summary::after { content: "▾"; float: right; color: var(--tlumeny); }
details.karta:not([open]) > summary::after { content: "▸"; }
details.karta[open] > summary { margin-bottom: 0.7rem; }
details.karta > * + * { margin-top: 0.6rem; }
.napoveda, .maly { color: var(--tlumeny); font-size: 0.88rem; margin: 0.4rem 0; }
.chyba { color: var(--chyba); font-size: 0.92rem; min-height: 1.2em; }
.chyba.ok { color: var(--ok); }
.radek { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.radek > span { color: var(--tlumeny); font-size: 0.92rem; margin-right: auto; }

/* ----- Správa ----- */
.obrazovka { max-width: 1200px; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) 16px calc(1.5rem + env(safe-area-inset-bottom)); }
.uzka { max-width: 420px; padding-top: 18vh; }
.uzka form { display: grid; gap: 0.8rem; margin-top: 1.2rem; }
.lista { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.lista h1 { margin-right: auto; }
.mrizka { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.model { display: grid; gap: 0.25rem; text-align: left; padding: 0.6rem; }
.model img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 9px; background: var(--pozadi); }
.model b { margin-top: 0.3rem; }
.prazdno { color: var(--tlumeny); text-align: center; padding: 3rem 1rem; max-width: 460px; margin: 0 auto; }
.paticka { display: flex; justify-content: space-between; margin-top: 2rem; }

.editor .lista .nazev { font-size: 1.1rem; font-weight: 650; border-color: transparent; background: transparent; }
.editor .lista .nazev:focus { border-color: var(--linka); background: var(--karta); }
.editor-telo { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .editor-telo { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .nahled3d { position: sticky; top: 1rem; height: calc(100vh - 6rem) !important; }
}
.nahled3d {
  position: relative;
  height: 52vh;
  min-height: 300px;
  border-radius: var(--zaobleni);
  overflow: hidden;
  background: #f1f0ec;
  border: 1px solid var(--linka);
}
.nahled3d canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.nahled-prazdne {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 1rem;
  padding: 1.5rem; text-align: center; color: #5d5a53;
  background: #f1f0ec;
}
.nahled-prazdne p { font-size: 0.9rem; max-width: 420px; margin: 0 auto; }
.prace {
  position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.82); color: #fff; border-radius: 999px;
  padding: 0.5rem 1rem; display: flex; gap: 0.6rem; align-items: center; font-size: 0.92rem;
}
.tocitko { width: 16px; height: 16px; border: 2px solid #fff6; border-top-color: #fff; border-radius: 50%; animation: toc 0.8s linear infinite; }
@keyframes toc { to { transform: rotate(360deg); } }
.panel { display: grid; gap: 0.8rem; }
.velke-cislo { font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0; }
.prepinac { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.prepinac button {
  border: 1px solid var(--linka); background: var(--pozadi); border-radius: 10px; min-height: 44px; font-weight: 600;
}
.prepinac button[aria-pressed="true"] { background: var(--akcent); border-color: var(--akcent); color: var(--akcent-text); }
.ulozit { position: sticky; bottom: 0; padding: 0.6rem 0 calc(0.4rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--pozadi) 30%); }
.ulozit .chyba { text-align: center; margin: 0.4rem 0 0; }

.skupina { display: grid; gap: 0.4rem; margin-bottom: 0.7rem; }
.skupina .s-nazev { font-weight: 600; flex: 1; }
.s-materialy { display: grid; gap: 0.15rem; max-height: 220px; overflow: auto; }
.material { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-size: 0.92rem; min-height: 36px; cursor: pointer; }
.material input { width: 20px; min-height: 0; height: 20px; flex: none; }
.vzorek { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--linka); flex: none; background-size: cover; background-position: center; }
.vzorek.velky { width: 44px; height: 44px; border-radius: 10px; font-size: 1.1rem; background-color: var(--karta); padding: 0; }
.moznost { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; padding: 0.3rem 0; border-top: 1px solid var(--linka); }
.moznost > input:not([type]) { flex: 1; min-width: 110px; width: auto; }
.moznost input[type="color"] { width: 44px; height: 44px; padding: 2px; flex: none; }
.moznost select { width: auto; }
.moznost label { display: inline-flex; align-items: center; gap: 0.3rem; }
.moznost label input { width: 74px; }
.sdileni { display: grid; grid-template-columns: 120px 1fr; gap: 0.9rem; align-items: center; }
.sdileni .radek { margin-top: 0.5rem; }
.qr svg, .qr-blok svg { width: 100%; height: auto; display: block; background: #fff; border-radius: 8px; }

/* ----- Prohlížeč pro klienta ----- */
.rezim-prohlizec { background: #ecebe7; overflow: hidden; }
.prohlizec { position: fixed; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.mv-obal { position: relative; min-height: 0; }
model-viewer { width: 100%; height: 100%; background: #ecebe7; --poster-color: #ecebe7; }
.koty-cary { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.koty-cary line { stroke: #1d1c1a; stroke-width: 1.5; stroke-dasharray: 4 3; }
.kota {
  background: #1d1c1a; color: #fff; border-radius: 6px; padding: 2px 7px;
  font: 600 13px/1.3 -apple-system, sans-serif; white-space: nowrap; transform: translateY(-50%); pointer-events: none;
}
.kota-bod { width: 1px; height: 1px; pointer-events: none; }
.list {
  background: var(--karta);
  border-radius: 20px 20px 0 0;
  padding: 1rem 16px calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
  max-height: 55vh;
  overflow: auto;
  max-width: 640px; width: 100%; justify-self: center;
}
.list-hlava { display: flex; gap: 0.8rem; align-items: flex-start; justify-content: space-between; }
.rozmery { margin: 0.2rem 0 0; color: var(--tlumeny); font-size: 0.92rem; }
.p-skupina { margin-top: 0.8rem; }
.p-skupina .maly { margin: 0 0 0.35rem; }
.vzorky { display: flex; gap: 0.5rem; overflow-x: auto; padding: 3px; }
.vzorek-p {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  border: 2px solid var(--linka); background-size: cover; background-position: center; background-color: var(--pozadi);
  font-size: 1.1rem; padding: 0;
}
.vzorek-p[aria-checked="true"] { outline: 3px solid var(--akcent); outline-offset: 2px; }
#p-ar { margin-top: 1rem; }
.qr-blok { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.qr-blok > div { width: 120px; flex: none; }
.qr-blok p { color: var(--tlumeny); font-size: 0.92rem; }

/* Klientovi v prohlížeči modelu nenabízet instalaci správy */
[data-rezim="prohlizec"] .pwas-pruh:not(.pwas-pruh--verze) { display: none !important; }

/* ----- Návod k AR ----- */
.navod {
  border: 0; padding: 1.2rem 16px calc(1rem + env(safe-area-inset-bottom)); width: min(520px, 100%);
  max-height: 92vh; margin: auto auto 0; border-radius: 20px 20px 0 0;
  background: var(--karta); color: var(--text);
}
@media (min-width: 600px) { .navod { margin: auto; border-radius: 20px; } }
.navod::backdrop { background: rgba(0, 0, 0, 0.45); }
.navod h2 { margin: 0 0 0.6rem; font-size: 1.2rem; }
.kroky { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.kroky li { display: grid; grid-template-columns: 44px 1fr; gap: 0.75rem; align-items: start; }
.kroky svg { width: 44px; height: 44px; fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  background: var(--pozadi); border-radius: 12px; padding: 4px; }
.kroky svg .pohyb { stroke: var(--akcent); }
.kroky b { display: block; }
.kroky span { color: var(--tlumeny); font-size: 0.9rem; }
.zaskrtnout { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.zaskrtnout input { width: 20px; height: 20px; min-height: 0; }
.navod .tlacitka { justify-content: flex-end; margin-top: 0.6rem; }
.navod .tlacitka .hlavni { flex: 1; }
.ar-vyzva {
  position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7); color: #fff; padding: 0.6rem 1rem; border-radius: 999px; font-size: 0.95rem; white-space: nowrap;
}
.list-hlava .radek { flex-wrap: nowrap; flex: none; }
.list-hlava .cip { padding: 0.4rem 0.7rem; }
