/* ==========================================================================
   ROBOMĚSTO – Šroubek a Ztracená Jiskra
   Vizuální styl: Ručně kreslené měděné a mosazné Machinarium + tyrkysové elektronky
   Optimalizováno pro iPad (Safari dotykové ovládání) i PC
   ========================================================================== */

:root {
    --bg-dark: #16110d;
    --bg-panel: #261d16;
    --bg-panel-inner: #1d262b;
    --brass: #d99b43;
    --brass-dark: #8c5327;
    --copper: #c87533;
    --parchment: #f6ecd8;
    --parchment-ink: #261910;
    --turq: #26e6da;
    --turq-bright: #6fffe9;
    --turq-deep: #00897b;
    --turq-glow: rgba(38, 230, 218, 0.48);
    --amber-glow: rgba(242, 180, 65, 0.42);
    --ok-green: #2ecc71;
    --err-coral: #ff7043;
    --text-cream: #f4ead7;
    --text-muted: #cbb99d;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: radial-gradient(circle at center, #2a1f17 0%, #120d0a 100%);
    color: var(--text-cream);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.hidden {
    display: none !important;
}

#app-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================================================
   Horní mosazná lišta (HUD + Batoh + Tlačítka)
   ========================================================================== */
#top-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(180deg, #36271d 0%, #221812 100%);
    border-bottom: 3px solid var(--brass-dark);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    flex-wrap: wrap;
    z-index: 20;
}

.hud-brand-group {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    background: rgba(15, 22, 26, 0.78);
    border: 1.5px solid var(--brass);
    border-radius: 999px;
    font-size: 0.88rem;
    color: var(--text-cream);
}

.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--turq);
    box-shadow: 0 0 8px var(--turq);
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(20, 15, 11, 0.82);
    border: 1.5px solid var(--brass-dark);
    border-radius: 999px;
    font-size: 0.86rem;
}

.stat-turquoise {
    border-color: var(--turq);
    color: var(--turq-bright);
    box-shadow: inset 0 0 10px rgba(38, 230, 218, 0.16);
}

/* Inventář (Batoh) */
#inventory-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 11, 8, 0.65);
    border: 1.5px solid #6b4423;
    border-radius: 12px;
    padding: 3px 9px;
    min-height: 44px;
    max-width: 100%;
    overflow-x: auto;
}

.inv-bag-icon {
    font-size: 1.2rem;
}

#inventory-slots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inv-empty-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0 4px;
}

