/* Svitek – Hopla (ink #16203A, sun #FFC93C, balloon #C8321F) + pergamenové tóny. */
:root { --ink: #16203A; --sun: #FFC93C; --muted: #5A4A3A; --parch: #F6E8C8; --brown: #6A4220; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: 'Rubik', system-ui, sans-serif; color: var(--ink); background: #16203A; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
#app { position: relative; display: flex; flex-direction: column; height: 100%; }

.bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: linear-gradient(#3a2414, #2a180c); color: #F6E8C8; border-bottom: 3px solid #8a5a2a; }
.ico { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 2px solid #1a0e06; border-radius: 10px; background: #6a4220; color: #fff; box-shadow: 0 3px 0 #1a0e06; }
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sctitle { flex: 1; font-family: 'Alegreya', serif; font-weight: 800; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars { font-weight: 700; color: var(--sun); white-space: nowrap; }
.hint { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 2px solid #1a0e06; border-radius: 12px; background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 3px 0 #1a0e06; }
.hint span { font-size: 22px; }
@media (max-width: 600px) { .hint { padding: 0 8px; font-size: 0; } .hint span { font-size: 22px; } .stars { font-size: 14px; } .sctitle { font-size: 18px; } }

.stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#game { position: absolute; inset: 0; }
#game canvas { display: block; }

/* batoh */
.inv { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; max-width: calc(100% - 24px); overflow-x: auto; background: rgba(42,24,12,.82); border: 2px solid #8a5a2a; border-radius: 16px; color: #F6E8C8; z-index: 5; }
.inv .lbl { font-family: 'Alegreya', serif; font-weight: 800; margin-right: 4px; }
.inv .empty { opacity: .7; font-size: 14px; }
.inv .item { width: 64px; height: 64px; padding: 4px; border: 3px solid #c8a060; border-radius: 12px; background: var(--parch); }
.inv .item img { width: 100%; height: 100%; }
.inv .slot { width: 64px; height: 64px; flex: 0 0 auto; border: 3px dashed rgba(200,160,96,.55); border-radius: 12px; }
.inv .lbl small { display: block; font-family: 'Rubik', sans-serif; font-weight: 600; font-size: 13px; opacity: .8; }
.inv .item.sel { border-color: var(--sun); background: #fff6d0; box-shadow: 0 0 0 3px var(--sun); transform: translateY(-4px); }
.tip { position: fixed; z-index: 60; transform: translate(14px, 16px); padding: 4px 10px; border-radius: 8px; background: rgba(22,32,58,.9); color: #fff; font-weight: 600; font-size: 15px; pointer-events: none; white-space: nowrap; }
.cursorItem { position: fixed; z-index: 59; width: 52px; height: 52px; transform: translate(-6px, -6px); pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.4)); }

/* řeč a volby */
.say { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 0 12px 96px; cursor: pointer; }
.say .box { position: relative; width: min(920px, 100%); padding: 16px 22px 18px; background: var(--parch); border: 3px solid var(--brown); border-radius: 18px; box-shadow: 0 8px 0 rgba(26,14,6,.6); font-family: 'Alegreya', serif; font-size: 23px; line-height: 1.35; animation: up .2s ease-out; }
.say.dove .box { background: #fff; border-color: #3a7ac0; }
.say .who { display: inline-block; margin-bottom: 4px; padding: 2px 12px; border-radius: 999px; background: var(--brown); color: #fff; font-family: 'Rubik', sans-serif; font-size: 15px; }
.say.dove .who { background: #3a7ac0; }
.say p { margin: 0; }
.say .more { position: absolute; right: 16px; bottom: 8px; color: var(--brown); animation: blink 1s infinite; }
.say .read { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 22px; }
.say .opts { display: grid; gap: 8px; margin-top: 12px; }
.say .opts button { padding: 10px 14px; border: 2px solid var(--brown); border-radius: 12px; background: #fff; text-align: left; font-family: 'Rubik', sans-serif; font-size: 17px; font-weight: 600; }
.say .opts button:hover { background: #fff3c8; }
@keyframes up { from { transform: translateY(14px); opacity: 0; } }
@keyframes blink { 50% { opacity: .2; } }
.years { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 0 8%; text-align: center; background: rgba(10,8,4,.82); color: var(--parch); font-family: 'Alegreya', serif; font-size: 44px; font-weight: 800; pointer-events: none; }
@media (max-width: 700px) { .years { font-size: 28px; } }
.years.show { animation: fade 2.3s; }
@keyframes fade { 0% { opacity: 0; } 20%, 80% { opacity: 1; } 100% { opacity: 0; } }
.toast { position: absolute; left: 50%; top: 14px; z-index: 50; transform: translateX(-50%); padding: 8px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 4px 0 rgba(0,0,0,.3); pointer-events: none; max-width: calc(100% - 24px); text-align: center; }
.toast.show { animation: up .25s ease-out; }
.miniHud { position: absolute; left: 50%; top: 14px; z-index: 6; transform: translateX(-50%); padding: 6px 18px; border-radius: 999px; background: rgba(42,24,12,.85); color: #fff; font-weight: 700; font-size: 20px; max-width: calc(100% - 24px); text-align: center; }

/* sýpky */
.grain { position: absolute; right: 14px; top: 14px; z-index: 6; width: min(420px, calc(100% - 28px)); padding: 14px 16px; background: var(--parch); border: 3px solid var(--brown); border-radius: 16px; box-shadow: 0 6px 0 rgba(26,14,6,.5); }
.grain .yr { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 700; color: #fff; }
.grain .yr.plenty { background: #3a8a3a; } .grain .yr.famine { background: #c06020; }
.grain .stats { display: flex; gap: 16px; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.grain .stats span { display: flex; flex-direction: column; }
.grain .stats b { font-size: 19px; color: var(--ink); }
.grain .msg { margin: 8px 0; line-height: 1.35; }
.grain .req { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #fff3c8; }
.grain .store { display: block; font-weight: 600; }
.grain .store input { width: 100%; margin-top: 6px; accent-color: #c09020; }
.grain .sub { margin: 4px 0; font-size: 14px; color: var(--muted); }
.grain .warn { color: #c0301e; }
.grain .row { justify-content: flex-start; margin-top: 10px; }

/* překryvné vrstvy */
.overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 14px; overflow: auto; background: rgba(22,14,6,.7); }
.overlay.story { background: rgba(22,14,6,.88); }
.panel { width: min(1000px, 100%); margin: auto; padding: 16px; background: var(--parch); border: 4px solid var(--brown); border-radius: 18px; box-shadow: 0 10px 0 rgba(0,0,0,.4); }
.panel h2 { margin: 0 0 10px; text-align: center; font-family: 'Alegreya', serif; font-size: 34px; color: var(--brown); }
.panel canvas { display: block; width: 100%; height: auto; border-radius: 12px; border: 3px solid #8a5a2a; }
.panel .txt { margin: 14px 4px 6px; font-family: 'Alegreya', serif; font-size: clamp(19px, 2.4vw, 26px); line-height: 1.35; }
.panel .row { align-items: center; justify-content: flex-end; }
.panel .ref { flex: 1; color: var(--muted); font-style: italic; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #d8c090; } .dots i.on { background: var(--brown); }
.dlg { width: min(560px, 100%); margin: auto; padding: 22px; background: var(--parch); border: 4px solid var(--brown); border-radius: 18px; box-shadow: 0 10px 0 rgba(0,0,0,.4); text-align: center; animation: up .2s ease-out; }
.dlg h2 { margin: 0 0 8px; font-family: 'Alegreya', serif; font-size: 30px; line-height: 1.1; color: var(--brown); }
.dlg h3 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dlg p { margin: 6px 0; line-height: 1.4; }
.sub { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.btn { height: 46px; padding: 0 20px; border: 2px solid var(--ink); border-radius: 12px; background: var(--sun); color: var(--ink); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.btn.light { background: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:active, .big:active { transform: translateY(2px); }
.big { width: 100%; height: 56px; margin-top: 16px; border: 3px solid var(--ink); border-radius: 14px; background: var(--sun); font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 var(--ink); }
.title .logo { display: flex; align-items: center; justify-content: center; gap: 10px; }
.title .logo img { width: 80px; height: 80px; }
.title h1 { margin: 0; font-family: 'Alegreya', serif; font-size: 64px; color: var(--brown); }
.title .tag { color: var(--muted); }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.levels button { padding: 12px 10px; border: 3px solid #c8a060; border-radius: 14px; background: #fff; text-align: center; }
.levels button span { display: block; font-size: 40px; }
.levels button b { display: block; font-size: 18px; }
.levels button small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.3; }
.levels button.sel { border-color: var(--ink); background: var(--sun); box-shadow: 0 4px 0 var(--ink); }
.levels.small button { padding: 8px; font-weight: 700; }
@media (max-width: 460px) { .levels { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; text-align: left; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--ink); }
.subchecks { padding-left: 30px; }
.subchecks .check { margin-top: 6px; font-size: .92em; }
/* kvíz */
.quiz .qn { color: var(--muted); font-size: 14px; }
.quiz h2 { margin: 6px 0 14px; }
.qopts { display: grid; gap: 10px; }
.qopts button { padding: 12px 14px; border: 3px solid #c8a060; border-radius: 14px; background: #fff; font-size: 18px; font-weight: 600; text-align: left; }
.quiz.kids .qopts button { font-size: 24px; text-align: center; padding: 14px; }
.qopts button.ok { border-color: #2e8a3e; background: #d8f4d8; }
.qopts button.bad { border-color: #c0301e; background: #fbdcd6; }
.fb { font-weight: 700; }
/* kartička */
.card .seal img { width: 110px; height: 110px; padding: 8px; background: #fff3c8; border: 4px solid #c8a060; border-radius: 50%; }
.stars span { display: inline-block; font-size: 46px; color: #d8c8a0; }
.stars span.on { color: #e8a010; animation: pop .5s both; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); } 70% { transform: scale(1.3); } }
.why { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 4px 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.why li.ok { color: #2e7a3e; font-weight: 700; }
blockquote { margin: 12px 0; padding: 12px 16px; background: #fff8e0; border-left: 5px solid #c8a060; border-radius: 8px; font-family: 'Alegreya', serif; font-size: 21px; font-style: italic; text-align: left; }
blockquote cite { display: block; margin-top: 6px; font-family: 'Rubik', sans-serif; font-size: 13px; font-style: normal; color: var(--muted); }
.facts { margin: 0; padding-left: 20px; text-align: left; line-height: 1.4; }
.names { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.names span { padding: 3px 10px; border-radius: 999px; background: #fff; border: 2px solid #c8a060; font-weight: 600; font-size: 14px; }
.names i { color: #a8885a; font-style: normal; }
.names.locked span { color: #b8a080; border-style: dashed; }
.tree { width: min(760px, 100%); }
/* nízká okna (portál v iframe, telefon na šířku) */
@media (max-height: 620px) {
  .dlg { padding: 14px 16px; }
  .title .logo img { width: 52px; height: 52px; }
  .title h1 { font-size: 42px; }
  .title .tag { margin: 2px 0; font-size: 14px; }
  .levels button { padding: 6px 8px; }
  .levels button span { font-size: 26px; }
  .levels button small { display: none; }
  .big { height: 46px; margin-top: 10px; font-size: 19px; }
  .dlg h3 { margin: 8px 0 4px; }
  .say { padding-bottom: 84px; }
  .say .box { font-size: 19px; padding: 10px 16px 12px; }
  .inv .item, .inv .slot { width: 50px; height: 50px; }
  .panel .txt { font-size: 18px; margin: 8px 2px 4px; }
  .panel h2 { font-size: 24px; margin-bottom: 6px; }
}
/* adventura s chozením: portréty v dialogu, úkol, malovaná vyprávění */
.say.hasPor .box { display: flex; align-items: flex-end; gap: 16px; padding-left: 16px; }
.say.hasPor.porRight .box { flex-direction: row-reverse; padding-right: 16px; }
.say .por { flex: 0 0 auto; width: 150px; height: 150px; margin: -60px 0 -6px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,.35)); }
.say .por.right { transform: scaleX(-1); }
.say .txtw { flex: 1; min-width: 0; }
.say .opts .bye { background: #f3e6c8; color: var(--muted); }
.goal { position: absolute; left: 12px; top: 12px; z-index: 6; max-width: calc(100% - 24px); padding: 6px 14px; border-radius: 999px; background: rgba(42,24,12,.82); border: 2px solid #8a5a2a; color: #F6E8C8; font-size: 16px; pointer-events: none; }
.goal b { color: var(--sun); }
.miniHud .skip { margin-left: 10px; padding: 4px 10px; border: 2px solid #F6E8C8; border-radius: 10px; background: transparent; color: #F6E8C8; font-weight: 600; font-size: 14px; pointer-events: auto; }
.miniHud .next { background: var(--sun); color: var(--ink); border-color: var(--sun); font-size: 16px; }
.pimg { position: relative; overflow: hidden; border-radius: 12px; border: 3px solid #8a5a2a; aspect-ratio: 16 / 9; background: #2a180c; }
.pimg img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pimg.rain::after, .pimg.storm::after { content: ''; position: absolute; inset: -120px -60px 0; z-index: 2; background-image: radial-gradient(1.5px 14px at 20% 30%, rgba(210,225,255,.55), transparent), radial-gradient(1.5px 18px at 70% 10%, rgba(210,225,255,.45), transparent), radial-gradient(1px 12px at 45% 70%, rgba(210,225,255,.5), transparent), radial-gradient(1.5px 16px at 90% 55%, rgba(210,225,255,.4), transparent), radial-gradient(1px 10px at 8% 85%, rgba(210,225,255,.45), transparent); background-size: 97px 113px, 131px 89px, 73px 127px, 151px 101px, 109px 79px; transform: rotate(8deg); animation: rain .45s linear infinite; }
.pimg.storm img { filter: brightness(.55) saturate(.7) hue-rotate(-10deg); }
.pimg.storm::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: linear-gradient(transparent, rgba(40,70,110,.85) 30%); z-index: 1; animation: flood 6s ease-out forwards; }
.pimg.rainbow::after { content: ''; position: absolute; left: 10%; top: 8%; width: 80%; aspect-ratio: 2 / 1; border-radius: 50% 50% 0 0 / 100% 100% 0 0; background: radial-gradient(circle at 50% 100%, transparent 54%, rgba(150,60,200,.5) 55%, rgba(60,90,230,.5) 59%, rgba(60,180,90,.5) 63%, rgba(250,220,60,.5) 67%, rgba(250,140,40,.5) 71%, rgba(230,50,50,.5) 75%, transparent 76%); animation: fadein 2s; }
@keyframes rain { from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; } to { background-position: -12px 113px, -10px 89px, -14px 127px, -12px 101px, -10px 79px; } }
@keyframes flood { from { height: 0; } }
@keyframes fadein { from { opacity: 0; } }
@media (max-height: 620px) { .say .por { width: 100px; height: 100px; margin-top: -40px; } .goal { font-size: 13px; } }
