:root { --bg:#0f1115; --panel:#181b22; --user:#2b4a7a; --model:#22262f; --text:#e8eaf0; --muted:#8a90a0; --err:#ff6b6b; --w:270px; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, sans-serif; display: flex; }
#hlavni { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
header { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--panel); }
h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; }
select { background: var(--bg); color: var(--text); border: 1px solid #333; border-radius: 8px; padding: 6px; max-width: 45vw; font: inherit; font-size: 14px; }
main { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bublina { max-width: 85%; padding: 10px 12px; border-radius: 12px; word-wrap: break-word; }
.user .obsah { white-space: pre-wrap; }
.user { align-self: flex-end; background: var(--user); }
.model { align-self: flex-start; background: var(--model); }
.obsah > :first-child { margin-top: 0; } .obsah > :last-child { margin-bottom: 0; }
.obsah p { margin: 0 0 .6em; } .obsah h3, .obsah h4, .obsah h5, .obsah h6 { margin: .6em 0 .3em; }
.obsah ul, .obsah ol { margin: .3em 0 .6em; padding-left: 1.4em; }
.obsah code { background: #0006; padding: 1px 4px; border-radius: 4px; font-size: .9em; }
.obsah pre { background: #0008; padding: 8px; border-radius: 8px; overflow-x: auto; }
.obsah pre code { background: none; padding: 0; }
.obsah a { color: #8fb4ff; }
.chyba { color: var(--err); }
.cas { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
form { display: flex; gap: 8px; padding: 10px; background: var(--panel); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
textarea { flex: 1; resize: none; background: var(--bg); color: var(--text); border: 1px solid #333; border-radius: 10px; padding: 8px; font: inherit; }
button { background: #3b6fd8; color: #fff; border: 0; border-radius: 10px; padding: 8px 14px; font: inherit; cursor: pointer; }
button:disabled { opacity: .5; }
#panel { width: var(--w); background: var(--panel); border-right: 1px solid #262a33; display: flex; flex-direction: column; height: 100%; }
.panel-hlava { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; }
#zavrit, #historie { background: transparent; padding: 4px 8px; }
#seznam { overflow-y: auto; padding: 0 8px 12px; color: var(--muted); font-size: 14px; }
#seznam h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 12px 4px 4px; }
.polozka { display: flex; border-radius: 8px; }
.polozka.aktivni { background: #2a2f3a; }
.otevrit { flex: 1; text-align: left; background: transparent; color: var(--text); padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.smazat { background: transparent; padding: 4px 6px; opacity: .5; font-size: 13px; }
.smazat:hover { opacity: 1; }
#clona { display: none; }
@media (min-width: 801px) { #historie, #zavrit { display: none; } }
@media (max-width: 800px) {
  #panel { position: fixed; z-index: 20; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  body.panel-otevren #panel { transform: none; }
  body.panel-otevren #clona { display: block; position: fixed; inset: 0; background: #0008; z-index: 10; }
  #novy { padding: 8px 10px; font-size: 14px; }
}
#nastaveni-btn { background: transparent; padding: 4px 8px; font-size: 20px; }
#nastaveni { background: var(--panel); border-top: 1px solid #262a33; padding: 10px 14px; display: grid; gap: 10px; font-size: 14px; }
#nastaveni[hidden] { display: none; }
#nastaveni label { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#nastaveni label.radek { justify-content: flex-start; }
#nastaveni select { flex: 1; max-width: 70%; }
#nastaveni input[type=range] { flex: 1; }
#vyzkouset { justify-self: start; }
.pozn { margin: 0; color: var(--muted); font-size: 12px; }
.cist { background: transparent; padding: 0 4px; font-size: 14px; opacity: .7; margin-left: 6px; }
.cist:hover { opacity: 1; }
@media (max-width: 800px) { h1 { font-size: 16px; } }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #3a1d1d; color: #fff; border: 1px solid var(--err); padding: 8px 14px; border-radius: 10px; z-index: 50; font-size: 14px; max-width: 90vw; }
#hlas-diag { font-family: ui-monospace, monospace; word-break: break-all; }
.cloud-radek { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#cloud-btn { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
.auth-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #3a3a3a; color: #bbb; white-space: nowrap; flex-shrink: 0; }
.auth-badge-ok { background: #1a5c2e; color: #b6f0c8; }
.cloud-radek #cloud-stav { flex: 1; min-width: 0; }
#sync-ikona { font-size: 13px; color: var(--muted); }

/* Nápady a paměť */
#napady-panel summary { cursor: pointer; font-weight: 600; }
#napady-panel h4 { margin: 10px 0 4px; }
.napady-filtr { display: flex; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
#napady-seznam, #fakta-seznam { display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; }
.napad { display: flex; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 6px; background: rgba(255,255,255,0.04); }
.napad-text { flex: 1; word-break: break-word; }
.napad-hotovy .napad-text, .napad-zahozeny .napad-text { opacity: 0.55; }
.napad-zahozeny .napad-text { text-decoration: line-through; }
.napad button { padding: 2px 6px; }
.tlacitko { cursor: pointer; border: 1px solid #3a3f4b; border-radius: 6px; padding: 4px 10px; }

/* Karty nápadů v chatu */
.karty { display: grid; gap: 6px; margin-top: 8px; }
.karta { border: 1px solid #3a3f4b; border-radius: 8px; padding: 8px 10px; background: rgba(255,255,255,0.03); display: grid; gap: 4px; }
.karta-text { all: unset; cursor: pointer; font-weight: 600; word-break: break-word; }
.karta-text:hover, .karta-text:focus-visible { text-decoration: underline; }
.karta-meta { font-size: 12px; opacity: 0.75; }
.karta-akce { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.karta-akce a { color: inherit; }
.karta.smazana { opacity: 0.5; font-style: italic; }
.karta.napad-hotovy, .karta.napad-zahozeny { opacity: 0.6; }
.napad.zvyrazneni { outline: 2px solid #4dabf7; }

/* Přihlašovací modal */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: #000a; padding: 16px; }
.modal[hidden] { display: none !important; }
.modal-panel { background: var(--panel); border: 1px solid #333; border-radius: 14px; padding: 18px 20px; max-width: 420px; width: 100%; display: grid; gap: 12px; box-shadow: 0 12px 40px #0008; }
.modal-panel h2 { margin: 0; font-size: 18px; }
.modal-text { margin: 0; color: var(--muted); font-size: 14px; }
.modal-akce { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tlacitko-sekundarni { background: #2a2f3a; }
.toast-ok { background: #1d3a2a; border-color: #3d8f5f; }
