/* theme-globe style.css */
/* /theme-globe/style.css */

/* 1. global styles */
*, *::before, *::after {
    box-sizing: border-box; 
}

#controls, #controls * {
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: #1a1a1a;
    color: rgb(212, 196, 183);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch; 
    height: 100vh;
    height: 100dvh; 
    overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* --- sidebar & menu button --- */
#menu-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 2000; 
    background: #3b0202;
    border: 2px solid #d6d6d6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#menu-toggle:hover {
    background: #680404; 
    border: 3px solid #c7c7c7;
    color: #c7c7c7;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
}

#menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #d6d6d6;
}

.zoomButton0 {
    position: fixed;
    top:80px;
    right: 15px;
    z-index: 2000; 
    background: #909090d3;
    border: 2px solid #000000;
    border-radius: 1px;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    cursor: pointer;

    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.zoomButton1 {
    position: fixed;
    top:116px;
    right: 15px;
    z-index: 2000; 
    background: #909090d3;
    border: 2px solid #000000;
    border-radius: 1px;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    cursor: pointer;

    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.zoomButton2 {
    position: fixed;
    top:156px;
    right: 15px;
    z-index: 2000; 
    background: #909090d3;
    border: 0px solid #000000;
    border-radius: 0px;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    cursor: pointer;

    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.zoomButton0:hover { 
    background: #787878e6; 
    border: 3px solid #000000;
}

.zoomButton1:hover { 
    background: #787878e6; 
    border: 3px solid #000000;
}

.zoomButton2:hover { 
    background: #787878e6; 
    border: 1px solid #000000;
}

.saveButton {
    position: fixed;
    top:196px;
    right: 15px;
    z-index: 2000; 
    background: #909090d3;
    border: 2px solid #000000;
    border-radius: 1px;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    cursor: pointer;

    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.saveButton:hover { 
    background: #787878e6; 
    border: 3px solid #000000;
}

#sidebar {
    position: fixed;
    top: 0;
    right: -300px; 
    width: 180px;
    height: 50%;
    background: #f4f4f4;
    border-left: 3px solid #000000;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    z-index: 2001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#sidebar.open {
    right: 0;
}

.sidebar-header {
    background: #e8e8e8;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 0.8rem;
    color: #000000;
}

#close-sidebar {
    background: transparent;
    border: none;
    color: #000000;
    font-size: 1rem;
    cursor: pointer;
}

.sidebar-content {
    padding: 12px;
    overflow-y: auto;
}

.menu-item {
    display: block;
    width: 100%;
    background: #fcfcfc;
    color: #000000;
    border: 2px solid #cccccc;
    padding: 8px;
    margin-bottom: 8px;
    text-align: left;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600; 
}

.menu-item:hover { 
    background: #e0e0e0; 
    color: #000000; 
    border: 3px solid #cccccc;
}

#open-themes {
    position: relative;
    padding-right: 34px;
}

#open-themes svg {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.ig-link {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #000000; 
    text-decoration: none;
    font-size: 0.75rem;
    margin-top: 20px;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.ig-link svg {
    height: 1.1em; 
    width: 1.1em;
    fill: currentColor; 
    display: block;
    flex-shrink: 0;
    padding-right: 1px;
    box-sizing: content-box;
}

.ig-link:hover {
    opacity: 0.5;
}

.yt-link {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #000000; 
    text-decoration: none;
    font-size: 0.75rem;
    margin-top: 12px; 
    transition: opacity 0.2s ease;
    line-height: 1;
}

.yt-link svg {
    height: 1.1em;
    width: 1.1em;
    fill: currentColor; 
    display: block;
    flex-shrink: 0;
    padding-right: 1px;
    box-sizing: content-box;
}

.yt-link:hover {
    opacity: 0.5;
}

/* --- modals (hovered windows) --- */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-window {
    background: #f9f9f9;
    border: 5px solid #b4b4b4;
    padding: 20px;
    max-width: 300px;
    width: 90%;
    position: relative; /* important for the (x) position */
    color: #000000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.modal-window h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #000000;
    text-transform: none;
}

/* This covers all (x) buttons in all modals */
.close-modal, 
#close-concept, 
#close-themes, 
#close-howtoplay, 
#close-projects, 
#close-about {
    position: absolute;
    top: 10px; 
    right: 10px;
    background: transparent; 
    border: none;
    color: #000000; 
    font-size: 1.5rem; 
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
#close-concept:hover,
#close-themes:hover {
    opacity: 0.5;
}

