// --- styles.css (v4) ---
/* styles.css */
/* Verze: 3.90 (Redesign Editoru + Vlastní scrollbar) */
/* Verze 3.93: Vizuální odezva a zvětšen inventář */
/* Verze 3.96: Tlačítko nápovědy */
/* Verze 3.98: Zákaz pull-to-refresh */

/* Společné styly a reset */
html {
    height: 100%;
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: #111827;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; 
    padding: 0;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: pan-y;
}
body.scanner-active {
    overflow: hidden;
    touch-action: none;
    position: fixed;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overscroll-behavior-y: contain; /* V3.98: Zákaz "pull-to-refresh" */
}
body.scanner-active .main-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#print-status {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-size: 1.5rem;
    font-weight: bold;
    display: none; 
}
.main-container {
    width: 100%;
    max-width: 1200px;
    padding: 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-height: 100vh; /* Důležité pro fixní layout editoru */
}

/* V3.90: Vlastní scrollbar pro kontejnery v editoru */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Inputy pro barvy */
input[type="color"] {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    width: 40px; height: 40px; background-color: transparent;
    border: none; cursor: pointer; padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border-radius: 50%; border: 3px solid #374151;
}
input[type="color"]::-moz-color-swatch {
    border-radius: 50%; border: 3px solid #374151;
}

