*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --dark-bg: #000000;
    --darker-bg: #141414;
    --blood-red: #a92408;
    --blood-red-hover: #c22c0f;
    --blood-red-click: #681706;
    --text-light: #e0e0e0;
    --text-lighter: #ffffff;
    --text-de-emph: #5e5d5d;
    --border-dark: #333333;
    --coin-bright: #e6ba2b;
    --coin-light: #fad447;
    --coin-base: #d2a616;
    --coin-dark: #ffae00;
    --coin-shadow: #c798008c;
    --coin-shadow-t: #cb860555;
    --max-width-body: 800px;
    --padding-game-element: 15px;
    --padding-body: 5px;
    --tail-symbol: "🐺"; 
}


/* Base styles */

body {
    font-family: -apple-system, system-ui, sans-serif;
    max-width: var(--max-width-body);
    margin: 0 auto;
    padding: var(--padding-body);
    background-color: var(--dark-bg);
    color: var(--text-light);
}


.header-title {
    position: relative;
    flex-shrink: 1;
    min-width: 0;
}
.header-logo {
    position: relative;
    flex-shrink: 1;
    min-height: 2rem;
    max-width: min(60vw, var(--max-width-body)*0.6);
    max-height: 12vh;
    width: auto;
    height: auto;
}
.index-logo {
    position: relative;
    flex-shrink: 1;
    min-height: 2rem;
    max-width: min(60vw, var(--max-width-body)*0.6);
    width: auto;
    height: auto;
}
.index-title {
    display: flex;
    justify-content: left;
    width: 100%;
}

h1 {
    flex-shrink: 1;
    min-width: 0;
    font-size: clamp(1.2rem, 5vw, 2.5rem); /* Shrinks between 1.5rem and 2.5rem based on viewport width */
}

/* Night sky container */


/* .night-sky {
    position: relative;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 10%, var(--darker-bg), #727272);
}


/* Moon styling */


/* .moon {
    position: absolute;
    top: 10%;
    right: 7%;
    width: 40px;
    height: 40px;
    background-color: #f0f0f0;
    border-radius: 50%;
    box-shadow: 0 0 60px rgba(255, 255, 255, 0.8), 
    0 0 120px rgba(255, 255, 255, 0.6), 
    0 0 180px rgba(255, 255, 255, 0.4);
    animation: float 30s infinite ease-in-out;
}  */


/* .crater {
    position: absolute;
    background-color: #e2e2e2ab;
    box-shadow: 0 0 2px rgba(171, 171, 171, 0.403);
    border-radius: 50%;
} */


/* Crater 1 */


/* .crater1 {
    width: 9px;
    height: 9px;
    top: 20%;
    left: 21%;
} */


/* Crater 2 */


/* .crater2 {
    width: 6px;
    height: 6px;
    top: 47%;
    left: 20%;
} */


/* Crater 3 */


/* .crater3 {
    width: 7px;
    height: 7px;
    top: 65%;
    left: 50%;
} */


/* Crater 4 */


/* .crater4 {
    width: 3px;
    height: 3px;
    top: 8px;
    left: 23px;
} */


/* Optional: Add a subtle floating animation to the moon */


/* @keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
} */

.container {
    background-color: var(--darker-bg);
    padding: 0px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 0px;
    min-height: calc(100vh - 10px - 2*var(--padding-body));
    display: flex;
    position: relative;
    flex-direction: column;
}


/* Header styles */

.header {
    display: flex;
    position: sticky;
    justify-content: space-around;
    align-items: center;
    top: 0px;
    border-radius: 10px 10px 0 0;
    padding: 0px 8px;
    background-color: var(--darker-bg);
    margin-bottom: 15px;
    min-height: min-content;  
    max-height: 12vh;
    border-bottom: 1px solid var(--border-dark);
    z-index: 10;
}


/* .header {
    background-image: linear-gradient(180deg, var(--text-light), var(--darker-bg), var(--blood-red));
    color: transparent;
    background-clip: text
} */


/* Button styles */

