:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --shadow: 0 10px 25px rgba(2,8,23,.06);
  --radius:18px;
  --radius2:14px;

  --good:#10b981;
  --warn:#f59e0b;
  --bad:#ef4444;
  --cold:#38bdf8;
  --hot:#f97316;
  --accent:#2563eb;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background: radial-gradient(1200px 600px at 20% 0%, #e9efff 0%, transparent 60%),
              radial-gradient(900px 500px at 80% 10%, #eafff6 0%, transparent 55%),
              var(--bg);
}
.wrap{max-width:1120px;margin:0 auto;padding:26px 16px 44px;}
/* App Header - Premium Design */
.appHeader{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:24px;
  align-items:start;
  padding:16px 20px;
  margin:0 0 20px;
  background:linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.98) 100%);
  border-bottom:1px solid rgba(229,231,235,0.8);
  backdrop-filter:blur(10px);
  border-radius:var(--radius);
  box-shadow:0 2px 8px rgba(2,8,23,0.04);
  position:relative;
  z-index:1000;
}
.headerLeft{
  min-width:0;
}
.appHeader h1{
  font-size:clamp(24px, 2.2vw, 32px);
  margin:0 0 4px 0;
  letter-spacing:-0.03em;
  font-weight:700;
  color:var(--text);
}
.headerSubtitle{
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
  max-width:60ch;
}
.headerCenter{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  justify-content:center;
}
.headerRight{
  display:flex;
  align-items:center;
  gap:10px;
}
.contextChip{
  display:flex;
  align-items:center;
  gap:6px;
  padding:6px 12px;
  background:rgba(255,255,255,0.8);
  border:1px solid rgba(229,231,235,0.6);
  border-radius:20px;
  font-size:12px;
  color:var(--text);
  backdrop-filter:blur(6px);
  transition:all 0.2s;
  white-space:nowrap;
}
.contextChip:hover{
  background:rgba(255,255,255,0.95);
  border-color:var(--accent);
  box-shadow:0 2px 6px rgba(37,99,235,0.1);
}
.chipIcon{
  font-size:14px;
  line-height:1;
}
.chipLabel{
  color:var(--muted);
  font-weight:500;
}
.chipValue{
  color:var(--text);
  font-weight:600;
}
.headerAction{
  display:flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  padding:0;
  background:rgba(255,255,255,0.8);
  border:1px solid rgba(229,231,235,0.6);
  border-radius:8px;
  cursor:pointer;
  font-size:16px;
  transition:all 0.2s;
  backdrop-filter:blur(6px);
}
.headerAction:hover{
  background:rgba(255,255,255,0.95);
  border-color:var(--accent);
  box-shadow:0 2px 6px rgba(37,99,235,0.1);
}
@media (max-width:980px){
  .appHeader{
    grid-template-columns:1fr;
    gap:16px;
  }
  .headerCenter{
    justify-content:flex-start;
  }
  .headerRight{
    justify-content:flex-end;
  }
}
@media (max-width:640px){
  .appHeader{
    padding:12px 16px;
  }
  .headerCenter{
    gap:6px;
  }
  .contextChip{
    font-size:11px;
    padding:5px 10px;
  }
}
.pillrow{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.pill{
  border:1px solid var(--border);
  background: rgba(255,255,255,.7);
  padding:8px 10px;border-radius:999px;
  font-size:12px;color:var(--muted);
  box-shadow: 0 6px 18px rgba(2,8,23,.04);
  backdrop-filter: blur(6px);
}

.grid{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap:16px;
  align-items:start;
}
@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .hd{
  padding:16px 16px 12px;
  border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:10px;
}
.card .hd h2{margin:0;font-size:14px;letter-spacing:.01em}
.card .bd{padding:16px}
.hint{font-size:12px;color:var(--muted);line-height:1.4;margin-top:6px}

/* Unit Switch Toggle */
.unitSwitch{
  position:relative;
  display:inline-block;
  width:70px;
  height:28px;
  cursor:pointer;
}
.unitSwitch input{
  opacity:0;
  width:0;
  height:0;
}
.unitSwitchSlider{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background-color:#e5e7eb;
  border:1px solid var(--border);
  border-radius:999px;
  transition:0.3s;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 4px;
}
.unitSwitchSlider:before{
  content:"KM";
  position:absolute;
  height:20px;
  width:32px;
  left:3px;
  bottom:3px;
  background-color:#fff;
  border-radius:999px;
  transition:0.3s;
  box-shadow:0 2px 4px rgba(0,0,0,0.1);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  font-weight:600;
  color:var(--text);
}
.unitSwitch input:checked + .unitSwitchSlider:before{
  content:"MI";
  left:calc(100% - 35px);
  transform:translateX(0);
}
.unitSwitchLabel{
  display:none;
}

label{display:block;font-size:12px;color:var(--muted);margin:0 0 6px}
select,input[type="number"],input[type="text"]{
  width:100%;
  border:1px solid var(--border);
  border-radius: 12px;
  padding:10px 12px;
  font-size:14px;
  background:#fff;
  outline:none;
}
select:disabled,input[type="number"]:disabled,input[type="text"]:disabled{
  background:#f8fafc;
  color:var(--muted);
  cursor:not-allowed;
  opacity:0.6;
}
input[type="checkbox"]{
  width:auto;
  margin-right:6px;
  cursor:pointer;
}

/* Advanced Settings Collapsible */
.advancedSection{
  margin-top:16px;
  border-top:1px solid var(--border);
  padding-top:16px;
}
.advancedToggle{
  width:100%;
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  cursor:pointer;
  font-size:14px;
  color:var(--text);
  transition:background 0.2s;
}
.advancedToggle:hover{
  background:#f8fafc;
}
.advancedToggleIcon{
  margin-left:auto;
  transition:transform 0.2s;
  font-size:12px;
}
.advancedToggle[aria-expanded="true"] .advancedToggleIcon{
  transform:rotate(180deg);
}
.advancedContent{
  margin-top:12px;
  animation:fadeIn 0.2s;
}
@keyframes fadeIn{
  from{opacity:0;transform:translateY(-4px)}
  to{opacity:1;transform:translateY(0)}
}
input[type="range"]{width:100%}
.row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.row3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}
.mt12{margin-top:12px}
.mt16{margin-top:16px}
.mt6{margin-top:6px}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}

