/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
    transition: background-color 0.6s ease, background-image 0.6s ease;
}

/* Container */
.container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    z-index: 1;
    overflow: hidden;
}

/* Logo - Fixed at top center */
.logo-container {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 140px;
    height: auto;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.logo {
    width: 100%;
    height: auto;
    display: block;
    max-width: 140px;
    border-radius: 8px;
    object-fit: contain;
}

/* Main content */
.main-content {
    text-align: center;
    margin-top: 100px;
    z-index: 10;
    padding: 10px 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-height: calc(100vh - 100px);
}

/* Title styles - will be randomized */
.title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1d1d1f;
    transition: font-size 0.6s ease, font-weight 0.6s ease, color 0.6s ease;
    line-height: 1.1;
}

/* Dice container */
.dice-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin: 15px 0;
    min-height: 300px;
    max-height: 320px;
}

/* Dice styles */
.dice {
    width: 280px;
    height: 280px;
    background: linear-gradient(135deg, #28A7AB 0%, #5B5B5C 100%);
    border-radius: 30px;
    box-shadow: 0 12px 35px rgba(40, 167, 171, 0.4), 
                0 0 0 4px rgba(255, 255, 255, 0.3),
                inset 0 3px 12px rgba(255, 255, 255, 0.3),
                inset 0 -3px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dice:hover {
    transform: scale(1.08);
    box-shadow: 0 18px 50px rgba(40, 167, 171, 0.6), 
                0 0 0 5px rgba(255, 255, 255, 0.4),
                inset 0 3px 15px rgba(255, 255, 255, 0.4),
                inset 0 -3px 15px rgba(0, 0, 0, 0.25);
}

.dice:active {
    transform: scale(0.95);
}

.dice.rolling {
    animation: rollDice 0.4s ease-in-out;
}

@keyframes rollDice {
    0% { 
        transform: rotate(0deg) scale(1);
    }
    25% { 
        transform: rotate(90deg) scale(1.08);
    }
    50% { 
        transform: rotate(180deg) scale(0.92);
    }
    75% { 
        transform: rotate(270deg) scale(1.08);
    }
    100% { 
        transform: rotate(360deg) scale(1);
    }
}

.dice-face {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 28px;
    gap: 6px;
    position: relative;
}

.dot {
    width: 38px;
    height: 38px;
    background: #ffffff;
    border-radius: 50%;
    margin: auto;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4),
                inset 0 2px 3px rgba(255, 255, 255, 0.9),
                0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Dice face patterns - using absolute positioning for better control */
.dice[data-value="1"] .dot:nth-child(1) { 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dice[data-value="2"] .dot:nth-child(1) { 
    position: absolute;
    top: 25%;
    left: 25%;
}

.dice[data-value="2"] .dot:nth-child(2) { 
    position: absolute;
    bottom: 25%;
    right: 25%;
}

.dice[data-value="3"] .dot:nth-child(1) { 
    position: absolute;
    top: 20%;
    left: 20%;
}

.dice[data-value="3"] .dot:nth-child(2) { 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dice[data-value="3"] .dot:nth-child(3) { 
    position: absolute;
    bottom: 20%;
    right: 20%;
}

.dice[data-value="4"] .dot:nth-child(1) { 
    position: absolute;
    top: 20%;
    left: 20%;
}

.dice[data-value="4"] .dot:nth-child(2) { 
    position: absolute;
    top: 20%;
    right: 20%;
}

.dice[data-value="4"] .dot:nth-child(3) { 
    position: absolute;
    bottom: 20%;
    left: 20%;
}

.dice[data-value="4"] .dot:nth-child(4) { 
    position: absolute;
    bottom: 20%;
    right: 20%;
}

.dice[data-value="5"] .dot:nth-child(1) { 
    position: absolute;
    top: 20%;
    left: 20%;
}

.dice[data-value="5"] .dot:nth-child(2) { 
    position: absolute;
    top: 20%;
    right: 20%;
}

.dice[data-value="5"] .dot:nth-child(3) { 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dice[data-value="5"] .dot:nth-child(4) { 
    position: absolute;
    bottom: 20%;
    left: 20%;
}

.dice[data-value="5"] .dot:nth-child(5) { 
    position: absolute;
    bottom: 20%;
    right: 20%;
}

.dice[data-value="6"] .dot:nth-child(1) { 
    position: absolute;
    top: 20%;
    left: 20%;
}

.dice[data-value="6"] .dot:nth-child(2) { 
    position: absolute;
    top: 20%;
    right: 20%;
}

.dice[data-value="6"] .dot:nth-child(3) { 
    position: absolute;
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
}

.dice[data-value="6"] .dot:nth-child(4) { 
    position: absolute;
    top: 50%;
    right: 20%;
    transform: translateY(-50%);
}

.dice[data-value="6"] .dot:nth-child(5) { 
    position: absolute;
    bottom: 20%;
    left: 20%;
}

.dice[data-value="6"] .dot:nth-child(6) { 
    position: absolute;
    bottom: 20%;
    right: 20%;
}

/* Result display */
.result-display {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 8px 0;
    min-height: 35px;
    color: #1d1d1f;
    transition: all 0.3s ease;
}

.result-display.show {
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Roll button */
.roll-btn {
    background: linear-gradient(135deg, #28A7AB 0%, #5B5B5C 100%);
    color: #ffffff;
    border: none;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin: 8px 0 5px 0;
    box-shadow: 0 4px 15px rgba(40, 167, 171, 0.4);
    position: relative;
    z-index: 100;
    min-width: 180px;
}

.roll-btn:hover {
    background: linear-gradient(135deg, #32CD32 0%, #28A7AB 100%);
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(40, 167, 171, 0.6);
}

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

.roll-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    position: relative;
    z-index: 100;
}

.dice-count-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
}

.dice-count-control label {
    font-size: 14px;
    color: #1d1d1f;
    font-weight: 500;
}

.dice-count-control input {
    width: 55px;
    padding: 6px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #28A7AB;
    border-radius: 8px;
    text-align: center;
    background: #ffffff;
    color: #1d1d1f;
}

/* Shapes container */
.shapes-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Random shape styles */
.random-shape {
    position: absolute;
    opacity: 0.15;
    transition: all 0.8s ease;
}

.shape-circle {
    border-radius: 50%;
}

.shape-wave {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}

.shape-blob {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    filter: blur(40px);
}

/* Responsive design */
@media (max-width: 768px) {
    .logo-container {
        top: 10px;
        width: 110px;
        padding: 6px 10px;
    }

    .logo {
        max-width: 110px;
    }

    .main-content {
        margin-top: 80px;
        padding: 5px 15px;
    }

    .title {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .dice {
        width: 220px;
        height: 220px;
        border-radius: 25px;
    }

    .dot {
        width: 30px;
        height: 30px;
    }

    .dice-face {
        padding: 22px;
    }

    .dice-container {
        min-height: 240px;
        max-height: 250px;
        gap: 20px;
    }

    .result-display {
        font-size: 1.2rem;
        min-height: 30px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        width: 90px;
        padding: 5px 8px;
        top: 8px;
    }

    .logo {
        max-width: 90px;
    }

    .main-content {
        margin-top: 70px;
        padding: 5px 10px;
    }

    .title {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .dice {
        width: 180px;
        height: 180px;
        border-radius: 20px;
    }

    .dot {
        width: 24px;
        height: 24px;
    }

    .dice-face {
        padding: 18px;
    }

    .dice-container {
        min-height: 200px;
        max-height: 210px;
        gap: 15px;
    }

    .result-display {
        font-size: 1rem;
        min-height: 25px;
    }

    .dice-count-control {
        padding: 6px 12px;
    }

    .dice-count-control label {
        font-size: 12px;
    }

    .dice-count-control input {
        width: 45px;
        padding: 5px;
        font-size: 14px;
    }
}