.btn,
button {
    width: 100%;
    padding: 12px 20px;
    margin: 5px 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    background-color: var(--blood-red);
    background-image: radial-gradient(100% 60% at 75% 5%, #ff959541 0, #570d0d3f 100%);
    box-shadow: 0 3px 3cap #432c2c;
    color: rgb(197, 193, 193);
    display: block;
}

.btn:hover,
button:hover {
    background-color: var(--blood-red-hover);
}

.btn:active,
button:active {
    background-color: var(--blood-red-click);
    font-size-adjust: 0.5;
}

.btn:disabled,
button:disabled {
    background: #cccccc !important;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

.screen-element {
    margin-left: 10px;
    margin-right: 10px;
}
/* Input styles */

input {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#playerName {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-dark);
    border-radius: 5px;
    background-color: var(--dark-bg);
    color: var(--text-light);
    font-size: 1rem;
    box-sizing: border-box;
}


.game-status {
    font-weight: 500;
    margin: 5px 8px;
    font-size: 1.1rem;
}

.game-phase,
.night-action,
.player-list {
    position: relative;
    margin: 10px 10px;
    padding: 10px 5px;
    background: var(--darker-bg);
    border-radius: 8px;
    border: 1px solid var(--border-dark);
}

.setting-selector h3,
.night-action h3,
.game-phase h3,
.player-list h3 {
    margin: 0 0 15px 0;
    color: var(--text-light);
    font-size: 1.1rem;
}
.setting-selector:open{
    position: relative; /* Required for the pseudo-element */
}
.setting-selector h3 {
    margin:  0 0 0px 0;
    color: var(--text-light);
    font-size: 1.1rem;
    position: relative;
}
.setting-selector h4 {
    margin:  10px 0 3px 0;
    font-size: 1.0rem;
}
.setting-selector p {
    margin:  0;
}
.setting-selector:open h3 {
    margin:  0 0 12px 0;
}

.setting-selector:open::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: calc(1.2em + var(--padding-game-element) + 18px);
    height: 1px;
    background-color: var(--border-dark); /* Use your theme's border color */
}

.symbol-display {
    margin: 0;
    background-color: #242424;
    font-size: 5em;
    border-radius: 5px;
    border-color: var(--blood-red);
}

#playerRoleDuringGame h3 {
    margin-block-start: 0.33em;
    margin-block-end: 0.33em
}
#playerRoleDuringGame p {
    margin-block-start: 0.33em;
    margin-block-end: 1em;
    text-align: left;
}

.vote-button {
    display: inline-block;
    box-sizing: border-box;
    width: auto;
    margin: 0px 0.2em 0px 0.8em; /* Increased left margin */
    padding: 0.5em 0.8em;
    height: auto;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.7em;
    font-weight: 300;
    background-color: var(--blood-red);
    background-image: radial-gradient(100% 60% at 75% 5%, #ff95957c 0, #570d0d47 100%);
    box-shadow: 0px #432c2c;
    color: rgb(197, 193, 193);
}

.vote-button:disabled {
    visibility: hidden;
}

.vote-indicators { 
    display: flex;
    flex-direction: row-reverse;
    margin-left: auto;
    gap: 2px;
    align-items: flex-end;
    flex-wrap: wrap;
    max-height: 2em;
    font-size: clamp(0.3em , 1em, 1.8em);
}


#playerListContent {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: auto;
    position: relative; 
    width: 100%; 
    --itemCount: 1; /* Default value */
    
    /* Font size calculation:
       - Limited by height (many players) or width (small screens)
       - Target height (90vh) divided by number of items
       - Divided by the height of each item in rem (2.0)
       - Width in view width 5vw
       - Clamped between 0.85em and 1.3em
     */
    font-size: clamp(0.85rem, min(calc(90vh / var(--itemCount) / 2.5), 5vw), 1.3rem);
}


