:root {
    --poster-color: #bc1a26;
    --plyr-video-background: #bc1a26;
    --plyr-color-main: rgba(0, 0, 0, 0.5);
}

/* ==================== */
/* CUSTOM FONT FACES     */
/* ==================== */

@font-face {
    font-family: 'Street2Art';
    src: url('fonts/Street2Art-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FromStreetArt';
    src: url('fonts/FromStreetArt-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SuperPopstar';
    src: url('fonts/Super Popstar.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Edo';
    src: url('fonts/edo.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HVD Peace';
    src: url('fonts/HVD_Peace.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Gothic-Dice';
    src: url('fonts/Darksad-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: #1a1a1a;
    color: #7f7f7f;
}

#flip-counter-wrapper {
    padding-bottom: 60px;
}

/* The counter sits below the poster, but its joker row is mounted only after
   the roll. Keep the pre-roll page compact while poster/graffiti assets load. */
#flip-counter-wrapper.poster-pile-active {
    padding-bottom: 0;
}

#flip-counter,
.flip-counter {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 4px;
}

.joker-image-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    column-gap: 4px;
    row-gap: 4px;
    min-height: 64px;
    width: 50%;
    margin: 0 auto 10px;
}

/* Once the roll resolves into the Joker array, pack its rows tightly while
   retaining enough horizontal separation to keep individual cards readable. */
#flip-counter-wrapper:not(.poster-pile-active) .joker-image-row {
    row-gap: 0;
}

.joker-image-row .joker-card {
    position: relative;
    aspect-ratio: 1;
    min-width: 0;
}

.joker-image-row .joker-card-visual {
    position: absolute;
    inset: 0;
    overflow: hidden;
    transform: rotate(var(--rotation, 0deg));
    opacity: 0;
    animation: jokerFadeIn 0.5s ease forwards;
    will-change: transform;
}

.joker-image-row .joker-card-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 20%, rgba(255, 0, 0, var(--red-opacity, 0)));
    pointer-events: none;
    z-index: 1;
}

.joker-image-row img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@keyframes jokerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


.fc-device {
    padding: 12px 16px;
}

.fc-screen {
    display: flex;
    gap: 4px;
    font-family: 'Anton', 'Bangers', monospace;
}

.fc-digit {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 56px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.fc-digit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.4);
}

.tick-flip {
    font-family: 'Oswald', sans-serif !important;
}

@media (max-width: 768px) {
    .fc-digit {
        width: 30px;
        height: 42px;
        font-size: 28px;
    }

    .fc-device {
        padding: 8px 12px;
    }
}

.sunday-title {
    font-size: 40px;
}

.sunday-div {
    display: none;
}

h1 {
    user-select: none;
    /* Prevent text selection */
    cursor: default;
    /* Set the cursor to the default (normal) */
}

#snow {
    /* display: none; */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 400;
}

.container {
    display: none;
    flex-direction: column;
    /* justify-content: center; */
    align-items: center;
    min-height: 100vh;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
    color: #7f7f7f;
    transition: all 1s ease-in-out;
}

.emoji {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
        "Android Emoji", "EmojiSymbols", sans-serif;
}

.videoContainer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
}

#video-frame {
    z-index: 500;
    --video-surface-background: var(--poster-color);
    --plyr-video-background: var(--video-surface-background);
    /* The loaded source supplies these variables.  The width cap keeps a
       portrait reward clip from consuming the entire viewport. */
    width: min(70vw, var(--video-frame-max-width, 70vw));
    aspect-ratio: var(--video-aspect-ratio, 16 / 9);
    margin-bottom: 35px;
}

#video-frame.video-has-played {
    --video-surface-background: #000;
}

#video-frame .plyr,
#video-frame .plyr__video-wrapper,
#video-frame #videoPlayer {
    width: 100%;
    height: 100%;
}

/* Plyr normally assumes a 16:9 wrapper. The frame above is the source of
   truth so each loaded clip can retain its native shape. */
