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

body {
    margin: 0;
    font-family: 'CustomFont', sans-serif;
    background: linear-gradient(135deg, #e0e0e0, #34495e);
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-y: auto;
    position: relative;
    touch-action: manipulation;
    padding: 16px 0 120px;
}

.game-container {
    width: 86vw;
    max-width: 380px;
    background: #1e1e1e;
    border-radius: 15px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
    text-align: center;
    position: relative;
    font-family: 'CustomFont', sans-serif;
}

.home-link {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: #333;
    border: 2px solid #444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #ecf0f1;
    font-size: 0.9em;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
}

.home-link:active {
    background: #1EE6FF;
    border-color: #1EE6FF;
    transform: scale(0.9);
}

.score-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.score-box {
    background: #2a2a2a;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #e6e6e6;
    min-width: 60px;
    text-align: center;
}

.dice-area {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.die {
    width: 56px;
    height: 56px;
    background: #fff;
    border: 3px solid #444;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    color: #1e1e1e;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    -webkit-user-select: none;
    font-weight: bold;
    font-family: 'CustomFont', sans-serif;
}

.die:active {
    transform: scale(0.9);
}

.die.held {
    border-color: #66FF0E;
    box-shadow: 0 0 10px rgba(102, 255, 14, 0.4);
    background: #d4edda;
}

.die.rolling {
    animation: rollAnim 0.4s ease;
}

@keyframes rollAnim {
    0% { transform: rotate(0deg) scale(0.8); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(0.9); }
    75% { transform: rotate(270deg) scale(1.05); }
    100% { transform: rotate(360deg) scale(1); }
}

.hold-info {
    font-size: 0.75em;
    color: #888;
    margin-bottom: 12px;
    display: none;
}

.status {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #ecf0f1;
    font-family: 'CustomFont', sans-serif;
}

.result {
    font-size: 1.2em;
    font-weight: bold;
    display: none;
    color: #ecf0f1;
    margin-bottom: 8px;
    font-family: 'CustomFont', sans-serif;
}

.result.win {
    color: #66FF0E;
    transform: scale(1.1);
}

.result.lose {
    color: #F50055;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.roll-btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1.1em;
    cursor: pointer;
    font-family: 'CustomFont', sans-serif;
    background: #1EE6FF;
    color: #1e1e1e;
    border: none;
    font-weight: bold;
    transition: transform 0.2s, background 0.2s;
}

.roll-btn:active {
    background: #15b8d4;
    transform: scale(0.95);
}

.roll-btn:disabled {
    background: #555;
    color: #888;
}

.keep-btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1.1em;
    cursor: pointer;
    font-family: 'CustomFont', sans-serif;
    background: #66FF0E;
    color: #1e1e1e;
    border: none;
    font-weight: bold;
    transition: transform 0.2s, background 0.2s;
}

.keep-btn:active {
    background: #55dd00;
    transform: scale(0.95);
}

.play-again {
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 1em;
    cursor: pointer;
    font-family: 'CustomFont', sans-serif;
    background: #28a745;
    color: #fff;
    border: none;
}

.play-again:active {
    color: #28a745;
    background: #fff;
}

*:focus, *:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ecf0f1;
    font-size: 0.8em;
    position: fixed;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    padding: 10px 20px;
    box-sizing: border-box;
    background: #1e1e1e;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    font-family: 'CustomFont', sans-serif;
}

.footer-content {
    text-align: center;
    border-top: 1px solid #444;
    padding-top: 10px;
}

.footer-links {
    text-align: center;
    margin-top: 10px;
}

.terms-link {
    color: #8a2be2;
    text-decoration: none;
}

@media (max-width: 420px) {
    .game-container {
        padding: 12px;
    }
    .die {
        width: 48px;
        height: 48px;
        font-size: 1.5em;
    }
    .score-box {
        padding: 6px 8px;
        min-width: 55px;
        font-size: 0.8rem;
    }
}
