/*
Theme Name: Wuerfelspiel
Author: Dein Name
Version: 1.0
*/

:root {
    --rot: rgba(163, 42, 47, 0.95);
}

body {
    background: #222;
    font-family: Arial, sans-serif;
}

html, body {
    margin: 0;
    padding: 0 0 70px 0;
    width: 100%;
    overflow-x: hidden; /* Horizontales Scrollen verhindern */
    position: relative;
}


#spielfeld {
    position: relative;
    /*width: 800px;*/
    /*height: 1036px;*/
    width: 1000px;
    height: 1295px;

    background-image: url('spielplan.png');
    background-size: cover;
    background-position: center;
    margin: 40px auto 100px auto;
    box-shadow: 0 2px 20px #0008;
    user-select: none;
}

.feld {
    position: absolute;
    width: 36px;
    height: 36px;
    text-indent: -9999px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 15px;
    text-shadow: 0 1px 4px #0009;
    box-shadow: 0 0 8px #0003;
    z-index: 1;
    pointer-events: none;
    transition: background 0.2s;
}

/* Sonderfelder einfärben (Passe die Farben nach Wunsch an) */
.feld.sonder {
    /*background: rgba(220, 53, 69, 0.8);*/
}

.feld.sonder_nochmal {
    /*background: rgba(40, 167, 69, 0.85);*/
}

.feld.aussetzen {
    /*background: rgba(0, 123, 255, 0.65);*/
}

.feld.aktuell {
    border: 2px solid #fff;
    z-index: 3;
}

.spielfigur {
    position: absolute;
    z-index: 2;
    width: 58px;
    height: 58px;
    background: var(--rot);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 16px #ffec7f99;
    transform: translate(-50%, -60%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #b88c00;
    pointer-events: none;
    transition: left 0.36s cubic-bezier(.51, -0.42, .52, 1.34), top 0.36s cubic-bezier(.51, -0.42, .52, 1.34);
}

.spielfigur img {
    height: 90px;
    display: block;
}

.spielfigur.sieger {
    z-index: 2000;
    animation: siegerZoom 2.1s cubic-bezier(.59, .54, .24, 1.24) forwards;
}

@keyframes siegerZoom {
    0% {
        transform: scale(1) rotate(0deg);
    }
    60% {
        transform: scale(2.2) rotate(-10deg);
    }
    85% {
        transform: scale(1.7) rotate(4deg);
    }
    100% {
        transform: scale(2) rotate(0deg);
    }
}

#controls {
    box-sizing: border-box;
    position: fixed;
    z-index: 3000;
    bottom: 10px;
    width: 100%; /* Immer 100% Breite */
    max-width: 100%; /* Nicht über den Bildschirmrand hinaus */
    left: 0; /* Ausgerichtet an der linken Kante */
    right: 0; /* Ausgerichtet an der rechten Kante */
    margin: 0 auto; /* Automatische Zentrierung */
    padding: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 22px;
    background: rgba(163, 42, 47, 0.95);
    border-radius: 10px;
}


#wuerfeln {
    position: relative;
    padding: 2px 10px;
    font-size: 18px;
    line-height: 40px;
    font-weight: bold;
    color: #333 !important;
    background: #fff;
    border: none;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
    box-shadow: 0 2px 6px #0004;
    user-select: none;
    min-width: 180px;
}

#toggle-music {
    color: #333 !important;
    background: #fff;
}

#ausgabe {
    font-size: 18px;
    color: #fff;
    padding: 10px 16px;
    border-radius: 5px;
    margin: 0 auto;
    text-align: center;
    user-select: none;
    width: 60%;
}

#ruecksetzen {
    padding: 4px 8px;
    color: #fafafa;
    /*background: #fff;*/
    background: none;
    font-size: 14px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    outline: none;
    margin-left: auto;
    transition: background 0.2s;
}

#ruecksetzen:active {
    background: #404245;
}

#dice-face {
    position: absolute;
    left: 16px;
    font-size: 30px;
}

#dice-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(0, 0, 0, 0.36);
    align-items: center;
    justify-content: center;
}

#dice-anim-window {
    z-index: 1501;
    padding: 45px 24px;
    border-radius: 12px;
    box-shadow: 0 0 12px #0004;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#dice-face-big {
    font-size: 76px;
    margin: 24px 0;
    transition: transform 0.1s;
}

#dice-overlay-text {
    font-size: 20px;
    letter-spacing: 1px;
    color: #333;
    text-align: center;
    margin-top: 30px;
}

#eintragen-btn {
    margin-top: 8px;
    padding: 8px 24px;
    font-size: 16px;
    border-radius: 8px;
    background: var(--rot);
    color: white;
    border: none;
    cursor: pointer;
}

#name-eingabe {
    margin: 16px 0;
    padding: 8px;
    width: 100%;
    font-size: 18px;
    border-radius: 6px;
    border: 1px solid #aaa;
    background: #fff;
    color: #333;
}

#start-form {
    background: white;
    padding: 20px 40px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 0 0 20px #0003;
    font-size: 1.2em;
}

#start-form img {
    height: 140px;
}


