@import url('https://fonts.googleapis.com/css2?family=Bungee&display=swap');

.tool-container {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 900px;
    margin: 20px auto;
    border: 3px solid #111111;
    border-radius: 12px;
    box-shadow: 6px 6px 0px #111111;
    padding: 20px;
    background: #ffffff;
}

.flipper-wrapper {
    width: 100%;
    min-height: 500px;
    background-color: #F6F3EB;
    border-radius: 8px;
    border: 3px solid #111111;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.top-bar {
    background: #725349;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex; 
    flex-wrap: wrap;
    gap: 12px; 
    align-items: center;
    border: 3px solid #111111;
    box-shadow: 4px 4px 0px #111111;
    margin-bottom: 20px;
}

.bar-text { 
    color: #fff; 
    font-weight: 900; 
    font-size: 16px; 
    margin: 0;
}

.top-bar select {
    padding: 8px 15px; 
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px; 
    border: 2px solid #111111;
    background: #ffffff;
    color: #111111;
    cursor: pointer; 
    outline: none;
}

.btn-flip {
    margin-left: auto;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 900;
    padding: 8px 20px;
    background-color: #ffb7b2;
    border: 2px solid #111111;
    border-radius: 6px;
    box-shadow: 2px 2px 0px #111111;
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
    color: #111111;
}

.btn-flip:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px #111111;
}

.btn-flip:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: 2px 2px 0px #111111;
}

/* Vùng chứa đồng xu */
.coin-arena {
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* HIỆU ỨNG 3D BẰNG CSS */
.coin {
    width: 120px;
    height: 120px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 2.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bungee', sans-serif;
    font-size: 28px;
    color: #111111;
    border: 4px solid #111111;
    box-shadow: inset 0 0 0 8px rgba(255,255,255,0.3), 4px 4px 0px rgba(0,0,0,0.2);
}

.coin-face.front {
    background-color: #ffb7b2; /* Màu Xấp */
    transform: rotateX(0deg);
}

.coin-face.back {
    background-color: #b5ead7; /* Màu Ngửa */
    transform: rotateX(180deg);
}

/* Bảng kết quả */
.result-board {
    text-align: center;
    margin-bottom: 20px;
    transition: opacity 0.3s;
}
.result-board.hidden {
    opacity: 0;
    pointer-events: none;
}
.main-text {
    display: block;
    font-family: 'Bungee', sans-serif;
    font-size: 35px;
    color: #725349;
    text-shadow: 2px 2px 0px #fff;
    margin-bottom: 5px;
}
.sub-text {
    font-weight: 800;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 4px 12px;
    border-radius: 20px;
    color: #513228;
}

/* Lịch sử */
.history-box {
    margin-top: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 2px dashed #111111;
    border-radius: 8px;
}
.history-box h4 { margin: 0 0 10px 0; font-size: 1.1rem; }
.history-box ul { list-style: none; padding: 0; margin: 0; }
.history-box li { font-size: 1.05rem; padding: 8px 0; border-bottom: 1px solid #ccc; font-weight: bold; }
.history-box li:last-child { border-bottom: none; }

@media (max-width: 600px) {
    .coin { width: 90px; height: 90px; }
    .coin-face { font-size: 20px; box-shadow: inset 0 0 0 5px rgba(255,255,255,0.3), 2px 2px 0px rgba(0,0,0,0.2); border-width: 3px; }
    .top-bar { flex-direction: column; align-items: stretch; }
    .btn-flip { margin-left: 0; text-align: center; }
}