/* Replace global star selector with targeted box-sizing to preserve layout
   and paddings while avoiding the `*` rule. This restores right/bottom
   padding that depended on border-box sizing. */
html, body, .container, .left, .right, .chat-messages, .chat-form,
input, textarea, button, .user-menu, .modal {
    box-sizing: border-box;
}

/* Strong mobile overrides placed at end to ensure they take precedence
   over earlier desktop-oriented rules. Forces the toggle and status to
   fixed bottom positioning and prevents them from stretching. */
@media (max-width: 768px) {
    .mega-toggle {
        position: fixed !important;
        top: 12px !important;
        right: 12px !important;
        left: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 3.2rem !important;
        height: var(--mega-toggle-height) !important;
        z-index: 9999 !important;
    }
    /* Only push the OFF-AIR variant to the bottom on mobile so it
       doesn't obscure stream controls while online/checking states
       remain top-right as on desktop. */
    .stream-status.offline {
        position: fixed !important;
        bottom: 12px !important;
        right: 12px !important;
        top: auto !important;
        left: auto !important;
        display: inline-block !important;
        max-width: calc(100% - 96px) !important;
        height: auto !important;
        padding: 6px 10px !important;
        box-sizing: border-box !important;
        z-index: 9999 !important;
    }
}

/* Flat edges and embossed look overrides */
/* Remove rounded corners globally for UI elements we control */
body * { border-radius: 0 !important; }

/* Embossed edge for panels and controls */
.embossed, .modal .modal-content, .user-menu, .stream-status, .hidden-list .hidden-row,
.chat-messages, .chat-form input[type="text"], .chat-form button, .chat-user-area,
.admin-badge {
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.7), inset 0 -2px 0 rgba(var(--brand-dark-rgb),0.06);
    border: 1px solid rgba(var(--brand-dark-rgb),0.06);
}


:root {
    --chat-font-size: 14px;
    --mega-duration: 360ms;
    --mega-easing: cubic-bezier(.2,.9,.2,1);
    /* Reduce drawer height so it doesn't push content as far — half the previous distance */
    --mega-height: 37.5vh; /* visible drawer height (half of 75vh) */
    /* Toggle size so we can anchor it to the menu edge */
    --mega-toggle-height: 3.4em;
    /* Layout spacing for typographic rhythm */
    --page-padding: 15px;
    --layout-gap: 15px;
    --header-height: 3.6em;
    /* Header nav sizing: change these two variables to adjust image size and spacing */
    --header-icon-height: 4rem; /* height of each numbered image */
    --header-nav-gap: 8px; /* gap between header images */
    /* Brand palette */
    --brand-dark: #553779; /* deep purple used instead of black */
    --brand-dark-rgb: 85,55,121; /* RGB form for rgba() usage */
    --brand-contrast: #EFEEEA; /* light contrast color (kept from existing palette) */

    /* Custom theme colors requested by user */
    --site-bg: #fff9d6; /* light yellow background */
    --chat-color: #6A0DAA; /* purple for chat messages */
    --title-radio-color: #1fa843; /* strong green for 'radio' */
    --title-kassa-color: #D9435F; /* red for 'kassa' */
    --send-button-color: #0B64E6; /* strong blue for send button */
}

@font-face {
    font-family: 'Merchant Copy';
    src: url('Merchant Copy.ttf') format('truetype');
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    gap: var(--layout-gap);
    padding: var(--page-padding);
    min-height: 100vh;
    background: var(--site-bg);
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--header-height);
    box-sizing: border-box;
    padding-right: 6px;
    position: relative;
}

.brand {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.6rem;
}
.brand h1 { line-height: 1; margin: 0; font-size: 5rem; }
.stream-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    color: rgba(0,0,0,0.6);
    margin: 0;
    padding: 0;
    font-family: 'Merchant Copy', sans-serif;
}

@media (max-width: 768px) {
    .brand { flex-direction: column; align-items: flex-start; }
}

