
:root{--blue:#164d8e;--deep:#123766;--light:#e5f4ff;--cream:#fff9e9;--outline:#bad9f0;--mint:#18a66d;--text:#243d55;--shadow:0 10px 30px rgba(37,80,122,.13)}
*{box-sizing:border-box}html{font-family:system-ui,-apple-system,'Segoe UI',Arial,sans-serif;color:var(--text);background:#e9f4fc}body{margin:0;padding:18px 12px 28px;background:radial-gradient(circle at 50% -60%,#fff 0,#eaf6ff 70%)}button{font:inherit;cursor:pointer}button:focus-visible,a:focus-visible{outline:4px solid #ffba26;outline-offset:3px}.app{max-width:1020px;margin:0 auto;background:linear-gradient(180deg,#fff,#f8fcff);border:1px solid #d5e5ef;border-radius:20px;box-shadow:var(--shadow);overflow:hidden;position:relative}
.topbar{display:flex;gap:14px;align-items:center;padding:11px 22px;background:#e5f3fd;border-bottom:1px solid #bcdcf0;min-height:72px}.brand{text-decoration:none;color:var(--deep);display:flex;align-items:center;gap:12px;min-width:0}.brand strong{display:block;letter-spacing:.01em;font-size:clamp(21px,3vw,30px);line-height:1.1}.brand small{display:block;font-size:12px;font-weight:600;color:#487196;margin-top:3px}.brand-icon{background:linear-gradient(150deg,#3c9cd5,#105a9c);color:white;display:grid;place-items:center;font-weight:900;font-size:27px;border-radius:12px;width:49px;height:49px;box-shadow:0 2px 0 #095180,inset 0 2px 4px #ffffff77;flex:0 0 auto}.top-progress{display:flex;align-items:center;gap:12px;background:#d7ebfa;padding:10px 15px;border-radius:99px;margin-left:auto;white-space:nowrap;font-size:14px;font-weight:800;color:var(--deep)}.progress-track{width:140px;height:12px;border-radius:99px;background:#b4d6ef;box-shadow:inset 0 2px 5px #0001;overflow:hidden}.progress-track>span{display:block;height:100%;width:0%;background:linear-gradient(180deg,#4ee8a0,#15a466);border-radius:99px;transition:width .4s ease}.header-actions{display:flex;gap:7px}.icon-button{background:#fff;border:2px solid #a4cae5;border-radius:50%;width:43px;height:43px;display:grid;place-items:center;color:var(--blue);transition:background .2s}.icon-button:hover{background:#daf2ff}.icon-button[aria-pressed=true]{background:#c7f1e4;border-color:#6bbfa1}.icon-button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.learning{padding:18px clamp(16px,3vw,32px) 13px}.learning-heading{display:flex;align-items:center;gap:15px;justify-content:space-between}.eyebrow{font-size:10px;font-weight:900;letter-spacing:.13em;color:#2c7db0;margin:0 0 3px}h1{font-family:'Trebuchet MS',system-ui,sans-serif;color:var(--deep);font-size:clamp(23px,3.7vw,33px);margin:0}.lesson-badge{font-size:12px;font-weight:800;color:#9e6e27;background:#fff0cb;border:1px solid #efd89f;padding:7px 12px;border-radius:30px;white-space:nowrap}.instruction{margin:7px 0 13px;font-size:15px;color:#516a7f}.question-card{background:#fff;border:2px solid #dfedf7;border-radius:18px;box-shadow:0 6px 17px #bcd4e52e;text-align:center;padding:15px 17px 8px}.prompt{font-weight:750;font-size:clamp(14px,2.3vw,18px);margin:0 0 7px;color:var(--deep)}.question{font-weight:850;letter-spacing:.06em;line-height:1.1;font-size:clamp(29px,4.6vw,44px);min-height:49px;color:#104b88;margin:0 auto 14px;white-space:nowrap}.options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px;max-width:700px;margin:0 auto}.option{border:2px solid #a7cee9;background:linear-gradient(#eef8ff,#d8edfc);color:#144b89;border-radius:13px;min-height:67px;font-weight:900;font-size:clamp(24px,4vw,35px);box-shadow:0 3px 0 #b1d1e6;transition:transform .12s,background .15s,border-color .15s}.option:not(:disabled):hover{background:#cce9ff;transform:translateY(-2px)}.option:disabled{cursor:default}.option.wrong{background:#ffe9e8;color:#a73f3d;border-color:#e98b83;box-shadow:none}.option.right{background:#defbea;color:#146c41;border-color:#55bb87;box-shadow:none}.option.reveal{background:#d8f9e7;color:#0a7242;border-color:#24ad71;box-shadow:0 0 0 3px #44cd8b50}.option.faded{opacity:.65}.feedback{min-height:29px;font-size:14px;color:#436b83;font-weight:700;padding:9px 0 1px}.feedback.success{color:#087543}.feedback.error{color:#ab493a}.feedback.hint{color:#8c611d}
.scene-section{margin:0 12px 12px}.scene{position:relative;isolation:isolate;aspect-ratio:1920/600;background:#80c6e9 url('assets/pozadi_nadrazi_1920x600.png') center / 100% 100% no-repeat;border:2px solid #bad5e8;border-radius:15px 15px 0 0;overflow:hidden}.scene:before{content:'';position:absolute;inset:0;background:linear-gradient(180deg,transparent 45%,rgba(3,61,100,.04));pointer-events:none}.scene-badge{position:absolute;z-index:3;top:14px;left:50%;transform:translateX(-50%);padding:7px 14px;background:#fffffff2;border:1px solid #d4e5ef;color:#234f71;font-size:12px;font-weight:850;border-radius:60px;box-shadow:0 3px 8px #4673903d;white-space:nowrap}.train{position:absolute;z-index:2;left:1%;bottom:5.2%;display:flex;align-items:flex-end;width:98%;will-change:transform}.train img{pointer-events:none;user-select:none;-webkit-user-drag:none}.locomotive{flex:0 0 24%;width:24%;height:auto;object-fit:contain;align-self:flex-end;margin:0}.wagon{position:relative;flex:0 0 18.9%;width:18.9%;height:auto;align-self:flex-end;margin-left:-.5%;transform-origin:bottom center}.wagon-picture{display:block;width:100%;height:auto}.cargo-slot{position:absolute;top:38.4%;left:50%;width:14.8%;height:22%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center}.cargo-slot img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 1px 1px #713a2044)}.cargo-slot img.new-parcel{animation:parcel-in .5s cubic-bezier(.1,1.5,.6,1) both}.wagon.new-wagon{animation:wagon-in .85s cubic-bezier(.3,.7,.2,1) both}.train.depart{animation:train-depart 2.4s ease-in forwards}.stage-note{position:absolute;left:50%;bottom:13px;transform:translateX(-50%);border-radius:50px;background:#fff5d8;color:#875609;border:2px solid #edcf7c;padding:8px 16px;font-weight:850;font-size:13px;z-index:3;box-shadow:0 3px 12px #0001;max-width:90%;text-align:center;opacity:0;pointer-events:none}.stage-note.show{animation:note-appear 1.4s ease both}
.station-footer{background:#e8f3fc;border:1px solid #cfdfed;border-top:0;border-radius:0 0 15px 15px;display:flex;align-items:center;justify-content:space-between;gap:22px;padding:12px 18px}.parcels-progress{display:flex;flex:1;align-items:center;gap:16px}.parcels-progress strong{display:block;font-size:14px;color:var(--deep);white-space:nowrap}.parcels-progress small{color:#607e94;font-size:11px}.parcel-dots{display:grid;grid-template-columns:repeat(20,minmax(5px,1fr));gap:3px;flex:1;max-width:340px;min-width:80px}.parcel-dots i{display:block;height:12px;border-radius:3px;border:1px solid #a9c8da;background:#f3fbff;transition:background .2s}.parcel-dots i.filled{background:var(--color);border-color:var(--color)}.status-info{color:#39718d;font-size:12px;font-weight:700;max-width:235px;text-align:right}.keyboard-hint{text-align:center;font-size:11px;color:#7d93a3;margin:0 0 10px}.result-overlay{position:absolute;z-index:20;inset:0;background:#123d65aa;display:flex;align-items:center;justify-content:center;padding:18px}.result-overlay[hidden]{display:none}.result-card{background:linear-gradient(180deg,#fff,#f1faff);border:4px solid #d2ebfb;border-radius:23px;text-align:center;box-shadow:0 18px 60px #0c2a4f85;max-width:520px;width:100%;padding:26px;color:#173f68}.result-star{color:#efa825;font-size:46px;text-shadow:0 3px #ffebb5}.result-eyebrow{font-size:11px;letter-spacing:.13em;font-weight:900;margin:5px 0 6px;color:#4785aa}.result-card h2{font-family:'Trebuchet MS',system-ui;font-size:clamp(23px,4vw,34px);margin:0 0 7px}.result-card p{line-height:1.5}.result-scores{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:24px}.result-scores>div{background:#e7f2fc;border:1px solid #c0dcf2;border-radius:12px;padding:13px 5px}.result-scores strong{display:block;font-size:27px;color:#14518b}.result-scores span{font-size:11px;display:block;color:#4d6d86}.result-summary{font-weight:650;color:#315977;font-size:14px}.play-again{border:0;border-radius:12px;padding:13px 26px;font-size:17px;font-weight:800;background:#186bb3;color:white;box-shadow:0 4px 0 #0b4c86}.play-again:hover{background:#0f5999}
@keyframes parcel-in{from{opacity:0;transform:translateY(-55px) scale(.3) rotate(-15deg)}55%{opacity:1;transform:translateY(4px) scale(1.15)}to{opacity:1;transform:translateY(0) scale(1) rotate(0)}}@keyframes wagon-in{from{opacity:0;transform:translateX(150px)}to{opacity:1;transform:translateX(0)}}@keyframes train-depart{0%{transform:translateX(0)}15%{transform:translateX(2%)}100%{transform:translateX(-125%)}}@keyframes note-appear{0%{opacity:0;transform:translate(-50%,10px)}18%,75%{opacity:1;transform:translate(-50%,0)}100%{opacity:0;transform:translate(-50%,-8px)}}
@media(max-width:760px){body{padding:5px}.app{border-radius:12px}.topbar{padding:10px;gap:7px;flex-wrap:wrap}.top-progress{order:3;width:100%;justify-content:space-between;margin-left:0;padding:7px 10px}.progress-track{width:44%}.header-actions{margin-left:auto}.learning{padding:12px}.lesson-badge{font-size:10px}.question-card{padding:13px 10px 7px}.options{gap:7px}.option{min-height:59px}.scene-section{margin:0 6px 7px}.scene-badge{font-size:10px;top:6px;padding:5px 7px}.station-footer{padding:10px;display:block}.parcels-progress{gap:10px}.status-info{max-width:100%;text-align:center;margin-top:9px}.parcel-dots{min-width:80px}.keyboard-hint{font-size:10px}.instruction{font-size:13px}}@media(max-width:430px){.brand strong{font-size:21px}.brand small{font-size:10px}.brand-icon{width:41px;height:41px}.icon-button{width:38px;height:38px}.question{font-size:27px}.option{min-height:53px}.lesson-badge{display:none}.scene-badge{font-size:9px}.parcel-dots{gap:2px}.parcel-dots i{height:9px}.result-scores{gap:5px}.result-scores strong{font-size:22px}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.train.depart{transform:translateX(-125%)}}

/* Logo Školákova – původní pirát místo textového Š */
.brand-icon {
  width: 56px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}
.brand-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media (max-width: 430px) {
  .brand-icon { width: 44px; height: 42px; }
}


/* V5 – schválená hlavička Školákova podle Tajemné brány.
   Pouze rozložení hlavičky, zadání a přesunutí původního počítadla do patičky.
   Editor, herní scéna a algoritmus hry zůstávají beze změny. */
.topbar{
  display:grid;
  grid-template-columns:minmax(0,1fr) max-content minmax(0,1fr);
  align-items:center;
  gap:10px;
  padding:7px 13px;
  min-height:76px;
  margin:9px 12px 0;
  background:#fff;
  border:0;
  border-radius:17px;
  box-shadow:0 4px 16px #163b5f15;
}
.brand{grid-column:1;justify-self:start;gap:8px;min-width:0}
.brand-icon{width:60px;height:60px;flex:0 0 60px}
.brand-label{display:flex;flex-direction:column;line-height:1.15;min-width:0}
.brand strong{font-size:14px;font-weight:750;letter-spacing:.025em;line-height:1.15}
.brand small{font-size:11px;font-weight:400;line-height:1.25;color:#54738b;margin-top:4px;white-space:normal}
.header-learning{grid-column:2;justify-self:center;text-align:center;min-width:0;max-width:100%}
.header-learning h1{
  font:500 clamp(23px,2.45vw,28px)/1.15 system-ui,-apple-system,'Segoe UI',sans-serif;
  letter-spacing:0;
  color:#173e5e;
  margin:0 0 3px;
  white-space:nowrap;
}
.header-instructions{margin:0;font-size:clamp(11px,1.3vw,13px);line-height:1.2;font-weight:400;color:#476780;white-space:nowrap}
.header-actions{grid-column:3;justify-self:end;align-items:center;margin-left:0}
.icon-button{width:43px;height:43px;background:#eaf4fc;border:1.5px solid #b2d2e8;color:#1b5a8b}
.icon-button:hover{background:#d4eaf9}
.learning{padding:10px 12px 10px}
.question-card{padding:16px 17px 8px;border-radius:17px}
.question{margin:0 auto 12px}
.station-footer{gap:10px;padding:9px 12px;flex-wrap:wrap}
.parcels-progress{gap:10px;min-width:210px}
.parcels-progress strong{font-size:13px}
.top-progress{
  order:3;
  margin:0;
  padding:4px 7px;
  background:#f1f8fd;
  border:1px solid #d3e5f0;
  border-radius:9px;
  gap:7px;
  font-size:11px;
  font-weight:750;
  width:auto;
  white-space:nowrap;
}
.progress-track{width:72px;height:8px}
.status-info{font-size:11px;max-width:150px}
@media(max-width:780px){
  .topbar{padding:6px 10px;gap:6px;min-height:72px}
  .brand-icon{width:56px;height:56px;flex-basis:56px}
  .brand strong{font-size:13px}
  .brand small{font-size:10px}
  .header-learning h1{font-size:clamp(22px,3.35vw,25px)}
  .header-instructions{font-size:11px}
  .top-progress{order:3;max-width:none;width:auto;flex-direction:row;justify-content:center}
  .progress-track{width:70px}
  .header-actions{margin-left:0}
  .station-footer{display:flex;align-items:center;gap:7px}
  .status-info{margin-top:0}
}
@media(max-width:680px){
  .topbar{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;row-gap:3px;min-height:0;padding:6px 10px 8px}
  .brand{grid-column:1;grid-row:1}
  .brand-icon{width:48px;height:48px;flex-basis:48px}
  .header-actions{grid-column:2;grid-row:1}
  .header-learning{grid-column:1/-1;grid-row:2;justify-self:center;padding:0 4px}
  .header-learning h1{font-size:clamp(21px,5.1vw,25px);margin-bottom:1px}
  .header-instructions{font-size:12px}
  .learning{padding:8px 8px 8px}
  .question-card{padding:13px 10px 7px}
  .top-progress{margin:0;width:auto}
  .station-footer{justify-content:center}
  .status-info{max-width:100%;text-align:center}
}
@media(max-width:430px){
  .brand strong{font-size:13px}
  .brand small{font-size:10px}
  .brand-icon{width:48px;height:48px;flex-basis:48px}
  .header-learning h1{font-size:21px}
  .header-instructions{font-size:11px}
  .icon-button{width:35px;height:35px}
  .station-footer{padding:8px}
  .parcels-progress{width:100%;flex:1 1 100%;min-width:0}
  .status-info{flex:1 1 100%;margin-top:0}
  .top-progress{order:3;margin:0 auto}
}
@media(max-width:360px){
  .topbar{padding:5px 7px 8px}
  .brand{gap:6px}
  .brand-icon{width:46px;height:46px;flex-basis:46px}
  .header-learning h1{font-size:20px}
  .header-instructions{font-size:11px;white-space:normal}
}