.btnrow{display:flex;gap:10px;flex-wrap:wrap}
button{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  font-size:13px;
  cursor:pointer;
}
button.primary{
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color:#fff;border:none;
}
button:active{transform: translateY(1px)}

/* Share Button - Responsive */
#shareButton{
  font-size:17px;
  padding:13px 24px;
  min-width:200px;
  width:100%;
  max-width:400px;
  font-weight:600;
  transition:all 0.2s;
}
@media (min-width: 640px){
  #shareButton{
    font-size:18px;
    padding:14px 32px;
    min-width:250px;
    max-width:450px;
  }
}
@media (min-width: 980px){
  #shareButton{
    font-size:19px;
    padding:15px 40px;
    min-width:280px;
    max-width:500px;
  }
}
@media (max-width: 480px){
  #shareButton{
    font-size:16px;
    padding:12px 20px;
    min-width:180px;
    max-width:100%;
  }
}
.small{font-size:12px;color:var(--muted)}

/* Temperature visual */
.tempCard{
  padding:14px 16px 16px;
}
.tempHeader{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:10px;
  align-items:center;
  margin-bottom:10px;
}
.tempSide{
  display:flex;gap:10px;align-items:center;
}
.tempIcon{
  width:34px;height:34px;border-radius:12px;
  display:grid;place-items:center;
  border:1px solid var(--border);
  background: rgba(255,255,255,.7);
}
.tempSide b{font-size:14px}
.tempSide .lbl{font-size:12px;color:var(--muted);margin-top:2px}
.tempCenter{
  text-align:center;
  display:flex;flex-direction:column;align-items:center;gap:6px;
}
.tempChip{
  display:inline-flex;gap:8px;align-items:center;
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  box-shadow: 0 8px 20px rgba(2,8,23,.06);
  font-weight:650;
}
.tempScale{
  position:relative;
  height:14px;border-radius:999px;
  /* Gradient: červená (35°C vlevo) -> zelená (23°C uprostřed) -> modrá (-10°C vpravo) */
  /* Rozsah: 35°C (vlevo 0%) -> 23°C (~27%) -> -10°C (vpravo 100%) */
  /* Pozice 23°C: (35 - 23) / (35 - (-10)) = 12/45 = 26.7% */
  background: linear-gradient(90deg, #b91c1c 0%, #dc2626 5%, #ef4444 10%, #f59e0b 15%, #fbbf24 20%, #22c55e 27%, #84cc16 30%, #60a5fa 40%, #3b82f6 60%, #2563eb 80%, #1e40af 100%);
  border:1px solid var(--border);
  overflow:hidden;
}
.tick{
  position:absolute;top:0;bottom:0;width:2px;background:rgba(255,255,255,.75);
  transform: translateX(-1px);
}
.tickLabel{
  position:absolute;top:18px;transform: translateX(-50%);
  font-size:11px;color:var(--muted);
}

.tempSliderWrap{
  margin-top:12px;
  position:relative;
  height:42px;
}
.tempSliderTrack{
  position:absolute;
  top:50%;
  left:0;
  right:0;
  height:10px;
  transform:translateY(-50%);
  border-radius:999px;
  /* Gradient: červená (35°C vlevo) -> zelená (23°C uprostřed) -> modrá (-10°C vpravo) */
  /* Rozsah: -10°C (vlevo 0%) -> 23°C (~73%) -> 35°C (vpravo 100%) */
  /* Otočíme pomocí CSS transform scaleX(-1) */
  background: linear-gradient(90deg, #1e40af 0%, #2563eb 20%, #3b82f6 40%, #60a5fa 50%, #84cc16 70%, #22c55e 73%, #fbbf24 80%, #f59e0b 85%, #ef4444 90%, #dc2626 95%, #b91c1c 100%);
  transform: translateY(-50%) scaleX(-1);
  border:1px solid var(--border);
  pointer-events:none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.08);
}
.tempSliderTrack .sliderTick{
  position:absolute;
  top:0;
  bottom:0;
  width:1.5px;
  background:rgba(255,255,255,.85);
  transform:translateX(-50%);
  box-shadow: 0 0 2px rgba(0,0,0,.1);
}
.tempSliderWrap input[type="range"]{
  position:relative;
  z-index:2;
  -webkit-appearance:none;
  appearance:none;
  width:100%;
  height:42px;
  background: transparent;
  margin:0;
  cursor:pointer;
}
.tempSliderWrap input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:32px;
  height:32px;
  border-radius:50%;
  background: transparent;
  border:none;
  box-shadow:none;
  cursor:grab;
  position:relative;
  z-index:3;
  margin-top:-11px; /* Vycentrování vůči tracku: (32px - 10px) / 2 = 11px */
}
.tempSliderWrap input[type="range"]::-webkit-slider-thumb:hover{
  cursor:grab;
}
.tempSliderWrap input[type="range"]::-webkit-slider-thumb:active{
  cursor:grabbing;
}
.tempSliderWrap input[type="range"]::-moz-range-thumb{
  width:32px;
  height:32px;
  border-radius:50%;
  background: transparent;
  border:none;
  box-shadow:none;
  cursor:grab;
  position:relative;
  z-index:3;
}
.tempSliderWrap input[type="range"]::-moz-range-thumb:hover{
  cursor:grab;
}
.tempSliderWrap input[type="range"]::-moz-range-thumb:active{
  cursor:grabbing;
}
.tempSliderWrap input[type="range"]::-webkit-slider-runnable-track{
  background:transparent;
  height:10px;
  margin-top:16px; /* Vycentrování: (42px - 10px) / 2 = 16px */
}
.tempSliderWrap input[type="range"]::-moz-range-track{
  background:transparent;
  height:10px;
}
.sliderThumb{
  position:absolute;
  top:50%;
  left:0;
  transform:translate(-50%, -50%);
  width:32px;
  height:32px;
  border-radius:50%;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border:3px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.15), 0 0 0 3px rgba(255,255,255,.9);
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  z-index:4;
  transition: left 0.1s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.tempSliderWrap input[type="range"]:hover + .sliderThumb{
  transform:translate(-50%, -50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,.2), 0 0 0 3px rgba(255,255,255,.9);
}
.tempSliderWrap input[type="range"]:active + .sliderThumb{
  transform:translate(-50%, -50%) scale(1.15);
  box-shadow: 0 6px 16px rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.9);
}
.sliderThumbIcon{
  font-size:16px;
  color:var(--text);
  font-weight:600;
  line-height:1;
}
.tempNoteBox{
  margin-top:10px;
  border-radius: 14px;
  background: rgba(248,250,252,.6);
  border: 1px dashed rgba(100,116,139,.35);
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.tempNoteLabel{
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}
.tempNoteBox .mono{
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
}

/* Results table */
table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow:visible;
  border:1px solid var(--border);
  border-radius: var(--radius);
  background:#fff;
}
thead th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(248,250,252,.95), rgba(248,250,252,.75));
}
tbody td{
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
  position:relative;
  overflow:visible;
}
tbody tr:last-child td{border-bottom:none}
.rlabel{
  display:flex;align-items:center;gap:10px;
  font-weight:650;
}
.iconBox{
  width:28px;height:28px;border-radius:10px;
  display:grid;place-items:center;
  border:1px solid var(--border);
  background: rgba(255,255,255,.7);
}
.cellMain{font-weight:800;font-size:16px}
.cellSub{font-size:11px;color:var(--muted);margin-top:2px}
.cellUncertainty{
  font-size:10px;
  color:var(--muted);
  margin-top:4px;
  opacity:0.8;
}
.emphCol{
  background: rgba(16,185,129,.10);
  position:relative;
  padding-bottom:24px;
}
.emphCol.is-scenario-cell{
  background: rgba(16,185,129,.18);
  border:3px solid #f97316;
  border-radius:8px;
}
.scenarioBadge{
  position:absolute;
  bottom:-14px;
  left:50%;
  transform:translateX(-50%);
  background:#f97316;
  color:#fff;
  font-size:12px;
  font-weight:600;
  padding:5px 14px;
  border-radius:14px;
  white-space:nowrap;
  z-index:10;
  box-shadow:0 2px 6px rgba(0,0,0,0.25);
  display:block;
}
.kpiRow{
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap:12px;
  margin-top:12px;
}
@media (max-width: 980px){
  .kpiRow{grid-template-columns:1fr}
}
.kpi{
  border:1px solid var(--border);
  border-radius: var(--radius2);
  background: rgba(255,255,255,.7);
  padding:12px 12px;
}
.kpi .t{font-size:12px;color:var(--muted)}
.kpi .v{font-size:20px;font-weight:850;margin-top:4px}
.kpi .s{font-size:12px;color:var(--muted);margin-top:4px;line-height:1.35}

