@font-face {
    font-family: 'Dieselpower';
    src: url('fonts/DieselpowerPersonalUse-axaY5.ttf') format('truetype');
}

@font-face {
    font-family: 'Microwaves';
    src: url('fonts/Microwaves.ttf') format('truetype');
}

.header {
    color: grey;
    background-color: white;
    border-bottom: 1px solid #333;
    font-family: 'Arial', 'Helvetica', 'sans-serif';
    font-size: 0.8em; 
    letter-spacing: 0.1em;
    justify-content: center;
    align-items: center;
    min-height: 3vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.header a {
    text-decoration: none;
    color: grey;
    font-family: 'Microwaves', sans-serif;
    font-size: 2.2rem;
    transition: color 0.3s ease;
}

.header a:hover {
    color: black;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 5%;
    padding-bottom: 10vh;
    font-family: 'Dieselpower', sans-serif;
    background-size: contain;
    background-position: center;
}

/* Mobile-specific header spacing */
@media (max-width: 768px) {
    body {
        margin-top: 15%;
    }
    
    .header a {
        font-size: 1.7rem;
    }
}

@media (max-width: 600px) {
    body {
        margin-top: 18%;
    }
    
    .header a {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        margin-top: 20%;
    }
    
    .header a {
        font-size: 1.4rem;
    }
}

@media (max-width: 360px) {
    body {
        margin-top: 22%;
    }
    
    .header a {
        font-size: 1.2rem;
    }
}

h2 {
    margin-top: 8%; /* Mehr Abstand zum Header */
    font-family: 'Dieselpower', sans-serif;
    font-size: 2.5vw;
    color: black;
    text-align: center;
}

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

.neustart {
    font-family: 'Dieselpower', sans-serif;
    background-color: red;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 50%;
    margin-bottom: 0.2vh;
    margin-top: 2%;
    width: 1.5vw;
    height: 1.5vw;
    min-width: 20px;
    min-height: 20px;
    max-width: 30px;
    max-height: 30px;
    overflow: hidden;
}

.neustart::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.neustart::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.neustart:hover::before {
    left: 100%;
}

.neustart:focus {
    background-color: darkred;
    transform: scale(1.1);
}

.neustart:hover {
    transform: scale(1.1);
    background-color: darkred;
}

.neustart:active {
    transform: scale(1.05);
    background-color: darkred;
}

/* Mobile touch feedback */
@media (hover: none) and (pointer: coarse) {
    .neustart:hover {
        transform: none;
        background-color: red;
    }
    
    .neustart:active {
        background-color: darkred;
        transform: scale(0.95);
    }
    
    .karte:active {
        transform: scale(0.95);
    }
}

.spiel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    perspective: 1000px; /* für 3D Flip */
}

.karte {
    width: 20vh;
    height: 20vh;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(.4,.2,.2,1);
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    -webkit-tap-highlight-color: transparent;
}

.karte.flip {
    transform: rotateY(180deg);
}

.karte.match {
    transform: rotateY(180deg) !important;
    pointer-events: none;
}

/* Vorderseite */
.karte .front,
.karte .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Bildseite */
.karte .front {
    transform: rotateY(180deg);
}

.karte .front img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Rückseite */
.karte .back {
    background: black;
    background-image: url("ehh.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.footer {
    color: grey;
    background-color: white;
    font-family: 'Arial', 'Helvetica', 'sans-serif';
    font-size: 0.6em;
    letter-spacing: 0.1em;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 5vh;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
    .karte { 
        width: 14vh; 
        height: 14vh; 
        font-size: 0.8em;
    }
    .spiel { 
        gap: 5px; 
        padding: 0 5px;
    }
    .header a { font-size: 2.2rem; }
    .neustart { 
        font-size: 0.8em; 
        padding: 7px 12px;
        margin-top: 2%;
        width: 1.2vw;
        height: 1.2vw;
        min-width: 15px;
        min-height: 15px;
    }
}

@media (max-width: 768px) {
    .karte { 
        width: 12vh; 
        height: 12vh; 
        font-size: 0.7em;
    }
    .spiel { 
        gap: 4px; 
        padding: 0 3px;
        max-width: 95%;
    }
    .header a { font-size: 2rem; }
    .neustart { 
        font-size: 0.7em; 
        padding: 6px 10px;
        margin-top: 2%;
        width: 1vw;
        height: 1vw;
        min-width: 12px;
        min-height: 12px;
    }
    h2 { font-size: 3vw; }
}

@media (max-width: 600px) {
    .karte { 
        width: 10vh; 
        height: 10vh; 
        font-size: 0.6em;
    }
    .spiel { 
        gap: 3px; 
        padding: 0 2px;
        width: 100%;
        max-width: 100%;
    }
    .header a { font-size: 1.8rem; }
    .neustart { 
        font-size: 0.6em; 
        padding: 5px 8px;
        margin-top: 2%;
        width: 0.8vw;
        height: 0.8vw;
        min-width: 10px;
        min-height: 10px;
    }
    h2 { font-size: 4vw; }
    body { 
        padding-bottom: 10vh;
    }
}

@media (max-width: 480px) {
    .karte { 
        width: 9vh; 
        height: 9vh; 
        font-size: 0.5em;
    }
    .spiel { 
        gap: 2px; 
        padding: 0 1px;
    }
    .header a { font-size: 1.6rem; }
    .neustart { 
        font-size: 0.5em; 
        padding: 4px 6px;
        margin-top: 2%;
        width: 0.6vw;
        height: 0.6vw;
        min-width: 8px;
        min-height: 8px;
    }
    h2 { font-size: 5vw; }
}

@media (max-width: 360px) {
    .karte { 
        width: 8vh; 
        height: 8vh; 
        font-size: 0.4em;
    }
    .spiel { 
        gap: 2px; 
        padding: 0 1px;
    }
    .header a { font-size: 1.4rem; }
    .neustart { 
        font-size: 0.4em; 
        padding: 3px 5px;
        margin-top: 2%;
        width: 0.5vw;
        height: 0.5vw;
        min-width: 6px;
        min-height: 6px;
    }
    h2 { font-size: 6vw; }
    body {
        margin-top: 10%;
        padding-bottom: 10vh;
    }
}