/* --- CSS Reset & Variablen --- */
:root {
    --color-bg: #7dd3fc; /* sky-300 */
    --color-header: #22c55e; /* green-500 */
    --color-header-text: #ffffff;
    --color-mark-ring: #22c55e;
    --color-mark-bg: rgba(34, 197, 94, 0.4);
    --color-slot-bg: #f8fafc;
    --color-slot-border: #334155;
    --color-btn-primary: #f59e0b; /* amber-500 */
    --color-btn-primary-hover: #d97706;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Header --- */
header {
    background-color: var(--color-header);
    padding: 1rem 0 0.5rem 0;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

h1 {
    margin: 0;
    color: var(--color-header-text);
    font-size: 1.875rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-curve {
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: var(--color-header);
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
    z-index: -1;
}

/* --- Main Content --- */
main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

/* --- Slot Machine View --- */
.slot-container {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
}

.slot-container.active {
    display: flex;
}

.slot-title {
    font-size: 1.25rem;
    color: #334155;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* Neue Wheel Styles */
.slot-machine {
    display: flex;
    gap: 15px;
    margin-bottom: 2rem;
    background: #e2e8f0; /* slighter lighter slate */
    padding: 15px;
    border-radius: 20px;
    border: 6px solid var(--color-slot-border);
    position: relative;
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(255,255,255,0.5);
}

/* Highlight Balken in der Mitte */
.slot-machine::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 60px; /* Muss Item-Height entsprechen */
    transform: translateY(-50%);
    border: 3px solid var(--color-btn-primary);
    border-radius: 8px;
    pointer-events: none; /* Klicks durchlassen */
    z-index: 5;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.slot-reel {
    width: 70px;
    height: 180px; /* Sichtbare Höhe: 3 Items (3 * 60px) */
    background: white;
    border-radius: 8px;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    position: relative;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.2);
    cursor: grab; /* Zeigt an, dass man greifen kann */
}

.slot-reel:active {
    cursor: grabbing;
}

.slot-reel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.reel-padding {
    height: 60px; /* Padding oben/unten damit erstes/letztes Item in die Mitte kann */
}

.reel-item {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* font-size: 2.5rem; */ /* Removed font-size for images */
    scroll-snap-align: center;
    user-select: none;
    pointer-events: none; /* Verhindert Text-Selektion beim Draggen */
}

.reel-item img {
    height: 80%;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
    transition: transform 0.2s;
}


/* --- Buttons --- */
.button-group {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}

.circle-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s, background-color 0.2s;
    padding: 0;
}

.circle-btn:active {
    transform: scale(0.95);
}

.circle-btn svg {
    width: 32px;
    height: 32px;
}

.confirm-btn {
    background-color: var(--color-btn-primary);
    color: white;
}

.confirm-btn:hover {
    background-color: var(--color-btn-primary-hover);
}

.back-btn {
    background-color: #64748b; /* slate-500 */
    color: white;
}

.back-btn:hover {
    background-color: #475569;
}

/* --- Game Board View --- */
.board-container {
    display: none; /* Hidden by default */
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: white;
    padding: 0.5rem;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 4px solid white;
    position: relative;
    overflow: hidden;
}

.board-container.active {
    display: block;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1rem;
    width: 100%;
    height: 100%;
    padding: 0.25rem;
}

.grid-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: #f1f5f9; /* Fallback color */
    border: 4px solid transparent; 
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* Prevent image drag */
}

.grid-item:active {
    transform: scale(0.95);
}

/* Status: Markiert */
.grid-item.marked {
    border-color: var(--color-mark-ring);
}

/* Overlay für den grünen Schleier */
.grid-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--color-mark-bg);
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-item.marked::after {
    opacity: 1;
}

.checkmark {
    position: absolute;
    z-index: 10;
    display: none;
    color: white;
    width: 70%;
    height: 70%;
    filter: drop-shadow(0 4px 3px rgba(0,0,0,0.3));
}

.grid-item.marked .checkmark {
    display: block;
    animation: bounce-short 0.3s ease-in-out;
}

@keyframes bounce-short {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10%); }
}

/* --- Subset Selection Grid --- */
.subset-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
    padding: 20px;
    background: #cbd5e1;
    border-radius: 15px;
    border: 4px solid var(--color-slot-border);
}

.subset-item {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.1s;
    border: 2px solid transparent;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.subset-item:hover {
    transform: scale(1.05);
    border-color: var(--color-btn-primary);
}

.subset-item:active {
    transform: scale(0.95);
}

.subset-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