.inv-slot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(180deg, #3c2b1f, #261b13);
    border: 2px solid var(--brass-dark);
    border-radius: 9px;
    padding: 2px 8px 2px 4px;
    color: var(--text-cream);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.inv-slot:hover {
    transform: translateY(-1px);
    border-color: var(--brass);
}

.inv-slot.selected {
    border-color: var(--turq);
    background: linear-gradient(180deg, #1b3d40, #13282b);
    box-shadow: 0 0 12px var(--turq-glow);
}

.inv-slot.inv-pulse {
    animation: pulseTurq 0.6s ease-in-out 3;
}

.inv-svg svg {
    width: 32px;
    height: 32px;
    display: block;
}

.inv-name {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Akční tlačítka v HUD */
.hud-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.hud-btn {
    position: relative;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 9px;
    border: 1.5px solid var(--brass-dark);
    background: linear-gradient(180deg, #422f21 0%, #2a1d14 100%);
    color: var(--text-cream);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}

.hud-btn:hover, .hud-btn:active {
    border-color: var(--brass);
    transform: translateY(-1px);
}

.hud-btn.btn-accent-teal {
    background: linear-gradient(180deg, #144d4d 0%, #0d3336 100%);
    border-color: var(--turq);
    color: var(--turq-bright);
}

.hud-btn.btn-glow-hint {
    border-color: #f2b441;
    color: #ffe39f;
}

.mistake-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 3px;
    border-radius: 999px;
    background: var(--err-coral);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.active-item-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 5px 14px;
    background: linear-gradient(90deg, #0f383a, #175254, #0f383a);
    border-bottom: 2px solid var(--turq);
    color: var(--turq-bright);
    font-size: 0.88rem;
    z-index: 19;
}

.banner-cancel-btn {
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    border: 1px solid var(--turq);
    border-radius: 6px;
    padding: 3px 9px;
    cursor: pointer;
    font-weight: 600;
}

.save-toast {
    position: fixed;
    top: 66px;
    right: 16px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #113e3d;
    border: 1.5px solid var(--turq);
    color: var(--turq-bright);
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s;
    z-index: 95;
}

.save-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Hlavní 16:9 ilustrovaná scéna Roboměsta
   ========================================================================== */
#stage-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
}

#scene-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    width: min(100%, calc((100dvh - 96px) * 16 / 9));
    max-height: 100%;
    border-radius: 14px;
    border: 4px solid #6c4324;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.82), inset 0 0 28px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    background: #1e1610;
    cursor: pointer;
}

#scene-bg {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    pointer-events: none;
}

#scene-entities {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Jemné poletující jiskřičky ve scéně */
.ambient-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.mote {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--turq);
    box-shadow: 0 0 10px var(--turq);
    opacity: 0.55;
    animation: floatMote 9s infinite ease-in-out;
}
.mote.m1 { left: 22%; top: 44%; animation-delay: 0s; }
.mote.m2 { left: 48%; top: 32%; animation-delay: 2.1s; background: #ffd57e; box-shadow: 0 0 8px #ffd57e; }
.mote.m3 { left: 74%; top: 52%; animation-delay: 4.3s; }
.mote.m4 { left: 62%; top: 25%; animation-delay: 1.4s; }
.mote.m5 { left: 33%; top: 62%; animation-delay: 5.5s; background: #ffd57e; }

@keyframes floatMote {
    0%, 100% { transform: translate(0, 0) scale(0.85); opacity: 0.25; }
    50% { transform: translate(10px, -18px) scale(1.2); opacity: 0.75; }
}

/* Efekt rozsvícené Velké Tyrkysové Jiskry v Observatoři */
.reactor-victory-glow {
    position: absolute;
    left: 58%;
    top: 48%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    pointer-events: none;
}

.spark-core-glow {
    position: absolute;
    inset: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(38, 230, 218, 0.7) 0%, rgba(38, 230, 218, 0) 70%);
    animation: pulseTurq 2.2s infinite ease-in-out;
}

/* Interaktivní prvky a NPC */
.hotspot-el, .npc-el {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 12;
}

.npc-el {
    transform: translate(-50%, -88%);
    z-index: 8;
}

.npc-figure {
    width: clamp(58px, 7.6vw, 96px);
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.6));
    animation: npcBob 3.2s infinite ease-in-out;
}

@keyframes npcBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.hotspot-ring {
    position: absolute;
    width: 54px;
    height: 54px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px dashed rgba(38, 230, 218, 0.75);
    box-shadow: 0 0 14px rgba(38, 230, 218, 0.35);
    animation: spinSlow 11s linear infinite;
    pointer-events: none;
}

@keyframes spinSlow {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.pickup-floating {
    background: radial-gradient(circle, rgba(24, 38, 44, 0.85) 0%, rgba(24, 38, 44, 0.25) 75%);
    border-radius: 50%;
    padding: 5px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.75));
    animation: npcBob 2.4s infinite ease-in-out;
}

.hotspot-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(28, 20, 14, 0.86);
    border: 2.5px solid var(--brass);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    transition: transform 0.16s, border-color 0.16s;
}

.hotspot-badge.machine-ready,
.hotspot-badge.door-open {
    border-color: var(--turq);
    box-shadow: 0 0 15px var(--turq-glow);
}

.hotspot-badge.machine-done {
    background: #103c3c;
    border-color: var(--turq-bright);
}