.modal-body {
    line-height: 1.2; /* space between lines */
    font-size: 0.8rem;
}

.modal-body p {
    margin: 0 0 10px 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}



#control-toggle {
    position: fixed;
    top: 135px;
    left: 3px;
    z-index: 2000; 
    background: #909090b2;
    border: 2px solid #000000;
    border-radius: 4px;
    width: 40px;
    height: 36px;
    min-width: 40px;
    min-height: 36px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#control-toggle:hover {
    background: #d0d0d0; 
    border: 3px solid #000000;
    top: 134px;
    left: 3px;
    width: 48px;
    height: 40px;
}

#control-toggle svg {
    transform: scale(1.4);
    width: 20px; 
    height: 20px; 
    flex-shrink: 0; 
}


#controlBar {
    position: fixed;
    top: 15px;
    left: -300px;
    width: 170px;
    height: auto;
    max-height: 80vh; 
    background: #6c6c6c;

    border: 3px solid #000000;
    border-radius: 2px;
    z-index: 6001;
    transition: show 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#controlBar.open {
    left: 15px;
}

#controlBar .sidebar-header {
    background: #6c6c6c;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#controlBar .sidebar-header h3 {
    margin: 0;
    font-size: 0.8rem;
    color: #000000;
}

#close-controlBar {
    background: transparent;
    border: none;
    color: #000000;
    font-size: 1rem;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.controlBar-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

/* Control groups inside the settings panel */
.control-group {
    margin-bottom: 12px;
}

.control-label {
    display: block;
    font-size: 0.65rem;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    font-weight: 600;
}

.control-select {
    display: block;
    width: 100%;
    background: #a9a9a9;
    color: #000000;
    border: 2px solid #212121;
    padding: 6px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
    appearance: auto;
}

.control-select:hover {
    background: #e0e0e0;
    border-color: #d7d7d7;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.control-input {
    background: #b2b2b2;
    color: #000000;
    border: 2px solid #000000;
    padding: 6px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    width: 60px;
    border-radius: 0;
    flex-shrink: 0;
}

.control-input--full {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.control-x {
    color: #000000;
    font-size: 0.8rem;
    flex-shrink: 0;
}



.onoffswitch {
    position: relative; width: 75px;
    /* -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; */
}
.onoffswitch-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.onoffswitch-label {
    display: block; overflow: hidden; cursor: pointer;
    border: 2px solid #000000; border-radius: 24px;
}
.onoffswitch-inner {
    display: block; width: 200%; margin-left: -100%;
    transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
    display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
    font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
    box-sizing: border-box;
}
.onoffswitch-inner:before {
    content: "ON";
    padding-left: 10px;
    background-color: #AD000C; color: #FFFFFF;
}
.onoffswitch-inner:after {
    content: "OFF";
    padding-right: 10px;
    background-color: #636363; color: #D6D6D6;
    text-align: right;
}
.onoffswitch-switch {
    display: block; 
    width: 17px; 
    height: 17px; 
    background: #FFFFFF;
    position: absolute; 
    top: 65%; 
    transform: translateY(-50%);
    right: 50px;
    border: 2px solid #000000; 
    border-radius: 50%;
    transition: all 0.3s ease-in 0s; 
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 9px; 
}



#betty-image {
    position: fixed;
    bottom: 15px;   /* Distance from the bottom */
    right: 15px;    /* Distance from the right, matches your menu button */
    z-index: 8500;  /* Above disco-dim (7000) but below beams (10000) */
    width: 300px;   /* You can adjust the width as needed */
    height: 360px;
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none; /* Optional: allows clicking "through" the image if it overlaps game elements */
}

