/* Baloo 2 – bublinkové písmo s kompletní češtinou (Fredoka neměla č, ě, ř, ů…) */
@font-face {
  font-family: 'Baloo 2'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(assets/fonts/baloo2-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo 2'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(assets/fonts/baloo2-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button { color: #1d2433; }   /* Safari na iPadu jinak barví text tlačítek modře */
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #1f93b0;
  font-family: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif; font-weight: 600; color: #1d2433;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }

.screen {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; background: rgba(5, 40, 60, 0.2);
}
.screen.active { display: flex; }
.hidden { display: none !important; }

.panel {
  background: #fffaf2; border: 5px solid #1d2433; border-radius: 28px;
  box-shadow: 0 10px 0 rgba(0,0,0,0.25); padding: 16px 24px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: min(560px, 100%); max-height: 100%; overflow: auto;
}
.panel.wide { max-width: min(900px, 100%); }
h2 { margin: 0; text-align: center; line-height: 1.05; font-weight: 800; font-size: clamp(26px, 4.5vw, 38px); }

.row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

.btn {
  font: inherit; font-weight: 800; font-size: 24px; line-height: 1.2; color: #1d2433;
  background: #ffd23f; border: 4px solid #1d2433; border-radius: 18px;
  padding: 8px 24px; box-shadow: 0 5px 0 #1d2433; cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #1d2433; }
.btn.big { font-size: 30px; padding: 8px 34px; background: #7ee07e; }
.btn.ghost { background: #fff; }

/* ---------- Intro + logo ---------- */
.intro { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(860px, 100%); }
.logo { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }
#logo-img { width: min(760px, 92vw, calc((100vh - 200px) * 1.4)); height: auto; aspect-ratio: 1712 / 919; filter: drop-shadow(0 8px 0 rgba(0,0,0,0.18)); }

.loader { width: min(420px, 80vw); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.loader-bar { width: 100%; height: 26px; border: 4px solid #1d2433; border-radius: 16px; background: #fffaf2; overflow: hidden; }
.loader-fill { height: 100%; width: 0%; background: repeating-linear-gradient(-45deg, #7ee07e 0 14px, #5fcf6a 14px 28px); transition: width 0.25s; }
.loader-tip { font-size: 20px; color: #fff; text-shadow: 0 2px 0 #1d2433, 0 -2px 0 #1d2433, 2px 0 0 #1d2433, -2px 0 0 #1d2433; }
#btn-play { animation: pulse 1.2s ease-in-out infinite; font-size: 38px; padding: 8px 48px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* ---------- Stavění axolotla ---------- */
.setup { display: flex; gap: 20px; width: min(1180px, 100%); height: 100%; align-items: center; }
.setup-left { flex: 1.1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
#setup-preview { width: 100%; max-width: 640px; height: auto; aspect-ratio: 600 / 380; }
.setup-right { flex: 1; max-width: 520px; align-items: stretch; max-height: 100%; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 20px; font-weight: 800; }
.field input {
  font: inherit; font-size: 24px; text-align: center; flex: 1; min-width: 0; padding: 2px 10px;
  border: 4px solid #1d2433; border-radius: 14px; background: #fff; user-select: text; -webkit-user-select: text; touch-action: manipulation;
}
.color-rows { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 6px; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row > span { width: 84px; flex: none; font-size: 19px; font-weight: 800; }
.swatches { display: flex; flex-wrap: nowrap; gap: 6px; }
.swatch {
  width: clamp(22px, 2.5vw, 30px); height: clamp(22px, 2.5vw, 30px); flex: none; border-radius: 50%; border: 3px solid #1d2433; padding: 0; cursor: pointer;
  touch-action: manipulation; box-shadow: 0 3px 0 #1d2433;
}
.swatch.selected { outline: 4px solid #ff9f1c; outline-offset: 2px; transform: scale(1.12); }

/* ---------- Mapa ---------- */
#screen-map { padding: 0; }
.map { position: absolute; inset: 0; }
.map-top { position: absolute; z-index: 3; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip { background: #fffaf2; border: 4px solid #1d2433; border-radius: 999px; padding: 2px 16px; font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 #1d2433; }
.btn.small { font-size: 18px; padding: 4px 14px; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: 0 5px 0 #1d2433; }
.map-area { position: absolute; inset: 0; overflow: hidden; background: #3fc1d9; }
#map-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
#map-pins { position: absolute; inset: 0; }
.pin {
  position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center;
  font: inherit; background: #fffaf2; border: 4px solid #1d2433; border-radius: 20px; padding: 4px 10px 6px;
  box-shadow: 0 5px 0 #1d2433; cursor: pointer; touch-action: manipulation; min-width: clamp(60px, 8.5vw, 130px);
  padding: clamp(2px, 0.4vw, 4px) clamp(5px, 0.9vw, 10px) clamp(3px, 0.5vw, 6px); border-width: clamp(3px, 0.35vw, 4px);
}
.pin:active { transform: translate(-50%, calc(-50% + 4px)); box-shadow: 0 1px 0 #1d2433; }
.pin-icon { font-size: clamp(20px, 3vw, 40px); line-height: 1.1; }
.pin-name { font-size: clamp(11px, 1.45vw, 20px); font-weight: 800; white-space: nowrap; }
.pin-sub { font-size: clamp(10px, 1.15vw, 15px); font-weight: 700; opacity: 0.75; }
.pin { gap: 1px; }
/* domeček a trénink: velký obrázek z návrhu se září a barevným štítkem */
.pin.home, .pin.training { background: none; border: none; box-shadow: none; padding: 0; min-width: 0; }
.pin.home:active, .pin.training:active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: none; }
.pin-pic {
  display: block; width: clamp(96px, 12vw, 190px); aspect-ratio: 310 / 300;
  background: url(assets/mista.webp) no-repeat; background-size: 200% 100%; background-position: calc(var(--i) * 100%) 0;
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 3px #fff) drop-shadow(0 8px 6px rgba(0,0,0,0.35));
  animation: pin-bob 2.6s ease-in-out infinite;
}
.pin.training .pin-pic { animation-delay: -1.3s; }
@keyframes pin-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.pin-label { margin-top: -8px; display: flex; flex-direction: column; align-items: center; border: 3px solid #1d2433; border-radius: 14px; padding: 2px 12px 3px; box-shadow: 0 4px 0 #1d2433; }
.pin.home .pin-label { background: #7ee07e; }
.pin.training .pin-label { background: #7cc8ff; }
.pin.home .pin-name, .pin.training .pin-name { font-size: clamp(14px, 1.7vw, 19px); }
.pin.home .pin-sub, .pin.training .pin-sub { opacity: 0.85; }
/* závody: zlatá cedule se stužkou nahoře a vlaječkou */
.pin.race { background: linear-gradient(#ffe680, #ffc93c); border-radius: 14px; padding-top: clamp(10px, 1.4vw, 14px); }
.pin-tag {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -60%);
  background: #ff5a4f; color: #fff; border: 3px solid #1d2433; border-radius: 999px;
  font-size: clamp(9px, 1vw, 12px); font-weight: 800; padding: 0 8px; white-space: nowrap; letter-spacing: 0.5px;
}
.pin.home .pin-sub, .pin.training .pin-sub { opacity: 0.8; }
.pin.locked { filter: grayscale(0.8); opacity: 0.75; }
.pin.locked .pin-sub::before { content: ''; display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.2em; margin-right: 2px; background: url(assets/ikony.webp) no-repeat; background-size: 1000% 100%; background-position: calc(4 * 100% / 9) 0; }
.popup { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5, 40, 60, 0.45); z-index: 12; padding: 16px; }
.popup .panel { max-width: min(520px, 100%); }
.popup h3 { margin: 0; font-size: 30px; font-weight: 800; text-align: center; }
.popup p { margin: 0; font-size: 20px; text-align: center; }
.warn { color: #c0392b; font-weight: 800; }

/* ---------- Domeček ---------- */
.trophy {
  display: inline-block; vertical-align: middle; width: var(--s, 56px); height: var(--s, 56px);
  background: url(assets/trofeje.webp) no-repeat; background-size: 1000% 300%;
  background-position: calc(var(--c) * 100% / 9) calc(var(--r) * 50%);
}
.trophy.empty { filter: grayscale(1) brightness(0.55); opacity: 0.35; }   /* ještě nezískaná trofej */
/* domeček přes celou obrazovku; obrázek je ukotvený vlevo (polici nic neořízne, vpravo je panel) */
#screen-house { padding: 0; background: #6b4423; overflow: hidden; }
.house-img {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: max(100vw, 100vh * 1.777); width: max(100vw, 100dvh * 1.777); aspect-ratio: 1672 / 941;
  background: url(assets/domecek.webp) center / 100% 100% no-repeat; container-type: inline-size;
}
#house-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* trofej na polici: ukotvená spodkem na desku, šířka v % obrázku */
.shelf-trophy {
  position: absolute; width: 6.8%; aspect-ratio: 1; transform: translate(-50%, -96%);
  background: url(assets/trofeje.webp) no-repeat; background-size: 1000% 300%;
  background-position: calc(var(--c) * 100% / 9) calc(var(--r) * 50%);
  filter: drop-shadow(0 0.4cqw 0 rgba(0,0,0,0.25));
}
.shelf-trophy.empty { filter: grayscale(1) brightness(0.45); opacity: 0.35; }
.item-img { display: inline-block; aspect-ratio: 1; background: url(assets/vybaveni.webp) no-repeat; background-size: 1400% 100%; background-position: calc(var(--i) * 100% / 13) 0; }
.ico-img { width: 40px; flex: none; }
.house-item { position: absolute; transform: translate(-50%, -100%); filter: drop-shadow(0 0.5cqw 0 rgba(0,0,0,0.25)); }

/* tlačítka nahoře: všechna stejně vysoká */
.house-actions { position: absolute; z-index: 3; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); display: flex; gap: 10px; }
.btn.top { height: 52px; display: inline-flex; align-items: center; gap: 6px; padding: 0 18px; font-size: 20px; line-height: 1; white-space: nowrap; background: #fff; }
.btn.top.green { background: #7ee07e; }

/* panel vpravo */
.house-panel {
  position: absolute; z-index: 3; right: max(14px, env(safe-area-inset-right)); top: 14px; bottom: 14px;
  width: clamp(330px, 38vw, 470px); max-width: none; align-items: stretch; gap: 8px;
  padding: 12px 14px; overflow: hidden; background: rgba(255,250,242,0.97); display: flex; flex-direction: column;
}
.house-panel.hidden { display: none; }
#house-edit { overflow-y: auto; }
.house-head { display: flex; align-items: center; gap: 8px; justify-content: center; }
.house-head h2 { font-size: clamp(22px, 2.4vw, 30px); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.house-panel .chip { font-size: 18px; padding: 0 12px; box-shadow: 0 3px 0 #1d2433; border-width: 3px; }
.muted { opacity: 0.7; margin: 0; font-size: 14px; text-align: center; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tab { position: relative; white-space: nowrap; padding: 0 4px; font: inherit; font-weight: 800; font-size: 18px; height: 44px; border: 3px solid #1d2433; border-radius: 14px; background: #f1e6d2; cursor: pointer; touch-action: manipulation; }
.tab.active { background: #ffd23f; box-shadow: 0 3px 0 #1d2433; }
.tab-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 6px; }
.tab-body.hidden { display: none; }

/* řádek vylepšení a obchodu: stejná stavba, tlačítko vpravo stejně vysoké */
.card { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; align-items: center; gap: 4px 10px; background: #fff; border: 3px solid #1d2433; border-radius: 16px; padding: 8px 10px; }
.card-title { font-size: 19px; font-weight: 800; line-height: 1.1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.card-title .ico { font-size: 26px; }
.card-desc { grid-column: 1; font-size: 14px; font-weight: 600; opacity: 0.75; line-height: 1.15; }
.card .buy { grid-column: 2; grid-row: 1 / span 2; height: 44px; min-width: 104px; padding: 0 12px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.card .buy:disabled { background: #e6e1d8; color: #7a7a7a; opacity: 1; }
.card .buy.owned { background: #7ee07e; color: #1d2433; }
.card.has { background: #effaea; }
.lvl { font-size: 15px; font-weight: 800; background: #eef3f8; border: 2px solid #1d2433; border-radius: 999px; padding: 0 8px; }
.bar { grid-column: 1 / span 2; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; min-width: 0; }
.bar i { height: 12px; border: 2px solid #1d2433; border-radius: 4px; background: #fff; }
.bar i.on { background: #7ee07e; }

/* úpravy axolotla v panelu */
#house-edit .color-row > span { width: 70px; font-size: 17px; }
#house-edit .swatches { flex-wrap: wrap; gap: clamp(5px, 0.75vw, 10px); }
#house-edit .swatch { width: clamp(18px, 1.95vw, 27px); height: clamp(18px, 1.95vw, 27px); border-width: 2.5px; box-shadow: 0 2px 0 #1d2433; }
#house-edit .row { flex-wrap: nowrap; margin-top: auto; }
#house-edit .row .btn { height: 52px; display: inline-flex; align-items: center; white-space: nowrap; font-size: 20px; padding: 0 16px; }

@media (orientation: portrait) {
  .house-img { top: 0; transform: none; width: 100vw; }
  #house-cv { height: calc(100vw / 1.777); }
  .house-panel { top: calc(100vw / 1.777 + 10px); left: 14px; right: 14px; width: auto; }
}
@media (max-height: 600px) {
  .btn.top { height: 44px; font-size: 17px; padding: 0 12px; }
  .house-panel { padding: 8px 10px; gap: 6px; }
  .card-title { font-size: 17px; } .card-title .ico { font-size: 22px; } .ico-img { width: 32px; }
  .card .buy { height: 40px; min-width: 92px; font-size: 16px; }
  .tab { height: 40px; font-size: 16px; }
}

.reward { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; font-size: 18px; text-align: center; }
.reward:not(:has(.rw-tile)) { background: #ffeceb; border: 3px solid #1d2433; border-radius: 14px; padding: 8px 14px; }
.rw-tile { flex: 1 1 220px; display: flex; align-items: center; gap: 12px; background: #fff1b8; border: 3px solid #1d2433; border-radius: 16px; padding: 8px 14px; text-align: left; }
.rw-tile.trophy-tile { background: #e9f7ff; }
.rw-coin { width: 54px; height: 54px; flex: none; margin: 0; }
.rw-big { font-size: 30px; font-weight: 800; line-height: 1.05; }
.rw-lbl { font-size: 14px; font-weight: 700; opacity: 0.75; line-height: 1.25; }
.rw-tile .trophy { flex: none; }
.result-list .lv { font-size: 15px; font-weight: 800; background: #eef3f8; border: 2px solid #1d2433; border-radius: 999px; padding: 0 8px; margin-left: 4px; }

/* ---------- Závod ---------- */
#hud.hidden { display: none; }
.top-buttons { position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 10px; z-index: 5; }
.icon-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 4px solid #1d2433; background: #fffaf2;
  font-size: 26px; box-shadow: 0 4px 0 #1d2433; cursor: pointer; touch-action: manipulation; padding: 0;
}
#controls { position: fixed; inset: auto 0 0 0; pointer-events: none; z-index: 4; }
.pad { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 14px; pointer-events: auto; }
.pad-left { left: max(14px, env(safe-area-inset-left)); flex-direction: column; }
.pad-right { right: max(14px, env(safe-area-inset-right)); flex-direction: row; align-items: flex-end; }
.ctl {
  width: clamp(76px, 12vmin, 104px); height: clamp(76px, 12vmin, 104px); border-radius: 50%;
  background: rgba(255, 250, 242, 0.55); border: 4px solid rgba(29, 36, 51, 0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: inherit; color: #1d2433; touch-action: none; cursor: pointer; padding: 0;
}
.ctl span { font-size: clamp(28px, 4.5vmin, 40px); line-height: 1; }
.ctl small { font-size: 14px; font-weight: 800; }
.ctl.on { background: rgba(255, 210, 63, 0.9); transform: scale(0.94); }

.result-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.result-list li {
  display: grid; grid-template-columns: 56px 110px 1fr auto; align-items: center; gap: 10px;
  background: #fff; border: 3px solid #1d2433; border-radius: 16px; padding: 0 14px; font-size: 22px;
}
.result-list li.me { background: #fff1b8; border-width: 4px; }
.result-list .place { font-size: 30px; font-weight: 800; text-align: center; }
.result-list canvas { width: 110px; height: 60px; }
.result-list .time { font-weight: 800; display: inline-block; }

@media (orientation: portrait) {
  .setup { flex-direction: column; justify-content: center; height: auto; max-height: 100%; }
  .setup-left { flex: none; width: 100%; }
  #setup-preview { max-width: 460px; }
  .setup-right { width: 100%; }
}
@media (max-height: 560px) {
  .panel { padding: 10px 18px 14px; gap: 6px; }
  .swatch { width: 28px; height: 28px; }
  .result-list li { font-size: 18px; grid-template-columns: 44px 80px 1fr auto; }
  .result-list canvas { height: 44px; width: 80px; }
}

/* jednotná výška tlačítek a štítků v horních lištách */
.map-top .chip, .map-top .btn { height: 52px; display: inline-flex; align-items: center; gap: 6px; padding: 0 18px; font-size: 22px; line-height: 1; box-shadow: 0 4px 0 #1d2433; border-width: 4px; white-space: nowrap; }
.house-head .chip { height: 44px; display: inline-flex; align-items: center; gap: 4px; padding: 0 14px; font-size: 19px; line-height: 1; }

/* vylepšení: tři karty vyplní panel; shora dolů název a body → popis → ukazatel → tlačítko nákupu */
#upgrades { gap: 10px; }
.up-card { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; gap: clamp(4px, 1vh, 10px);
  background: #fff; border: 3px solid #1d2433; border-radius: 16px; padding: clamp(8px, 1.4vh, 14px) 14px; }
.up-top { display: flex; align-items: center; gap: 8px; }
.up-ico { font-size: clamp(26px, 3vw, 38px); line-height: 1; }
.up-name { font-size: clamp(20px, 2.3vw, 28px); font-weight: 800; flex: 1; min-width: 0; }
.up-pts { font-size: clamp(16px, 1.7vw, 20px); font-weight: 800; background: #eef3f8; border: 3px solid #1d2433; border-radius: 999px; padding: 2px 12px; white-space: nowrap; }
.up-pts b { font-size: 1.35em; color: #2f9e44; }
.up-desc { font-size: clamp(14px, 1.5vw, 17px); font-weight: 600; opacity: 0.75; margin-top: -4px; }
.up-card .bar { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: clamp(2px, 0.4vw, 5px); }
.up-card .bar i { height: clamp(14px, 2.2vh, 22px); border: 2.5px solid #1d2433; border-radius: 6px; background: #fff; }
.up-card .bar i.on { background: #7ee07e; }
.up-card .buy { width: 100%; height: 52px; font-size: clamp(17px, 1.9vw, 21px); display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.up-card .buy:disabled { background: #e6e1d8; color: #6b6b6b; opacity: 1; }
.up-card .buy.owned { background: #7ee07e; color: #1d2433; }
@media (max-height: 600px) { .map-top .chip, .map-top .btn { height: 44px; font-size: 18px; padding: 0 12px; } .up-card .buy { height: 44px; font-size: 17px; } }

/* úpravy axolotla: víc vzduchu mezi řádky a kroužky */
#house-edit { gap: 14px; }
#house-edit .color-rows { gap: clamp(14px, 3vh, 26px); margin: 10px 0; }
#house-edit { container-type: inline-size; }
#house-edit .color-row { gap: 12px; }
/* kroužky a mezery podle šířky panelu: 10 kroužků + mezery se vždy vejdou na jeden řádek */
#house-edit .color-rows { --s: min(30px, calc((100cqw - 104px) / 13.6)); }
#house-edit .swatches { flex-wrap: nowrap; gap: calc(var(--s) * 0.38); }
#house-edit .swatch { width: var(--s); height: var(--s); }
#house-edit { width: clamp(330px, 38vw, 470px); }   /* stejně široký jako ostatní panely */
@media (orientation: portrait) { #house-edit { width: auto; } }

/* ---------- všechna místa na mapě stejně velká ---------- */
:root { --pin-w: clamp(112px, 12.5vw, 180px); }
.pin.race { width: var(--pin-w); min-width: 0; height: calc(var(--pin-w) * 0.78); justify-content: center; }
.pin.home, .pin.training { width: var(--pin-w); }
.pin-pic { width: calc(var(--pin-w) * 0.9); }
.pin-label { width: 100%; height: calc(var(--pin-w) * 0.38); justify-content: center; padding: 0 6px; }
.pin-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pin.race .pin-name { white-space: normal; text-align: center; line-height: 1.05; }

/* ---------- okno místa na mapě ---------- */
.popup .panel.pp { width: min(560px, 100%); max-width: none; gap: 12px; align-items: stretch; padding: 18px 20px 20px; }
.pp-head { display: flex; align-items: center; gap: 14px; border-radius: 18px; padding: 10px 14px; border: 3px solid #1d2433; }
.pp-head.race { background: linear-gradient(#ffe680, #ffc93c); }
.pp-head.training { background: #bfe6ff; }
.pp-head h3 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; text-align: left; line-height: 1.05; }
.pp-kind { display: inline-block; font-size: 14px; font-weight: 800; letter-spacing: 1px; background: #1d2433; color: #fff; border-radius: 999px; padding: 1px 10px; margin-bottom: 4px; }
.pp-head.training .pp-kind { background: #2f7fd1; }
.pp-head.race .pp-kind { background: #ff5a4f; }
.pp-pic { width: 84px; aspect-ratio: 310 / 300; flex: none; background: url(assets/mista.webp) no-repeat; background-size: 200% 100%; background-position: calc(var(--i) * 100%) 0; }
.pp-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pp-tile, .pp-prize { background: #fff; border: 3px solid #1d2433; border-radius: 16px; padding: 8px 10px; text-align: center; }
.pp-tile.free { background: #e6f7e0; }
.pp-tile.bad { background: #ffe1dc; }
.pp-lbl { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; opacity: 0.6; }
.pp-val { font-size: clamp(24px, 3vw, 30px); font-weight: 800; line-height: 1.1; }
.pp-sub { font-size: 15px; font-weight: 700; opacity: 0.7; }
.pp-places { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.pp-place { display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 12px; padding: 6px 4px; }
.pp-place.p1 { background: #fff3c4; } .pp-place.p2 { background: #eef1f5; } .pp-place.p3 { background: #f8e2cf; }
.pp-medal { font-size: 28px; line-height: 1; }
.pp-place b { font-size: 20px; }
.pp-warn { text-align: center; font-size: 17px; font-weight: 800; color: #b3261e; background: #ffe1dc; border: 3px solid #b3261e; border-radius: 14px; padding: 6px 10px; }
.pp-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.pp-btns .btn { height: 60px; padding: 0 10px; font-size: clamp(18px, 2.2vw, 24px); display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.pp-btns .btn:disabled { background: #e6e1d8; color: #6b6b6b; opacity: 1; }
@media (max-height: 600px) { .popup .panel.pp { gap: 8px; padding: 12px 14px; } .pp-places .trophy { --s: 32px !important; width: 32px; height: 32px; } .pp-btns .btn { height: 48px; } }
.pin.race { gap: 0; padding: calc(var(--pin-w) * 0.07) 6px 4px; }
.pin.race .pin-icon { font-size: calc(var(--pin-w) * 0.18); }
.pin.race .pin-name { overflow: visible; font-size: calc(var(--pin-w) * 0.105); }
.pin.race .pin-sub { font-size: calc(var(--pin-w) * 0.085); }

/* odznaky závodů */
.badge { display: inline-block; vertical-align: middle; aspect-ratio: 1; width: calc(var(--pin-w) * 0.3);
  background: url(assets/odznaky.webp) no-repeat; background-size: 1000% 100%; background-position: calc(var(--b) * 100% / 9) 0; }
.badge.big { width: 76px; }
.pin.race .pin-icon { line-height: 0; margin-bottom: 2px; }

/* ikony z návrhu */
.ic { display: inline-block; margin: 0 0.15em; width: 1.15em; height: 1.15em; vertical-align: -0.22em; background: url(assets/ikony.webp) no-repeat; background-size: 1000% 100%; background-position: calc(var(--n) * 100% / 9) 0; }
.ic.medal { width: 1.6em; height: 1.6em; vertical-align: middle; }
.pp-medal .ic { width: 34px; height: 34px; }
.result-list .place .ic { width: 40px; height: 40px; }
.up-ico .ic { width: 1em; height: 1em; vertical-align: -0.1em; }

/* kvíz v domečku */
.quiz-badge { position: absolute; top: -9px; right: -6px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: #ff5a4f; color: #fff; border: 2.5px solid #1d2433; font-size: 14px; line-height: 19px; }
.quiz-badge.hidden { display: none; }
.quiz-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 16px; }
.quiz-dots { display: flex; gap: 5px; }
.quiz-dots i { width: 18px; height: 18px; border: 2.5px solid #1d2433; border-radius: 50%; background: #fff; }
.quiz-dots i.on { background: #ffd23f; }
.quiz-card { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 3px solid #1d2433; border-radius: 16px; padding: 10px 12px; }
.quiz-q { font-size: clamp(19px, 2vw, 23px); font-weight: 800; line-height: 1.15; text-align: center; }
.quiz-opts { display: flex; flex-direction: column; gap: 7px; }
.quiz-opt { min-height: 48px; font-size: 18px; text-align: left; display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: #f1e6d2; color: #1d2433; line-height: 1.1; }
.quiz-opt b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #1d2433; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.quiz-opt:disabled { opacity: 1; }
.quiz-opt.ok { background: #7ee07e; }
.quiz-opt.bad { background: #ff8a80; }
.quiz-opt.off { opacity: 0.5; }
.quiz-res { text-align: center; font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.quiz-res.ok { color: #1f7a2e; } .quiz-res.bad { color: #b3261e; }
.quiz-next { height: 48px; font-size: 19px; background: #7ee07e; color: #1d2433; }
.quiz-wait { text-align: center; font-size: 17px; font-weight: 700; line-height: 1.25; }
.quiz-card.quiz-wait { padding: 18px 12px; }
#quiz .muted { display: flex; align-items: center; justify-content: center; gap: 4px; }

/* výsledky: čas doplutého závodníka naskočí */
.result-list li.fresh .time { animation: time-pop 0.7s ease-out; }
@keyframes time-pop { 0% { transform: scale(1.7); color: #2a9d3a; } 100% { transform: scale(1); } }

/* nižší obrazovky (iPad na šířku se Safari lištou): vylepšení se vejdou celá bez posouvání */
@media (orientation: landscape) and (max-height: 820px) {
  .house-panel { gap: 6px; padding: 10px 12px; }
  .house-head h2 { font-size: 24px; }
  .house-panel .chip { font-size: 16px; height: 38px; }
  .tab { height: 40px; font-size: 16px; }
  .up-card { gap: 4px; padding: 6px 12px; }
  .up-ico { font-size: 26px; }
  .up-name { font-size: 21px; }
  .up-pts { font-size: 15px; padding: 1px 10px; }
  .up-desc { font-size: 13px; margin-top: -2px; }
  .up-card .bar i { height: 13px; }
  .up-card .buy { height: 42px; font-size: 17px; }
  #shop { gap: 5px; }
  .card { padding: 3px 10px; gap: 0 8px; }
  .card-title { font-size: 17px; } .card-title .ico-img { width: 30px; }
  .card-desc { font-size: 12.5px; }
  .card .buy { height: 36px; min-width: 88px; font-size: 16px; }
}
/* když se obsah záložky přece nevejde, je vidět posuvník */
.tab-body { scrollbar-width: thin; scrollbar-color: #1d2433 transparent; }
.tab-body::-webkit-scrollbar { width: 6px; } .tab-body::-webkit-scrollbar-thumb { background: rgba(29,36,51,0.5); border-radius: 3px; }

/* okno závodu: co je na trati */
.pp-feats { font-size: 15px; font-weight: 700; text-align: center; line-height: 1.35; opacity: 0.85; }
@media (max-height: 600px) { .pp-feats { font-size: 13px; } }

/* trénink: výběr obtížnosti */
.pp-diff { display: flex; gap: 8px; }
.pp-diff .btn { flex: 1; height: 46px; font-size: 18px; background: #f1e6d2; box-shadow: 0 3px 0 #1d2433; }
.pp-diff .btn.on { background: #ffd23f; }
.pp-diff small { font-size: 0.8em; opacity: 0.8; }

/* počítání příkladů */
#math-gate { z-index: 60; }
.math-gate { width: min(440px, 94vw); gap: 10px; }
.math-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.math-head h3 { margin: 0; font-size: 22px; }
.math-dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.math-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #1d2433; background: #fff; }
.math-dots i.on { background: #7ee07e; }
.math-card { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 3px solid #1d2433; border-radius: 18px; padding: 10px 12px; }
.math-card.ok { background: #effaea; } .math-card.bad { background: #ffeceb; }
.math-q { display: flex; justify-content: center; align-items: center; gap: 12px; font-size: clamp(38px, 6vh, 54px); font-weight: 800; }
.math-ans { min-width: 1.6em; text-align: center; border-bottom: 5px solid #1d2433; color: #2f6fd8; }
.math-ans.empty { color: #b9b2a6; }
.math-msg { min-height: 1.4em; text-align: center; font-size: 18px; font-weight: 700; }
.math-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.math-pad .mk { height: clamp(44px, 7vh, 60px); font-size: 26px; padding: 0; }
#math .math-pad .mk { height: clamp(40px, 6vh, 54px); }
@media (orientation: landscape) and (max-height: 820px) { .math-q { font-size: 36px; } .math-pad .mk, #math .math-pad .mk { height: 42px; font-size: 22px; } .math-msg { font-size: 15px; } }

/* předměty v pokoji, které otevřou panel: tabule (počítání) a kniha na polici (kvíz) */
.room-obj { position: absolute; z-index: 2; padding: 0; border: 0; background: none; cursor: pointer; transform: translate(-50%, -100%); filter: drop-shadow(0 0.5cqw 0 rgba(0,0,0,0.25)); touch-action: manipulation; }
.room-obj svg { display: block; width: 100%; height: auto; }
.room-obj:active { transform: translate(-50%, -100%) scale(0.95); }
.room-board { left: 62%; top: 57%; width: 12.5%; transform-origin: 50% 0; animation: obj-bob 3s ease-in-out infinite; }
.room-obj .quiz-badge { position: absolute; top: -6px; right: -6px; }
@keyframes obj-bob { 50% { transform: translate(-50%, -100%) rotate(-1.5deg); } }
.panel-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-sub h3 { margin: 0; font-size: 20px; }
.panel-sub.hidden, .tabs.hidden { display: none; }

/* ===== domeček: lišta nahoře vpravo, nabídka dole vpravo, panel mezi nimi ===== */
.house-bar { position: absolute; z-index: 3; right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); display: flex; gap: 8px; }
.house-bar .chip { height: 52px; font-size: 20px; padding: 0 16px; box-shadow: 0 4px 0 #1d2433; background: #fffaf2; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
#house-mini { width: 60px; height: 32px; margin-left: -8px; }
.dock-axo { width: 66px; height: 36px; }
.house-dock { position: absolute; z-index: 4; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 8px; }
.house-dock.hidden { display: none; }
.dock-btn { position: relative; width: 92px; height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: inherit; color: #1d2433; background: #fffaf2; border: 4px solid #1d2433; border-radius: 18px; box-shadow: 0 5px 0 #1d2433; cursor: pointer; touch-action: manipulation; padding: 0; }
.dock-btn b { font-size: 15px; font-weight: 800; }
.dock-btn .dock-ico, .dock-btn .ic { font-size: 32px; line-height: 1; }
.dock-btn .ic { width: 34px; height: 34px; margin: 0; }
.dock-btn.active { background: #ffd23f; transform: translateY(3px); box-shadow: 0 2px 0 #1d2433; }
.dock-btn:not(.active):hover { background: #fff3c4; }
.dock-btn .quiz-badge { top: -10px; right: -8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 24px; display: flex; align-items: center; gap: 6px; }
.panel-head .btn { width: 44px; height: 44px; padding: 0; font-size: 22px; flex: none; }
.panel-head .btn.hidden { display: none; }
#house-stats.hidden { display: none; }
.math-head { justify-content: flex-start; }
.math-head .badge.big, .math-head .pp-pic { flex: none; width: 64px; height: 64px; }
.math-head .math-title { flex: 1; text-align: left; }
/* na šířku: nabídka svisle u pravého okraje, panel vedle ní na celou výšku */
@media (orientation: landscape) {
  .house-dock { flex-direction: column; top: 80px; bottom: auto; }
  .house-panel, #house-edit { top: 80px; bottom: 14px; right: calc(max(14px, env(safe-area-inset-right)) + 104px); }
}
@media (orientation: landscape) and (max-height: 820px) {
  .house-bar .chip { height: 46px; font-size: 18px; padding: 0 12px; }
  .house-dock { top: 72px; gap: 7px; }
  .dock-btn { width: 80px; height: 72px; } .dock-btn .dock-ico, .dock-btn .ic { font-size: 26px; } .dock-btn .ic { width: 28px; height: 28px; } .dock-btn b { font-size: 13px; }
  .house-panel, #house-edit { top: 72px; right: calc(max(14px, env(safe-area-inset-right)) + 92px); }
  .panel-head h2 { font-size: 20px; }
}
@media (orientation: portrait) {
  .house-dock { left: 14px; right: 14px; bottom: auto; top: calc(100vw / 1.777 + 10px); justify-content: space-between; }
  .dock-btn { flex: 1; width: auto; }
  .house-panel, #house-edit { top: calc(100vw / 1.777 + 112px); bottom: 14px; }
}

/* Axík: přepínač Schopnosti / Vzhled */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg.hidden { display: none; }
.seg-btn { font: inherit; font-weight: 800; font-size: 17px; height: 42px; color: #1d2433; border: 3px solid #1d2433; border-radius: 14px; background: #f1e6d2; cursor: pointer; touch-action: manipulation; }
.seg-btn.active { background: #ffd23f; box-shadow: 0 3px 0 #1d2433; }

/* tabule z obrázku: příklad je napsaný křídou přes zelenou plochu */
.room-board { background: url(assets/tabule.webp) center / 100% 100% no-repeat; aspect-ratio: 1298 / 992; }
.room-board .board-text { position: absolute; left: 9%; right: 9%; top: 27%; bottom: 18%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.9cqw; color: #f4f1e8; letter-spacing: 0.02em; text-shadow: 0 0 2px rgba(255,255,255,0.4); }
/* ikony domečku od ChatGPT */
.hic { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.28em; background: url(assets/ikony-domecek.webp) no-repeat; background-size: 600% 100%; background-position: calc(var(--n) * 20%) 0; flex: none; }
.dock-btn .dock-hic { width: 38px; height: 38px; }
@media (orientation: landscape) and (max-height: 820px) { .dock-btn .dock-hic { width: 32px; height: 32px; } }

#map-mini { width: 60px; height: 32px; margin-left: -8px; }

/* hover pro tlačítka nahoře (Na mapu) */
.btn.top { transition: transform 0.12s, filter 0.12s; }
.btn.top:hover { filter: brightness(1.06); transform: translateY(-2px); }
.btn.top:active { transform: translateY(2px); }
/* hlavička počítání: logo vlevo, nadpis vedle něj, Zpět vpravo – vše na jedné ose */
.math-head { align-items: center; gap: 12px; }
.math-head .math-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.math-head .math-title h3 { text-align: left; font-size: 24px; line-height: 1.1; }
.math-head .math-title .pp-kind { align-self: flex-start; }
/* výsledky: zlaťák v dlaždici velký; na nižších obrazovkách kompaktní seznam, aby byla vidět tlačítka dole */
.rw-tile .ic.rw-coin { width: 54px; height: 54px; font-size: 54px; }
@media (max-height: 820px) {
  #screen-results .panel { padding: 10px 18px 14px; gap: 8px; }
  #result-title { font-size: 28px; margin: 0; }
  .rw-tile { padding: 4px 12px; } .rw-big { font-size: 24px; } .rw-tile .trophy { --s: 50px !important; width: 50px; height: 50px; }
  .result-list { gap: 4px; }
  .result-list li { grid-template-columns: 40px 76px 1fr auto; font-size: 17px; gap: 8px; padding: 0 10px; }
  .result-list .place { font-size: 22px; }
  .result-list canvas { width: 76px; height: 40px; }
  #screen-results .row .btn { height: 48px; font-size: 19px; }
}

/* Axík v liště mapy je tlačítko: otevře jeho panel nad mapou */
.chip-btn { font: inherit; font-weight: 800; color: #1d2433; cursor: pointer; transition: transform 0.12s; touch-action: manipulation; }
.chip-btn:hover { transform: translateY(-2px); background: #fff3c4; }
#screen-map .house-panel { right: max(14px, env(safe-area-inset-right)) !important; top: 80px; bottom: 14px; }

/* místa na mapě výraznější než ztlumená mapa */
.pin { box-shadow: 0 5px 0 #1d2433, 0 8px 18px rgba(0,0,0,0.25); }
.pin.locked { filter: grayscale(1); opacity: 0.65; }

/* jiná oblast: vlevo nahoře Jezero, Domeček a název oblasti */
.region-bar { position: absolute; z-index: 4; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); display: flex; gap: 8px; align-items: center; }
.region-bar.hidden, .region-lock.hidden { display: none; }
.region-bar .chip { height: 52px; display: inline-flex; align-items: center; font-size: 22px; background: #ffd23f; }
/* vstup do jeskyně na mapě jezera */
.pin.gate { background: #3b3550; color: #fff; border-radius: 18px; flex-direction: column; gap: 2px; padding: 6px 12px 8px; }
.pin.gate .pin-label { background: none; border: none; box-shadow: none; padding: 0; } .pin.gate .pin-name { color: #fff; font-size: clamp(14px, 1.6vw, 19px); }
.gate-badge { width: calc(var(--pin-w) * 0.45) !important; }
.pin.gate.locked .pin-name::before { content: ''; display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.2em; margin-right: 3px; background: url(assets/ikony.webp) no-repeat; background-size: 1000% 100%; background-position: calc(4 * 100% / 9) 0; }
.region-lock { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(15,30,45,0.45); }
.region-lock .panel { pointer-events: auto; max-width: 420px; text-align: center; }
.region-lock .lock-ico .ic { width: 64px; height: 64px; margin: 0; }
.region-lock p { margin: 0; font-size: 18px; }
.pin.hidden { display: none; }

/* zámek oblasti: seznam závodů s trofejemi / co chybí */
.region-lock .panel { max-width: 460px; gap: 6px; }
.region-lock h3 { margin: 0; }
.lock-list { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; text-align: left; }
.lock-item { display: flex; align-items: center; gap: 10px; background: #ffeceb; border: 3px solid #1d2433; border-radius: 12px; padding: 3px 10px; font-size: 16px; font-weight: 700; }
.lock-item.has { background: #effaea; }
.lock-item .lock-name { flex: 1; }
.lock-item b { font-size: 14px; white-space: nowrap; }
.lock-item:not(.has) b { color: #c0392b; }
.lock-item .trophy, .lock-badge { flex: none; width: 44px !important; height: 44px; }
.lock-item:not(.has) .lock-badge { filter: grayscale(1); opacity: 0.55; }
@media (max-height: 700px) { .region-lock .lock-ico { display: none; } .lock-item { padding: 1px 8px; font-size: 14px; } .lock-item .trophy, .lock-badge { width: 34px !important; height: 34px; } }
.gate-hic { width: calc(var(--pin-w) * 0.4); height: calc(var(--pin-w) * 0.4); }
.pin.gate.back { background: #2f7f6a; }
#region-home.hidden { display: none; }
#house-title.active { background: #fff3c4; }

/* nastavení pro rodiče */
.settings-btn { position: fixed; z-index: 11; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%;
  border: 3px solid #1d2433; background: #fffaf2; box-shadow: 0 4px 0 #1d2433; font-size: 30px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: manipulation; color: #1d2433; }
.settings-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1d2433; }
.settings-btn.hidden { display: none; }
#settings-pop { z-index: 14; }
.set-panel { max-height: calc(100dvh - 32px); }
.set-panel .panel-head { display: flex; align-items: center; justify-content: space-between; }
.set-panel .panel-head h2 { margin: 0; font-size: 28px; }
.set-body { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 2px; }
.set-sec { display: flex; flex-direction: column; gap: 6px; }
.set-sec .pp-diff { flex-wrap: wrap; }
.set-sec .pp-diff .btn { min-width: 0; color: #1d2433; }
.set-ex { font-size: 17px; text-align: center; background: #f1e6d2; border-radius: 12px; padding: 8px; }
.set-sub { font-size: 16px !important; opacity: 0.8; text-align: left !important; }
.set-pin { align-items: center !important; width: min(380px, 100%) !important; }
.set-pin .set-sub { text-align: center !important; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 4px 0; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #1d2433; }
.pin-dots i.on { background: #1d2433; }
.pin-dots.bad i { border-color: #e04b4b; background: #e04b4b; }
.set-link { background: none; border: 0; font: inherit; font-size: 15px; text-decoration: underline; color: #1d2433; opacity: 0.7; cursor: pointer; }
.set-pin .math-pad { width: 100%; max-width: 300px; }
.set-pin .math-pad .mk { height: 56px; font-size: 26px; }
.set-sec .pp-diff .btn { white-space: nowrap; font-size: 17px; }

/* minimum: kratší strana aspoň 600 px a delší aspoň 900 px (tablet, počítač); menší obrazovka = jen hláška */
#too-small { display: none; }
@media (max-width: 599px), (max-height: 599px), (max-width: 899px) and (max-height: 899px) {
  body > *:not(#too-small) { display: none !important; }
  #too-small { display: flex; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(#3fc1d9, #1b7fa6); }
  .ts-box { background: #fffaf2; border: 3px solid #1d2433; border-radius: 22px; box-shadow: 0 5px 0 #1d2433; padding: 22px 24px; max-width: 420px; text-align: center; color: #1d2433; }
  .ts-ico { width: 110px; height: 80px; margin: 0 auto; background: url(assets/axolotl-hlava.webp) center / contain no-repeat; filter: sepia(1) saturate(3.5) hue-rotate(-75deg) brightness(1); }
  .ts-box h2 { margin: 10px 0 8px; font-size: 24px; font-weight: 800; }
  .ts-box p { margin: 0; font-size: 17px; }
}

/* obchod: náznak, že seznam pokračuje */
.tab-body, .set-body { overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
/* ztmavení dole jako lepivý konec samotného seznamu – sedí přesně na šířku i spodní hranu karet */
#shop::after { content: ''; flex: none; position: sticky; bottom: -6px; height: 70px; margin: -70px -2px -6px; pointer-events: none;
  background: linear-gradient(rgba(255,250,242,0), rgba(255,250,242,0.97) 85%); opacity: 0; transition: opacity 0.2s; }
#shop.more::after { opacity: 1; }
.scroll-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; font: inherit; font-weight: 800; font-size: 16px; color: #1d2433;
  background: #ffd23f; border: 3px solid #1d2433; border-radius: 999px; padding: 4px 16px; box-shadow: 0 3px 0 #1d2433; cursor: pointer; animation: hintBob 1.2s ease-in-out infinite; }
.scroll-hint.hidden { display: none; }
@keyframes hintBob { 50% { transform: translate(-50%, 4px); } }
/* nízká obrazovka: schopnosti vždy celé (bez popisku a statistik, menší karty) */
@media (max-height: 760px), (orientation: portrait) {
  #house-stats, .up-desc { display: none; }
  #upgrades { gap: 6px; overflow: hidden; }
  .up-card { flex: 1 1 0; min-height: 0; gap: 4px; padding: 5px 12px; }
  .up-ico { font-size: 24px; } .up-name { font-size: 20px; } .up-pts { font-size: 14px; padding: 0 9px; }
  .up-card .bar i { height: 12px; border-width: 2px; }
  .up-card .buy { height: 38px; font-size: 16px; }
  .house-panel .seg-btn { height: 38px; }
}
@media (orientation: portrait) { body[data-screen="screen-house"] .settings-btn { top: calc(100vw / 1.777 - 72px); bottom: auto; } }
/* ikony počítání: tabule, kalkulačka, ozubené kolo */
.pic { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.3em; background: url(assets/ikony-pocitani.webp) no-repeat; background-size: 300% 100%; background-position: calc(var(--n) * 50%) 0; flex: none; }
.settings-btn .pic { width: 40px; height: 40px; }
.settings-btn { font-size: 0; }
