:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --accent-rock: #ef4444;
    --accent-paper: #3b82f6;
    --accent-scissors: #10b981;

    --win-color: #10b981;
    --loss-color: #ef4444;
    --tie-color: #f59e0b;

    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 0.2) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 0.2) 0, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.back-link {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1200;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(15, 23, 42, 0.75);
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--text-primary);
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Header & Stats */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

h1 span {
    color: var(--accent-paper);
}

.stats-dashboard {
    display: flex;
    gap: 1rem;
    background: var(--panel-bg);
    padding: 1rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.stat-box .label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.stat-box .value {
    font-size: 2rem;
    font-weight: 600;
}

.advanced-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.advanced-stats span {
    color: var(--text-primary);
    font-weight: 600;
}

.reset-btn {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Game Board */
.game-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
}

.player-side,
.computer-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.vs-text {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-secondary);
    opacity: 0.5;
}

.choice-display {
    width: 150px;
    height: 150px;
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.choice-display.win-ring {
    border-color: var(--win-color);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

.choice-display.loss-ring {
    border-color: var(--loss-color);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.choice-display.tie-ring {
    border-color: var(--tie-color);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.choice-display .placeholder {
    opacity: 0.2;
}

.choice-display.pop {
    transform: scale(1.1);
}

/* Result Display */
.result-display {
    text-align: center;
    margin-bottom: 2rem;
    height: 40px;
}

#round-result {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 1px;
    transition: color 0.3s;
}

#round-result.win {
    color: var(--win-color);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

#round-result.loss {
    color: var(--loss-color);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

#round-result.tie {
    color: var(--tie-color);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.choice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.choice-btn .icon {
    font-size: 2.5rem;
    transition: transform 0.2s ease;
}

.choice-btn .text {
    color: var(--text-primary);
    font-family: var(--font-main);
    font-weight: 600;
    letter-spacing: 1px;
}

.choice-btn:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.choice-btn:hover .icon {
    transform: scale(1.1);
}

.choice-btn:active {
    transform: translateY(2px);
}

.choice-btn[data-choice="rock"]:hover {
    border-color: var(--accent-rock);
}

.choice-btn[data-choice="paper"]:hover {
    border-color: var(--accent-paper);
}

.choice-btn[data-choice="scissors"]:hover {
    border-color: var(--accent-scissors);
}

/* Shake animation for computer processing */
@keyframes shake {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    25% {
        transform: translateY(-10px) rotate(-10deg);
    }

    50% {
        transform: translateY(0) rotate(0);
    }

    75% {
        transform: translateY(-10px) rotate(10deg);
    }
}

.shaking {
    animation: shake 0.5s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 600px) {
    .back-link {
        top: 10px;
        left: 10px;
        font-size: 0.76rem;
        padding: 7px 10px;
    }

    .game-board {
        flex-direction: column;
        gap: 2rem;
    }

    .vs-text {
        transform: rotate(90deg);
    }

    .controls {
        flex-wrap: wrap;
    }

    .stats-dashboard {
        padding: 1rem;
    }
}

/* Badges Section */
.badges-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: var(--panel-bg);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
}

.badges-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.badges-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    min-height: 60px;
    width: 100%;
}

.empty-badges {
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.5;
    display: flex;
    align-items: center;
}

.badge-container {
    position: relative;
    width: 80px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    cursor: default;
    transition: transform 0.2s ease;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-container:hover {
    transform: scale(1.15) translateY(-5px);
}

.badge-container::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
    font-weight: 600;
}

.badge-container:hover::after {
    opacity: 1;
}

.badge-medal {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fde68a 0%, #d97706 40%, #78350f 100%);
    background-size: 200% 200%;
    color: #fffbeb;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.7),
        inset 0 -4px 8px rgba(0, 0, 0, 0.6),
        0 6px 12px rgba(0, 0, 0, 0.4);
    border: 3px solid #fcd34d;
    position: relative;
    z-index: 10;
    animation: shimmer 3s infinite alternate ease-in-out;
}

.badge-number {
    position: relative;
    z-index: 2;
    font-weight: 900;
    font-size: 1.6rem;
    line-height: 1;
    margin-top: 5px;
}

.badge-text {
    position: relative;
    z-index: 2;
    font-size: 0.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-top: 2px;
}

.ribbon-left,
.ribbon-right {
    position: absolute;
    top: 45px;
    width: 24px;
    height: 40px;
    background: linear-gradient(to bottom, #ef4444, #991b1b);
    z-index: 5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

.ribbon-left {
    left: 14px;
    transform: rotate(15deg);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

.ribbon-right {
    right: 14px;
    transform: rotate(-15deg);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    border-radius: 12px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.fade-out {
    animation: fadeOutUp 0.4s ease forwards;
}

.toast-icon {
    font-size: 2rem;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-weight: 800;
    font-size: 1.1rem;
}

.toast-msg {
    font-size: 0.9rem;
    opacity: 0.9;
}

@keyframes slideDown {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }

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

@keyframes fadeOutUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}