:root {
    font:
        16px/1.4 system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

body {
    margin: 0;
    background: #0b0b0c;
    color: #f3f3f3;
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.wrap {
    width: min(680px, 92vw);
    text-align: center;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.95;
}

.controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

button {
    cursor: pointer;
    border: 0;
    padding: 0.7rem 1rem;
    border-radius: 0.9rem;
    background: #1b1c20;
    color: #fff;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 10px 30px rgba(0, 0, 0, 0.35);
}

button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

#pad {
    width: 100%;
    height: 42vh;
    min-height: 260px;
    font-size: clamp(1.1rem, 3.8vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.3px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.box {
    background: #111216;
    border: 1px solid #1e1f26;
    padding: 0.8rem;
    border-radius: 0.9rem;
}

.label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.val {
    font-size: 1.4rem;
    font-weight: 800;
    margin-top: 0.2rem;
}

#cps {
    perspective: 400px;
    display: inline-flex;
    font-size: 1.4rem;
    font-weight: 800;
    margin-top: 0.2rem;
}

.digit {
    display: inline-block;
    position: relative;
    min-width: 0.6em;
    text-align: center;
}

.digit.dot {
    min-width: 0.3em;
}

.flip-out {
    animation: flipOut 0.15s ease-in forwards;
}

.flip-in {
    animation: flipIn 0.15s ease-out forwards;
}

@keyframes flipOut {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }

    100% {
        transform: rotateX(90deg);
        opacity: 0;
    }
}

@keyframes flipIn {
    0% {
        transform: rotateX(-90deg);
        opacity: 0;
    }

    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

.note {
    opacity: 0.6;
    font-size: 0.85rem;
    margin-top: 0.6rem;
}

#share {
    transition: transform 0.2s ease;
}

#share:hover:not(:disabled) {
    transform: translateY(-2px);
}

#sharePopup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1b1c20;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.7rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}