.player-item {
    display: flex;
    position: relative;
    align-items: center;
    padding: 0.1em 0.2em;
    margin: 0;
    height: 2.0em;
    font-size: 0.82em;
    background: var(--dark-bg);
    border-radius: 5px;
    transition: 
        opacity 3s ease-in, 
        color 3s ease-in, 
        border-top 2s ease-in, 
        border 1s ease-in, 
        box-shadow 2.0s ease-in;
    color: var(--text-light);
}

.player-item.joined {
    background: rgba(139, 0, 0, 0.2);
    border-left: 4px solid var(--blood-red);
}

.player-item.dead {
    opacity: 0.45;
    color: #666;
    pointer-events: none;
    position: relative;
}

.player-item.dead::after {
    content: "";
    position: absolute;
    width: 97%;
    top: 53%;
    left: 50%;
    border-top: 1px solid #666666a5;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.player-item.winner {
    border: 2px solid gold;
    box-shadow: 0 0px 4px rgba(248, 211, 0, 0.884);
}

.vote-status {
    margin-top: 15px;
    padding: 10px;
    background: var(--darker-bg);
    border: 1px solid var(--border-dark);
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: clamp(0.8em, 1em, 1.2em);
}

.player-name {
    font-weight: bold;
    color: var(--text-lighter);
    /* margin to the right */
    margin: 0 5px 0 5px;
}

/* Button containers */

.leader-candidates,
.victims-list,
.witch-kill-action,
.witch-save-action,
.day-vote-candidates,
#successorCandidates {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Special case for the show role button in header */

.show-role-btn {
    width: auto;
    padding: 10px 10px;
    margin: 0;
    background: var(--blood-red);
    background-image: radial-gradient(100% 60% at 75% 5%, #ff95957c 0, #570d0d47 100%);
    box-shadow: 0 3px 3cap #432c2c;
    border-radius: 5px;
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
}

.show-role-btn:hover {
    background: var(--blood-red-hover);
}

.show-role-area {
    margin: 0;
    height: min(min(25vw, calc(var(--max-width-body) / 4)), 10vh);
    width: min(min(25vw, calc(var(--max-width-body) / 4)), 10vh);
    display: flex;
    position: relative;
    flex-direction: column;
    align-items: center;
    font-size: min(min(25vw, calc(var(--max-width-body) / 4)), 10vh);
    justify-content: center;
}
.show-role-area p {
    position: relative;
    z-index: 10;
    margin: 0;
    font-size: 0.08em;
}

.popup-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 40px;
    height: 40px;
    padding: 0px 0px 0.6px 2px;
    margin: 0px 0px;
    background-color: #000;
    background-image: #000;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    line-height: 0;
    font-weight: 300;
    font-family: Arial, sans-serif;
}

.popup-close:hover {
    background-color: var(--blood-red);
}


/* Add popup styling for showPlayerRoleDuringGame */

.popup-text-screen {
    position: fixed;
    top: 30%;
    left: 50%;
    background: var(--darker-bg);
    border-radius: 8px;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
    border: 2px solid var(--blood-red);
    text-align: center;
    padding: 20px 15px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}


/* Optional: Add an overlay behind the popup */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
}

.status-update {
    animation: fadeInOut 3s ease-in-out;
    transition: all 0.3s ease-in-out;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0.8;
    }
}


.vote-timer {
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    text-align: center;
    transition: all 0.3s ease;
}

.vote-timer.normal {
    color: #2ecc71;
    background-color: rgba(46, 204, 113, 0.1);
    border: 2px solid #2ecc71;
}

.vote-timer.warning {
    color: #f1c40f;
    background-color: rgba(241, 196, 15, 0.1);
    border: 2px solid #f1c40f;
    animation: pulse 1s infinite;
}

