:root {
    --pokedex-red: #DC0A2D;
    --pokedex-dark-red: #8B0000;
    /* For shadows/borders */
    --screen-bg: #98CB98;
    /* Gameboy-ish green */
    --screen-border-grey: #DEDEDE;
    --panel-border: #520610;
    --light-blue: #3B4CCA;
    --nav-color: #222;
    --glass-blue: #00BFFF;
}

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

body {
    background-color: #333;
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.pokedex-container {
    perspective: 1000px;
}

.pokedex {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    /* Align bottom to handle different heights if any */
}

/* PANELS */
.panel {
    background-color: var(--pokedex-red);
    border: 3px solid var(--panel-border);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 5px 5px 15px rgba(255, 255, 255, 0.2),
        inset -5px -5px 15px rgba(0, 0, 0, 0.2);
}

.left-panel {
    width: 350px;
    height: 500px;
    z-index: 2;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    position: relative;
}

.left-panel::after {
    /* The curve at the top right of left panel */
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 160px;
    height: 80px;
    background-color: var(--pokedex-red);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 30% 100%, 0 45%);
    /* This is a simplification, doing complex curves in CSS is tricky without SVG or careful border radius */
    /* Let's stick to standard layout first to ensure stability */
    display: none;
    /* Removing advanced shape for now to keep it clean */
}

/* Actually, let's just use border-radius tricks for the shape if possible, or keep it simple rectangular for v1 */

.right-panel {
    width: 320px;
    height: 450px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    position: relative;
    /* The right panel is usually shorter/positioned slightly differently, but let's align them */
    margin-bottom: 0;
    border-left: none;
    /* Hinge covers this */
}

/* TOP Curve simulation for Right Panel */
.right-panel::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    width: 150px;
    height: 40px;
    background-color: transparent;
    /* Complex shape placeholder */
}

/* HEADER LIGHTS (Left Panel) */
.header-lights {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.big-light {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 20px 20px, #29dfff, #00BFFF, #0080ff);
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 0 10px #00BFFF;
    margin-right: 20px;
}

.small-lights {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.light {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.5);
    box-shadow: inset 1px 1px 3px rgba(255, 255, 255, 0.5);
}

.light.red {
    background-color: #CC2222;
}

.light.yellow {
    background-color: #DDCC22;
}

.light.green {
    background-color: #22CC22;
}

/* SCREEN AREA */
.screen-container {
    background-color: var(--screen-border-grey);
    border-radius: 15px 15px 15px 40px;
    /* Slight cut in corner */
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2);
}

.screen-border {
    background-color: #B0B0B0;
    /* Inner bezel */
    padding: 10px;
    border-radius: 10px;
}

.tiny-lights {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
    justify-content: center;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #CC2222;
    border: 1px solid #555;
}

.main-screen {
    background-color: #222;
    /* Off screen */
    width: 100%;
    height: 190px;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid #555;
    position: relative;
    overflow: hidden;
}

.main-screen.on {
    background-color: #87CEFA;
    /* Sky blue active screen */
}

#pokemon-image {
    width: 180px;
    height: 180px;
    object-fit: contain;
    image-rendering: pixelated;
}

#loading-text {
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
}

.screen-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.status-light {
    width: 16px;
    height: 16px;
    background-color: #CC2222;
    border-radius: 50%;
}

.speakers {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.speakers .line {
    width: 30px;
    height: 2px;
    background-color: #555;
}

/* CONTROLS AREA */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.circle-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #333;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.circle-btn.black {
    background-color: #333;
}

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

.long-btn {
    width: 40px;
    height: 8px;
    border-radius: 10px;
    border: 1px solid #333;
    cursor: pointer;
}

.long-btn.red {
    background-color: #CC2222;
}

.long-btn.blue {
    background-color: #3B4CCA;
}

.green-scouter {
    width: 80px;
    height: 50px;
    background-color: #588A58;
    border: 1px solid #333;
    border-radius: 5px;
}

/* D-PAD */
.cross-pad {
    position: relative;
    width: 75px;
    height: 75px;
}

.cross-key {
    position: absolute;
    background-color: #222;
    border: 1px solid #111;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.cross-key:active {
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.8);
    background-color: #111;
}

.cross-key.center {
    width: 25px;
    height: 25px;
    top: 25px;
    left: 25px;
    z-index: 2;
    box-shadow: none;
    /* Smooth center */
}

.cross-key.up {
    width: 25px;
    height: 25px;
    top: 0;
    left: 25px;
    border-radius: 5px 5px 0 0;
}

.cross-key.down {
    width: 25px;
    height: 25px;
    bottom: 0;
    left: 25px;
    border-radius: 0 0 5px 5px;
}

.cross-key.left {
    width: 25px;
    height: 25px;
    top: 25px;
    left: 0;
    border-radius: 5px 0 0 5px;
}

.cross-key.right {
    width: 25px;
    height: 25px;
    top: 25px;
    right: 0;
    border-radius: 0 5px 5px 0;
}