.hotspot-el:hover .hotspot-badge,
.npc-el:hover .npc-figure {
    transform: scale(1.1);
}

.entity-tag {
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(18, 13, 9, 0.88);
    border: 1px solid var(--brass-dark);
    color: var(--parchment);
    font-size: clamp(0.66rem, 1.05vw, 0.8rem);
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.65);
}

/* ==========================================================================
   Hrdina: Robůtek Šroubek (Natahování & Krčení jako v Machinariu!)
   ========================================================================== */
#hero-robot {
    position: absolute;
    left: 26%;
    top: 85%;
    width: clamp(64px, 7.8vw, 102px);
    transform: translate(-50%, -94%);
    transform-origin: 50% 94%;
    z-index: 10;
    cursor: pointer;
    transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7));
}

#hero-robot.posture-tall {
    transform: translate(-50%, -94%) scaleY(1.42) scaleX(0.91);
}

#hero-robot.posture-short {
    transform: translate(-50%, -94%) scaleY(0.64) scaleX(1.14);
}

#hero-flip-wrap {
    width: 100%;
    transition: transform 0.16s ease-out;
}

.hero-svg {
    width: 100%;
    height: auto;
    display: block;
}

#hero-robot.walking .hero-svg {
    animation: heroWalkBounce 0.32s infinite alternate ease-in-out;
}

@keyframes heroWalkBounce {
    from { transform: translateY(0px) rotate(-1.6deg); }
    to { transform: translateY(-5px) rotate(1.6deg); }
}

.hero-eyes {
    transform-origin: 46px 46px;
    animation: heroBlink 4.6s infinite;
}

@keyframes heroBlink {
    0%, 94%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(0.12); }
}

.antenna-bulb, .hero-heart-led {
    animation: pulseTurq 2s infinite alternate;
}

@keyframes pulseTurq {
    0% { opacity: 0.72; filter: brightness(0.95); }
    100% { opacity: 1; filter: brightness(1.3); }
}

/* Kruh po ťuknutí na podlahu */
.walk-ripple {
    position: absolute;
    width: 34px;
    height: 16px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2.5px solid var(--turq);
    pointer-events: none;
    animation: rippleOut 0.52s ease-out forwards;
    z-index: 5;
}

@keyframes rippleOut {
    from { opacity: 0.95; transform: translate(-50%, -50%) scale(0.4); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
}

/* Plovoucí tlačítka výšky Šroubka v levém dolním rohu scény */
#posture-controls {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    gap: 6px;
    background: rgba(22, 16, 11, 0.86);
    border: 2px solid var(--brass-dark);
    border-radius: 12px;
    padding: 5px;
    z-index: 14;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.posture-btn {
    min-height: 40px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1.5px solid #5c3b20;
    background: #2e2118;
    color: var(--text-cream);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.posture-btn.active {
    background: linear-gradient(180deg, #154e50, #0d3235);
    border-color: var(--turq);
    color: var(--turq-bright);
    box-shadow: 0 0 10px var(--turq-glow);
}

/* Komiksová bublina ve stylu Machinaria */
.speech-bubble {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92%, 540px);
    background: var(--parchment);
    color: var(--parchment-ink);
    border: 3px solid #3a2414;
    border-radius: 18px;
    padding: 11px 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72);
    z-index: 16;
    animation: popBubble 0.2s ease-out;
}

@keyframes popBubble {
    from { transform: translateX(-50%) scale(0.9); opacity: 0; }
    to { transform: translateX(-50%) scale(1); opacity: 1; }
}

.bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #7c4318;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bubble-close {
    background: transparent;
    border: none;
    font-size: 1rem;
    color: #5a3921;
    cursor: pointer;
    padding: 2px 6px;
}

#bubble-text {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.42;
    font-weight: 500;
}

#bubble-action-wrap {
    margin-top: 8px;
}