#video-frame .plyr__video-wrapper {
    aspect-ratio: inherit;
    padding-bottom: 0;
    background-color: var(--video-surface-background);
}

/* Clean Plyr skin: no lower control gradient. */
#video-frame .plyr {
    --plyr-video-controls-background: transparent;
}

h1 {
    margin: 20px 0;
    align-self: center;
    font-weight: 100;
    font-size: 16px;
}

#videoPlayer {
    display: block;
    max-width: 100%;

    background-color: var(--video-surface-background);
    /* Preserve the whole frame for portrait reward clips. Standard 16:9
       chunks still fill the player, while vertical sources pillarbox. */
    object-fit: contain;
    /* clip-path: inset(0% 0% 0% 0% round 7px); */
    /* border-radius: 7px; */
    /* box-shadow : 8px 8px 20px rgba( 0, 0, 0, 0.8 ); */
}

.date-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

#dateInput {
    padding: 10px;
    font-size: 16px;
    margin-top: 5px;
}

#dayCount {
    font-size: 16px;
    margin-top: 1px;
}

.timer-container {
    display: none;
    text-align: center;
    padding: 20px;
}

#countdown-timer {
    font-size: 48px;
    margin-top: 20px;
}

#chunkSelector {
    color: transparent;
    background-color: #1a1a1a;
    width: 60px;
    padding: 5px;
    cursor: pointer;
    font-size: 12px;
    border: none;
    text-align: right;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-color: transparent;
    /* background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiI+PHN3aXRjaD48Zz48cGF0aCBmaWxsPSIjOUM5QjlCIiBkPSJNNi4zMDcgMTAuNjY1bC01LjItNi4wODggMS4wOTYtLjkzNSA0LjA1NyA0Ljc1IDMuNzkxLTQuODMzIDEuMTM1Ljg4OHoiLz48L2c+PC9zd2l0Y2g+PC9zdmc+"); */
    background-repeat: no-repeat;
    background-position: 99% 0.5em;
    z-index: 2;
}

.selectContainer {
    display: flex;
    margin: 20px 0;
    position: relative;
    justify-content: center;
    align-items: flex-start;
    word-spacing: -3.4px;
    flex-shrink: 0;
}

.numberDisplay {
    margin-right: -57px;
    font-size: 16px;
    margin-top: 1px;
    text-align: right;
    z-index: 1;
}

option {
    background-color: #1a1a1a;
    color: #7f7f7f;
    text-align: left;
    font-size: 16px;
}

#d20RollerVideo {
    display: none;
    z-index: 2147483647;
    position: fixed;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 100%;
    width: 60vw;
    height: auto;
    object-fit: cover;
    pointer-events: none;
    transition: opacity 2s ease;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

.display-none {
    display: none;
}

.unhidden {
    opacity: 1;
    pointer-events: auto;
}

.poster-section {
    position: relative;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: visible;
    width: 100%;
    z-index: 200;
}

.poster-container {
    position: relative;
}

.poster-image {
    max-height: 80vh;
    max-width: 40vw;
    margin: 3vw;
    object-fit: contain;
    position: relative;
}

#joker-tilt-control {
    flex: 0 0 44px;
    opacity: 1;
    transition: opacity 400ms ease, background 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

#joker-tilt-control .tilt-phone-icon {
    width: 25px;
    height: 25px;
    overflow: visible;
}

#joker-tilt-control .tilt-phone-body {
    transform: rotate(-12deg);
    transform-origin: 12px 12px;
}

#joker-tilt-control .tilt-motion-mark {
    opacity: 0.68;
}

#joker-tilt-control[hidden] {
    display: none !important;
}

#joker-tilt-control[data-state="active"] {
    color: rgb(154, 255, 197);
    background: rgba(93, 255, 164, 0.12);
    box-shadow: inset 0 0 0 1px rgba(93, 255, 164, 0.42);
}

#joker-tilt-control[data-state="waiting"] .tilt-phone-body {
    animation: tilt-phone-listen 700ms ease-in-out 2;
}