/* hide the old stream-status badge (we now show status under the title) */
.stream-status { display: none !important; }

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Header navigation images (1..4) */
.header-nav { display: flex; gap: var(--header-nav-gap); align-items: center; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); z-index: 50; }
.header-nav .nav-item { display: inline-flex; align-items: center; }
.header-nav img { height: var(--header-icon-height); width: auto; display: block; object-fit: contain; }

@media (max-width:768px) {
    :root { --header-icon-height: 1.8rem; }
    .header-nav { position: static; transform: none; margin-left: 0; }
}

/* Hide legacy mega menu toggle button across site */
.mega-toggle { display: none !important; }

main { display: flex; flex: 1 1 auto; min-height: 0; }

h1 {
    margin: 0;
    font-size: 3em;
    text-align: left;
    color: inherit;
    flex-shrink: 0;
    font-family: 'Merchant Copy', "MS UI Gothic", sans-serif;
}

/* Title parts styling: color 'radio' green and 'kassa' red */
.brand h1 .title-radio { color: var(--title-radio-color); }
.brand h1 .title-kassa { color: var(--title-kassa-color); }

/* Per-letter title characters used by the title asterisk animation */
.title-char { transition: none; }
.title-char.title-star { color: #39ff14; text-shadow: none; font-weight: inherit; }

/* Stream status badge in the top-right of the page */
.stream-status {
    position: absolute;
    right: 18px;
    top: 18px;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 2rem;
    color: #EFEEEA;
    /* use same display font as the title */
    font-family: 'Merchant Copy', sans-serif;
    background: #D9435F; /* offline color */
    box-shadow: 0 6px 18px rgba(var(--brand-dark-rgb),0.12);
}
.stream-status.online { background: transparent; color: #D9435F; }
.stream-status.checking { background: #f39c12; color: #EFEEEA; }
.stream-status.offline { background: #D9435F; color: #EFEEEA; box-shadow: none; border: 1px solid rgba(var(--brand-dark-rgb),0.03); }

/* Animated dot for on-air state */
@keyframes streamPulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.25; transform: scale(0.85); } 100% { opacity: 1; transform: scale(1); } }
.stream-status .stream-dot { display: inline-block; margin-right: 10px; vertical-align: middle; }
.stream-status.online .stream-dot { color: #D9435F; animation: streamPulse 1.6s ease-in-out infinite; }
.stream-status.offline .stream-dot { color: #EFEEEA; opacity: 1; animation: none; }
.stream-status.checking .stream-dot { color: #EFEEEA; animation: streamPulse 1.2s linear infinite; }

.container {
    display: flex;
    gap: 15px;
    flex: 1 1 auto;
    min-height: 0;
}

.left {
    flex: 1 1 70%;
    background-color: lightgrey;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
    position: relative;
}

.left iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Notify button overlay inside the stream area */
.notify-btn {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 40;
    background: #D9435F;
    color: #EFEEEA;
    border: none;
    padding: 8px 12px;
    font-weight: 700;
    font-family: 'Merchant Copy', sans-serif;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(var(--brand-dark-rgb),0.12);
}
.notify-btn[aria-pressed="true"] { background: rgba(85,55,121,0.9); }
.notify-btn:focus { outline: 3px solid rgba(85,55,121,0.16); }

.divider {
    width: 10px;
    background-color: transparent;
    cursor: col-resize;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider::after {
    content: '';
    width: 2px;
    height: 100%;
    background-color: #999;
}

/* Remove the visible divider between stream and chat — we don't need the resizer */
.divider { display: none !important; }

/* Ensure chat messages do not overflow into the container padding */
.chat-messages { box-sizing: border-box; padding-right: 16px; }
.chat-message { box-sizing: border-box; max-width: 100%; padding-right: 6px; }
.chat-message, .chat-message .body, .chat-message .name { overflow-wrap: anywhere; word-break: break-word; }

.right {
    flex: 1 1 30%;
    background-color: transparent;
    min-width: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

    .right iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

/* Chat styles */
    .right .chat {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 10px;
    font-family: 'Merchant Copy', sans-serif;
    color: var(--chat-color);
}

.chat-status {
    font-size: 0.9em;
    color: rgba(var(--brand-dark-rgb),0.9);
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(var(--brand-dark-rgb),0.03);
}

.chat-debug {
    display: none; /* debug UI removed from view; kept hidden */
}

/* user/logout area (replaces debug box) */
.chat-user-area {
    font-size: 0.9em;
    color: var(--brand-dark);
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(var(--brand-dark-rgb),0.02);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    position: relative;
}

/* Dropdown menu inside the user area */
.user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: white;
    border: 1px solid rgba(var(--brand-dark-rgb),0.14);
    box-shadow: 0 6px 18px rgba(var(--brand-dark-rgb),0.08);
     -webkit-user-select: none;
     -moz-user-select: none;
     -ms-user-select: none;
     user-select: none;
    padding: 8px;
    border-radius: 6px;
    display: none;
    z-index: 20;
}
.user-menu .menu-row { margin: 6px 0; }
.chat-user-area.open .user-menu { display: block; }
.chat-user-area #chatMenuToggle { background: transparent; border: none; cursor: pointer; font-size: 1.05em; margin-left: auto; padding: 4px; }

/* Ensure the font control inside the menu looks compact */
.user-menu .chat-font-control { display: flex; gap: 8px; align-items: center; }
.user-menu input[type="range"] { width: 120px; }

/* show/hide name input when logged in/out controlled by JS (fallback styles) */
.user-menu #chatName { width: 100%; padding: 6px; border: 1px solid #ddd; border-radius: 4px; }

/* small inline login button next to name input */
.user-menu .login-btn { padding: 6px 8px; border-radius: 4px; border: 1px solid #ccc; background: #f4f4f4; cursor: pointer; }

/* Admin login modal */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(var(--brand-dark-rgb),0.35); z-index: 60; }
.modal.open { display: flex; }
.modal .modal-content { background: white; padding: 16px; border-radius: 8px; width: 320px; box-shadow: 0 10px 30px rgba(var(--brand-dark-rgb),0.2); position: relative; }
.modal .modal-row { margin: 8px 0; display:flex; flex-direction:column; }
.modal .modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:8px; }
.modal .modal-close { position:absolute; right:8px; top:8px; background:transparent; border:none; font-size:1rem; cursor:pointer; }
.modal .modal-error { color: #D9435F; margin-top:8px; min-height:1.1em; }

/* Hidden list (public UI) - darker background for readability */
.hidden-list .hidden-row { background: rgba(var(--brand-dark-rgb),0.6); color: #EFEEEA; padding: 8px; border-radius: 6px; margin-bottom: 8px; }
.hidden-list .hidden-row .hid-id { font-size: 0.85rem; color: #cbd5e1; margin-top:6px }
.hidden-list .hidden-row .hid-actions { margin-top:6px }

/* Admin badge */
.admin-badge {
    background: #D9435F;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.6px;
}

/* error overlay inside chat messages */
.chat-messages { position: relative; }
.chat-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 180ms ease;
    z-index: 5;
    color: rgba#D9435F;
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(rgba(255,255,255,0.03), rgba(255,255,255,0.03));
}
.chat-error.visible {
    opacity: 1;
    pointer-events: auto;
}
.chat-error small { display: block; font-weight: 400; font-size: 0.8rem; color: rgba(100,100,100,0.9); margin-top: 0.4rem; }

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    background: var(--brand-contrast); /* receipt-ish off-white */
    padding: 8px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(var(--brand-dark-rgb),0.03);
}

/* Chat message text color override to ensure purple body and names */
.chat-message, .chat-message .body, .chat-message .name { color: var(--chat-color); }

/* Strong blue send button */
.chat-form button[type="submit"] {
    background: var(--send-button-color);
    color: #fff;
    border: none;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(11,100,230,0.12);
}
.chat-form button[type="submit"]:hover { opacity: 0.95; }

.chat-message {
    margin-bottom: 4px;
    line-height: 1.08;
    /* Use grid so we can place name (left) and meta/time (right) on the
       top row, and the message body on a second row aligned left */
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "name meta"
        "body body";
    gap: 4px 8px;
    align-items: start;
    text-align: left;
    width: 100%;
    align-self: stretch;
}

/* Banned message styling: cross through and overlay a large red [BANNED] */
.chat-message.banned { position: relative; }
.chat-message.banned .banned-body { text-decoration: line-through; opacity: 0.6; }
.chat-message.banned .name { text-decoration: line-through; opacity: 0.6; }
.chat-message .banned-banner { display: none !important; }

/* Message layout now uses grid (see .chat-message above) */

/* vertical spacing handled by grid gap */

/* extra small spacing after the timestamp for clarity */
.chat-message .meta { margin-bottom: 2px; }

.chat-message .body {
    max-width: 100%;
    word-break: break-word;
    grid-area: body;
    justify-self: start;
}

.chat-message .name {
    grid-area: name;
    font-weight: 700;
    margin: 0; /* reset top/bottom margins — spacing controlled by the grid gap */
    font-size: calc(var(--chat-font-size) * 0.95);
    color: var(--chat-color);
    justify-self: start;
}

.chat-message .body {
    font-size: var(--chat-font-size);
    grid-area: body;
    justify-self: start;
}

.chat-message .meta {
    grid-area: meta;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 0;
    justify-self: end;
    align-self: center;
}

/* Receipt themed tweaks */
.receipt-time {
    font-style: italic;
    color: rgba(var(--brand-dark-rgb),0.88);
    font-size: 0.95em;
    user-select: none;
}

.receipt-line {
    font-family: monospace;
    font-size: 0.72rem;
    color: #9aa0a6;
    user-select: none;
    margin: 1px 0 2px 0;
    letter-spacing: 1px;
    text-align: center;
}

.chat-message .body { /* keep the same font as the surrounding chat */ }

/* small divider between time and user */
.receipt-divider {
    font-family: monospace;
    font-size: 0.8rem;
    color: #b0b4b7;
    user-select: none;
    text-align: center;
    align-self: stretch; /* span the message width */
    margin: 4px 0 2px 0;
    letter-spacing: 1px;
}

/* long splitter between messages */
.message-split {
    /* Receipt-style dashed splitter: use a pseudo-element to draw
       repeating dashes so it remains a single visual line and scales
       with the container width without wrapping into text rows. */
    display: block;
    width: 100%;
    height: 18px; /* vertical space for the splitter */
    margin: 8px 0;
    align-self: stretch;
    position: relative;
}

.message-split::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
    /* 6px dash, 6px gap repeated across the width */
    background-image: repeating-linear-gradient(90deg, #d0d4d7 0 6px, rgba(var(--brand-dark-rgb),0) 6px 12px);
    background-repeat: repeat-x;
    background-size: 12px 1px;
    pointer-events: none;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-form input[type="text"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

#chatName {
    width: 24%;
    min-width: 70px;
}

/* When the name input lives in the user area, make it a reasonable inline size */
.chat-user-area #chatName {
    width: auto;
    min-width: 120px;
    max-width: 220px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Chat input: allow flex sizing and proper shrinking */
#chatInput {
    flex: 1;
    min-width: 0;
}

/* Prevent children from overflowing the right padding and allow inputs to shrink */
.right > * {
    box-sizing: border-box;
    max-width: 100%;
}

/* merged into earlier #chatInput rule */

.chat-messages {
    padding-right: 15px;
}

.chat-form button {
    padding: 8px 12px;
    border: none;
    background: #440044;
    color: #EFEEEA;
    border-radius: 4px;
    cursor: pointer;
}

/* Registration bar styles */
.chat-reg {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.chat-reg .reg-name {
    flex: 1 1 auto;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.chat-reg .reg-btn,
.chat-reg .reg-logout {
    padding: 8px 10px;
    border: none;
    background: #2d8659;
    color: #EFEEEA;
    border-radius: 4px;
    cursor: pointer;
}
.chat-reg .reg-logout {
    background: #c0392b;
}
.chat-reg .reg-status {
    font-size: 0.9em;
    color: var(--brand-dark);
    margin-left: 6px;
}

.chat-font-control {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.95em;
}
.chat-font-control input[type="range"] {
    width: 120px;
}

/* Responsive: stack the chat column under the stream on narrow screens */
@media (max-width: 768px) {
    body {
        padding: 10px;
        gap: 10px;
    }
    .container {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    /* hide the divider used for desktop resizing */
    .divider { display: none; }

    .left, .right {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }

    /* keep the stream visible with a reasonable height on phones */
    .left { align-items: stretch; }
    .left iframe { width: 100%; height: 320px; }

    /* chat column spans full width and gets modest padding */
    .right { padding: 12px; }
    .right iframe { height: auto; }

    /* make chat content height automatic and limit message area height */
    .right .chat { height: auto; }
    .chat-messages { max-height: 40vh; overflow-y: auto; padding-right: 8px; }

     /* Allow the page to scroll on small screens so controls (send button)
         can be reached — override the desktop `overflow: hidden` behavior. */
     html, body { overflow: auto; height: auto; }

    /* ensure form stretches full width on small screens */
    .chat-form { flex-direction: column; align-items: stretch; }
    .chat-form input[type="text"], #chatInput { width: 100%; }
    .chat-form button { width: 100%; }

    /* mobile-specific placement handled by final overrides at top of file */
}

/* Admin/mod controls: place controls on their own row and right-align buttons */
.chat-message .mod-controls {
    grid-column: 1 / -1; /* span full width of the message grid */
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.chat-message .mod-controls button {
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid rgba(var(--brand-dark-rgb),0.08);
    background: #f4f4f4;
    cursor: pointer;
}

/* Mega dropdown module: full-width slide-down panel that fills ~75% height */
/* place mega menu above most overlays so it remains usable while other UI layers are shown */
#megaMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--mega-height);
    overflow: hidden;
    background: #EFEEEAfff;
    box-shadow: 0 8px 40px rgba(var(--brand-dark-rgb),0.25);
    z-index: 400;
    transform: translateY(-100%); /* hide above viewport */
    transition: transform var(--mega-duration) var(--mega-easing), opacity calc(var(--mega-duration) - 140ms) ease;
    opacity: 0;
    will-change: transform, opacity;
}
#megaMenu.open {
    transform: translateY(0); /* slide into view */
    opacity: 1;
}
#megaMenu .mega-inner {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 0; /* remove padding so images can fill the full menu */
    overflow: hidden; /* prevent internal scrolling; content will scale to fit */
}
#megaMenu .mega-header { flex: 0 0 auto; }
#megaMenuContent { display: flex; flex-direction: row; gap: 8px; flex: 1 1 auto; align-items: stretch; height: 100%; }
#megaMenu .mega-header {
    display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;
}
#megaMenu .mega-close {
    background: transparent; border: none; font-size: 1.2rem; cursor: pointer; padding:6px 10px;
}
.mega-toggle {
    position: fixed;
    left: 50%;
    top: 15px; /* align with page/header padding so it fits the header */
    transform: translateX(-50%);
    /* keep padding inside the declared height so the tap target is larger */
    box-sizing: border-box;
    padding: 0.08em 0.4em;
    border: none;
    background: transparent no-repeat top center / contain url('menubutton.png');
    cursor: pointer;
    z-index: 410; /* sit above overlays and the mega menu when closed */
    /* size to roughly match the header height (h1 uses 3em) */
    height: var(--mega-toggle-height);
    min-width: calc(var(--mega-toggle-height) * 0.9);
    width: auto;
    aspect-ratio: 1.6 / 1; /* keep key-ish proportions */
    transition: transform 360ms cubic-bezier(.2,.9,.2,1), top 360ms ease;
}

/* When the mega menu is open, keep the toggle in its fixed top location (no movement). */
body.mega-open .mega-toggle {
    transform: translateX(-50%);
    top: 15px;
}

/* Compact behavior for small screens: fill more height */
@media (max-width: 480px) {
    /* increase drawer height on very small screens */
    /* Use half the previously large mobile drawer so it doesn't cover as much */
    :root { --mega-height: 45vh; }
    #megaMenu { height: var(--mega-height); }
    .mega-toggle { right: 12px; top: 0; }
}

/* Kassa bill-style options inside the mega menu */
.bill-option {
    display: flex;
    width: 100%;
    /* let flex sizing determine width so 4 options fill the available menu width */
    flex: 1 1 0;
    margin: 0; /* gaps are handled by the parent */
    border-radius: 0; /* remove rounded corners to let image reach edges */
    box-shadow: none; /* remove the embossed green look */
    border: none; /* remove borders so images appear edge-to-edge */
    background: transparent; /* remove green background */
    cursor: pointer;
    position: relative;
    overflow: hidden;
    align-items: stretch;
    justify-content: stretch;
    padding: 0; /* no padding so images can fill fully */
    box-sizing: border-box;
}
.bill-option::before { display: none; }
.bill-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(var(--brand-dark-rgb),0.12);
}
.bill-option:focus {
    outline: 3px solid rgba(74,144,226,0.18);
}

/* visually hide any text that might be present inside the bill (we keep aria-labels)
   but leave space for future icons or small labels if needed */
.bill-option > * { position: relative; }

/* Image wrapper and image styling: rotate -90deg and allow stretching/squashing */
.bill-option .img-wrap {
    width: 100%;
    height: 100%;
    display: block;
    padding: 0;
    box-sizing: border-box;
}
.bill-option img {
    width: 100%;
    height: 100%;
    object-fit: fill; /* allow stretch and squash to fill the slot */
    transform: none;
    transform-origin: center center;
    display: block;
}

/* Stack back to vertical on small screens for usability */
@media (max-width: 768px) {
    #megaMenuContent { flex-direction: column; gap: 6px; }
    /* evenly split the menu height among the 4 items so no internal scrolling is required */
    .bill-option { flex: none; height: calc((100% - (3 * 6px)) / 4); }
    .bill-option img { object-fit: fill; }
}

/* Overlay for loading other pages while audio plays in background */
#pageOverlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 220;
    background: rgba(var(--brand-dark-rgb),0.65);
    backdrop-filter: blur(4px);
    align-items: stretch;
    justify-content: center;
}
#pageOverlay.open { display: flex; }
#pageOverlay .overlay-bar {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 230;
}
#overlayClose {
    background: rgba(var(--brand-dark-rgb),0.6);
    color: #EFEEEA;
    border: none;
    padding: 8px 10px;
    font-size: 1.1rem;
    border-radius: 6px;
    cursor: pointer;
}
/* Content container for fetch-injected pages (non-iframe) */
#overlayContent {
    position: absolute;
    inset: 0;
    z-index: 235;
    background: white;
    overflow: auto;
    box-sizing: border-box;
    padding: 18px;
}