.vote-timer.critical {
    color: var(--blood-red);
    background-color: rgba(139, 0, 0, 0.2);
    border: 2px solid var(--blood-red);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.role-text.disabled {
    opacity: 0.5;
}

.setting-selector {
    margin: 10px 10px;
    padding: var(--padding-game-element, 15px);
    background-color: var(--darker-bg);
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    cursor: pointer;
}

.setting-selector.disabled {
    pointer-events: none;
    opacity: 0.5;
    background-color: #2ecc71;
}

.setting-selector .form-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-selector label {
    display: flex;
    align-items: left;
    width: 50%;
    gap: 10px;
    font-size: 1em;
    color: var(--text-light);
}
.setting-selector select {
    width: 50%;
    padding: 8px;
    border: 1px solid var(--border-dark);
    border-radius: 5px;
    background-color: #242424;
    cursor: pointer;
    margin-top: 5px;
    color: var(--text-light);
}

.setting-selector input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-left: 10px;
    accent-color: var(--blood-red);
}

.join-game-section {
    margin: 0 auto;
    padding: 20px;
}

.form-group {
    width: 100%;
    margin: 6px 0px;
}

.leave-game-btn {
    margin: 20px 0;
}

.leave-game-btn .btn {
    background-color: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text-light);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.leave-game-btn .btn:hover {
    background-color: rgba(139, 0, 0, 0.2);
    border-color: var(--blood-red);
    opacity: 1;
}


/* Color picker styles */

.color-picker-section {
    margin: 15px 0;
    display: none;
    /* Will be shown when in lobby */
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#signPicker {
    margin-bottom: 15px;
}

.sign-color-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}


.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.681);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #000;
}

.color-option.disabled {
    background: repeating-linear-gradient( 45deg, #393939aa, #393939aa 2.5px, #f0f0f032 2.5px, #f0f0f032 5px);
    opacity: 0.6;
    box-shadow: #121212 0 0 0 3px;
    transform: scale(0.9);
    cursor: not-allowed;
    pointer-events: none;
}

.player-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    user-select: none;
}

.sign-option {
    background-color: var(--text-lighter);
    color: transparent;
    font-size: 1.43em;
    height: 30px;
    width: 30px;
    border-radius: 15%;
    margin: 0px;
    padding-bottom: 3px;
    background-clip: text;
    -webkit-background-clip: text;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.681);
    user-select: none;
}

.sign-option:hover {
transform: scale(1.1);
}

.sign-option.selected {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #000;
}

.player-sign {
    font-size: 1.0em;
    background-color: var(--text-lighter);
    color: transparent;
    background-clip: text;
    user-select: none;
}

.sign-option.disabled {
    background-image: repeating-linear-gradient( 45deg, #393939aa, #393939aa 2.5px, #f0f0f032 2.5px, #f0f0f032 5px);
    box-shadow: #121212 0 0 0 3px;
    transform: scale(0.9);
    cursor: not-allowed;
    pointer-events: none;
}

.sign-display {
    background-color: var(--dark-bg);
    margin-top: 10px;
    width: 60px;
    height: 60px;
    border-radius: 25%;
    position: relative;
}

.player-sign-big {
    font-size: 2.0em;
    background-color: white;
    color: transparent;
    background-clip: text;
    position: absolute;
    top: 48%;
    left: 51%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.game-controls{
    margin: 5px 10px;

}

/* Session code display */

/* .session-code-display {
    margin-top: auto;
    text-align: center;
    padding-top: 5px;
    border-top: 1px solid #ccc;
} */

.session-code-display p {
    margin: 0;
    font-size: 1.2em;
    color: var(--text-light);
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.9em;
    width: 50%;
    margin: 5px auto;
    background-color: rgba(85, 85, 85, 0.2);
    background-image: none;
    border: 1px solid var(--border-dark);
    color: var(--text-de-emph);
    box-shadow: none;
    opacity: 1.0;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background-color: rgba(131, 131, 131, 0.2);
    border-color: var(--blood-red);
    opacity: 1;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.active-sessions {
    margin-top: 2rem;
    width: 100%;
    max-width: 600px;
}

.active-sessions h2 {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.session-item {
    background-color: var(--darker-bg);
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-dark);
}

.session-item span {
    color: var(--text-light);
}

.session-item button {
    padding: 5px 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.session-stats {
    background-color: var(--darker-bg);
    padding: 20px;
    border-radius: 5px;
    margin: 20px 10px;
    border: 1px solid var(--border-dark);
}
.join-section {
    margin: 20px 10px;
}
.join-section h2 {
    margin-top: 0;
}

.session-stats h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-light);
}

#sessionStats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}

#sessionStats span {
    font-size: 1.4em;
    color: var(--text-light);
    margin: 0;
    text-align: center;
    flex: 1;
    min-width: 200px;
}

#sessionStats .session-stats-highlight {
    font-size: 1.4em;
    font-weight: bold;
    color: #4CAF50;
    padding-left: 10px;
}