#joker-tilt-control[data-state="blocked"],
#joker-tilt-control[data-state="unavailable"] {
    color: rgb(255, 164, 164);
    background: rgba(255, 110, 110, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 110, 110, 0.36);
}

#joker-tilt-control:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

#joker-tilt-control.tilt-control--fading {
    pointer-events: none;
    opacity: 0;
}

@keyframes tilt-phone-listen {
    0%, 100% { transform: rotate(-12deg); }
    50% { transform: rotate(12deg); }
}

@media screen and (min-width: 769px), (prefers-reduced-motion: reduce) {
    #joker-tilt-control {
        display: none !important;
    }
}

.winner {
    transition: all 1s ease-in-out;
    z-index: 999;
}

.fade-out-fast {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.fade-out-slow {
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

#roll-button {
    /* background: url(images/die-eye.gif); */
    position: relative;
    background-size: contain;
    width: 6vw;
    height: 6vw;
    font-size: 0.9vw;
    font-weight: 900;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s ease;
}

#roll-button video {
    position: absolute;
    height: 100%;
    width: 100%;
    object-fit: contain;
    inset: 0;
    z-index: 0;
    visibility: hidden;
}

#roll-button video#deye-idle {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

#roll-button video#deye-hover {
    opacity: 0;
    z-index: 2;
    pointer-events: none;
}

#roll-button video#deye-hover-reverse {
    opacity: 0;
    z-index: 2;
    pointer-events: none;
}

#dice-and-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#roll-text {
    font-size: 3vw;
    font-weight: 900;
    text-align: center;
    margin-top: 4px;
    font-family: 'Gothic-Dice', 'Anton', 'Bangers', monospace;
}

#deye {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#flip-button {
    background: url(images/coin.png);
    background-size: contain;
    width: 4vw;
    height: 4vw;
    font-size: 0.9vw;
    font-weight: 900;
    text-align: center;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: default;
}

.rolled {
    transform-origin: center;
    transition: all 1s ease-in-out;
    transform: translate(0, -20px);
    opacity: 0;
}

.flipped {
    transform-origin: center;
    transition: all 1s ease-in-out;
    transform: translate(0, -20px);
    opacity: 0;
}

#todays-poster-container {
    width: 70vw;
    position: relative;
    overflow: hidden;
}

#todays-poster {
    /* border-radius: 12px; */
    width: 100%;
    height: auto;
    object-fit: contain;
}

#top-bar {
    width: 70vw;
    display: flex;
    justify-content: center;
}

.info-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
}

.ep-title {
    flex: 1;
    min-width: 0;
    margin-right: 12px;
    text-align: left;
    align-self: flex-start;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #444;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 16px;
    background: #333;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
    border: 1px solid #444;
    border-bottom: none;
}

.tab.active {
    background: #0078ff;
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 70px);
    gap: 2px;
}

.grid button {
    width: 70px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: #555;
    color: white;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.grid button:hover {
    background: #777;
}

#soundboard {
    font-family: Arial, sans-serif;
    width: 100vw;
    background: #1e1e1e;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* padding: 20px; */
}

@media screen and (max-width: 768px) {
    #d20RollerVideo {
        width: 150vw;
        left: 50%;
        transform: translateX(-50%);
        max-width: 300vw;
        height: auto;
        overflow: hidden;
    }

    #roll-button {
        width: 4vh;
        height: 4vh;
        font-size: 2vw;
    }

    #flip-button {
        width: 4vh;
        height: 4vh;
        font-size: 2vw;
    }
}

#sonic {
    display: none;
    position: absolute;
    left: 100%;
    transition: left ease-in-out 3s;
    z-index: 900;
}

/* ==================== */
/* Rensday Styles */
/* ==================== */

#thingee {
    display: none;
    position: fixed;
    left: 100%;
    bottom: 50%;
    z-index: 910;
}

#thingee.animate {
    animation: slide 8s linear forwards;
}