/* Blocked embed message shown when a site refuses to be framed */
#overlayMessage {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 240;
    padding: 24px;
    box-sizing: border-box;
    color: #EFEEEA;
    background: linear-gradient(180deg, rgba(var(--brand-dark-rgb),0.6), rgba(var(--brand-dark-rgb),0.55));
    font-size: 1rem;
    line-height: 1.4;
    overflow: auto;
}
#overlayMessage.open { display: block; }
#overlayMessage .msg-inner { max-width: 900px; margin: 40px auto; }
#overlayMessage p { margin: 0 0 12px 0; }
#overlayMessage .open-link { display: inline-block; margin-top: 12px; padding: 8px 12px; background: #EFEEEA; color: var(--brand-dark); border-radius: 6px; text-decoration: none; font-weight:700 }

/* For small screens, keep a small top bar and full-screen iframe */
@media (max-width: 768px) {
    #pageOverlay .overlay-bar { top: 6px; right: 8px; }
    #overlayClose { padding: 6px 8px; }
}

/* in-content back button inside injected overlay pages */
.overlay-back {
    position: absolute;
    top: 12px;
    right: 60px; /* sit to the left of the top-right overlay close button */
    left: auto;
    z-index: 245;
    background: rgba(255,255,255,0.95);
    color: var(--brand-dark);
    border: none;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
}
.overlay-back:focus { outline: 3px solid rgba(74,144,226,0.2); }