/* Disco "lights out" dim — covers all UI, spares canvas + betty + beams */
#disco-dim {
    position: fixed;
    inset: 0;
    background: rgba(28, 20, 31, 0.649);
    z-index: 7000;
    pointer-events: none;
    display: none;
    opacity: 0;
    transition: opacity 0.55s ease;
}





#theme-toggle {
    position: fixed;
    top: 80px;
    left: 2px;
    z-index: 2000; 
    background: #909090b2;
    border: 2px solid #000000;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#theme-toggle:hover {
    background: #d0d0d0; 
    border: 3px solid #000000;
    color: #fff;
    top: 79px;
    left: 2px;
    width: 48px;
    height: 44px;
}

#theme-toggle svg {
    transform: scale(1.3);
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.theme-header {
    background: #bfbfbf;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; 
}

.theme-header h3 {
    margin: 0;
    font-size: 0.8rem;
    color: #000000;
}

#themeSelectPanel {
    position: fixed;
    top: 15px;
    left: -300px;
    width: 220px;
    height: auto;
    max-height: 80vh;
    background: #bfbfbf;

    border: 3px solid #ffffff; 
    border-radius: 2px;

    z-index: 6001;
    transition: show 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

#themeSelectPanel.open {
    left: 15px;
}

#close-themeSelectPanel {
    background: transparent;
    border: none;
    color: #000000;
    font-size: 1rem;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.theme-tile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
}

.theme-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    background: #c0c0c0;
    border: none;
    padding: 6px 6px 4px 6px;
    box-shadow:
        inset -2px -2px 0 #808080,
        inset 2px 2px 0 #ffffff;
    transition: filter 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.theme-tile:hover:not(.current-theme) {
    filter: brightness(0.6);
}

.theme-tile:active:not(.current-theme) {
    box-shadow:
        inset 2px 2px 0 #808080,
        inset -1px -1px 0 #ffffff;
}

.theme-tile.current-theme {
    filter: brightness(0.65);
    cursor: default;
    pointer-events: none;
    box-shadow:
        inset 1px 1px 0 #808080;
}

.theme-preview {
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    display: block;
}

.theme-tile-label {
    margin-top: 5px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #000000;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.2;
}


#controls {
    padding: 10px;
    background: #4f0d09;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-bottom: 0px solid #7c5959;
    flex-wrap: wrap;
    align-content: center; /* Added to keep rows tight */
    box-sizing: border-box;
    flex-shrink: 0;
}

.faceEmoji {
    position: flex;
    background: #c0c0c0; 
    border: 2px solid #000000;
    border-radius: 1px;
    width: 35px;
    height: 34px;
    margin: 0 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    cursor: pointer;

    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.faceEmoji:hover { 
    background: rgb(133, 133, 133); 
    border: 2.5px solid #000000;
}

.faceEmoji svg {
    pointer-events: none;
}

#mineDisplay, #timeDisplay {
    min-width: 80px; /* Ensures both sides have equal 'weight' */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px; 
}

button {
    background: #000000;
    color: rgb(212, 196, 183);
    border: 1px solid #d4c4b7;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 1px;
    transition: background 0.2s, color 0.2s;
    font-weight: normal;
    font-size: 0.7rem;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;

    width: auto;
    flex-grow: 0;
    flex-shrink: 0;
}

button:hover { 
    background: #444; 
    color: #fff;
}


/* 3. game viewport */
#canvas-container {
    flex: 1; 
    overflow: auto;
    background: #4F0D09; 
    display: grid; 
    place-items: start center; /* Centers horizontally, starts at top */
    position: relative; 
    -webkit-overflow-scrolling: touch;
}