#thingee-text {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px #ff6b6b, 0 0 40px #ff6b6b, 0 0 60px #ff6b6b;
    z-index: 920;
    text-align: center;
    letter-spacing: 0.2em;
    animation: thingeePulse 0.5s ease-in-out infinite alternate;
}

@keyframes thingeePulse {
    from {
        transform: translate(-50%, -50%) scale(1);
        text-shadow: 0 0 20px #ff6b6b, 0 0 40px #ff6b6b, 0 0 60px #ff6b6b;
    }

    to {
        transform: translate(-50%, -50%) scale(1.05);
        text-shadow: 0 0 30px #ff6b6b, 0 0 50px #ff6b6b, 0 0 70px #ff6b6b;
    }
}

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

#tomorrow-div {
    /* outline: 1px solid red; */
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.animate {
    animation: slide 10s linear forwards;
}

@keyframes slide {
    from {
        left: 100%;
    }

    to {
        left: -130%;
    }
}

/* ==================== */
/* Admin Section Styles */
/* ==================== */

/* Admin Section - Centered at Bottom of Container */
.admin-section {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    position: relative;
    z-index: 2100;
}

.admin-icon-button {
    box-sizing: border-box;
    width: 44px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.3);
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    transition: all 0.3s ease;
}

.admin-icon-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.admin-icon-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.75);
    outline-offset: 3px;
}

.archive-map-link span {
    color: inherit;
    font-family: Arial, sans-serif;
    font-size: 22px;
    filter: grayscale(1);
}

.admin-icon-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.admin-panel {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

@media screen and (max-width: 480px) {
    .admin-panel {
        width: calc(100vw - 16px);
    }

    .admin-panel .stepper-with-action {
        flex-wrap: wrap;
    }
}

.admin-login input {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    box-sizing: border-box;
}

.admin-login button {
    width: 100%;
    padding: 8px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.admin-login button:hover {
    background: #45a049;
}

.admin-error {
    color: #ff4444;
    font-size: 11px;
    display: block;
    min-height: 14px;
}

.admin-level {
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-level h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: normal;
}

/* Admin Action Buttons - Combined Styles */
#punishment-report-btn {
    width: 100%;
    padding: 8px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 4px;
    background: #ff4444;
}

#punishment-report-btn:hover {
    background: #cc0000;
}

/* Pointer Controls */
.admin-pointer-control {
    margin-bottom: 6px;
}

.admin-pointer-control label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 3px;
}

.test-date-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.test-date-controls select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    min-width: 56px;
}

.test-date-controls select option {
    background: #222;
    color: white;
}

.test-date-controls .admin-action-btn {
    padding: 4px 10px;
    font-size: 11px;
}

.stepper {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.stepper button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.stepper button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.stepper-input {
    flex: 1;
    width: 50px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.stepper-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.stepper-with-action {
    display: flex;
    gap: 6px;
    align-items: center;
}

.stepper-with-action .stepper {
    margin-bottom: 0;
}

.stepper-set-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s;
    white-space: nowrap;
}

.stepper-set-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.stepper-set-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

.admin-action-btn {
    width: 100%;
    padding: 8px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 4px;
    background: #555;
}

.admin-action-btn:hover {
    background: #666;
}

.admin-action-btn.danger {
    background: #ff4444;
}

.admin-action-btn.danger:hover {
    background: #cc0000;
}

.admin-color-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.admin-color-swatch {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.admin-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 4px 0;
}

/* Poster Upload Section */
.poster-upload-section .poster-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poster-upload-section .upload-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    min-height: 16px;
}

.poster-upload-section .upload-status.error {
    color: #ff6b6b;
}

.poster-upload-section .upload-status.success {
    color: #4CAF50;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: min(520px, calc(100vw - 40px));
    background: #4CAF50;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 7000;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.toast:not(.hidden) {
    animation: slideIn 0.3s ease;
}

.toast.error {
    background: #ff4444;
}

.toast.info {
    background: #2196F3;
}

