/* Count Submission */
.count-submission {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.submission-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-align: center;
}

.submission-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: center;
}

.count-input-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.count-adjust-btn {
    width: 60px;
    height: 60px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.count-adjust-btn:hover {
    background: var(--gold);
    color: var(--black-suit);
    border-color: var(--gold);
    transform: scale(1.1);
}

.count-input {
    width: 120px;
    height: 80px;
    border: 2px solid var(--gold);
    border-radius: var(--radius-lg);
    background: rgba(0, 0, 0, 0.5);
    color: var(--gold);
    font-family: var(--font-main);
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: all 0.25s ease;
}

.count-input:focus {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.count-input::-webkit-inner-spin-button,
.count-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.count-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.submit-btn {
    padding: 1.5rem 3rem;
    background: linear-gradient(135deg, #f4d03f, #d4af37);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--black-suit);
    font-family: var(--font-main);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 30px rgba(212, 175, 55, 0.4);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 40px rgba(212, 175, 55, 0.5);
}

/* Results Display */
.results-display {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.result-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem;
    text-align: center;
    max-width: 450px;
    width: 100%;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    margin-bottom: 2rem;
}

.result-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    animation: bounce 0.6s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.result-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--gold);
}

.result-counts {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.count-box {
    flex: 1;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: rgba(0, 0, 0, 0.3);
}

.count-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.count-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
}

.your-count .count-number {
    color: var(--text-primary);
}

.actual-count .count-number {
    color: var(--gold);
}

.diff-display {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
}

.diff-label {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.diff-value {
    font-weight: 700;
    font-size: 1.25rem;
}

.diff-value.perfect {
    color: var(--success);
}

.diff-value.close {
    color: var(--warning);
}

.diff-value.off {
    color: var(--error);
}

.feedback-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.result-stat {
    text-align: center;
}

.rs-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
}

.rs-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.next-round-btn {
    padding: 1rem 3rem;
    background: linear-gradient(135deg, #f4d03f, #d4af37);
    border: none;
    border-radius: var(--radius-md);
    color: var(--black-suit);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.next-round-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(212, 175, 55, 0.4);
}

/* Revealed Count */
.revealed-count {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    animation: slideUp 0.3s ease;
}

.reveal-box {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--gold);
    border-radius: var(--radius-lg);
    padding: 1.5rem 3rem;
    text-align: center;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.3);
}

.reveal-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    line-height: 1;
}

.reveal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.reveal-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.reveal-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.reveal-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.reveal-timer {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.reveal-timer-bar {
    height: 100%;
    width: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confettiFall 3s ease-out forwards;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.square {
    border-radius: 2px;
}

.confetti.ribbon {
    width: 8px;
    height: 20px;
    border-radius: 4px;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.5);
    }
}

/* Shake Animation for Wrong Answers */
.shake-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    background: transparent;
}

.shake-overlay.active {
    animation: shakeScreen 0.5s ease;
}

@keyframes shakeScreen {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Wrong Answer Flash */
.wrong-flash {
    animation: wrongFlash 0.6s ease;
}

@keyframes wrongFlash {

    0%,
    100% {
        background-color: transparent;
    }

    25%,
    75% {
        background-color: rgba(255, 71, 87, 0.2);
    }
}

/* Success Glow */
.success-glow {
    animation: successGlow 1s ease;
}

@keyframes successGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 210, 106, 0);
    }

    50% {
        box-shadow: 0 0 60px 20px rgba(0, 210, 106, 0.4);
    }
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #0d5c2e 0%, #073d1d 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    color: var(--gold);
    margin-bottom: 2rem;
    text-align: center;
}

.modal-body {
    color: var(--text-secondary);
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.help-section p {
    margin-bottom: 1rem;
}

.help-section ol,
.help-section ul {
    padding-left: 2rem;
}

.help-section li {
    margin-bottom: 0.5rem;
}

.hi-lo-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
}

.chart-row.positive {
    border-left: 4px solid var(--success);
}

.chart-row.neutral {
    border-left: 4px solid var(--text-muted);
}

.chart-row.negative {
    border-left: 4px solid var(--error);
}

.chart-row .cards {
    font-weight: 500;
}

.chart-row .value {
    font-weight: 700;
    font-size: 1.25rem;
}

.chart-row.positive .value {
    color: var(--success);
}

.chart-row.neutral .value {
    color: var(--text-muted);
}

.chart-row.negative .value {
    color: var(--error);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .card {
        width: 140px;
        height: 200px;
    }

    .card-value {
        font-size: 1.5rem;
    }

    .card-suit {
        font-size: 1.25rem;
    }

    .card-center-suit {
        font-size: 3.5rem;
    }

    .control-panel {
        padding: 1.5rem;
    }

    .speed-btn,
    .deck-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .primary-btn,
    .secondary-btn {
        padding: 0.5rem 1.5rem;
        font-size: 0.875rem;
    }

    .game-controls {
        gap: 0.5rem;
    }

    .submission-title {
        font-size: 1.75rem;
    }

    .count-input {
        width: 100px;
        height: 60px;
        font-size: 2rem;
    }

    .count-adjust-btn {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .result-card {
        padding: 2rem;
    }

    .result-emoji {
        font-size: 3rem;
    }

    .result-title {
        font-size: 1.5rem;
    }

    .count-number {
        font-size: 2rem;
    }

    .reveal-number {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.25rem;
    }

    .stats-bar {
        gap: 0.5rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .card-display {
        min-height: 220px;
    }

    .card {
        width: 120px;
        height: 170px;
    }

    .card-center-suit {
        font-size: 2.5rem;
    }

    .mini-card {
        width: 30px;
        height: 42px;
        font-size: 0.6rem;
    }

    .result-counts {
        flex-direction: column;
    }

    .result-stats {
        gap: 1rem;
    }
}

/* Selection & Scrollbar */
::selection {
    background: var(--gold);
    color: var(--black-suit);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}