/* 4. canvas styles */
#canvas-container canvas {
    margin-top: 20px; 
    margin-bottom: 20px;
    display: block; 

    image-rendering: pixelated; /* Keeps it from getting blurry */
    touch-action: manipulation;

    user-select: none;
    background: transparent !important;
    /* Use width/height transition instead of transform */
    transition: width 0.2s ease-in-out, height 0.2s ease-in-out;

    /* Circular canvas */
    border-radius: 50%;
    box-shadow:
        inset -6px -6px 18px rgba(0,0,0,0.55),
        inset  4px  4px 12px rgba(255,255,255,0.12),
        0 8px 32px rgba(0,0,0,0.6);
}

#canvas-container canvas.zoomed {
    /* handle the specific width/height in JS to ensure it matches dynamic grid size */
    margin-top: 40px; 
    margin-bottom: 100px;
}


/* 5. sidebar footer */
.sidebar-footer {
    margin-top: auto; /* Pushes the footer to the bottom of the flex container */
    padding: 10px;
    border-top: 1px solid #ddd;
    background: #e8e8e8;
}

.sidebar-footer p {
    margin: 0 0 6px 0;
    font-size: 0.5rem;
    color: #666;
    line-height: 1.4;
}

.sidebar-footer .copyright {
    font-size: 0.5rem;
    color: #000;
    font-weight: bold;
}


/* ── cassette / FM radio ── */
#radioPlayer {
    position: fixed;
    bottom: -220px;
    left: -36px;
    width: fit-content;
    height: fit-content;
    overflow: visible;
    font-family: sans-serif;
    user-select: none;
    -webkit-touch-callout: none;
    z-index: 5000;
    cursor: default;
    pointer-events: none;
    will-change: transform; /* promotes to compositor layer — prevents full-page repaints on drag */
}

#bb-drag-handle {
    position: absolute;
    top: -10px;
    right: 22%;
    width: 54%;
    height: 30px;
    background: #4b1e1c;
    border: 3px solid #3c0706; 
    
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bca990;
    cursor: grab;
    z-index: 10;
    transition: background 0.15s, color 0.15s;
}

#bb-drag-handle:hover {
    background: #6a2926;
    color: #bca990;
}

#bb-drag-handle:active {
    cursor: grabbing;
    background: #6a2926;
    color: #3c0706;
}