.beta-banner {
    background-color: #ff9800;
    color: #000;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    width: min(100vw, 800px);
    position: relative;
    top: var(--padding-body);
    left: 0;
    transform: translateX(calc(0px - var(--padding-body)));
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.server-down {
    background-color: var(--blood-red);
    color: var(--text-light);
    text-align: center;
    padding: 10px;
    font-weight: bold;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Language Selector Styles */
.language-selector {
    position: absolute;
    top: 5px;
    right: 5px;
    margin-right: 0px;
}

.language-dropdown {
    color: var(--text-light);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8em;
    padding-right: 15px;
    background-color: var(--darker-bg);
    border-radius: 8px;
    border: 1px solid var(--border-dark);
}
.language-dropdown select {
    padding: 8px;
    border: 1px solid var(--border-dark);
    border-radius: 5px;
    background-color: #242424;
    margin-top: 5px;
}

/* .language-dropdown:hover {
    background-color: #555;
}

.language-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.5);
} */

/* Remove old button styles */
.lang-btn {
    display: none;
}
.session-code-display {
    margin-top: auto;
    padding-top: 5px;
    border-top: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
    padding-bottom: 10px;
}

.reload-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    box-sizing: content-box;
    font-size: larger;
    color: var(--text-light);
    background: var(--darker-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}


.role-coin {
    width: 1.4em;
    height: 1.4em;
    position: relative;
    perspective: 1000px;
    border-radius: 50%;
    font-size: 0.6em;
    transform-style: preserve-3d;
    transform-origin: center center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 2px 4px 2px rgb(0 0 0 / 68%);
}
.animate-land {
    animation: land 0.6s cubic-bezier(0.5, 1.5, 0.5, 1) forwards;
}

@keyframes land {
    0% {
        transform: translate(-5px, 10px) rotateX(80deg)rotateY(80deg);
        opacity: 0;
    }
    60% {
        transform: translate(1px, -2px) rotateX(30deg)rotateY(30deg);
        opacity: 1;
    }
    70% {
        transform: translate(-1px, 1px) rotateX(0deg)rotateY(0deg);
    }
    80% {
        transform: translate(0px, 0px) rotateX(0deg)rotateY(0deg);
    }
    90% {
        transform: translate(0px, 1px) rotateX(0deg) rotateY(0deg);
    }
    100% {
        transform: translate(0px, 0px) rotateX(0deg) rotateY(0deg);
    }
}
.role-coin:hover{
    filter: brightness(1.1);
}
.coin-hold {
    font-size: min(min(25vw, calc(var(--max-width-body) / 4)), 10vh);
}
.coin {
    width: 1.4em;;
    height:  1.4em;;
    position: relative;
    perspective: 1000px;
    border-radius: 50%;
    font-size: 0.6em;
    transform-style: preserve-3d;
    transform-origin: center center;
    z-index: 11;
    animation: spin 0.4s linear 6 2.1s,
    half_spin 2s linear(0, 0.35 5%, 0.75 90%, 0.875 97%, 1) 4.5s,
    throw 6.5s linear,
    flyToTarget 0.5s ease-in 6.5s forwards;
    margin: 20px auto;
   
}

@keyframes spin {
    0% { 
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}
@keyframes half_spin {
    0% { 
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(255deg);
    }
}
@keyframes flyToTarget {
    0% {
        transform: translate(0, 0) rotateY(-105deg) scale(4.2);
    }
    100% {
        transform: translate(var(--target-x), var(--target-y)) rotateY(270deg) scale(1);
    }
}


@keyframes throw {
    0% {
        scale: 1
    }
    56% {
        scale: 1.05
    }
    63% {
        scale: 1.1
    }
    65% {
        scale: 2;
    }
    70% {
        scale: 4.3;
    }
    80% {
        scale: 4.3;
    }
    100% {
        scale: 4.2;
    }
}

@keyframes blink {
    48% { filter: brightness(1.45); } 
    0%, 25%, 67%, 100% { filter: brightness(1); } 
}

.side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    font-size: 0.35em;
    background-image: linear-gradient(45deg, var(--coin-dark) 0%,  var(--coin-light) 100%);
    box-shadow: inset var(--coin-shadow) 0em 0em 0em 0.07em;;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--coin-dark);
}

/* Add a middle layer to fill the gap */
.middle-layer {
    position: absolute;
    top: 0%;
    left: 50%;
    width: 4px;
    height: 100%;
    border-radius: 0%;
    background-image: linear-gradient(var(--coin-bright), var(--coin-dark));
    transform: rotateY(90deg) ;
    z-index: 5;
}

.head {
    transform: translateZ(2px);
    z-index: 2;
}
.head::after {
    transform: translateZ(1.5px);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 0;
    background-image: linear-gradient(var(--coin-bright), var(--coin-dark));
}

.tail {
    transform: translateZ(-2px) rotateY(180deg);
    animation: blink 2s linear(0, 0.35 5%, 0.75 90%, 0.875 97%, 1) 4.5s;
    z-index: 1;
}
.tail::after {
    transform: translateZ(-1.5px);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 0;
    background-image: linear-gradient(var(--coin-bright), var(--coin-dark));
}

.inset{
    width: 80%;
    height: 80%;
    border-radius: 50%;
    position: relative;
    user-select: none;
    
    /* border: 0.1em solid var(--coin-bright); */
/* #f3b121cf 0.0em 0.0em 0.3em 0.6em,
                #fdca13cf 0.0em 0.0em 0.1em 0.3em, */
                
    box-shadow: var(--coin-shadow-t) 0.0em 0.0em 0.3em 0.05em,
    /* #fff27e97 -0.1em 0.1em 0.3em 0.01em, */
    /* inset var(--coin-shadow) -0.02em 0.05em 0.06em 0.09em, */
    /* inset var(--coin-shadow) -0.02em 0.05em 0.06em 0.09em, */
    inset var(--coin-shadow) -0.0em 0.0em 0.0em 0.05em,
        inset #5b310052 -0.05em 0.05em 0.0em 0.005em;
    /* background-image: radial-gradient(circle at 80% 5%, #fff27e 0, #f3e249 60%, var(--coin-bright) 100%);  */
    background-image: linear-gradient(45deg, var(--coin-base) 0, var(--coin-light) 100%); 
    /* background-color: var(--coin-bright); */
}

.inset .coin-symbol {
    color: transparent;
    background-image: radial-gradient(circle at 75% 25%, var(--coin-light) 0,  var(--coin-dark) 40%, var(--coin-dark) 100%);
    background-clip: text;
    position: absolute;
    top: 0%;
    left: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    z-index: 1;
}
.head .inset .coin-symbol {
    font-size: 1.5em;
}
.tail .inset .coin-symbol {
    font-size: 1.5em;
}
.role .inset .coin-symbol {
    font-size: 2.8em;
}
.inset::after {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-shadow:  var(--coin-shadow) -0.00em 0.00em 0.2em,
    var(--coin-shadow) -0.02em 0.02em 0.0em;
    color: transparent;
    text-align: center;
    transform: translate(-50%, -50%);
}
.head .inset::after {
    content: "🧍";
    font-size: 1.5em;
}
.tail .inset::after {
    content: var(--tail-symbol);
    font-size: 1.5em;
}
.role .inset::after {
    content: "?";
    font-size: 3.0em;
}