/* ==========================================================================
   Modální okna a Skříň Mechanického Stroje (Hlavolamy češtiny)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 6, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 60;
}

.modal-topmost {
    z-index: 85;
}

.machine-cabinet, .steampunk-dialog {
    width: min(100%, 760px);
    max-height: 92dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #2d2118 0%, #1c1510 100%);
    border: 4px solid var(--brass);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.9), inset 0 0 22px rgba(0, 0, 0, 0.6);
    padding: 16px 18px;
}

.dialog-md {
    width: min(100%, 580px);
}

.dialog-lg {
    width: min(100%, 840px);
}

.cabinet-top-bar, .dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #5e3c20;
}

.cabinet-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cabinet-top-bar h2, .dialog-head h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #ffe3b3;
}

.topic-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: #123c3f;
    border: 1.5px solid var(--turq);
    color: var(--turq-bright);
    font-size: 0.8rem;
    font-weight: 700;
}

.cabinet-close-btn {
    min-height: 38px;
    padding: 6px 12px;
    border-radius: 9px;
    border: 1.5px solid var(--brass-dark);
    background: #3b281c;
    color: var(--text-cream);
    font-weight: 700;
    cursor: pointer;
}

/* Horní řada elektronek + Manometr */
.cabinet-telemetry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    margin: 12px 0;
    background: #161e22;
    border: 2px solid #4c3522;
    border-radius: 12px;
}

.bulbs-rack {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vacuum-bulb {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bulb-glass {
    width: 24px;
    height: 34px;
    border-radius: 12px 12px 4px 4px;
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid #60737d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}

.bulb-filament {
    width: 8px;
    height: 16px;
    border-radius: 4px;
    background: #37474f;
    transition: all 0.25s;
}

.vacuum-bulb.active .bulb-glass {
    border-color: var(--brass);
}

.vacuum-bulb.lit .bulb-glass {
    background: rgba(38, 230, 218, 0.28);
    border-color: var(--turq-bright);
    box-shadow: 0 0 14px var(--turq);
}

.vacuum-bulb.lit .bulb-filament {
    background: var(--turq-bright);
    box-shadow: 0 0 10px #ffffff;
}

.bulb-base {
    width: 18px;
    height: 7px;
    background: var(--brass-dark);
    border-radius: 0 0 3px 3px;
}

.manometer-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 92px;
}

.gauge-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--turq-bright);
    margin-top: -4px;
}

/* Vnitřní komora stroje se slovem a tlačítky */
.machine-chamber {
    background: radial-gradient(circle at top, #243238 0%, #162024 100%);
    border: 2.5px solid #6b4728;
    border-radius: 14px;
    padding: 16px;
}

.chamber-deco-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--turq-bright);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(217, 155, 67, 0.4);
}

