/* General styling */
@font-face {
    font-family: 'Showboat';
    src: url('font-library/Showboat.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* For tablets */
@media (max-width: 768px) {
    .arcade-cabinet {
      width: 90%;
      height: auto;
    }
    /* Other tablet-specific styles */
  }
  
  /* For mobile phones */
  @media (max-width: 480px) {
    .arcade-cabinet {
      width: 95%;
    }
    /* Other mobile-specific styles */
  }

body {
    background-color: #fef3e0;
    font-family: 'Showboat', sans-serif;
    text-align: center;
    color: #1a1a1a;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-image: radial-gradient(circle, #fff0d8 0%, #ffd59e 100%);
}

/* Arcade cabinet styling */
.arcade-cabinet {
    position: relative;
    width: 560px;
    height: 800px;
    background: linear-gradient(145deg, #8c0e0e 0%, #d62828 50%, #8c0e0e 100%);
    border-radius: 20px 20px 0 0;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.3),
        -15px 0 15px -15px rgba(0, 0, 0, 0.8),
        15px 0 15px -15px rgba(0, 0, 0, 0.8);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.cabinet-top {
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, #ffca3a, #f4a261);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.2);
    border: 8px solid #333;
    border-bottom-width: 12px;
}

.cabinet-top h1 {
    font-size: 3rem;
    color: #d62828;
    text-shadow: 
        2px 2px 0 #fff,
        -2px 2px 0 #fff,
        2px -2px 0 #fff,
        -2px -2px 0 #fff,
        0 0 10px #ffd700;
    margin: 0;
    padding: 0;
}

.screen-container {
    width: 85%;
    height: 320px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    border: 12px solid #333;
    position: relative;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3), 0 5px 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
}

.screen-reflection {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.15), 
        rgba(255, 255, 255, 0.05) 80%, 
        rgba(255, 255, 255, 0));
    pointer-events: none;
    z-index: 10;
}

.screen-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none; /* Hidden by default */
}

/* Controls section */
.control-panel {
    width: 90%;
    height: 240px;
    background: linear-gradient(to bottom, #333, #222);
    border-radius: 10px 10px 0 0;
    margin-top: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.8);
    position: relative;
}

/* Coin mechanism */
.coin-mechanism {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.coin {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffd700, #ffaa00);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #854d0e;
    user-select: none;
    border: 4px solid #f0b000;
    margin-right: 20px;
    position: relative;
    z-index: 5;
}

.coin:hover {
    transform: rotate(10deg);
}

.coin.inserted {
    animation: insertCoin 1s forwards;
}

@keyframes insertCoin {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
    100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
}

.coin:before {
    content: "$";
    font-size: 40px;
    position: absolute;
}

.coin-slot {
    width: 100px;
    height: 15px;
    background: #111;
    border-radius: 5px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 5px rgba(255, 255, 255, 0.2);
    margin-right: 20px;
    position: relative;
}

.coin-slot:after {
    content: "INSERT COIN";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffaa00;
    font-size: 14px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.coin-counter {
    width: 60px;
    height: 30px;
    background: #000;
    border-radius: 5px;
    color: #ff0000;
    font-family: monospace;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 5px rgba(255, 0, 0, 0.5);
}

/* Button controls */
.button-controls {
    display: flex;
    justify-content: space-around;
    width: 100%;
}

.kaleidoscope-button {
    position: relative;
    width: 150px;
    height: 150px;
    border: none;
    padding: 0;
    border-radius: 100%;
    cursor: pointer;
    overflow: hidden;
    background: transparent;
    outline: none;
    transition: transform 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    opacity: 0.5;
    pointer-events: none;
}

.kaleidoscope-button.active {
    opacity: 1;
    pointer-events: all;
    animation: pulsate 2s infinite;
}

@keyframes pulsate {
    0% { transform: scale(1); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 15px 25px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.5); }
    100% { transform: scale(1); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); }
}

.kaleidoscope-button:hover.active {
    transform: scale(1.1);
}

.kaleidoscope-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 100%;
    background-image: radial-gradient(
        farthest-corner circle at left bottom,
        hsl(145, 54%, 50%),
        hsl(243, 100%, 24%)
    );
}

canvas {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100%;
    box-shadow: inset 0.5vh 4.5vh 2.5vh hsla(280, 90%, 8%, 0.4);
    position: absolute;
    transform: scale(1) rotate(0deg);
    animation: turn 38s cubic-bezier(1, -0.07, 0.06, 1.37) infinite;
}

.play-text {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffaa00;
    font-size: 20px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    white-space: nowrap;
}

