/*
 * Cara ou coroa — cara-ou-coroa.php.
 * Usa gerador.css e sorteio.css; aqui ficam a moeda, o palpite, o placar e o histórico.
 */

.coin-stage {
    text-align: center;
}

/* Moeda */
.coin-scene {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 0 8px;
}

.draw-card .coin-toss {
    position: relative;
    z-index: 1;
    width: 200px;
    height: 200px;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    perspective: 1000px;
    -webkit-tap-highlight-color: transparent;
}

.draw-card .coin-toss:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px rgba(10, 127, 209, .3);
}

.coin-toss.is-tossing {
    cursor: progress;
    animation: coin-arc var(--coin-duration, 1.6s) cubic-bezier(.3, .6, .4, 1) both;
}

@keyframes coin-arc {
    0% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-48px) scale(1.12); }
    100% { transform: translateY(0) scale(1); }
}

.coin {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(0deg);
    transition: transform var(--coin-duration, 1.6s) cubic-bezier(.2, .7, .25, 1);
}

.coin__face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff3b0 0%, #f4c542 38%, #d79a12 72%, #a86f00 100%);
    box-shadow:
        inset 0 0 0 8px #e0ab25,
        inset 0 0 0 10px #b37b06,
        inset 0 -6px 14px rgba(120, 70, 0, .35);
    color: #8a5800;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.coin__face--coroa {
    transform: rotateX(180deg);
}

.coin__face svg {
    width: 84px;
    height: 84px;
    fill: currentColor;
    filter: drop-shadow(0 1px 0 rgba(255, 245, 200, .7));
}

.coin__label {
    color: #7a4d00;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
    text-shadow: 0 1px 0 rgba(255, 245, 200, .7);
}

.coin-shadow {
    width: 150px;
    height: 16px;
    margin-top: 14px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(10, 40, 70, .28) 0%, rgba(10, 40, 70, 0) 70%);
}

.coin-shadow.is-tossing {
    animation: coin-shadow var(--coin-duration, 1.6s) cubic-bezier(.3, .6, .4, 1) both;
}

@keyframes coin-shadow {
    45% { transform: scale(.6); opacity: .5; }
}

.coin-status {
    min-height: 1.4em;
    margin: 18px 0 0;
    color: var(--ink-soft);
    font-size: 17px;
    font-weight: 700;
}

.coin-status strong {
    color: var(--ink);
    font-size: 22px;
}

.coin-status .is-hit {
    color: #067647;
}

.coin-status .is-miss {
    color: #b42318;
}

/* Palpite */
.coin-guess {
    max-width: 420px;
    margin: 22px auto 0;
    text-align: left;
}

.coin-pick {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    border-radius: 14px;
    background: #eef3f8;
}

.coin-pick label {
    margin: 0;
    cursor: pointer;
}

.coin-pick input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.coin-pick span {
    display: block;
    padding: 10px 6px;
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    transition: background-color .15s ease, color .15s ease;
}

.coin-pick input:checked + span {
    background: #fff;
    color: var(--brand-dark);
    box-shadow: 0 2px 6px rgba(10, 60, 110, .12);
}

.coin-pick input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(10, 127, 209, .3);
}

.coin-stage .draw-submit {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* Placar */
.coin-score {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.coin-score li {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f7fafc;
}

.coin-score__label {
    display: block;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.coin-score strong {
    display: block;
    margin: 2px 0;
    color: var(--ink);
    font-size: 30px;
    line-height: 1.1;
}

.coin-score small {
    color: var(--ink-soft);
    font-size: 13px;
}

/* Histórico */
.coin-history {
    margin-top: 20px;
}

.coin-history h3 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 15px;
}

.coin-history h3 span {
    margin-left: 6px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}

.coin-history ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.coin-history li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f4c542;
    color: #7a4d00;
    font-size: 13px;
    font-weight: 800;
    animation: draw-pop .3s ease both;
}

.coin-history li.is-coroa {
    background: #d6e4f0;
    color: var(--brand-dark);
}

.coin-history li.is-hit {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #16a34a;
}

@media (prefers-reduced-motion: reduce) {
    .coin,
    .coin-toss.is-tossing,
    .coin-shadow.is-tossing {
        transition: none;
        animation: none;
    }
}

@media (max-width: 640px) {
    .draw-card .coin-toss {
        width: 170px;
        height: 170px;
    }

    .coin__face svg {
        width: 70px;
        height: 70px;
    }

    .coin-scene {
        padding-top: 44px;
    }
}
