:root {
    --color-primary: #FFD700; /* Comic Yellow */
    --color-secondary: #00E5FF; /* Cyan */
    --color-accent: #FF4081; /* Hot Pink */
    --color-danger: #FF3D00; /* Red */
    --color-white: #FFFFFF;
    --color-bg-dots: #E1F5FE;
    --color-black: #000000;
    --border-thick: 3px solid var(--color-black);
    --shadow-hard: 5px 5px 0px var(--color-black);
    --shadow-inset: inset 3px 3px 0px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Comic Neue', cursive;
    background-color: #333;
    color: var(--color-black);
    height: 100dvh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    background-color: var(--color-white);
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* --- Header Styling --- */
.header-container {
    position: relative;
    width: 100%;
    height: 160px; /* Fixed height for header */
    flex-shrink: 0;
    border-bottom: var(--border-thick);
    background-color: var(--color-secondary);
    overflow: hidden;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    box-shadow: 0 10px 0 rgba(0,0,0,0.2);
    z-index: 10;
}

a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.header-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* No filter for colorful look */
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent);
}

.top-icons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.icon-btn {
    background: var(--color-white);
    border: var(--border-thick);
    width: 44px;
    height: 44px;
    border-radius: 50%; /* Circular icons in comic style */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-black);
    box-shadow: 3px 3px 0 var(--color-black);
    cursor: pointer;
    transition: transform 0.1s;
}

.icon-btn:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.app-logo {
    font-family: 'Bangers', cursive;
    font-size: 48px;
    color: var(--color-primary); /* Yellow text */
    text-shadow: 
        3px 3px 0 var(--color-danger), /* Red shadow 3D effect */
        -1px -1px 0 var(--color-black),  
        1px -1px 0 var(--color-black),
        -1px 1px 0 var(--color-black),
        1px 1px 0 var(--color-black),
        4px 4px 0 var(--color-black);
    letter-spacing: 2px;
    transform: rotate(-3deg);
    margin-top: auto;
    margin-left: 10px;
}

/* --- Content Area --- */
.content-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    /* Colorful Halftone Pattern */
    background-color: var(--color-bg-dots);
    background-image: radial-gradient(var(--color-secondary) 20%, transparent 20%),
                      radial-gradient(var(--color-secondary) 20%, transparent 20%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* --- Components --- */
.comic-card {
    background: var(--color-white);
    border: var(--border-thick);
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-hard);
    position: relative;
    z-index: 1;
    border-radius: 20px;
}

.card-title {
    font-family: 'Bangers', cursive;
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 10px;
    text-transform: uppercase;
    background: var(--color-danger); /* Red bg for titles */
    color: var(--color-primary); /* Yellow text */
    display: inline-block;
    padding: 4px 10px;
    border: 2px solid var(--color-black);
    transform: skew(-5deg) rotate(-2deg);
    box-shadow: 3px 3px 0 var(--color-black);
}

.balance-display {
    font-size: 36px;
    font-weight: 700;
    text-align: right;
    color: var(--color-black);
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

/* Grid Menu */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.menu-btn {
    background: var(--color-primary); /* Yellow buttons */
    border: var(--border-thick);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-hard);
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
    border-radius: 16px;
}

/* Alternate colors for menu items using nth-child */
.menu-grid .menu-btn:nth-child(1) { background-color: #FFEB3B; } /* Yellow */
.menu-grid .menu-btn:nth-child(2) { background-color: #00E5FF; } /* Cyan */
.menu-grid .menu-btn:nth-child(3) { background-color: #FF4081; color: white; } /* Pink */
.menu-grid .menu-btn:nth-child(4) { background-color: #76FF03; } /* Green */

.menu-btn i {
    font-size: 28px;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.5));
}

.menu-btn span {
    font-family: 'Bangers', cursive;
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 1px 1px 0 var(--color-black);
}

/* List Items */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 2px dashed var(--color-black);
    font-weight: bold;
}

.transaction-item:last-child {
    border-bottom: none;
}

.amount-plus { color: #00C853; text-shadow: 1px 1px 0 #000; }
.amount-minus { color: #D50000; text-shadow: 1px 1px 0 #000; }

/* Forms */
.comic-input {
    width: 100%;
    padding: 15px;
    border: var(--border-thick);
    font-family: 'Comic Neue', cursive;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    background: #fff;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
    border-radius: 12px;
}
.comic-input:focus {
    outline: none;
    background: #fffDE7;
    box-shadow: 3px 3px 0 var(--color-primary);
}

select.comic-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

.action-btn {
    width: 100%;
    padding: 15px;
    background: var(--color-danger); /* Red Action Buttons */
    color: var(--color-primary); /* Yellow Text */
    font-family: 'Bangers', cursive;
    font-size: 24px;
    border: var(--border-thick);
    cursor: pointer;
    box-shadow: var(--shadow-hard);
    text-shadow: 1px 1px 0 #000;
    text-transform: uppercase;
    border-radius: 16px;
}

.action-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 1px 1px 0 var(--color-black);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.product-item {
    background: white;
    border: var(--border-thick);
    padding: 10px;
    text-align: center;
    border-radius: 16px;
    box-shadow: 3px 3px 0 var(--color-black);
}

.product-img {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
    border: 1px solid #000;
}

/* Back Button */
.back-btn-container {
    margin-bottom: 15px;
}

.back-btn {
    background: transparent;
    border: none;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-black);
    color: white;
    padding: 15px 30px;
    font-family: 'Bangers', cursive;
    font-size: 20px;
    border: 2px solid white;
    z-index: 100;
    transition: opacity 0.3s;
}
.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- Authentication Pages --- */
.auth-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
    color: var(--color-black);
    text-decoration: underline;
    font-size: 18px;
    cursor: pointer;
}

.captcha-container {
    background: #f9f9f9;
    border: var(--border-thick);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1);
}

.captcha-box {
    width: 30px;
    height: 30px;
    border: 2px solid #ccc;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.captcha-box.checked {
    border-color: #00C853;
    background: #00C853;
}

.captcha-box.checked::after {
    content: '✔';
    color: white;
    font-size: 20px;
}

/* --- Footer App Menu --- */
.app-footer-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: var(--border-thick);
    box-shadow: 0 -3px 0 rgba(0,0,0,0.1);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    margin-top: auto;
    z-index: 30;
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    border: 2px solid #000;
    border-radius: 12px;
    background: #f8f8f8;
    font-weight: bold;
    font-size: 10px;
    min-height: 48px;
}

.footer-item i {
    font-size: 14px;
}

.footer-item.active {
    background: var(--color-primary);
}