:root {
    --bg-color: #0d0221;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-primary: #7b2cbf;
    --accent-secondary: #3c096c;
    --accent-glow: #9d4edd;
    --text-color: #e0e1dd;
    --text-muted: #8d99ae;
    --neon-blue: #00d4ff;
    --gold: #ffca3a;
    --silver: #e0e1dd;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(123, 44, 191, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.15) 0%, transparent 40%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    height: calc(100vh - 4rem);
    min-height: 500px;
}

@media (max-width: 800px) {
    .container {
        grid-template-columns: 1fr;
        height: auto;
        display: flex;
        flex-direction: column;
    }
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

.coin-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.header {
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--gold), var(--accent-glow));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Coin 3D Visuals */
.coin-container {
    perspective: 1000px;
    cursor: pointer;
    margin: 2rem 0;
    transition: transform 0.2s;
}

.coin-container:active {
    transform: scale(0.95);
}

.coin {
    width: 220px;
    height: 220px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s linear;
}

.coin .face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    box-shadow:
        inset 0 0 20px rgba(0, 0, 0, 0.4),
        0 15px 35px rgba(0, 0, 0, 0.6);
    background: radial-gradient(circle at 30% 30%, #ffffff, #dee2e6 40%, #adb5bd);
    border: 10px solid #adb5bd;
}

.coin .face::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 3px double rgba(0, 0, 0, 0.15);
}

/* Realistic Face (Heads) */
.face.heads {
    background-image: url('heads.png'), radial-gradient(circle at 30% 30%, #ffffff, #dee2e6 40%, #adb5bd);
    background-size: cover;
    background-position: center;
}

.face.heads::after {
    content: '👤';
    font-size: 5.5rem;
    /* Reduced to fit within coin */
    filter: grayscale(100%) brightness(0.7) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
    opacity: 0.85;
}

/* Realistic Cross (Tails) */
.face.tails {
    background-image: url('tails.png'), radial-gradient(circle at 30% 30%, #ffffff, #dee2e6 40%, #adb5bd);
    background-size: cover;
    background-position: center;
    transform: rotateX(180deg);
}

.face.tails::after {
    content: '✚';
    /* Bold Plus sign per user request */
    font-size: 6rem;
    filter: grayscale(100%) brightness(0.4) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
    opacity: 0.9;
}

/* Animations */
.flipping {
    animation: flip-3d 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes flip-3d {
    0% {
        transform: translateY(0) rotateX(0) scale(1);
    }

    50% {
        transform: translateY(-150px) rotateX(var(--mid-rotation)) scale(1.3);
    }

    100% {
        transform: translateY(0) rotateX(var(--final-rotation)) scale(1);
    }
}

.landing-impact {
    animation: impact-shake 0.3s ease-out;
}

@keyframes impact-shake {
    0% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(10px);
    }

    50% {
        transform: translateY(0);
    }

    75% {
        transform: translateY(5px);
    }

    100% {
        transform: translateY(0);
    }
}

.result-display {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 0 15px var(--accent-glow);
    min-height: 3rem;
    display: flex;
    align-items: center;
}

.btn-flip {
    background: var(--accent-primary);
    border: none;
    color: white;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(123, 44, 191, 0.4);
    transition: all 0.2s;
}

.btn-flip:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(123, 44, 191, 0.6);
}

.btn-flip:active {
    transform: translateY(0);
}

.btn-flip:disabled {
    background: #444;
    cursor: not-allowed;
    box-shadow: none;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 1rem;
}

.panel {
    padding: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.8rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--text-muted);
    transition: all 0.3s;
}

.history-item.latest {
    background: rgba(0, 212, 255, 0.15);
    border-left: 5px solid var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: scale(1.05);
    z-index: 10;
}

.item-side {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-icon {
    font-size: 0.75rem;
    /* Reduced to fit perfectly inside the 24px circle */
    width: 24px;
    height: 24px;
    background: radial-gradient(circle, #f8f9fa, #ced4da);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    color: #1a1a1a;
    /* Dark color for visibility */
}

.item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-icon-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch {
    width: 40px;
    height: 20px;
    position: relative;
    display: inline-block;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background: var(--accent-glow);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Portal Nav */
.nav-panel {
    margin-top: auto;
    padding: 0;
    overflow: hidden;
    border-top: 1px solid var(--glass-border);
}

.btn-hub-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.2rem;
    text-decoration: none;
    color: white;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.btn-hub-link:hover {
    background: var(--accent-primary);
}