.toast-close {
    flex: 0 0 auto;
    min-width: 32px;
    min-height: 32px;
    margin: -7px -17px -7px 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

/* Confirmation Dialog */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.confirm-content {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.confirm-content p {
    font-size: 18px;
    margin-bottom: 20px;
    color: white;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.confirm-btn.yes {
    background: #ff4444;
    color: white;
}

.confirm-btn.yes:hover {
    background: #cc0000;
}

.confirm-btn.no {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.confirm-btn.no:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== */
/* Graffiti Styles */
/* ==================== */

/* Graffiti Button - positioned on poster container */
#graffiti-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#graffiti-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

#graffiti-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Graffiti Overlay - displayed on poster */
.graffiti-overlay {
    position: absolute;
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    color: white;
    pointer-events: none;
    z-index: 50;
    white-space: pre-wrap;
    word-break: break-word;
    width: max-content;
    max-width: 90%;
    text-align: left;
    font-weight: bold;
}

/* Control Panel Overlay - Above poster */
.graffiti-controls-panel {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 90%;
    max-width: 400px;
    margin: 0 auto 15px auto;
    z-index: 100;
    box-sizing: border-box;
}

/* Live graffiti element during editing */
.graffiti-live {
    position: absolute;
    cursor: move;
    user-select: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    transform-origin: 50% 50%;
    white-space: pre-wrap;
    word-break: break-word;
    width: max-content;
    max-width: 90%;
    text-align: left;
    font-weight: bold;
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    touch-action: none;
}

/* Control rows */
.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0;
    gap: 10px;
}

.control-row label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 50px;
}

.control-row input[type="range"],
.control-row input[type="color"],
.control-row select {
    flex: 1;
    height: 30px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex: 0 0 auto;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: #0078ff;
    border-color: #0078ff;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 1px #0078ff;
}

.control-row select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

/* Font preview in dropdown */
.font-preview-select {
    font-family: 'Segoe UI', sans-serif;
}

/* Style for disabled separator option */
.font-preview-select option:disabled {
    font-style: italic;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
}

/* Additional attempt at dropdown font preview - browser dependent */
.font-preview-select option:not([disabled]) {
    font-size: 14px;
}

.font-preview-select option {
    font-family: inherit;
}

/* Basic fonts */
.font-preview-select option[value="sans-serif"] {
    font-family: 'Segoe UI', sans-serif !important;
}

.font-preview-select option[value="serif"] {
    font-family: Georgia, serif !important;
}

.font-preview-select option[value="monospace"] {
    font-family: 'Courier New', monospace !important;
}

.font-preview-select option[value="cursive"] {
    font-family: 'Comic Sans MS', cursive !important;
}

.font-preview-select option[value="fantasy"] {
    font-family: 'Anton', Impact, sans-serif !important;
}

.font-preview-select option[value="system-ui"] {
    font-family: system-ui !important;
}

.font-preview-select option[value="rounded"] {
    font-family: sans-serif !important;
    font-weight: 500;
}

.font-preview-select option[value="typewriter"] {
    font-family: 'Courier New', monospace !important;
}

/* Graffiti fonts */
.font-preview-select option[value="graffiti-marker"] {
    font-family: 'Permanent Marker', cursive !important;
}

.font-preview-select option[value="graffiti-messy"] {
    font-family: 'Rock Salt', cursive !important;
}

.font-preview-select option[value="graffiti-bubble"] {
    font-family: 'Knewave', display !important;
}

.font-preview-select option[value="graffiti-outline"] {
    font-family: 'Monoton', cursive !important;
}

.font-preview-select option[value="graffiti-spray"] {
    font-family: 'Rubik Marker Hatch', cursive !important;
}

.font-preview-select option[value="graffiti-comic"] {
    font-family: 'Bangers', cursive !important;
}

.font-preview-select option[value="graffiti-fast"] {
    font-family: 'Faster One', cursive !important;
}

/* ==================== */
/* CUSTOM FONT DROPDOWN  */
/* ==================== */

.custom-font-dropdown {
    position: relative;
    flex: 1;
}

.custom-font-dropdown-trigger {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    padding: 0 25px 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    position: relative;
    user-select: none;
    box-sizing: border-box;
}

.custom-font-dropdown-trigger::after {
    content: '▼';
    position: absolute;
    right: 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.custom-font-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.custom-font-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-top: 4px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
}

.custom-font-dropdown-menu.open {
    display: block;
}

.font-dropdown-separator {
    padding: 8px 10px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    user-select: none;
}

.font-dropdown-option {
    padding: 10px 8px;
    cursor: pointer;
    color: white;
    transition: background 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.font-dropdown-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.font-dropdown-option.selected {
    background: rgba(0, 150, 255, 0.3);
}

/* Scrollbar styling for dropdown menu */
.custom-font-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.custom-font-dropdown-menu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.custom-font-dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.custom-font-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.control-row input[type="color"] {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/* Color Picker Wrapper and Trigger */
.color-picker-wrapper {
    flex: 1;
    display: flex;
}

.pickr-trigger {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pickr-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-icon {
    font-size: 16px;
    line-height: 1;
}

/* Pickr Button (generated by Pickr) */
.pickr-trigger .pcr-button {
    width: 100% !important;
    height: 100% !important;
    border-radius: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Keep Pickr above the editor/admin UI while preserving its own positioning. */
.pcr-app {
    z-index: 2000;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
}

/* Textarea */
#graffiti-text {
    width: 100%;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    padding: 8px;
    resize: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
    text-align: left !important;
    text-align-last: left;
    word-spacing: normal;
    letter-spacing: normal;
}

/* Graffiti hint text */
.graffiti-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin: 5px 0 8px 0;
    font-style: italic;
}

#graffiti-text:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

#graffiti-text::placeholder {
    color: rgba(255, 255, 255, 0.5);
    text-align: left !important;
}

#graffiti-text::-webkit-input-placeholder {
    text-align: left;
}

#graffiti-text::-moz-placeholder {
    text-align: left;
}

#graffiti-text:-ms-input-placeholder {
    text-align: left;
}