/* HINGE */
.hinge {
    width: 30px;
    height: 480px;
    background: linear-gradient(90deg, #8B0000 0%, #DC0A2D 40%, #DC0A2D 60%, #8B0000 100%);
    border-top: 2px solid var(--panel-border);
    border-bottom: 2px solid var(--panel-border);
    margin: 0 2px;
    position: relative;
    align-self: flex-end;
    /* Align with panels */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
}

.hinge-part {
    width: 100%;
    height: 25px;
    border-top: 2px solid #520610;
    border-bottom: 2px solid #520610;
    opacity: 0.5;
}


/* RIGHT PANEL */
.right-panel {
    display: flex;
    flex-direction: column;
    padding-top: 40px;
    /* Space for the "cutout" vibe */
}

.info-screen-container {
    background-color: #222;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.info-screen {
    background-color: #222;
    color: #4db8ff;
    /* Retro glowing text */
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    line-height: 1.5;
    min-height: 100px;
    word-break: break-all;
}

.blue-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    margin-bottom: 15px;
    background-color: #222;
    /* Framing the buttons? Or just loose? */
    /* Looking at image, it's just keys on red? Actually image has a slight area. Let's precise it */
    /* The image has a blue grid block. */
}

.blue-key {
    width: 100%;
    height: 30px;
    background-color: #639BFF;
    border: 1px solid #335599;
    border-radius: 2px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
    cursor: pointer;

    /* Text Display properties */
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 6px;
    text-shadow: 1px 1px 0 #000;
    padding: 2px;
    text-align: center;
}

.blue-key:active {
    background-color: #4B7ACC;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.option-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.white-btn {
    flex: 1;
    height: 40px;
    background-color: #eee;
    border: 1px solid #aaa;
    border-radius: 5px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    color: #333;
}

.white-btn:active {
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.yellow-light {
    width: 25px;
    height: 25px;
    background-color: #FFD700;
    border-radius: 50%;
    border: 1px solid #B8860B;
    box-shadow: inset 2px 2px 5px rgba(255, 255, 255, 0.5);
}

.bottom-screens {
    display: flex;
    gap: 10px;
}

.mini-screen {
    flex: 1;
    height: 40px;
    background-color: #222;
    border-radius: 5px;
    border: 1px solid #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    color: #4db8ff;
    font-size: 10px;
}

/* Green Scouter Marquee */
/* Green Scouter Marquee */
.green-scouter {
    overflow: hidden;
    position: relative;
    display: flex;
    /* Centers content vertically */
    align-items: center;
    /* Ensure existing dimensions are respected or set */
}

.scrolling-text {
    width: 600%;
    /* Ensure wide enough to not wrap */
    white-space: nowrap;
    /* Crucial for inline block */
    display: inline-block;
    padding-left: 100%;
    animation: marquee 8s linear infinite;
    color: #333;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    line-height: normal;
    font-weight: bold;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* MOBILE RESPONSIVENESS */
@media screen and (max-width: 850px) {
    body {
        align-items: flex-start;
        /* Allow scrolling from top */
        padding-top: 20px;
    }

    .pokedex {
        flex-direction: column;
        align-items: center;
        perspective: none;
        height: auto;
        padding-bottom: 20px;
        transform-origin: top center;
        /* Optional: scale down if screen is really small height-wise */
    }

    .panel {
        width: 90vw;
        max-width: 340px;
        /* Reduced from 400px to fit narrower phones */
        box-shadow: none;
        border: 2px solid var(--panel-border);
        padding: 15px;
        /* Reduced padding */
    }

    .left-panel {
        height: auto;
        border-radius: 15px 15px 0 0;
        border-bottom: none;
        padding-bottom: 20px;
        z-index: 2;
    }

    .left-panel::after {
        display: none;
    }

    .hinge {
        display: none;
    }

    .right-panel {
        height: auto;
        border-radius: 0 0 15px 15px;
        border-top: none;
        margin-top: -2px;
        padding-top: 20px;
        position: relative;
    }

    .right-panel::before {
        content: '';
        position: absolute;
        top: 0;
        left: 5%;
        width: 90%;
        height: 15px;
        background: linear-gradient(180deg, #8b0000, #dc0a2d);
        border-radius: 10px;
        border: 2px solid var(--panel-border);
        transform: translateY(-50%);
        z-index: 3;
    }

    .main-screen {
        height: 170px;
        /* Reduced height */
    }

    #pokemon-image {
        width: 140px;
        /* Reduced slightly to fit new screen height */
        height: 140px;
    }

    .cross-pad {
        margin: 0 auto;
        width: 75px;
        /* Keep resized D-Pad */
        height: 75px;
        margin-bottom: 5px;
    }

    .controls {
        justify-content: space-around;
        padding: 0;
    }

    /* Adjust blue keys to fit better */
    .blue-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
        margin-bottom: 10px;
    }

    .blue-key {
        height: 35px;
        font-size: 7px;
    }

    .white-btn {
        height: 40px;
        font-size: 9px;
    }

    .info-screen-container {
        padding: 10px;
        margin-bottom: 10px;
    }

    .info-screen {
        font-size: 9px;
        min-height: 80px;
    }
}