/* RESPONSIVE */
@media (max-width: 600px) {
    body {
        padding-bottom: 100px;
    }

    #spielfeld {
        width: 96vw;
        height: 124vw;
        max-width: 98vw;
        max-height: 80vh;
        margin-top: 3vw;
    }

    .feld {
        width: 9vw;
        height: 9vw;
        font-size: 4vw;
        min-width: 34px;
        min-height: 34px;
    }

    .spielfigur {
        /*width: 9vw;*/
        /*height: 9vw;*/
        /*font-size: 5vw;*/

        min-width: 32px;
        min-height: 32px;


        width: 86px; /* → 66px */
        height: 86px; /* → 66px */
        font-size: 22px;


        border-width: 2px;
    }

    .spielfigur img {
        height: 7vw;
        min-height: 32px;
        max-height: 42px;
    }

    #controls {
        width: 98vw;
        left: 1vw;
        position: absolute;
        bottom: 20px;
        border-radius: 16px 16px 0 0;
        padding: 2vw 0;
        gap: 2vw;
        background: rgba(0, 0, 0, 0.80);
        flex-wrap: wrap;
        z-index: 3000;
    }

    #wuerfeln, #ruecksetzen {
        font-size: 5vw;
        min-width: 44vw;
        padding: 2vw 4vw;
        margin: 1vw;
    }

    #wuerfeln {
        width: 220px;
        padding: 0;
        margin: 0;
    }

    #ausgabe {
        font-size: 4vw;
        margin: 2vw 0 0 0;
        padding: 2vw 2vw;
    }

    #dice-anim-window {
        padding: 6vw 7vw 8vw;
    }

    #dice-face-big {
        font-size: 12vw;
    }

    #dice-overlay-text {
        font-size: 4vw;
    }
}


/* iPhone spezifische Anpassungen */
@media screen and (max-width: 430px) {

    /*html, body {*/
    /*    margin: 0;*/
    /*    padding: 0;*/
    /*    width: 100%;*/
    /*    height: 100%;*/
    /*    position: fixed;*/
    /*    overflow: hidden;*/
    /*    overscroll-behavior: none;*/
    /*    -webkit-overflow-scrolling: touch;*/
    /*}*/
    body {
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100vh;
        /* Unterstützung für iPhone X und neuere Modelle mit Notch */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    #spielfeld {
        width: 100vw;
        height: calc(100vh - 120px); /* Platz für Controls unten lassen */
        margin: 0;
        max-height: none;
        background-size: contain;
        background-repeat: no-repeat;
    }

    #controls {
        width: 100%;
        left: 0;
        bottom: 0;
        position: fixed;
        border-radius: 16px 16px 0 0;
        padding: 10px 0;
        box-sizing: border-box;
        margin: 0;
        height: 50px;
        overflow: hidden;
    }

    .spielfigur {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .spielfigur img {
        height: 40px;
    }

    .feld {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
    }
}


/* Animation für das Rotationsicon */
@keyframes rotate {
    from {
        transform: rotate(-30deg);
    }
    to {
        transform: rotate(30deg);
    }
}

/* Für KLEINE Mobilgeräte (Smartphones) im Hochformat: Rotationshinweis anzeigen */
@media screen and (orientation: portrait) and (max-width: 767px) {
    #spielfeld {
        display: none !important;
    }

    #rotate-overlay {
        display: flex !important;
    }
}

/* Für KLEINE Mobilgeräte im Querformat: Spiel anzeigen */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #rotate-overlay {
        display: none !important;
    }

    #spielfeld {
        display: block !important;
    }

    #start-form {
        gap: 6px;
        padding: 6px 20px;
    }

    #start-form button {
        margin: 10px 0;
    }

    #start-form img {
        height: 70px;
    }
}

/* Für iPads und größere Tablets: In beiden Orientierungen anzeigen */
@media screen and (min-width: 768px) {
    #rotate-overlay {
        display: none !important;
    }

    #spielfeld {
        display: block !important;
    }

    /* iPad-spezifische Anpassungen für Portrait-Modus */
    @media (orientation: portrait) {
        #spielfeld {
            width: 90vw;
            height: 116vw;
            max-height: calc(100vh - 180px);
            margin: 20px auto;
        }

        /*#controls {*/
        /*    width: 90vw;*/
        /*    left: 5vw;*/
        /*    bottom: 20px;*/
        /*}*/
    }
}

h2 {
    color: #333;
}

#bestenliste-tabelle {
    font-size: 1.2em;
}

#bestenliste-tabelle th, #bestenliste-tabelle td {
    color: #333;
}

button {
    background: var(--rot);
    color: #fff;
}

#bestenliste-form {
    font-size: 1.2em;
    color: #333;
}

#bestenliste-form h2 {
    text-align: center;
    color: #333;
}

#bestenliste-form h2 small {
    display: block;
    font-weight: normal;
    font-size: .6em;
}

#bestenliste{
    color:#343434;
    opacity: 0.9;
}

input.edit {
    background: #efefef;
    border: 1px solid #ccc;
    color: #333;
}