/* Buttons */
.control-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.control-buttons button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#graffiti-cancel {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

#graffiti-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
}

#graffiti-submit {
    background: #4CAF50;
    color: white;
}

#graffiti-submit:hover {
    background: #45a049;
}

#graffiti-submit:disabled {
    background: #666;
    cursor: not-allowed;
}

/* ==================== */
/* MODE SELECTOR        */
/* ==================== */

.graffiti-mode-selector {
    text-align: center;
}

.graffiti-mode-title {
    font-size: 1.2vw;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    font-family: Arial, sans-serif;
}

.graffiti-mode-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 12px;
}

.graffiti-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.graffiti-mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.mode-icon {
    font-size: 24px;
    line-height: 1;
}

.mode-label {
    font-size: 12px;
    font-weight: 600;
}

.graffiti-cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.graffiti-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==================== */
/* DRAWING TOOLBAR      */
/* ==================== */

.drawing-toolbar {
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    position: relative;
    z-index: 95;
}

.drawing-toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.draw-tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.draw-tool-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.draw-tool-btn.active {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.7);
}

.draw-done-btn {
    background: #4CAF50;
    border-color: #4CAF50;
}

.draw-done-btn:hover {
    background: #45a049;
}

.draw-color-picker {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.draw-color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.draw-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.draw-color-picker--custom {
    background: var(--draw-color, #ffffff);
    padding: 2px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
    flex: 0 0 auto;
}

.draw-color-picker--custom:hover,
.draw-color-picker--custom:focus-visible {
    border-color: rgba(255, 255, 255, 0.8);
    outline: none;
}

.drawing-canvas-container.poster-eyedropper-active {
    pointer-events: none;
}

.poster-eyedropper-target {
    cursor: crosshair;
}

.poster-eyedropper-loupe {
    --poster-eyedropper-color: #ffffff;
    position: fixed;
    width: 88px;
    height: 88px;
    z-index: 10000;
    overflow: hidden;
    border-radius: 50%;
    background: #101010;
    box-shadow:
        inset 0 0 0 3px var(--poster-eyedropper-color),
        0 0 0 1px rgba(255, 255, 255, 0.95),
        0 0 0 2px rgba(0, 0, 0, 0.9),
        0 7px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    contain: strict;
    transition: opacity 60ms ease-out;
}

.poster-eyedropper-loupe.visible {
    opacity: 1;
    visibility: visible;
}

.poster-eyedropper-loupe-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .poster-eyedropper-loupe {
        transition: none;
    }
}

.draw-size-slider {
    width: 80px;
    accent-color: white;
    cursor: pointer;
}

/* Drawing tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 11px;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Drawing overlay image on poster */
.graffiti-drawing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* ==================== */
/* MOBILE RESPONSIVE     */
/* ==================== */

@media (max-width: 768px) {
    .graffiti-controls-panel {
        width: 95%;
        max-width: none;
        padding: 12px;
        margin-bottom: 10px;
    }

    .control-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .control-row label {
        font-size: 11px;
        min-width: 45px;
        flex-basis: 45px;
    }

    .control-row input[type="range"],
    .control-row input[type="color"],
    .custom-font-dropdown,
    .color-picker-wrapper {
        flex: 1;
        min-width: 0;
    }

    #graffiti-text {
        height: 45px;
        font-size: 14px;
    }

    .graffiti-hint {
        font-size: 10px;
        margin: 4px 0 6px 0;
    }

    .color-icon {
        font-size: 14px;
    }

    .custom-font-dropdown-menu {
        max-height: 250px;
    }

    .font-dropdown-option {
        padding: 8px 6px;
        font-size: 13px;
    }

    .control-buttons button {
        font-size: 13px;
        padding: 8px;
    }

    .graffiti-mode-title {
        font-size: 14px;
    }

    .graffiti-mode-btn {
        padding: 10px 16px;
    }

    .mode-icon {
        font-size: 20px;
    }

    .mode-label {
        font-size: 11px;
    }

    .drawing-toolbar {
        margin-bottom: 6px;
        padding: 6px 10px;
    }

    .draw-tool-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .draw-size-slider {
        width: 60px;
    }
}