/* Navigační tlačítka */
.view-btn {
    transition: all 0.2s;
    font-size: 0.9rem;
    padding: 10px;
}
.view-btn.active {
    background-color: #3b82f6;
    color: white;
    font-weight: 700; 
}
.editor-icon-btn {
    background-color: #374151;
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
}
.editor-icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- STYLY PRO EDITOR KROKŮ (Uvnitř nového layoutu) --- */
.step-item {
    background-color: #374151; 
    border-radius: 12px; 
    overflow: hidden;
}
.step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background-color: #374151;
    padding: 8px 12px;
}
.step-header.collapsible { cursor: pointer; }
.step-toggle-collapse {
    color: #9ca3af;
    font-size: 1.0rem;
    font-weight: 900;
    width: 20px; height: 20px; line-height: 20px;
    text-align: center; flex-shrink: 0; margin-left: -4px;
    transition: transform 0.2s ease-in-out;
}
.step-toggle-collapse.collapsed { transform: rotate(-90deg); }
.step-number {
    font-size: 1.5rem; font-weight: 900; color: #9ca3af;
    line-height: 1; margin-right: 4px; margin-left: 4px; 
}
.step-controls-group {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.step-controls-group .remove-step {
    background-color: #9f1239; color: white;
    border-radius: 50%; width: 32px; height: 32px;
    font-weight: bold; font-size: 1.5rem; line-height: 1;
    flex-shrink: 0; padding-bottom: 2px;
}
.step-body {
    background-color: #1f2937; padding: 12px;
}
.step-body.collapsed { display: none; }
.step-fieldset {
    display: none; padding: 10px; margin-top: 8px;
    border-radius: 8px; background-color: #1f2937;
}
.step-fieldset.step-active { display: block; padding: 0; margin-top: 0; }

.step-body label, .step-fieldset label {
    font-size: 0.8rem; font-weight: 700; color: #9ca3af; text-transform: uppercase;
}
.step-body input[type="text"], .step-body input[type="number"], 
.step-body textarea, .step-body select,
.step-fieldset input[type="text"], .step-fieldset input[type="number"], 
.step-fieldset textarea, .step-fieldset select {
     width: 100%; padding: 8px; border-radius: 6px; 
     color: white; margin-top: 4px; border: none; 
     background-color: #4b5563;
}
.step-fieldset input[type="checkbox"] {
    width: 16px; height: 16px; border-radius: 4px;
    margin: 0 8px 0 0; padding: 0; vertical-align: middle;
}
.checkbox-label {
    display: flex; align-items: center; color: #d1d5db;
    font-size: 0.9rem; text-transform: none; margin-top: 8px;
}

/* Barevné odlišení inputů */
.input-location-note { background-color: #312e81 !important; } 
.input-predmet-id { background-color: #3730a3 !important; } 
.input-zamek-req { background-color: #be123c !important; } 
.input-bonus-id { background-color: #15803d !important; } 
.input-bonus-value { background-color: #166534 !important; } 
.input-past-id { background-color: #9f1239 !important; } 
.input-past-value { background-color: #881337 !important; }
.input-score-lock-req { background-color: #6d28d9 !important; }
.input-score-lock-value { background-color: #5b21b6 !important; }
.input-predmet-icon {
    background-color: #047857 !important; font-size: 1.5rem;
    text-align: center; padding-top: 4px; padding-bottom: 4px;
}
.step-lock-give-id, .step-lock-give-name { background-color: #059669 !important; }
.input-var-id { background-color: #0e7490 !important; }
.input-var-value { background-color: #155e75 !important; }
.input-var-type { background-color: #164e63 !important; }
.input-var-req-id { background-color: #be185d !important; }
.input-var-req-value { background-color: #9d174d !important; }

/* --- STYLY PRO SKENER (HUD) --- */
#scanner-view {
    position: relative; /* V3.96: Nutné pro pozicování tlačítka nápovědy */
}
#scanner-view, #scanner-view * {
    -webkit-user-select: none; -ms-user-select: none; user-select: none;
}
#game-state-container {
    width: 100%; margin: 8px 0 0 0; flex-grow: 1;
    overflow-y: auto; min-height: 0; display: flex;
    flex-direction: column; gap: 16px; background-color: #1f2937;
    padding: 12px; border-radius: 8px;
}
#inventory-label::before { content: '🎒'; display: inline-block; margin-right: 6px; font-size: 0.9rem; vertical-align: middle; }
#score-label::before { content: '⭐'; display: inline-block; margin-right: 6px; vertical-align: middle; }
#variables-label::before { content: '⚙️'; display: inline-block; margin-right: 6px; vertical-align: middle; }
#score-label, #variables-label { vertical-align: middle; }
#score-display { vertical-align: middle; font-size: 1.25rem; }

/* V3.93: Zvětšený inventář */
#inventory-display {
    font-style: normal;
    font-size: 1.1rem;
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    overflow-y: hidden;
    gap: 8px; /* Zvětšená mezera */
}
.inventory-placeholder { font-style: italic; color: #ca8a04; }
.inventory-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ca8a04;
    color: #1f2937;
    font-weight: 700;
    font-size: 1.75rem; /* Zvětšená ikona (cca 2x) */
    padding: 4px 10px; /* Upravený padding */
    border-radius: 24px; /* Větší zaoblení */
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    user-select: none;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    min-width: 44px; /* Minimální šířka pro dotyk */
    min-height: 44px; /* Minimální výška pro dotyk */
}
.inventory-item:hover { background-color: #eab308; }
.inventory-item:active { transform: scale(0.95); }

#variables-display { flex-wrap: wrap; gap: 4px; }
.variables-placeholder { font-style: italic; color: #22d3ee; }
.variable-item {
    display: inline-flex; align-items: center; justify-content: center;
    background-color: #06b6d4; color: #1f2937; font-weight: 700;
    font-size: 0.9rem; padding: 2px 8px; border-radius: 16px;
    user-select: none; line-height: 1.2; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.variable-item-id { font-weight: 400; margin-right: 4px; opacity: 0.7; }
.variable-item-value { font-weight: 900; }

#reader-container {
    width: 100%; max-width: 220px; aspect-ratio: 1 / 1;
    margin: 8px auto; position: relative; border: 4px solid #00c4ff;
    border-radius: 12px; overflow: hidden; box-shadow: 0 0 25px rgba(0, 196, 255, 0.6);
    background-color: #000; flex-shrink: 0;
}
#reader { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover !important; }
#result-scanner {
    margin: 8px 0; padding: 12px; background-color: #242424;
    border-radius: 8px; width: 100%; min-height: 48px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; font-size: 1.0rem; font-weight: 500;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease-in-out; flex-shrink: 0;
}
.status-message { color: #ffcc00; }
.success-message { color: #4CAF50; }
.error-message { color: #FF5252; }

#zoom-controls {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
    background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0.0));
    padding: 20px 16px 12px 16px; display: flex; align-items: center; gap: 8px;
}
#zoom-controls label {
    color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    flex-shrink: 0; font-size: 0.9rem;
}
#zoom-slider {
    -webkit-appearance: none; appearance: none; width: 100%; height: 8px;
    background: rgba(255, 255, 255, 0.3); border-radius: 4px; outline: none;
    opacity: 0.9; transition: opacity .2s; padding: 0; margin: 0;
}
#zoom-slider:hover { opacity: 1; }
#zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px;
    background: #ffffff; border-radius: 50%; border: 2px solid #00c4ff; cursor: pointer;
}
#zoom-slider::-moz-range-thumb {
    width: 20px; height: 20px; background: #ffffff; border-radius: 50%;
    border: 2px solid #00c4ff; cursor: pointer;
}
#zoom-slider:disabled { opacity: 0.3; }
.scanning #reader-container { animation: breathe 2s infinite ease-in-out; }
@keyframes breathe {
    0% { border-color: #00c4ff; box-shadow: 0 0 25px rgba(0, 196, 255, 0.6); }
    50% { border-color: #ffffff; box-shadow: 0 0 35px rgba(255, 255, 255, 0.8); }
    100% { border-color: #00c4ff; box-shadow: 0 0 25px rgba(0, 196, 255, 0.6); }
}

/* --- V3.96: TLAČÍTKO NÁPOVĚDY --- */
.help-button {
    position: absolute;
    bottom: 16px; /* Umístění nad spodní lištou (nebo dle potřeby) */
    right: 16px;
    width: 50px;
    height: 50px;
    background-color: #2563eb; /* Modrá */
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}
.help-button:active {
    transform: scale(0.9);
    background-color: #1d4ed8;
}


/* --- V3.93: VIZUÁLNÍ ODEZVA (FLASH) --- */
#visual-feedback-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: transparent;
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.5s ease-out;
}
#visual-feedback-overlay.visual-flash-active {
    opacity: 1;
    transition: opacity 0.1s ease-in;
}
#visual-feedback-overlay.visual-flash-success {
    background-color: rgba(76, 175, 80, 0.6); /* Zelená */
}
#visual-feedback-overlay.visual-flash-fail {
    background-color: rgba(255, 82, 82, 0.6); /* Červená */
}

/* --- STYLY PRO MANUÁL --- */
#manual-nav {
    background-color: #1f2937; border: 1px solid #374151;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 1.5rem;
}
#manual-nav h4 {
    font-size: 1.0rem; font-weight: 700; color: #a5b4fc; margin-top: 0; margin-bottom: 0.75rem;
}
#manual-nav ul {
    list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
#manual-nav li a {
    display: block; font-size: 0.9rem; color: #d1d5db; text-decoration: none;
    padding: 4px 8px; border-radius: 4px; transition: all 0.2s;
}
#manual-nav li a:hover { background-color: #374151; color: #ffffff; text-decoration: underline; }
#manual-view h2 { font-size: 1.5rem; font-weight: 900; color: #3b82f6; margin: 0.5rem 0; }
#manual-view h3 {
    font-size: 1.2rem; font-weight: 700; color: #ffffff; margin: 1.25rem 0 0.5rem 0;
    border-bottom: 1px solid #374151; padding-bottom: 4px;
}
#manual-view h4 { font-size: 1.0rem; font-weight: 700; color: #a5b4fc; margin: 1rem 0 0.25rem 0; }
#manual-view p, #manual-view li { font-size: 0.95rem; color: #d1d5db; line-height: 1.6; margin-bottom: 0.5rem; }
#manual-view ol, #manual-view ul { font-size: 0.95rem; list-style-position: inside; color: #d1d5db; padding-left: 0.5rem; }
#manual-priklad-list { list-style-type: decimal; padding-left: 1rem; }
#manual-priklad-list li { margin-bottom: 0.75rem; padding-left: 0.5rem; }
#manual-priklad-list code { font-style: italic; color: #fcd34d; font-weight: bold; }
#manual-view ol { list-style-type: decimal; }
#manual-view ul { list-style-type: disc; }
#manual-view code { background-color: #374151; color: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
#manual-view ul ul, #manual-view ol ol { padding-left: 1.5rem; margin-top: 0.25rem; }

/* --- STYLY PRO TISK --- */
#multi-qrcode-container { background-color: #f3f4f6; display: grid; gap: 16px; align-items: start; }
.print-card {
    display: flex !important; flex-direction: column; align-items: center;
    justify-content: space-between; padding: 15px; border: 1px solid #cccccc;
    border-radius: 8px; page-break-inside: avoid; background-color: #ffffff;
    height: 100%; position: relative;
}
.print-card .card-number {
    position: absolute; top: 8px; right: 12px; font-size: 1.25rem;
    font-weight: 900; color: #374151; z-index: 10; line-height: 1;
}
.print-card p {
    font-family: 'Inter', sans-serif; color: #000000 !important;
    text-align: center; word-wrap: break-word; margin-bottom: 10px;
    flex-grow: 1; display: block; padding-left: 1.5rem; padding-right: 1.5rem;
}
.print-card .qr-image-wrapper { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.print-card .qr-image-wrapper img { display: block; }
#print-output, #guide-output { display: none; }

/* --- PWA & TOAST --- */
body:not(.web-share-supported) #share-button { display: none; }
.toast-notification {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    width: calc(100% - 40px); max-width: 500px; background-color: #1f2937;
    color: #f3f4f6; padding: 16px; border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2); z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    transition: bottom 0.5s ease-in-out; box-sizing: border-box;
}
.toast-notification.show { bottom: 20px; }
.toast-notification p { margin: 0; padding-right: 15px; font-size: 0.95rem; line-height: 1.4; }
.toast-notification button {
    flex-shrink: 0; background-color: #3b82f6; color: white; border: none;
    padding: 8px 14px; border-radius: 5px; cursor: pointer; font-weight: bold;
    transition: background-color 0.3s ease;
}
.toast-notification button:hover { background-color: #2563eb; }

/* --- V3.84/3.90: DĚTSKÝ REŽIM & INPUT VYLEPŠENÍ --- */
#child-unlock-btn {
    position: fixed; bottom: 10px; left: 10px; width: 40px; height: 40px;
    background-color: rgba(0, 0, 0, 0.3); color: rgba(255, 255, 255, 0.5);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; z-index: 2000; user-select: none; cursor: pointer;
    transition: all 0.3s ease;
}
#child-unlock-btn.unlocking {
    background-color: rgba(220, 38, 38, 0.8); color: white; transform: scale(1.2);
}
#game-title-input:focus { background-color: #111827; }