.deco-sub {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.puzzle-prompt-wrap {
    text-align: center;
    margin: 14px 0 18px;
}

.machine-word-plate, .machine-question-plate {
    display: inline-block;
    padding: 14px 26px;
    background: linear-gradient(180deg, #4b3321 0%, #312014 100%);
    border: 3px solid var(--brass);
    border-radius: 14px;
    font-size: clamp(1.45rem, 3.3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff6e5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.machine-question-plate {
    font-size: clamp(1.1rem, 2.3vw, 1.4rem);
    font-weight: 700;
}

.gap-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 0 8px;
    margin: 0 4px;
    border-radius: 8px;
    background: #142227;
    border: 2.5px dashed var(--turq);
    color: var(--turq-bright);
}

.gap-slot.filled-ok {
    border-style: solid;
    background: #0f4c4a;
    color: #ffffff;
    box-shadow: 0 0 14px var(--turq);
}

.machine-sentence-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.machine-sentence {
    display: inline-block;
    padding: 14px 22px;
    background: #2f2117;
    border: 2.5px solid var(--brass);
    border-radius: 14px;
    font-size: clamp(1.12rem, 2.4vw, 1.45rem);
    line-height: 1.45;
}

.highlight-word {
    padding: 2px 10px;
    margin: 0 2px;
    border-radius: 8px;
    background: #12494b;
    border: 2px solid var(--turq);
    color: var(--turq-bright);
}

/* Mechanická tlačítka voleb (Ventily / Páky / Ozubená kola) */
.puzzle-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.mech-option-btn {
    position: relative;
    min-height: 68px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 3px solid var(--brass);
    background: linear-gradient(180deg, #422e1f 0%, #291c13 100%);
    color: #fff8eb;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
    transition: transform 0.14s, border-color 0.15s, background 0.15s;
}

.puzzle-options.count-4 .mech-option-btn {
    min-height: 58px;
    font-size: clamp(1rem, 2vw, 1.22rem);
}

.mech-option-btn:hover {
    border-color: var(--turq);
    transform: translateY(-2px);
}

.mech-option-btn:active .opt-wheel-svg {
    transform: rotate(75deg);
}

.opt-wheel-svg {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.mech-option-btn.btn-correct,
.mech-option-btn.btn-reveal-right {
    background: linear-gradient(180deg, #135e58 0%, #0b3c39 100%);
    border-color: var(--turq-bright);
    box-shadow: 0 0 18px var(--turq-glow);
}

.mech-option-btn.btn-wrong {
    background: linear-gradient(180deg, #6b2a1d 0%, #441911 100%);
    border-color: var(--err-coral);
}

/* Nápověda a zpětná vazba */
.puzzle-hint-box {
    margin: 0 auto 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--parchment);
    color: var(--parchment-ink);
    border: 2px solid var(--brass-dark);
    font-size: 0.95rem;
}

.puzzle-feedback {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: center;
}

.feedback-ok {
    background: rgba(18, 84, 78, 0.9);
    border: 2px solid var(--turq);
}

.feedback-err {
    background: rgba(74, 34, 24, 0.94);
    border: 2px solid #ff8a65;
}

.fb-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.fb-rule {
    font-size: 0.94rem;
    color: #f8efe0;
}

.cabinet-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

/* Obecná steampunk tlačítka */
.steampunk-btn {
    min-height: 42px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 2px solid var(--brass);
    background: linear-gradient(180deg, #4b3423 0%, #2f2015 100%);
    color: var(--text-cream);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.15s;
}

.steampunk-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.steampunk-btn.btn-turquoise {
    background: linear-gradient(180deg, #176968 0%, #0f4547 100%);
    border-color: var(--turq);
    color: var(--turq-bright);
    box-shadow: 0 0 14px rgba(38, 230, 218, 0.25);
}

.steampunk-btn.btn-sm {
    min-height: 34px;
    padding: 5px 11px;
    font-size: 0.82rem;
}

.steampunk-btn.btn-lg {
    min-height: 50px;
    padding: 12px 22px;
    font-size: 1.05rem;
}

/* ==========================================================================
   Ostatní modály: Plán lokace, Volná dílna, Učivo, Mapa, Tahák, Vítězství
   ========================================================================== */
.dialog-content {
    padding-top: 12px;
}

.dialog-lead {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 0.94rem;
}

/* Minihra s klíčkem pro modrotiskový plán */
.lockpick-arena {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.bp-intro {
    text-align: center;
    margin: 0 0 8px;
}

.lockpick-pins {
    display: flex;
    gap: 10px;
}

.pin-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--brass);
    background: #1b262c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.pin-dot.done {
    background: var(--turq-deep);
    border-color: var(--turq-bright);
    color: #fff;
    box-shadow: 0 0 10px var(--turq);
}

.blueprint-sheet {
    background: linear-gradient(180deg, #123548 0%, #0c2533 100%);
    border: 2px solid var(--turq);
    border-radius: 12px;
    padding: 16px;
    color: #e3f9ff;
}

.bp-header {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--turq-bright);
    margin-bottom: 8px;
}

.bp-steps {
    line-height: 1.55;
    margin: 0 0 10px;
}

.bp-tip {
    font-size: 0.88rem;
    color: #b4e8ec;
}

/* Volná dílna */
.workshop-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: #172227;
    border: 1.5px solid #4e3824;
    border-radius: 10px;
    font-size: 0.9rem;
}

.workshop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: 12px;
}

.workshop-card {
    background: #231a13;
    border: 2px solid #634124;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.workshop-card.card-mistakes {
    background: linear-gradient(180deg, #18363a 0%, #122528 100%);
    border-color: var(--turq);
}

.wc-head {
    font-weight: 800;
    font-size: 1rem;
    color: #ffe2b0;
}

.workshop-card p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Nastavení učiva */
.preset-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.topics-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px;
    max-height: 48dvh;
    overflow-y: auto;
    padding-right: 4px;
}

.topic-check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 10px;
    background: #221912;
    border: 1.5px solid #4d341f;
    cursor: pointer;
}

.topic-check-row.is-on {
    background: #152d30;
    border-color: var(--turq);
}

.topic-check-row input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--turq);
}

.topic-badge-pill {
    padding: 2px 7px;
    border-radius: 6px;
    background: #3b2819;
    border: 1px solid var(--brass);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.topic-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topic-info strong {
    font-size: 0.88rem;
}

.topic-info small {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.dialog-footer-right {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

/* Mapa Roboměsta */
.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.map-node {
    background: #231912;
    border: 2px solid #593b21;
    border-radius: 12px;
    overflow: hidden;
}

.map-node.current {
    border-color: var(--turq);
    box-shadow: 0 0 14px var(--turq-glow);
}

.map-node.locked {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.map-node-thumb {
    height: 105px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.map-status-pill {
    position: absolute;
    top: 7px;
    right: 7px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15, 22, 26, 0.88);
    border: 1px solid var(--brass);
    font-size: 0.74rem;
    font-weight: 700;
}

.map-node-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-locked-note {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Plechový tahák */
.tahak-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tahak-card {
    background: var(--parchment);
    color: var(--parchment-ink);
    border: 2.5px solid #5a3921;
    border-radius: 12px;
    padding: 12px 16px;
}

.tahak-card h3 {
    margin: 0 0 8px;
    color: #6b3410;
    font-size: 1.02rem;
}

.tahak-card ul {
    margin: 0;
    padding-left: 18px;
}

.tahak-card li {
    margin-bottom: 5px;
    font-size: 0.9rem;
    line-height: 1.42;
}

/* Uvítací a Vítězná karta */
.welcome-card, .victory-card {
    text-align: center;
}

.welcome-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #133f42;
    border: 1.5px solid var(--turq);
    color: var(--turq-bright);
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-card h1 {
    margin: 6px 0 10px;
    font-size: 1.55rem;
    color: #ffe3b0;
}

.welcome-tips {
    text-align: left;
    background: rgba(20, 29, 34, 0.72);
    border: 1.5px solid #543a22;
    border-radius: 12px;
    padding: 12px 16px 12px 32px;
    margin: 14px 0;
    line-height: 1.55;
    font-size: 0.93rem;
}

.welcome-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.welcome-sub-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.victory-spark-icon {
    font-size: 2.6rem;
    margin-bottom: 6px;
}

.victory-stats-box {
    background: #142f33;
    border: 2px solid var(--turq);
    border-radius: 12px;
    padding: 12px;
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shake-once {
    animation: shakeX 0.26s linear;
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Mobilní a menší tabletové přizpůsobení */
@media (max-width: 760px) {
    #top-hud {
        padding: 5px 8px;
        gap: 5px;
    }
    .brand-badge {
        font-size: 0.78rem;
        padding: 4px 8px;
    }
    .hud-btn {
        min-height: 34px;
        padding: 4px 8px;
        font-size: 0.78rem;
    }
    .posture-btn span {
        display: none;
    }
    .puzzle-options.count-4 {
        grid-template-columns: 1fr;
    }
}