@media (max-width: 480px) {
    .graffiti-controls-panel {
        padding: 10px;
        margin-bottom: 8px;
    }

    .control-row label {
        font-size: 10px;
        min-width: 40px;
        flex-basis: 40px;
    }

    .control-row input[type="range"],
    .control-row input[type="color"],
    .custom-font-dropdown,
    .color-picker-wrapper {
        height: 28px;
    }

    .color-picker-wrapper {
        flex: 1;
    }

    .pickr-trigger {
        height: 28px;
    }

    #graffiti-text {
        height: 40px;
        font-size: 13px;
    }

    .graffiti-hint {
        font-size: 9px;
        margin: 3px 0 5px 0;
    }

    .color-icon {
        font-size: 13px;
    }

    .custom-font-dropdown-trigger {
        font-size: 13px;
    }

    .drawing-toolbar {
        margin-bottom: 5px;
        padding: 5px 8px;
    }

    .draw-tool-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .draw-color-picker {
        width: 28px;
        height: 28px;
    }

    .draw-size-slider {
        width: 50px;
    }

    .graffiti-mode-btn {
        padding: 8px 14px;
    }

    .mode-icon {
        font-size: 18px;
    }
}

.joker-physics-viewport {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1000;
}

.joker-physics-layer {
    position: absolute;
    overflow: visible;
    pointer-events: none;
}

.joker-physics-card {
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    overflow: hidden;
    border: 0;
    border-radius: 3px;
    background: transparent;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.55);
    will-change: transform;
}

.joker-physics-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 45%, rgba(154, 0, 0, 0.22));
}

.joker-physics-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

#flip-counter-wrapper.poster-pile-active .joker-image-row {
    display: none;
}
