:root {
    --primary-color: #d18f52;
    --primary-dark: #b87b41;
    --bg-color: #1a1a1a;
    --text-color: #f4ede4;
    --correct-color: #4CAF50;
    --incorrect-color: #F44336;
    --zone-bg: rgba(255, 255, 255, 0.3);
    --zone-border: rgba(209, 143, 82, 0.6);
    --zone-hover: rgba(255, 255, 255, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 1250px;
    width: 100%;
    background-color: #222;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2.2rem;
}

p {
    margin-bottom: 25px;
    font-size: 1.2rem;
    color: #ccc;
}

.main-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
}

.controls-area {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.toggle-container {
    background-color: #2a2a2a;
    padding: 15px 25px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.toggle-label {
    font-weight: bold;
    color: var(--primary-dark);
    font-size: 1.1rem;
    cursor: pointer;
}

input[type=checkbox] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.slider-container {
    background-color: #2a2a2a;
    padding: 15px 25px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.slider-container label {
    font-weight: bold;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #deb887;
    border-radius: 3px;
}

.wrapper-container {
    position: relative;
    max-width: 800px;
    width: 100%;
    transform-origin: top center;
    transition: transform 0.15s ease-out;
}

.image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    border-radius: 12px;
}

.image-container.base-interior {
    position: relative;
    /* establishes the height for the wrapper container */
    border: 4px solid var(--primary-color);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.image-container.interior {
    border: 4px solid transparent;
    z-index: 5;
    transition: opacity 0.2s linear;
    /* Smooth visual transition when toggling */
}

.image-container.exterior {
    border: 4px solid transparent;
    /* Keep border sizing consistent but transparent so it matches */
    z-index: 10;
    transition: opacity 0.1s linear;
    /* Smooth slider transitions */
}

.image-container img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    /* added so it's rounded even without container overflowing */
}

/* SVG Connecting Lines */
.connecting-lines {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 20;
    overflow: visible;
    /* added so lines can expand beyond bounds */
}

.connecting-lines line {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 3;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
    stroke-dasharray: 6 4;
}

.connecting-lines circle {
    fill: var(--primary-color);
    stroke: white;
    stroke-width: 2;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
}

/* Distinct color for the inner elements (Holzgerüst/Lederriemen) */
.connecting-lines line.line-alt {
    stroke: #ff9800;
    /* Distinct orange color */
}

.connecting-lines circle.circle-alt {
    fill: #ff9800;
}

/* Distinct color for the deep inner elements (Inneneinrichtung) */
.connecting-lines line.line-inner {
    stroke: #00bcd4;
    /* Bright distinct Cyan blue */
}

.connecting-lines circle.circle-inner {
    fill: #00bcd4;
}

/* Distinct color for the Höhle elements (Grau) */
.connecting-lines line.line-grey {
    stroke: #757575;
    /* Grey color */
}

.connecting-lines circle.circle-grey {
    fill: #757575;
}

/* Distinct color for the new Höhle elements (Grün) */
.connecting-lines line.line-green {
    stroke: #4CAF50;
    /* Green color */
}

.connecting-lines circle.circle-green {
    fill: #4CAF50;
}

/* Drop Zones styling */
.drop-zone {
    position: absolute;
    border: 3px dashed var(--zone-border);
    background-color: var(--zone-bg);
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.drop-zone.drag-over {
    background-color: var(--zone-hover);
    border-color: var(--primary-color);
    border-width: 4px;
    transform: scale(1.02);
    /* Subtle hover effect */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.drop-zone.correct {
    border: 3px solid var(--correct-color);
    background-color: rgba(76, 175, 80, 0.2);
}

/* Draggable Items styling */
.draggable-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    min-height: 80px;
    padding: 15px;
    background-color: #fafafa;
    border: 2px dashed #dcdcdc;
    border-radius: 12px;
    width: 100%;
}

.draggable {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    /* Increased for iPad */
    margin: 4px;
    border-radius: 8px;
    cursor: grab;
    font-size: 1.1rem;
    /* Increased for iPad */
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(139, 90, 43, 0.3);
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    user-select: none;
    touch-action: none;
}

.draggable:hover {
    transform: translateY(-3px);
    background-color: var(--primary-dark);
    box-shadow: 0 6px 15px rgba(139, 90, 43, 0.4);
}

.draggable:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.draggable.dragging {
    opacity: 0.6;
}

.draggable.placed {
    background-color: var(--correct-color);
    margin: 0;
    box-shadow: none;
    cursor: default;
    transform: none;
    font-size: 0.75rem;
    line-height: 1.1;
    padding: 2px 4px;
    width: 98%;
    height: 98%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
}

.draggable.placed:hover {
    transform: none;
    box-shadow: none;
    background-color: var(--correct-color);
}

/* Layer specific colors for draggables */
.draggable.drag-white {
    background-color: #9E9E9E;
    /* Grey to represent 'white' lines on a light bg */
    color: white;
}

.draggable.drag-white:hover {
    background-color: #757575;
}

.draggable.drag-orange {
    background-color: #ff9800;
    /* Matches line.line-alt */
    color: white;
}

.draggable.drag-orange:hover {
    background-color: #f57c00;
}

.draggable.drag-cyan {
    background-color: #00bcd4;
    /* Matches line.line-inner */
    color: white;
}

.draggable.drag-cyan:hover {
    background-color: #0097a7;
}

.draggable.drag-grey {
    background-color: #757575;
    /* Matches line-grey */
    color: white;
}

.draggable.drag-grey:hover {
    background-color: #616161;
}

.draggable.drag-green {
    background-color: #4CAF50;
    /* Matches line-green */
    color: white;
}

.draggable.drag-green:hover {
    background-color: #388E3C;
}


/* Success Message styling */
#success-message {
    margin-top: 30px;
    padding: 25px;
    background-color: #1b3320;
    border: 3px solid var(--correct-color);
    border-radius: 12px;
    color: #81c784;
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#success-message h2 {
    margin-bottom: 15px;
    font-size: 2rem;
}

#success-message button {
    margin-top: 15px;
    padding: 12px 30px;
    background-color: var(--correct-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
    transition: all 0.3s;
}

#success-message button:hover {
    background-color: #388E3C;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-8px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.5s;
    background-color: var(--incorrect-color);
    color: white;
}

/* Startseite & Back Link */
.start-container {
    max-width: 800px;
}

body.start-page {
    background-color: var(--bg-color);
}

body.start-page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('hintergrund.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.6;
    /* 0.6 bedeutet leicht transparent */
    z-index: -1;
}

body.start-page .game-container {
    background-color: rgba(25, 25, 25, 0.85);
    backdrop-filter: blur(5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

body.zelt-page,
body.hoehle-page {
    background-color: var(--bg-color);
}

body.zelt-page::before,
body.hoehle-page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.6;
    z-index: -1;
}

body.zelt-page::before {
    background-image: url('hintergrund_Zelt.jpeg');
}

body.hoehle-page::before {
    background-image: url('hintergrund_Hoehle.jpeg');
}

body.zelt-page .game-container,
body.hoehle-page .game-container {
    background-color: rgba(25, 25, 25, 0.95);
    /* Fast deckend dunkel */
    backdrop-filter: blur(5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.choice-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.choice-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-color);
    background-color: #2a2a2a;
    border: 3px solid var(--primary-color);
    border-radius: 15px;
    padding: 20px;
    width: 300px;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.choice-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-dark);
}

.choice-img-wrapper {
    width: 100%;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.choice-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.choice-img-wrapper .placeholder-img {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.choice-card h2 {
    color: var(--primary-dark);
    margin-top: 10px;
    font-size: 1.8rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background-color: #2a2a2a;
    color: var(--primary-dark);
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    border: 2px solid var(--primary-color);
    transition: all 0.2s;
}

.back-link:hover {
    background-color: var(--primary-color);
    color: white;
}

/* iPad Zoom Controls */
.zoom-controls {
    display: flex;
    gap: 10px;
    background-color: #2a2a2a;
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.zoom-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.zoom-btn:active {
    transform: scale(0.9);
}

/* Helper visibility toggling */
body.hide-helpers .connecting-lines {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.hide-helpers .drop-zone:not(.correct):not(.drag-over) {
    border-color: transparent;
    background-color: transparent;
}