#arcade-btn {
    padding: 15px 30px;
    background-color: #3a0ca3;
    color: #fff;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 5px 0 #240046, 0 10px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    position: relative;
}

#arcade-btn:hover {
    background-color: #4361ee;
    transform: translateY(2px);
    box-shadow: 0 3px 0 #240046, 0 8px 10px rgba(0, 0, 0, 0.3);
}

#arcade-btn:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #240046, 0 5px 5px rgba(0, 0, 0, 0.3);
}

/* AI chat bubble */
#ai-chat-bubble {
    position: absolute;
    background-color: #fff;
    color: #d62828;
    padding: 20px;
    border-radius: 20px;
    font-size: 1.5rem;
    text-align: center;
    max-width: 80%;
    top: 20px;
    left: 8%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: none;
    animation: bubbleIn 0.5s ease-out forwards;
}

@keyframes bubbleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#ai-chat-bubble:after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 10%;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: #fff;
    border-bottom: 0;
}

/* Footer */
footer {
    background-color: #eaaf0c;
    color: #ee076b;
    font-family: 'Showboat', sans-serif;
    font-size: 1rem;
    text-shadow: 0 0 13px #edece7;
    padding: 5px 0;
    text-align: center;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

/* Animation for RGB elements in kaleidoscope */
#r, #g, #b {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10vmin;
    height: 10vmin;
    transform: translate(-50%, -50%);
}

#r {
    animation: red 10s cubic-bezier(0.04, -10.67, 1, -2.97) infinite;
    border-radius: 100%;
    background-image: radial-gradient(
        50% 50%,
        circle contain,
        rgba(0, 0, 0, 0.65),
        hsla(302, 69%, 58%, 0.3) 100%
    );
}

#b {
    animation: blue 11s ease-in-out infinite;
    border-radius: 100%;
    background-image: radial-gradient(
        50% 50%,
        circle contain,
        hsla(226, 52%, 29%, 0.85),
        hsla(202, 75%, 72%, 0.3) 100%
    );
}

#g {
    border-radius: 100%;
    animation: green 12s linear infinite;
    background-image: radial-gradient(
        50% 50%,
        circle contain,
        hsla(95, 91%, 45%, 0.87),
        hsla(63, 90%, 46%, 0.3) 100%
    );
}

@keyframes red {
    0% {
        transform: rotate(0deg) rotate(0deg) scale(1, 1);
    }
    50% {
        transform: rotate(-180deg) rotate(-180deg) scale(2, 2);
    }
    100% {
        transform: rotate(-360deg) rotate(-360deg) scale(1, 1);
    }
}

@keyframes green {
    0% {
        transform: rotate(0deg) rotate(0deg) scale(1, 3);
        opacity: 1;
    }
    66% {
        transform: rotate(180deg) rotate(-180deg) scale(3, 1);
        opacity: 0.33;
    }
    100% {
        transform: rotate(360deg) rotate(-360deg) scale(1, 3);
        opacity: 1;
    }
}

@keyframes blue {
    0% {
        transform: rotate(0deg) rotate(0deg) scale(1, 1);
    }
    33% {
        transform: rotate(180deg) rotate(-180deg) scale(3, 3);
    }
    100% {
        transform: rotate(360deg) rotate(-360deg) scale(1, 1);
    }
}

@keyframes turn {
    0%, 100% {
        transform: scale(0.7) translate(0%) rotate(95deg);
        mix-blend-mode: normal;
    }
    25% {
        transform: scale(0.5);
        box-shadow: inset 5.5vh 2.5vh 4.5vh hsla(20, 90%, 18%, 0.5);
        mix-blend-mode: xor;
    }
    40%, 50% {
        filter: invert(1);
    }
    60%, 80% {
        transform: scale(0.7) translate(0%) rotate(95deg);
        mix-blend-mode: hard-light;
    }
}

#bg {
    width: 10vmin;
    height: 10vmin;
    position: absolute;
    border-radius: 100%;
    z-index: 4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-image: url(images/treats.png);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: inset 0vh 0.5vh 0.5vh hsla(180, 90%, 15%, 0.7);
    animation: bg 20s infinite ease-in-out;
    mix-blend-mode: xor;
}

@keyframes bg {
    0% {
        background-size: 100%;
    }
    20% {
        background-size: cover;
        background-position: center top;
        transform: rotate(180deg) translate(50%, 50%);
    }
    40%,
    44% {
        background-size: cover;
        background-position: center;
        background-position: center bottom;
    }
    60% {
        background-size: 80%;
    }
    100% {
        background-size: 100%;
    }
}