/* OUTER SHELL */
.bb-shell {
    background: linear-gradient(160deg, #d4c0a8 0%, #bca990 35%, #a89278 70%, #c8b49a 100%);
    box-shadow: 
        4px 8px 16px 4px rgba(0,0,0,0.7),
        inset 0 1px 0 rgba(255,255,255,0.7),
        inset 0 -2px 4px rgba(0,0,0,0.3);
    border-top: none; 
    border-radius: 18px 18px 12px 12px;
    padding: 0 0 7px 0;
    position: relative;
    width: 100%;
    overflow: visible;
    transform: scale(0.741);
    transform-origin: top left;
    pointer-events: auto;
    contain: layout style; /* internal changes don't trigger recalc on the rest of the document */
}

.bb-antenna {
    position: absolute;
    left: 44px;
    top: -49px;
    width: 5px;
    height: 58px;
    background: linear-gradient(to right, #b7b7b7, #727272, #a9a9a9);
    border-radius: 3px 3px 2px 2px;
    transform-origin: bottom center;
    transform: rotate(30deg);
    z-index: 4999;
    pointer-events: none;
}
.bb-antenna::before {
    /* base ball joint */
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #a0a0a0, #5e5e5e);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.bb-antenna::after {
    /* tip ball */
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #a9a9a9, #6e6e6e);
}


/* KNOBS ROW */
.bb-knobs {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 5px 14px 4px;
}
.bb-knob {
    width: 8px;
    height: 12px;
    background: linear-gradient(to bottom, #ffdea5, #937541);
    border-radius: 3px;
    box-shadow: 0px 1px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

.bb-knob:active { transform: scaleY(0.9); }
.bb-knob-group { display: flex; gap: 5px; }

.bb-knob-small {
    width: 7px;
    height: 10px;
    background: linear-gradient(to bottom, #ffdea5, #937541);
    border-radius: 2px;
    box-shadow: 0px 0px 2px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
.bb-knob-small:hover { transform: scaleY(0.9); }

.bb-knob-group-right { display: flex; gap: 4px; align-items: flex-end; }

.bb-knob.bb-knob-power {
    width: 16px;
    height: 15px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1px 1px 0;
    overflow: hidden;
}
.bb-knob.bb-knob-power svg {
    width: 12px;
    height: 12px;
    display: block;
    fill: #6b4e1a;
    padding-bottom: 1px; 
}

/* TOP RED SECTION */
.bb-top {
    background: #6a2926;
    border: 1px solid #472624; 
    margin: 0 8px;
    border-radius: 4px;
    padding: 3px;
    display: flex;
    gap: 6px;
    align-items: stretch;
}

/* Tuner/radio strip */
.bb-tuner {
    flex: 1;
    background: #111;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 3px 4px;
    cursor: grab;
}
.bb-tuner-stripe {
    height: 7px;
    background: repeating-linear-gradient(to right, #2a2a2a 0px, #2a2a2a 8px, #1a1a1a 8px, #1a1a1a 10px);
    border-radius: 1px;
}
.bb-tuner-needle {
    position: absolute;
    top: 0; bottom: 0;
    left: 55%;
    width: 4px;
    background: rgb(224, 22, 0);
    cursor: grab;
    z-index: 5;
    user-select: none;
    touch-action: none;
    box-shadow: 0 0 8px rgba(224, 80, 0, 3.9);
}
.bb-tuner-needle:active { cursor: grabbing; }

.bb-tuner-tick {
    position: absolute;
    top: 2px; bottom: 2px;
    width: 1px;
    background: rgba(255, 200, 80, 0.35);
    pointer-events: none;
    transition: background 0.2s;
}
.bb-tuner-tick.active {
    background: rgba(255, 200, 80, 0.9);
    box-shadow: 0 0 3px rgba(255,200,80,0.6);
}

/* MAIN BODY */
.bb-body {
    background-color: rgb(89, 21, 19);
    background-image: radial-gradient(rgba(0,0,0,0.2) 1px, transparent 2px);
    background-size: 2.5px 4px;
    margin: 4px 8px 0;
    border-radius: 4px;
    border: 2px solid #270e0e; 
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.4), inset 0 -1px 3px rgba(0,0,0,0.3);
    padding: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Large speakers */
.bb-speaker {
    width: 78px;
    height: 78px;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow: 
        inset 0 3px 6px rgba(0,0,0,0.6),
        0 2px 4px rgba(255,255,255,0.08);
    background: radial-gradient(circle at center, #2a2a2a 0%, #380000 65%, #000 100%);
    display: grid;
    place-items: center;
}

.bb-speaker-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 45% 40%, #000000 0%, #2e2e2e 45%, #2a2a2a 85%, #000000 100%);
    display: grid;
    place-items: center;
    border: 3px solid #1a1a1a;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.25);
}

.bb-speaker-center {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, #3a3a3a 0%, #2e2e2e 50%, rgb(59, 59, 59) 100%);
    border: 1px solid #1e1e1e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.bb-speaker-center:active {
    background: radial-gradient(circle at 60% 70%, #3a3a3a 0%, #2e2e2e 50%, rgb(59, 59, 59) 100%);
    border: 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), inset 0 1px 2px rgba(0,0,0,0.5);
    cursor: pointer;
}

/* CENTER CONTROLS */
.bb-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Cassette / iframe area */
.bb-cassette {
    background: #390000;
    border-radius: 4px;
    border: 2px solid #310000;
    overflow: hidden;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: relative;
}
.bb-cassette iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.bb-cassette-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.bb-cassette-panel iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
/* height = cassette_height / scale, width = 100% / scale */
#bb-radio-iframe {
    position: absolute;
    top: -4px; left: -1px;
    width: 110%;
    height: 185px;
    transform: scale(0.92);
    transform-origin: top left;
    border: 0;
}
.bb-station-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.bb-station-lcd {
    background: #140908;
    border: 1px solid #3a1d19eb;
    border-radius: 3px;
    width: 100%;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.6);
}
.bb-station-name {
    color: #e8a840;
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-align: center;
    text-shadow: 0 0 6px rgba(212,170,48,0.5);
    text-transform: uppercase;
}
.bb-station-freq {
    color: #e8b640;
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(232,200,64,0.7);
}
.bb-station-status {
    color: #7a6010;
    font-family: 'Courier New', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.bb-station-status.playing  { color: #90b840; text-shadow: 0 0 4px rgba(144,184,64,0.5); }
.bb-station-status.buffering { color: #d4aa30; }
.bb-station-status.error    { color: #c04020; }

/* Dial glows orange when in radio mode */
#bb-mode-dial.radio-mode {
    box-shadow: 0 0 6px rgba(224, 80, 0, 0.7);
    background: radial-gradient(circle at 35% 35%, #f0c080, #c07030);
    transform: rotate(36deg);
}
#bb-mode-dial.radio-mode:active {transform: rotate(110deg);}


/* BOTTOM RED STRIP */
.bb-bottom {
    background: rgb(102, 25, 21);
    border: 2px solid #321c1c; 
    margin: 4px 8px 0;
    border-radius: 3px;
    box-shadow: inset 0 2px 3px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.6);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Round buttons */
.bb-roundbtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.4);
    box-shadow: 
        0 3px 5px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 2px rgba(0,0,0,0.3);
    transition: filter 0.1s, transform 0.1s;
    flex-shrink: 0;
}
.bb-roundbtn:active { 
    transform: scale(0.98); 
    filter: brightness(0.9); 
    border: 3px solid rgba(0, 0, 0, 0.4);
    box-shadow: 
        0 2px 2px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 2px rgba(0,0,0,0.3);
}
.bb-roundbtn.yellow  { background: radial-gradient(circle at 35% 35%, #ded0ad, #fde5a7); }
.bb-roundbtn.yellow.big { width: 30px; height: 30px; }

.bb-roundbtn svg {
    width: 100%;
    height: 100%;
    display: block;
    margin: auto;
    pointer-events: none;
}

/* Square buttons */
.bb-sqbtn-group { display: flex; gap: 2px; }
.bb-sqbtn {
    width: 28px;
    height: 27px;
    border-radius: 1px;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.4);
    transition: filter 0.1s;
}
.bb-sqbtn:active { filter: brightness(0.8); }
.bb-sqbtn.sq-yellow { background: #f0b800; }
.bb-sqbtn.sq-blue   { background: #2196c9; }
.bb-sqbtn.sq-red    { background: #e74c3c; }

.bb-sqbtn:hover {filter: brightness(1.3);}

/* Big dial knob */
.bb-dial {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff6da, #928464);
    border: 2px solid rgba(0,0,0,0.5);
    cursor: pointer;
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.bb-dial::after {
    content: '';
    position: absolute;
    top: 3px; left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 2px;
}
.bb-dial:active { transform: rotate(80deg); }

/* spacer */
.bb-sp { flex: 1; }


/* 6. mobile  */
@media (max-width: 768px) {
    #controls { 
        padding: 8px 5px; 
        gap: 8px; 
        justify-content: center;
    }
    button { 
        padding: 8px 10px; 
        flex-grow: 0; 
        width: auto;
        max-width: none; 
    }
}

@media (max-width: 500px) {
    #betty-image {
        width: 150px;
        height: 180px; 
        object-fit: contain;
        object-position: bottom right;
        bottom: 10px;
        right: 10px;
    }
    #radioPlayer {
        bottom: -200px;
        left: -100px;
    }
}

@media (max-width: 400px) {
    #controls {
        gap: 5px;
        padding: 5px;
    }
    input[type="number"] { width: 45px; } /* Shrink inputs slightly for tiny screens */
}


/* ── end game pop-up ── */
.end-popup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
}

.end-popup-window {
    pointer-events: all;
    width: 180px;
    background: #ece9d8;
    border: 1px solid #0a246a;
    box-shadow: inset 0 0 0 1px #a4b4d4, 3px 3px 8px rgba(0,0,0,0.5);
    font-family: Tahoma, 'MS Sans Serif', Arial, sans-serif;
    animation: popup-drop 0.15s cubic-bezier(.22,.68,0,1.15) both;
}

@keyframes popup-drop {
    from { transform: translateY(-14px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Title bar ── */
.end-popup-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 4px 3px 6px;
    background: linear-gradient(to bottom, #0f4ece 0%, #3a7bd5 40%, #245fcc 60%, #1a52c2 100%);
    border-bottom: 1px solid #0a246a;
    user-select: none;
}

.end-popup-titlebar-left {
    display: flex;
    align-items: center;
    gap: 5px;
}

.end-popup-titlebar-icon {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
}

.end-popup-title {
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    letter-spacing: 0;
}

/* ── X button ── */
.end-popup-close {
    width: 21px;
    height: 21px;
    font-size: 10px;
    line-height: 1;
    color: #000;
    background: linear-gradient(to bottom, #f0f0ea, #d4d0c8);
    border: 1px solid #888;
    border-top-color: #fff;
    border-left-color: #fff;
    box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #888;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Marlett, 'Courier New', monospace;
}
.end-popup-close:active {
    background: linear-gradient(to bottom, #d4d0c8, #f0f0ea);
    border-top-color: #888;
    border-left-color: #888;
    border-bottom-color: #fff;
    border-right-color: #fff;
}

/* ── Body ── */
.end-popup-body-wrap {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px 14px 16px;
    background: #ece9d8;
}

.end-popup-icon {
    font-size: 2.2rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.end-popup-body {
    font-size: 11px;
    color: #000;
    line-height: 1.6;
    flex: 1;
}

.end-popup-body strong {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}

.end-popup-body strong.is-gameover { color: #a00000; }
.end-popup-body strong.is-win      { color: #005500; }

/* ── Footer ── */
.end-popup-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 16px 12px;
    gap: 8px;
    border-top: 1px solid #aca899;
    background: #ece9d8;
}

/* ── OK / New Game button ── */
.end-popup-btn {
    min-width: 75px;
    height: 23px;
    font-family: Tahoma, 'MS Sans Serif', Arial, sans-serif;
    font-size: 11px;
    color: #000;
    background: linear-gradient(to bottom, #f4f2ec, #dbd8cc);
    border: 1px solid #888;
    border-top-color: #fff;
    border-left-color: #fff;
    box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #888, 1px 1px 2px rgba(0,0,0,0.2);
    cursor: pointer;
    padding: 0 12px;
}

.end-popup-btn:hover {
    background: linear-gradient(to bottom, #f9f8f4, #e8e4d8);
}

.end-popup-btn:active {
    background: linear-gradient(to bottom, #dbd8cc, #f4f2ec);
    border-top-color: #888;
    border-left-color: #888;
    border-bottom-color: #fff;
    border-right-color: #fff;
    box-shadow: inset 1px 1px 0 #888;
    transform: translate(1px, 1px);
}

/* Galaxy Background State */
body.galaxy-active {
    background-color: #000;
    background-image: url('https://res.cloudinary.com/ds139vso0/image/upload/q_auto/f_auto/v1775118491/Hubble_Legacy_Field_cropped_small_e0up0o.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Fade out the solid background canvas when galaxy is ON */
#bg-canvas {
    transition: opacity 0.8s ease-in-out;
}

body.galaxy-active #bg-canvas {
    opacity: 0;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Keeps it behind the game */
    transition: opacity 1s ease;
}

/* Let the body background image show through when galaxy is ON */
body.galaxy-active #canvas-container {
    background: transparent;
}

body.galaxy-active #controls {
    background: transparent;
}