/* Retro VB.NET Kniffel Style - Layout Angepasst */
:root {
    --bg-color: #f0f0f0; 
    --gold: #FFD700;
    --khaki: #F0E68C;
    --pink: #FFC0CB;
    --olive: #6B8E23;
    --lightgray: #D3D3D3;
    --green: #008000;
    --yellow: #FFFF00;
    --red: #FF0000;
}

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

body {
    font-family: 'Microsoft Sans Serif', Arial, sans-serif;
    background-color: var(--bg-color);
    color: black;
    display: flex;
    justify-content: flex-start;
    padding: 20px;
    height: 100vh;
}

.app-container {
    display: grid;
    grid-template-columns: auto auto auto auto;
    grid-template-areas:
        "upper center lower dice";
    gap: 18px;
    align-items: start;
}

/* Areas */
#dice-area { grid-area: dice; }
#upper-section { grid-area: upper; }
#center-area { 
    grid-area: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding-top: 0px;
}
#lower-section { grid-area: lower; }


/* Ziffer Input Display (Center Top) */
.input-display {
    background-color: var(--green);
    color: var(--yellow);
    font-size: 60pt;
    font-weight: bold;
    border: 4px inset #ccc; 
    width: 289px;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8pt;
    cursor: pointer;
}

/* Numpad & Controls (Center Bottom) */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 85px);
    gap: 17px;
}

.numpad button {
    height: 80px;
    font-size: 36pt;
    font-weight: bold;
    border: 2px outset #ddd;
    cursor: pointer;
}
.numpad button:active { border-style: inset; }

.num-btn {
    background-color: var(--gold);
}

.action-btn {
    font-size: 14pt;
    font-weight: normal;
    border: 2px outset #ddd;
    cursor: pointer;
}
.action-btn:active { border-style: inset; }

/* Special Buttons from VB.NET */
.cancel-btn { 
    background-color: var(--red); 
    height: 60px; 
    font-size: 18pt !important;
    font-weight: bold !important;
    width: 100%;
}
.strike-btn { 
    background-color: var(--khaki); 
    height: 60px;
    font-size: 18pt !important;
    font-weight: bold !important;
    width: 100%;
}

/* Score Sections (Left and Right) */
.score-section {
    background-color: var(--lightgray);
    padding: 10px;
    border: 1px solid #999;
    width: 320px;
}

.score-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.score-row span {
    font-size: 20pt; /* Leicht verkleinert für besseres Layout */
    font-weight: bold;
    width: 210px;
    background-color: var(--lightgray);
}

.score-box {
    width: 73px;
    height: 42px;
    background-color: var(--yellow);
    color: black;
    font-size: 20pt;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8pt;
    border: 1px solid #999;
    cursor: pointer;
    margin-left: auto;
}

/* Colors logic from VB.NET */
.score-box.filled {
    background-color: lightblue;
    color: black;
}
.score-box.striked {
    background-color: var(--red);
    color: black;
}
.score-box.read-only {
    background-color: var(--lightgray);
    cursor: default;
}

/* Specific total rows formatting to match */
.total-row {
    border-top: 2px solid #999;
    padding-top: 5px;
    margin-top: 5px;
}
.total-row span { width: 195px; }
.total-row .score-box { width: 103px; }
.total-row.highlight span { font-size: 24pt; }

/* Dice Area (Becher) - Small Top Left */
.dice-area {
    padding: 10px;
    background-color: var(--lightgray);
    border: 1px solid #999;
    width: 320px;
}

.dice-cup-container {
    perspective: 800px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 194px;
    margin-bottom: 0px;
    position: relative;
}

.dice-cup-3d {
    width: 135px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center center;
}

/* Upside down rotation (3D flip) */
.dice-cup-3d.upside-down {
    transform: rotateX(180deg) translateY(-10px);
}

/* 3D Shake animation */
.dice-cup-3d.shake {
    animation: shake-3d 0.6s ease-in-out infinite;
}

@keyframes shake-3d {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateY(0); }
    15% { transform: rotateX(15deg) rotateY(-20deg) rotateZ(10deg) translateY(-15px) translateX(-5px); }
    30% { transform: rotateX(-10deg) rotateY(25deg) rotateZ(-15deg) translateY(-20px) translateX(8px); }
    45% { transform: rotateX(20deg) rotateY(-15deg) rotateZ(5deg) translateY(-10px) translateX(-8px); }
    60% { transform: rotateX(-15deg) rotateY(20deg) rotateZ(-10deg) translateY(-18px) translateX(5px); }
    75% { transform: rotateX(10deg) rotateY(-10deg) rotateZ(8deg) translateY(-5px) translateX(-3px); }
    100% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateY(0); }
}

.dice-cup-img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3));
}

.dice-container {
    display: flex;
    gap: 5px;
    margin-bottom: 0px;
    justify-content: center;
    min-height: 60px;
}

.die {
    width: 40px; 
    height: 40px;
    background: white;
    border: 1px solid black;
    border-radius: 6px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    display: grid;
    grid-template-areas:
        "a . c"
        "e g f"
        "d . b";
    padding: 4px;
    cursor: pointer;
}

.die.clicked {
    background-color: #ffcccc; 
}

.die.hidden {
    visibility: hidden; 
}

/* Staggered dice roll-out animation */
.die.roll-out-anim {
    opacity: 0;
    animation: die-roll-out 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes die-roll-out {
    0% {
        transform: translateY(-130px) rotate(-180deg) scale(0.3);
        opacity: 0;
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
        box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    }
}

.dot {
    display: block;
    width: 8px; /* Kleiner! */
    height: 8px;
    border-radius: 50%;
    background-color: black;
}
.dot[data-pos="1"] { grid-area: a; }
.dot[data-pos="2"] { grid-area: b; }
.dot[data-pos="3"] { grid-area: c; }
.dot[data-pos="4"] { grid-area: d; }
.dot[data-pos="5"] { grid-area: e; }
.dot[data-pos="6"] { grid-area: f; }
.dot[data-pos="7"] { grid-area: g; align-self: center; justify-self: center;}


.dice-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.small-actions {
    display: flex;
    gap: 5px;
    justify-content: space-between;
}

.small-actions button {
    flex: 1;
}

.becher-btn {
    height: 60px; 
    font-size: 18pt;
    font-weight: bold;
    background-color: #FFE4E1; 
    border: 2px outset #ddd;
    cursor: pointer;
}

.versuch-display {
    font-size: 12pt;
    text-align: center;
    height: 24px;
    line-height: 24px;
}

.summe-display {
    background-color: var(--yellow);
    border: 4px inset #ccc;
    font-size: 16pt;
    text-align: right;
    padding: 2px 8pt 2px 2px;
    cursor: pointer;
}
.summe-display.hidden { visibility: hidden; }

/* Neustart / Korrektur / Zurueck */
#btnNeu { background-color: var(--pink); height: 60px; font-size: 18pt; font-weight: bold; width: 100%;}
#btnZurueck { background-color: #FFA07A; height: 60px; font-size: 18pt; font-weight: bold;}
#btnKorrektur { background-color: lightblue; height: 60px; font-size: 18pt; font-weight: bold;}
#btnScores { background-color: #98FB98; height: 60px; font-size: 18pt; font-weight: bold;}
