*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
}

body {
    font-family: sans-serif;
    font-size: 1.4rem;
    line-height: 1.6;
    color: white;
    background-color: #e5e5e5;
    display: flex;
    flex-direction: column;
    text-align: center;
}

@media (max-width: 768px) {
    body {
        font-size: 1rem;
    }
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 1rem;
}

@media (max-width: 768px) {
    main {
        padding: 0.5rem;
    }
}

.game-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.number-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

@media (max-width: 768px) {
    .number-box {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

.card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

a {
    color: #ffffff;
    font-size: 1rem;
    text-decoration: none;
}

button {
    padding: 2px;
    min-width: 100px;
    font-size: 0.8rem;
    border-radius: 5px;
    margin: 3px;
    border: 1px solid #ffffff;
    background-color: transparent;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    &:hover {
        background-color: #ffffff;
        color: #000000;
    }
}

@media (max-width: 768px) {
    button {
        min-width: 80px;
        font-size: 0.75rem;
        padding: 6px;
        margin: 2px;
    }
}

.modern-btn {
    padding: 8px 16px;
    min-width: 80px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    margin: 6px;
    border: 2px solid #00b4d8;
    background: #00b4d8;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 8px #6366f144;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #ffffff22;
    transition: left 0.5s;
}

.modern-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px #90e0ef;
    background: #90e0ef;
}

.modern-btn:hover::before {
    left: 100%;
}

.modern-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px #90e0ef;
}

.modern-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px #90e0ef;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

/* Responsive improvements for mobile */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
    
    .game-container {
        gap: 0.5rem;
    }
    
    .card {
        gap: 0.35rem;
    }
    
    a {
        font-size: 0.875rem;
    }
    
    .modern-btn {
        padding: 6px 12px;
        min-width: 70px;
        font-size: 0.75rem;
        margin: 4px;
    }
}

/* Touch-friendly interactions for mobile */
@media (hover: none) and (pointer: coarse) {
    button, .modern-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Dialog/Modal responsive styles */
dialog {
    max-width: calc(100% - 2rem);
    max-height: calc(100vh - 2rem);
    margin: auto;
}

@media (max-width: 640px) {
    dialog {
        max-width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
        margin: 0.5rem;
    }
    
    dialog div {
        font-size: 0.875rem;
    }
}