/* The companion stays on the map; only expanded speech pauses the game. */
.guide-companion {
    position: absolute; top: 12px; left: 12px; z-index: 4;
    display: flex; align-items: center; gap: 8px;
    width: min(300px, calc(100% - 24px)); padding: 6px 12px 6px 4px;
    text-align: left; border: 3px solid #986430; border-radius: 12px;
    background: linear-gradient(#fff4daec, #e5cda9f2); color: #352b21;
    box-shadow: 0 4px 12px #23190d55;
}
.guide-portrait-frame {
    display: block; position: relative; aspect-ratio: 160 / 190; padding: 10%;
    border-radius: 12px; background: #784a29 url('art/oak-texture-v1.png') center / cover;
    box-shadow: 0 3px 8px #26180c66;
}
.guide-portrait-frame::after { content: ''; position: absolute; inset: 0; background: url('art/ui/guide-frame.svg') center / 100% 100% no-repeat; pointer-events: none; }
.guide-portrait-frame img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 5px; background: radial-gradient(ellipse at center, #83907a, #344c43); }
.guide-companion .guide-portrait-frame { width: 78px; flex-shrink: 0; padding: 8px; }
.guide-companion strong, .guide-companion small, .guide-companion em { display: block; }
.guide-companion strong { font: bold 16px Georgia, serif; }
.guide-companion small { margin-top: 5px; font-size: 12px; line-height: 1.3; }
.guide-companion em { margin-top: 5px; font-size: 11px; font-style: normal; color: #426651; }
.tool-tabs button.guide-highlight { outline: 3px solid #efbe56; outline-offset: -3px; box-shadow: inset 0 0 12px #e2b14688; }
.guide-backdrop { z-index: 110; }
.game-popup.guide-popup {
    display: grid; grid-template-columns: 190px minmax(0, 1fr);
    gap: 24px; width: min(820px, calc(100vw - 32px)); max-width: 820px;
    padding: 32px; align-items: center; overflow: visible;
}
.guide-portrait { width: 100%; }
.guide-bubble { position: relative; padding: 20px; border: 2px solid #b48c50; border-radius: 16px; background: #fff5dc; }
.guide-bubble::before {
    content: ''; position: absolute; left: -12px; top: 60px; width: 20px; height: 20px;
    border-left: 2px solid #b48c50; border-bottom: 2px solid #b48c50;
    background: #fff5dc; transform: rotate(45deg);
}
.guide-bubble .eyebrow { color: #765230; }
.guide-bubble h2 { margin-top: 8px; font-size: 27px; }
.guide-bubble p { font-size: 15px; line-height: 1.55; }
.guide-task { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-block: 1px solid #dac39a; }
.guide-task .asset { width: 100px; height: 100px; flex-shrink: 0; }
.guide-task p { margin: 0; }
.guide-control-preview { flex:none; padding:8px; border:2px solid #a4713c; border-radius:8px; color:#fff8e8; background:#63391f; }
.guide-task .guide-control-preview .asset { width:28px; height:28px; margin:0; float:none; }
.guide-control-preview.resource { display:flex; gap:6px; align-items:center; }
.guide-control-preview.resource > span:last-child { display:flex; flex-direction:column; gap:3px; color:#fff8e8; }
.guide-control-preview.resource strong { color:#fff8e8; font-size:18px; }
.guide-tab-preview { display:flex; flex-direction:column; align-items:center; gap:6px; max-width:120px; text-align:center; }
.guide-tab-preview .tool-icon { width:44px; height:44px; }
.guide-actions, .guide-start-options { display: grid; gap: 8px; }
.guide-actions button, .guide-start-options button { width: 100%; min-height: 42px; }
.guide-start-options { margin-block: 20px 10px; }
.guide-start-options button { text-align: left; padding: 15px; }
.guide-start-options strong, .guide-start-options small { display: block; }
.guide-start-options small { margin-top: 6px; font-size: 12px; font-weight: normal; line-height: 1.5; }
.map-size-options { border: 0; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.map-size-options legend { font-weight: bold; margin-bottom: 8px; }
.map-size-options label { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 6px; border: 2px solid #dac39a; border-radius: 8px; background: #f2e6ce; }
.map-size-options label.selected { border-color: #6b8053; background: #e0ebcc; }
.map-size-options input { width: auto; margin: 0; accent-color: #496c3c; }
.map-size-options small { flex-basis: 100%; font-size: 11px; }
.game-popup.generation-popup { width: min(720px, calc(100vw - 32px)); padding: 24px; text-align: center; overflow: hidden; max-height:none; }
.loading-screen { overflow:hidden; }
.story-backdrop { overflow:hidden; z-index:125; }
.game-popup.story-popup { width:min(1040px,calc(100vw - 24px)); padding:12px; overflow:hidden; background:#f3e3bf; }
.story-slides { position:relative; height:clamp(360px,calc(66vw + 140px),740px); overflow:hidden; visibility:hidden; }
.story-ready .story-slides { visibility:visible; }
.story-slide { position:absolute; inset:0; display:grid; grid-template-rows:minmax(0,1fr) auto; opacity:0; transition:opacity 1s ease-in-out; pointer-events:none; }
.story-slide.active { opacity:1; z-index:1; }
.story-slide img { width:100%; height:100%; min-height:0; object-fit:contain; background:#322f24; border-radius:8px; }
.story-caption { padding:14px 18px 8px; min-height:118px; text-align:center; }
.story-caption h2 { margin:0 0 8px; }
.story-caption p { font-size:17px; line-height:1.45; margin:0; }
.story-loading { position:absolute; inset:30% 20px auto; text-align:center; }
.story-ready .story-loading { display:none; }
.story-controls { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; align-items:center; padding-top:10px; }
.story-counter { min-width:48px; text-align:center; }
.game-popup.population-praise-popup { width:min(900px,calc(100vw - 24px)); text-align:center; overflow:hidden; }
.population-praise-popup img { display:block; width:100%; max-height:56vh; object-fit:contain; border-radius:9px; }
.population-praise-popup h2 { margin-top:15px; font-size:30px; }
.population-praise-popup p { font-size:17px; line-height:1.5; }
@media(max-width:540px) {
    .story-caption { padding:12px 6px; min-height:140px; }
    .story-caption h2 { font-size:20px; }
    .story-caption p,.population-praise-popup p { font-size:14px; }
    .story-controls { gap:4px; }
    .story-controls button { padding:7px 10px; font-size:12px; }
}
.generation-art { height: clamp(180px, 34vh, 300px); position: relative; overflow: hidden; border: 2px solid #b48c50; border-radius: 12px; margin-bottom: 22px; background: #dbcaa5; }
.generation-art img { display:block; width:100%; height:100%; object-fit:cover; object-position:center 20%; }
.generation-popup progress { display: block; width: 100%; height: 22px; accent-color: #6b8053; border: 1px solid #927044; border-radius: 12px; overflow: hidden; background: #ddcba7; }
.generation-popup progress::-webkit-progress-bar { background: #ddcba7; }
.generation-popup progress::-webkit-progress-value { background: linear-gradient(90deg, #486a43, #92ad62); }
.generation-popup progress::-moz-progress-bar { background: #6b8053; }
.generation-percent { display: block; margin-top: 8px; font-size: 20px; font-variant-numeric: tabular-nums; }
.boot-progress { height: 22px; border: 1px solid #927044; border-radius: 12px; overflow: hidden; background: #ddcba7; }
.boot-progress span { display: block; height: 100%; width: var(--blazor-load-percentage, 0%); background: linear-gradient(90deg, #486a43, #92ad62); }
.boot-percent::after { content: var(--blazor-load-percentage-text, 'Načítání…'); }
@media (max-width: 650px) {
    .game-popup.start-choice { grid-template-columns: 1fr; max-height: calc(100dvh - 32px); overflow: auto; }
    .start-choice .guide-portrait { display: none; }
    .start-choice .guide-bubble::before { display: none; }
    .game-popup.generation-popup { padding: 16px; }
}
@media (max-width: 650px) {
    .game-popup.guide-popup { grid-template-columns: 86px minmax(0, 1fr); padding: 24px 12px 12px; gap: 12px; }
    .guide-bubble { padding: 12px; }
    .guide-bubble h2 { font-size: 21px; }
    .guide-bubble p { font-size: 13px; }
    .guide-task { display: block; }
    .guide-task .asset { float: right; width: 60px; height: 60px; margin-left: 6px; }
    .guide-companion { width: min(245px, calc(100% - 24px)); }
    .guide-companion .guide-portrait-frame { width: 54px; padding: 6px; }
}
@media (max-height: 550px) {
    .game-popup.guide-popup { padding: 20px; gap: 14px; }
    .guide-bubble { padding: 12px; }
    .guide-bubble h2 { font-size: 22px; }
    .guide-bubble p { font-size: 13px; margin-block: 7px; }
    .guide-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .guide-actions button { font-size: 12px; padding: 6px; }
}

/* Android keeps only the half-size portrait while the guide is at rest. */
.island-native .guide-companion { width:auto; min-width:44px; min-height:44px; padding:0; gap:0; justify-content:center; border:0; border-image:none; background:none; box-shadow:none; }
.island-native .guide-companion>span:not(.guide-portrait-frame) { display:none; }
.island-native .guide-companion .guide-portrait-frame { width:39px; padding:4px; }
@media(max-width:650px) {
    .island-native .guide-companion .guide-portrait-frame { width:27px; padding:3px; }
}