.warnbox{
  margin-top:12px;
  border-radius: 14px;
  border:1px dashed rgba(100,116,139,.35);
  padding:12px 12px;
  color: var(--muted);
  font-size:12px;
  line-height:1.5;
  background: rgba(248,250,252,.6);
}

footer{
  margin-top:18px;
  color:var(--muted);
  font-size:12px;
  line-height:1.55;
}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

/* Share Modal */
.modal{
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
}
.modalOverlay{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,0.5);
  backdrop-filter:blur(2px);
}
.modalContent{
  position:relative;
  background:var(--card);
  border-radius:var(--radius);
  padding:24px;
  max-width:500px;
  width:90%;
  max-height:90vh;
  overflow-y:auto;
  box-shadow:var(--shadow);
  z-index:1001;
}
.modalContent h3{
  margin:0 0 8px 0;
  font-size:20px;
  font-weight:700;
}
.modalContent p{
  margin:0 0 16px 0;
  color:var(--muted);
  font-size:14px;
}
@media (max-width:640px){
  .modalContent{
    padding:20px;
    width:95%;
  }
}

/* Language Switcher */
.languageSwitcher{
  position:relative;
}
.languageButton{
  display:flex;
  align-items:center;
  gap:6px;
  padding:6px 12px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:8px;
  cursor:pointer;
  font-size:13px;
  font-weight:500;
  color:var(--text);
  transition:all 0.2s;
}
.languageButton:hover{
  background:rgba(248,250,252,0.8);
  border-color:var(--accent);
}
.languageButton:focus{
  outline:2px solid var(--accent);
  outline-offset:2px;
}
.languageDropdown{
  position:absolute;
  top:calc(100% + 4px);
  right:0;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:8px;
  box-shadow:var(--shadow);
  min-width:200px;
  max-height:400px;
  overflow-y:auto;
  z-index:10000;
  display:none !important;
  flex-direction:column;
}
.languageDropdown.open{
  display:flex !important;
}
.languageDropdownItem{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  cursor:pointer;
  font-size:13px;
  color:var(--text);
  transition:background 0.15s;
  border:none;
  background:none;
  width:100%;
  text-align:left;
  font-family:inherit;
}
.languageDropdownItem:hover,
.languageDropdownItem:focus{
  background:rgba(248,250,252,0.8);
  outline:none;
}
.languageDropdownItem[aria-selected="true"]{
  background:rgba(37,99,235,0.1);
  font-weight:600;
}

