.puzzle-game-layout { display: flex; gap: 20px; align-items: flex-start; justify-content: center; max-width: 820px; margin: 0 auto 50px; flex-wrap: wrap; }
.puzzle-game-layout.no-sidebar { max-width: 580px; }
.puzzle-game { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 4px 20px rgba(0,0,0,0.10); max-width: 580px; flex: 1 1 420px; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; color: #222; }
.puzzle-game * { box-sizing: border-box; }
.puzzle-game button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; min-height: 44px; }
.puzzle-game h3 { margin: 0 0 6px; font-size: 22px; text-align: center; color: #1e293b; }
.puzzle-game-sub { text-align: center; color: #6b7280; font-size: 14px; margin-bottom: 20px; }

.puzzle-game-step { display: none; }
.puzzle-game-step.is-active { display: block; }

.puzzle-game-name-input {
    display: block; width: 100%; max-width: 260px; margin: 0 auto 14px; padding: 10px 14px;
    border: 2px solid #d1d5db; border-radius: 100px; font-size: 16px; text-align: center; font-weight: 600;
}
.puzzle-game-name-input:focus { outline: none; border-color: #7c3aed; }
.puzzle-game-greeting { text-align: center; font-weight: 700; color: #7c3aed; margin-bottom: 10px; font-size: 15px; }

.puzzle-game-sidebar {
    background: #fdf9ee; border: 2px solid #ffe4a3; border-radius: 16px; padding: 18px 18px 10px;
    width: 240px; flex: 0 0 240px; box-sizing: border-box; max-height: 420px; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.puzzle-game-sidebar .puzzle-game-choice-label { margin-top: 0; text-align: center; }
.puzzle-game-lb-list { list-style: none; margin: 8px 0 0; padding: 0; }
.puzzle-game-lb-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid #f5e8c4; }
.puzzle-game-lb-list li:last-child { border-bottom: none; }
.puzzle-game-lb-rank { width: 24px; text-align: center; font-weight: 700; flex-shrink: 0; }
.puzzle-game-lb-name { flex: 1; font-weight: 600; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puzzle-game-lb-points { font-weight: 700; color: #d97706; white-space: nowrap; }
.puzzle-game-lb-empty { font-size: 13px; color: #92702c; text-align: center; margin: 10px 0 6px; }

.puzzle-game-choice-label { font-weight: 700; font-size: 14px; margin: 16px 0 8px; color: #374151; text-align: center; }
.puzzle-game-choice-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.puzzle-game-choice-btn {
    border: 2px solid #d1d5db; background: #f9fafb; border-radius: 12px; padding: 10px 16px; cursor: pointer;
    font-size: 14px; font-weight: 700; transition: all 0.15s;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.puzzle-game-choice-btn:hover { border-color: #7c3aed; background: #f5f0ff; }
.puzzle-game-choice-btn.is-selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }

.puzzle-game-pattern-btn {
    width: 52px; height: 52px; border-radius: 12px; border: 3px solid #d1d5db; cursor: pointer;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent; padding: 0;
    background-size: cover; background-position: center;
}
.puzzle-game-pattern-btn.is-selected { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,0.25); }

/* ---- Popup mit weiteren Bild-Themen ---- */
.puzzle-pattern-modal {
    position: fixed; inset: 0; background: rgba(30,30,40,0.55); z-index: 9999;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.puzzle-pattern-modal-inner {
    background: #fff; border-radius: 20px; padding: 24px; max-width: 480px; width: 100%;
    max-height: 85vh; overflow-y: auto; text-align: center;
}
.puzzle-pattern-modal-inner h4 { margin: 0 0 16px; font-size: 18px; color: #1e293b; }
.puzzle-pattern-modal-section-title { text-align: left; font-size: 13px; font-weight: 700; color: #6b7280; margin: 14px 0 8px; }
.puzzle-pattern-modal-section-title:first-of-type { margin-top: 0; }
.puzzle-pattern-modal-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 12px; margin-bottom: 18px;
}
.puzzle-pattern-modal-btn {
    width: auto; height: auto; aspect-ratio: 1 / 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px; background-size: cover; background-position: center;
    border-radius: 14px; position: relative; overflow: hidden;
}
.puzzle-pattern-modal-emoji { font-size: 30px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.puzzle-pattern-modal-label {
    font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    background: rgba(0,0,0,0.15); padding: 2px 8px; border-radius: 100px;
}
.puzzle-pattern-modal-close {
    border: 2px solid #d1d5db; background: #f9fafb; border-radius: 100px; padding: 10px 24px;
    font-weight: 700; cursor: pointer;
}

.puzzle-game-privacy-note { font-size: 12px; color: #6b7280; text-align: center; margin: 10px 0 4px; }
.puzzle-game-status { text-align: center; font-size: 13px; font-weight: 700; color: #16a34a; min-height: 18px; margin-top: 6px; }
.puzzle-game-status.is-error { color: #dc2626; }

.puzzle-game-camera, .puzzle-game-preview { margin-top: 14px; text-align: center; }
.puzzle-game-camera video, .puzzle-game-preview img {
    width: 100%; max-width: 320px; border-radius: 14px; background: #000;
}
.puzzle-game-camera-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }

.puzzle-game-start-btn {
    display: block; margin: 24px auto 0; background: #16a34a; color: #fff; border: none; border-radius: 100px;
    padding: 14px 36px; font-size: 17px; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.puzzle-game-start-btn:hover { background: #15803d; }
.puzzle-game-start-btn:disabled { background: #d1d5db; cursor: not-allowed; }

.puzzle-game-score { display: flex; justify-content: center; gap: 24px; margin-bottom: 18px; font-size: 14px; font-weight: 700; color: #374151; }

.puzzle-game-board {
    position: relative; width: 320px; height: 320px; max-width: 100%; margin: 0 auto;
    border: 3px solid #e2e8f0; border-radius: 12px; background: #f8fafc;
    box-shadow: inset 0 0 0 1px #fff;
}
.puzzle-game-tile {
    position: absolute; background-repeat: no-repeat; cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    filter:
        drop-shadow(1.2px 0 0 #fff) drop-shadow(-1.2px 0 0 #fff)
        drop-shadow(0 1.2px 0 #fff) drop-shadow(0 -1.2px 0 #fff)
        drop-shadow(0.9px 0.9px 0 #fff) drop-shadow(-0.9px 0.9px 0 #fff)
        drop-shadow(0.9px -0.9px 0 #fff) drop-shadow(-0.9px -0.9px 0 #fff)
        drop-shadow(0 2px 3px rgba(0,0,0,0.35));
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.puzzle-game-tile:hover {
    filter:
        drop-shadow(1.2px 0 0 #fff) drop-shadow(-1.2px 0 0 #fff)
        drop-shadow(0 1.2px 0 #fff) drop-shadow(0 -1.2px 0 #fff)
        drop-shadow(0.9px 0.9px 0 #fff) drop-shadow(-0.9px 0.9px 0 #fff)
        drop-shadow(0.9px -0.9px 0 #fff) drop-shadow(-0.9px -0.9px 0 #fff)
        drop-shadow(0 2px 3px rgba(0,0,0,0.35)) brightness(1.06);
}
.puzzle-game-tile.is-selected {
    filter: drop-shadow(0 0 0 3px #7c3aed) drop-shadow(0 2px 6px rgba(124,58,237,0.5));
    z-index: 2;
}

.puzzle-game-feedback { text-align: center; min-height: 60px; padding-top: 14px; }
.puzzle-game-feedback-emoji { font-size: 50px; display: inline-block; animation: pg-pop 0.4s ease; }
@keyframes pg-pop { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.puzzle-game-feedback-text { font-size: 16px; font-weight: 700; margin-top: 8px; color: #16a34a; }

.puzzle-game-back-btn { display: block; margin: 18px auto 0; background: none; border: none; color: #6b7280; font-size: 13px; cursor: pointer; text-decoration: underline; }

@media (max-width: 700px) {
    .puzzle-game-layout { flex-direction: column; align-items: stretch; }
    .puzzle-game-sidebar { width: 100%; flex-basis: auto; max-height: 220px; order: 2; }
}

.game-focus-overlay .puzzle-game-layout { margin: 0 auto; }
