:root {
    --md-sys-color-primary: #6750A4; /* Purple */
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;
    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;
    --md-sys-color-background: #FFFBFE;
    --md-sys-color-on-background: #1C1B1F;
    --md-sys-color-surface: #FFFBFE; /* Cards, dialogs, menus */
    --md-sys-color-on-surface: #1C1B1F; /* Text on surface */
    --md-sys-color-surface-variant: #E7E0EC; /* Outlines, dividers */
    --md-sys-color-on-surface-variant: #49454F; /* Medium-emphasis text */
    --md-sys-color-outline: #79747E;
    --md-sys-color-shadow: #000000;
    --md-sys-color-inverse-surface: #313033;
    --md-sys-color-inverse-on-surface: #F4EFF4;
    --md-sys-color-inverse-primary: #D0BCFF;
    --md-sys-color-surface-container-high: #F3EDF7; /* For menus, as per M3 */


    /* Custom app colors based on M3 */
    --app-key-color-fab: var(--md-sys-color-primary-container);
    --app-key-color-fab-on: var(--md-sys-color-on-primary-container);

    /* Typography */
    --md-ref-typeface-brand: 'Roboto', 'Noto Sans JP', sans-serif;
    --md-ref-typeface-plain: 'Roboto', 'Noto Sans JP', sans-serif;
    --app-title-font: 'Codystar', cursive;

    /* Elevation (shadows) - simplified */
    --md-sys-elevation-level0: none;
    --md-sys-elevation-level1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    --md-sys-elevation-level2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    --md-sys-elevation-level3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px 0px rgba(0, 0, 0, 0.30);
}

@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary: #90caf9; /* Light Blue */
    --md-sys-color-on-primary: #001e36; /* Dark Blue/Black text */
    --md-sys-color-primary-container: #004a7c; /* Darker Blue container */
    --md-sys-color-on-primary-container: #d1e4ff; /* Light Blue text */

    --md-sys-color-secondary: #b39ddb; /* Light Purple */
    --md-sys-color-on-secondary: #1e1529; /* Dark Purple text */
    --md-sys-color-secondary-container: #3c3479; /* Dark Purple container (ref) */
    --md-sys-color-on-secondary-container: #e8def8; /* Light Purple text */

    --md-sys-color-tertiary: #bfa76a; /* Amber */
    --md-sys-color-on-tertiary: #291d00; /* Dark text */
    --md-sys-color-tertiary-container: #494100; /* Dark Amber container */
    --md-sys-color-on-tertiary-container: #ffe082; /* Light Amber text */

    --md-sys-color-error: #f48fb1; /* Light Pink error */
    --md-sys-color-on-error: #000000; /* Black text on error */
    --md-sys-color-error-container: #5c1123; /* Dark Red container */
    --md-sys-color-on-error-container: #fce4e8; /* Light Pink text */

    --md-sys-color-background: #181818; /* Dark Gray background (ref) */
    --md-sys-color-on-background: #e0e0e0; /* Light Gray text */
    --md-sys-color-surface: #232323; /* Slightly Lighter Dark Gray for surfaces (ref) */
    --md-sys-color-on-surface: #f3f3f3; /* White/Light Gray text (ref) */
    --md-sys-color-surface-variant: #23223a; /* Dark Blue/Gray for dividers, etc. (ref) */
    --md-sys-color-on-surface-variant: #b0b0b0; /* Medium Gray text (ref) */
    --md-sys-color-outline: #888888; /* Gray outline (ref) */
    --md-sys-color-shadow: #000000; /* Shadow color remains black */

    --md-sys-color-inverse-surface: #e0e0e0; /* Light Gray inverse surface */
    --md-sys-color-inverse-on-surface: #181818; /* Dark text on inverse surface */
    --md-sys-color-inverse-primary: #6750A4; /* Original light mode primary for inverse */

    --md-sys-color-surface-container-high: #23223a; /* (ref) For menus, etc. */

    /* Custom app colors will use the new M3 dark variables */
    /* --app-key-color-fab: var(--md-sys-color-primary-container); */
    /* --app-key-color-fab-on: var(--md-sys-color-on-primary-container); */

    /* Elevation (shadows) for dark mode */
    --md-sys-elevation-level1: 0px 1px 3px 1px rgba(0,0,0,0.7), 0px 1px 2px 0px rgba(0,0,0,0.8); /* Darker, more pronounced */
    --md-sys-elevation-level2: 0px 2px 6px 2px rgba(0,0,0,0.7), 0px 1px 4px 0px rgba(0,0,0,0.8);
    --md-sys-elevation-level3: 0px 4px 8px 3px rgba(0,0,0,0.7), 0px 2px 6px 0px rgba(0,0,0,0.8);

    /* RGB helpers for hover states (derived from new on-container/on-surface colors) */
    --md-sys-color-on-primary-container-rgb: 209, 228, 255; /* for #d1e4ff */
    --md-sys-color-on-surface-rgb: 243, 243, 243; /* for #f3f3f3 */
    --md-sys-color-on-surface-variant-rgb: 176, 176, 176; /* for #b0b0b0 */

  }
}

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

body {
    font-family: var(--md-ref-typeface-plain);
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
}

.page-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--md-sys-color-background);
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    /* padding-bottom: 80px; REMOVED for Split FAB, manage FAB position directly */
}
.page {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}
.page.active {
    display: flex;
}


/* Header (M3 Top App Bar - Small) */
.header {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    padding: 0 4px 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    flex-shrink: 0;
}

.header .app-logo-container {
    font-family: var(--app-title-font);
    font-size: 30px;
    line-height: 1;
    color: var(--md-sys-color-on-surface);
    flex-grow: 1;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.header-actions-wrapper {
    display: flex;
    align-items: center;
    position: absolute;
    right: 4px;
}

#auth-container {
    display: flex;
    align-items: center;
    padding-right: 4px;
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
}
#auth-container img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--md-sys-color-outline);
}
#auth-container .auth-avatar-placeholder {
    font-size: 32px;
    color: var(--md-sys-color-on-surface-variant);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}


.header-menu {
    position: relative;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Times New Roman', Times, serif;
}
.menu-btn:hover { background-color: rgba(0,0,0,0.04); }
.menu-btn:focus { outline: none; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: 48px;
    right: 4px;
    background-color: var(--md-sys-color-surface);
    border-radius: 4px;
    box-shadow: var(--md-sys-elevation-level2);
    z-index: 101;
    width: 240px;
    padding: 8px 0;
}
.dropdown-menu.show { display: block; }
.dropdown-menu button, .dropdown-menu a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
}
.dropdown-menu .material-symbols-outlined {
    margin-right: 12px;
    font-size: 20px;
    color: var(--md-sys-color-on-surface-variant);
}
.dropdown-menu button:hover, .dropdown-menu a:hover {
    background-color: rgba(0,0,0,0.04);
}
.dropdown-menu button {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: none;
    border: none;
    padding: 10px 15px;
    margin: 0;
    cursor: pointer;
    color: var(--md-sys-color-on-surface, #1c1b1f);
    font-size: 1rem;
    line-height: 1.5;
}

.dropdown-menu button:hover {
    background-color: var(--md-sys-color-surface-container-low, rgba(0, 0, 0, 0.05));
}

.dropdown-menu button .material-symbols-outlined {
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 20px;
}

.dropdown-menu div#logout-btn-dropdown {
    padding: 0;
    margin: 0;
    border: none;
    background: none;
}

.dropdown-menu .dropdown-item {
}

.empty-topping-list-message a {
    color: var(--brand-color); 
    text-decoration: underline;
    font-weight: 500;
}

/* M3 Bottom Navigation Bar */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    height: 80px;
    background-color: var(--md-sys-color-surface-variant);
    box-shadow: var(--md-sys-elevation-level2);
    z-index: 100;
    flex-shrink: 0;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0 12px 0;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    transition: color 0.2s ease;
    position: relative;
}
.nav-item .nav-icon-container {
    width: 64px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    margin-bottom: 4px;
    transition: background-color 0.2s ease;
}
.nav-item .material-symbols-outlined {
    font-size: 24px;
    color: var(--md-sys-color-on-surface-variant);
    transition: color 0.2s ease;
}
.nav-item .nav-label {
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    transition: color 0.2s ease;
}
.nav-item.active .nav-icon-container {
    background-color: var(--md-sys-color-primary);
}
.nav-item.active .material-symbols-outlined {
    color: var(--md-sys-color-on-primary);
}
.nav-item.active .nav-label {
    color: var(--md-sys-color-primary);
    font-weight: 700;
}


/* Voucher List */
.voucher-list-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    /* Add padding to prevent content from being hidden behind fixed bottom elements */
    padding-bottom: 96px; /* Space for FAB + Bottom Nav if both visible */
}
.voucher-list {
    padding: 8px 16px;
    background-color: var(--md-sys-color-background);
}

.voucher-card {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out, opacity 0.2s ease-in-out;
    position: relative;
}
.voucher-card:hover { box-shadow: var(--md-sys-elevation-level1); }
.voucher-card.used-card {
    opacity: 0.6;
    background-color: var(--md-sys-color-surface-variant);
}

.voucher-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.expiry-date {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}
.expiry-date.expiring-soon { color: var(--md-sys-color-error); font-weight: 500; }
.expiry-date.expired { color: var(--md-sys-color-on-surface-variant); text-decoration: line-through; opacity: 0.7; }

.status-toggle {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1.5px solid var(--md-sys-color-outline);
    background-color: transparent; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: all 0.3s ease;
    position: relative;
}
.status-toggle.available {
    border-color: var(--md-sys-color-outline);
}
.status-toggle.available::after {
    content: '✓';
    color: var(--md-sys-color-outline);
    font-size: 18px;
    font-weight: bold;
    opacity: 0.6;
}
.status-toggle.used {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}
.status-toggle.used::after {
    content: '✓';
    color: var(--md-sys-color-on-primary);
    font-size: 18px;
    font-weight: bold;
    opacity: 1;
}


.voucher-content {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px; line-height: 20px;
    max-height: 60px; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.voucher-content strong { color: var(--md-sys-color-on-surface); font-weight: 500; }
.voucher-content a { color: var(--md-sys-color-primary); text-decoration: none; }
.voucher-content a:hover { text-decoration: underline; }

.multi-code-indicator {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    padding: 4px 8px; border-radius: 8px; font-size: 12px;
    margin-top: 8px; display: inline-block; font-weight: 500;
}

/* MODIFIED: Old Extended FAB - hide it */
.extended-fab {
    display: none !important;
}

/* --- NEW: Split Extended FAB --- */
.split-fab-container {
    position: fixed;
    /* Default position if bottom nav is not shown */
    bottom: 24px;
    right: 16px;
    display: flex;
    align-items: center;
    border-radius: 16px; /* M3 Large shape */
    box-shadow: var(--md-sys-elevation-level3);
    background-color: var(--app-key-color-fab, var(--md-sys-color-primary-container));
    color: var(--app-key-color-fab-on, var(--md-sys-color-on-primary-container));
    z-index: 999; /* Below toast, above other content */
    overflow: visible; /* Allow menu to show */
    height: 56px; /* M3 FAB height */
}

.split-fab-main-action,
.split-fab-dropdown-trigger {
    background-color: transparent; /* Color from container */
    color: inherit; /* Color from container */
    border: none;
    padding: 0 16px; /* Horizontal padding */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative; /* For focus state if needed */
}

.split-fab-main-action {
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    padding-right: 12px; /* Slightly less padding towards divider */
    gap: 8px; /* Space between icon and label */
}

.split-fab-main-action:hover,
.split-fab-dropdown-trigger:hover {
    background-color: rgba(var(--md-sys-color-on-primary-container-rgb, 33, 0, 93), 0.08); /* Interaction state layer */
}
/* Helper for RGB value if not defined */
:root {
    --md-sys-color-on-primary-container-rgb: 33, 0, 93; /* Default if --app-key-color-fab-on is not #21005D */
}


.split-fab-main-action .fab-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.split-fab-main-action .fab-label {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
}

.split-fab-divider {
    width: 1px;
    height: 24px; /* M3 spec: 24dp height */
    background-color: currentColor; /* Inherits from container's text color */
    opacity: 0.4; /* Or adjust as needed */
}

.split-fab-dropdown-trigger {
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    padding-left: 12px;
    padding-right: 12px; /* M3 spec: 12dp for icon-only part */
}

.split-fab-dropdown-trigger .material-symbols-outlined {
    font-size: 24px;
}

/* FAB Menu */
.split-fab-menu {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: calc(100% + 8px); /* Position above the FAB with 8dp margin */
    right: 0; /* Align to the right edge of the FAB container */
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: 8px; /* M3 Menu shape */
    box-shadow: var(--md-sys-elevation-level2);
    padding: 8px 0; /* Vertical padding for the menu container */
    min-width: 200px; /* Adjust as needed, M3 suggests min 112dp, often wider */
    z-index: 1001; /* Above the FAB container */
    list-style: none;
    margin: 0;
    overflow: hidden; /* Ensures rounded corners are respected by items */
}

.split-fab-menu.show {
    display: block;
}

.split-fab-menu-item {
    display: flex;
    align-items: center;
    gap: 12px; /* Space between icon and label */
    padding: 12px 16px; /* M3 Menu item padding */
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

.split-fab-menu-item:hover {
    background-color: rgba(var(--md-sys-color-on-surface-rgb, 28, 27, 31), 0.08); /* M3 hover state */
}
/* Helper for RGB value if not defined */
:root {
    --md-sys-color-on-surface-rgb: 28, 27, 31;
    --md-sys-color-on-surface-variant-rgb: 73, 69, 79; /* for #49454F */

}


.split-fab-menu-item .menu-item-icon {
    font-size: 20px; /* Or 24px if preferred */
    color: var(--md-sys-color-on-surface-variant);
}
.split-fab-menu-item .menu-item-label {
    flex-grow: 1;
}


.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.32);
    z-index: 2000; animation: fadeIn 0.15s linear;
    padding: 24px;
    /* display: flex; MODIFIED: controlled by JS */
    align-items: flex-start;
    justify-content: center;
}
/* .modal.show { display: flex; } MODIFIED: Already handled by style.display='flex' in JS */


.modal-content {
    background-color: var(--md-sys-color-surface);
    width: 100%; max-width: 460px;
    margin-top: 5vh;
    padding: 0; border-radius: 28px;
    max-height: calc(100vh - 48px - 5vh);
    animation: slideInModal 0.2s cubic-bezier(0.0, 0.0, 0.2, 1);
    box-shadow: var(--md-sys-elevation-level2);
    display: flex; flex-direction: column;
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    min-height: 56px;
    flex-shrink: 0;
}
.modal-header .title-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
}
.modal-header h2 {
    font-size: 18px; line-height: 24px; font-weight: 500;
    color: var(--md-sys-color-on-surface);
}
#scan-giga-modal .modal-header {
    padding: 16px 16px 16px 24px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
}
#scan-giga-modal .modal-header p {
    font-size: 14px; /* Slightly smaller for instruction text */
    line-height: 1.4;
    color: var(--md-sys-color-on-surface-variant);
    flex-grow: 1;
    margin-right: 8px;
    text-align: left;
}


.close-btn-icon {
    background: none;
    border: none; /* This line ensures there's no border */
    cursor: pointer;
    padding: 8px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

}
.close-btn-icon svg { width: 24px; height: 24px; fill: currentColor; }
.close-btn-icon:hover { background-color: rgba(0,0,0,0.04); }

.form-group { padding: 0 24px; margin-bottom: 16px; }
.form-group:first-of-type { margin-top: 24px; }

.form-group textarea {
    width: 100%; padding: 16px;
    border: none; border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
    background-color: var(--md-sys-color-surface-variant);
    border-top-left-radius: 4px; border-top-right-radius: 4px;
    font-size: 16px;
    line-height: 24px;
    resize: vertical; min-height: 120px;
    font-family: inherit; color: var(--md-sys-color-on-surface);
}
.form-group textarea:focus {
    outline: none; border-bottom: 2px solid var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-variant);
}

.form-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 8px 24px 24px 24px;
    flex-shrink: 0;
}

.btn {
    padding: 10px 24px; border: none; border-radius: 20px;
    font-size: 14px;
    line-height: 20px; font-weight: 500;
    cursor: pointer; transition: background-color 0.2s ease, box-shadow 0.2s ease;
    text-transform: none;
}

.btn-cancel {
    background-color: transparent; color: var(--md-sys-color-primary);
}
.btn-cancel:hover { background-color: var(--md-sys-color-primary-container); opacity: 0.08; }

.btn-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-level0);
}
.btn-primary:hover { box-shadow: var(--md-sys-elevation-level1); filter: brightness(0.9); }

.btn-scan-primary {
    background-color: var(--md-sys-color-on-background);
    color: var(--md-sys-color-background);
}
.btn-scan-primary:hover {
    filter: brightness(1.2);
}


.btn-url-open {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    margin-left: 10px; font-size: 13px; padding: 6px 12px; flex-shrink: 0;
    border-radius: 16px;
}
.btn-url-open:hover { filter: brightness(0.9); }

.btn-delete-header, .btn-close-header, .btn-back-header {
    background: none; border: none; cursor: pointer; padding: 8px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
}
.btn-delete-header svg, .btn-close-header svg, .btn-back-header svg { width: 24px; height: 24px; fill: currentColor; }
.btn-delete-header:hover, .btn-close-header:hover, .btn-back-header:hover { background-color: rgba(0,0,0,0.04); }


/* Detail Page Specific Header */
.detail-page-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 4px 0 4px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    min-height: 64px;
    background-color: var(--md-sys-color-surface);
    position: sticky; top: 0; z-index: 100;
    flex-shrink: 0;
}
.detail-page-header h2 {
    font-size: 16px; line-height: 1.3; font-weight: 500;
    color: var(--md-sys-color-on-surface);
    text-align: left; flex-grow: 1; margin: 0 8px;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; max-height: calc(1.3em * 2 * 1.1);
}


.detail-header {
    display: flex; justify-content: space-between; align-items: center;
    margin: 0 16px; padding-top: 16px;
    padding-bottom: 0;
    margin-bottom: 24px;
}
.detail-header strong {
    font-weight: 500;
    margin-right: 8px;
    font-size: 14px;
    line-height: 20px;
    color: var(--md-sys-color-on-surface-variant);
}
.detail-expiry { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--md-sys-color-on-surface-variant);}
.detail-expiry .expiry-date-text.expiring-soon { color: var(--md-sys-color-error); font-weight: 500; }
.detail-expiry .expiry-date-text.expired { color: var(--md-sys-color-on-surface-variant); text-decoration: line-through; opacity: 0.7;}

.edit-date-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius:50%; display: inline-flex; align-items: center; justify-content: center;}
.edit-date-btn:hover { background-color: rgba(0,0,0,0.04); }
.edit-date-btn svg { width: 20px; height: 20px; fill: var(--md-sys-color-primary); }


.detail-content-wrapper {
    overflow-y: auto; padding: 16px;
    flex-grow: 1;
}
.detail-content-wrapper h3 {
    font-size: 14px; line-height: 20px; font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 16px;
    margin-bottom: 8px;
}
.detail-content-wrapper h3:first-of-type { margin-top: 0; }


.detail-extracted-info {
    background-color: var(--md-sys-color-surface);
    padding: 0; border-radius: 12px; margin-bottom: 16px;
}
.detail-extracted-info p {
    margin-bottom: 0; padding: 12px 16px; font-size: 16px;
    color: var(--md-sys-color-on-surface);
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.detail-extracted-info p:last-child { border-bottom: none; }
.detail-extracted-info strong { color: var(--md-sys-color-on-surface); font-weight: 500; display: inline-block; min-width: auto; margin-right: 8px; flex-shrink: 0;}
.detail-extracted-info span { color: var(--md-sys-color-on-surface-variant); flex-grow: 1; word-break: break-all;}
.detail-extracted-info .code-value {
    font-family: 'Roboto Mono', 'SF Mono', Consolas, Menlo, Courier, monospace;
    font-size: 16px; font-weight: 500; color: var(--md-sys-color-on-surface);
}

.prominent-code-section {
    margin-bottom: 16px;
}
.prominent-code-section h3 { margin-bottom: 4px; margin-top: 16px; }


.prominent-code-container {
    margin: 0; padding: 12px 16px; background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 12px;
    display: flex; justify-content: space-between;
    align-items: center;
}
.prominent-code-container > div { display: flex; align-items: baseline; flex-grow: 1; word-break: break-all; }

.prominent-code-text {
    font-family: 'Roboto Mono', 'SF Mono', Consolas, Menlo, Courier, monospace;
    font-size: 16px; font-weight: 500; color: var(--md-sys-color-on-surface);
    word-break: break-all; margin-right: 10px;
}
.copy-code-btn, .use-code-btn {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border: none; border-radius: 20px;
    padding: 8px 12px; cursor: pointer; font-size: 14px; display: flex;
    align-items: center; gap: 8px; flex-shrink: 0; font-weight: 500;
}
.copy-code-btn:hover, .use-code-btn:hover { filter: brightness(0.9); }
.copy-code-btn svg, .use-code-btn svg { width: 18px; height: 18px; fill: currentColor; }

.detail-full-content {
    padding: 16px; background-color: var(--md-sys-color-surface-variant);
    border-radius: 12px; white-space: pre-wrap; word-wrap: break-word;
    line-height: 1.5; font-size: 14px;
    color: var(--md-sys-color-on-surface-variant); margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
}
.detail-full-content a { color: var(--md-sys-color-primary); text-decoration: none; word-break: break-all; }
.detail-full-content a:hover { text-decoration: underline; }

.code-list { margin-top: 0; border: 1px solid var(--md-sys-color-outline); border-radius: 12px; overflow: hidden; background-color: var(--md-sys-color-surface);}

.code-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--md-sys-color-surface-variant);
    background-color: var(--md-sys-color-surface);
}
.code-item:last-child { border-bottom: none; }
.code-item.used .code-text { text-decoration: line-through; color: var(--md-sys-color-on-surface-variant); opacity: 0.7;}

.code-text {
    font-family: 'Roboto Mono', 'SF Mono', Consolas, Menlo, Courier, monospace;
    font-size: 14px; color: var(--md-sys-color-on-surface); word-break: break-all; margin-right: 8px;
    flex-grow: 1;
}

.code-status-toggle {
    width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--md-sys-color-outline);
    background-color: transparent; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: all 0.3s ease;
    flex-shrink: 0; margin-left: 8px;
}
.code-status-toggle.available {
    border-color: var(--md-sys-color-outline);
}
.code-status-toggle.available::after {
    content: '✓';
    color: var(--md-sys-color-outline);
    font-size: 14px;
    font-weight: bold;
    opacity: 0.6;
}
.code-status-toggle.used {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}
.code-status-toggle.used::after {
    content: '✓';
    color: var(--md-sys-color-on-primary);
    font-size: 14px;
    font-weight:bold;
    opacity: 1;
}

.empty-state { text-align: center; padding: 48px 24px; color: var(--md-sys-color-on-surface-variant); }
.empty-state p { font-size: 16px; /* M3 Body Large */ }

input[type="date"] {
    padding: 10px 12px; border: 1px solid var(--md-sys-color-outline); border-radius: 4px;
    font-size: 16px; font-family: inherit; line-height: 24px; color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-surface-variant);
}
input[type="date"]:focus { outline: none; border-color: var(--md-sys-color-primary); }

.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: 14px 16px; border-radius: 4px;
    font-size: 14px;
    z-index: 3000; opacity: 0;
    transition: opacity 0.2s ease, bottom 0.2s ease, transform 0.2s ease;
    box-shadow: var(--md-sys-elevation-level3);
    min-width: 288px; max-width: 500px;
    display: flex; justify-content: space-between; align-items: center;
}
.toast.show {
    opacity: 1;
    bottom: 24px;
}
/* Adjust toast position if FAB and/or bottom nav is visible */
body.on-main-page .toast.show {
    /* If bottom nav is visible, FAB is at 96px, toast above that */
    /* If only FAB is visible (no bottom nav), FAB is at 24px, toast above that */
    bottom: calc(var(--fab-bottom-position, 24px) + 56px + 16px); /* FAB_BOTTOM + FAB_HEIGHT + MARGIN */
}
:root { /* Define a variable for FAB's bottom position for easier adjustment */
    --fab-bottom-position: 24px;
}
body.on-main-page:has(#bottom-nav-bar[style*="display: flex"]) {
    --fab-bottom-position: 96px; /* Update if bottom nav is shown */
}


body.on-scan-page .toast.show { /* Ensure toast is above scan modal content */
    bottom: 24px !important; /* Override other rules if needed */
    z-index: 2001 !important; /* Higher than modal content */
}


.toast-message { flex-grow: 1; }
.toast-action {
    color: var(--md-sys-color-inverse-primary);
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 16px;
    background: none; border: none; padding: 0;
}
.detail-page-delete-cta {
    padding: 16px 16px 0;
    background-color: var(--md-sys-color-surface);
    border-top: 1px solid var(--md-sys-color-surface-variant);
    flex-shrink: 0;
}
.btn-delete-cta {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    width: 100%;
}
.btn-delete-cta:hover {
    background-color: #93000A;
}

#giga-scanner-ui p,
#giga-ocr-status { /* Removed #giga-ocr-result-container p for now */
    text-align: left;
}
#giga-ocr-result-container {
    display: flex; /* Use flex to align items in a row */
    align-items: center; /* Vertically align items */
    justify-content: space-between; /* Space between input and button */
    margin-top: 8px;
}
#giga-ocr-result-text {
    flex-grow: 1; /* Input takes available space */
    margin-right: 8px; /* Space before button */
    text-align: left; /* Align text inside input to the left */
}


#video-container {
    height: 200px; /* Increased height */
    max-width: 320px; /* Maintained max-width */
}
#scan-overlay {
    top: 37.5%; /* Adjusted for new height, to keep it centered */
    height: 25%; /* Maintained relative height */
    left: 15%; /* Narrower overlay */
    right: 15%; /* Narrower overlay */
}

.rec-card-link {
    text-decoration: none;
    color: inherit; /* Inherit text color from parent */
    display: block; /* Make the link a block to wrap the card */
    border-radius: 12px; /* Match card's border-radius if any */
}

.rec-card-link:hover .rec-card {
    /* Optional: Add a hover effect to the card when the link is hovered */
    box-shadow: var(--md-sys-elevation-level2); /* Example hover effect */
}

.open-in-new-icon {
    font-size: 1em; /* Adjust size as needed */
    vertical-align: middle; /* Align with text */
    margin-left: 4px; /* Space from text */
    color: var(--md-sys-color-primary); /* Or your preferred icon color */
}
/* In your CSS file, e.g., css/style.css */
.gacha-child-prize-list {
    margin-bottom: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 0;
}

.gacha-child-prize-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

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

.gacha-child-prize-item:hover {
    background-color: var(--md-sys-color-surface-container-hover);
}

.gacha-child-prize-name {
    flex-grow: 1;
    font-weight: 500;
    font-size: 12px;
    color: var(--md-sys-color-on-surface);
}

.gacha-child-prize-expiry {
    font-size: 0.85em;
    color: var(--md-sys-color-on-surface-variant);
    margin-left: 15px;
    white-space: nowrap;
}

.gacha-child-prize-expiry.expired {
    color: var(--md-sys-color-error);
    text-decoration: line-through;
}
.gacha-child-prize-expiry.expiring-soon {
    color: var(--md-sys-color-warning); /* Or your theme's warning color */
}

.gacha-child-prize-item .material-symbols-outlined {
    color: var(--md-sys-color-on-surface-variant);
}

/* About App Modal Styles (Moved from index.html and themed) */
#aboutAppModal .modal-content {
    /* Inherits general .modal-content styles for base structure */
    /* background-color: var(--md-sys-color-surface); Already set by .modal-content */
    /* padding: 20px; General .modal-content has padding:0, header/body have specific padding */
    /* border-radius: 28px; Already set by .modal-content */
    /* box-shadow: var(--md-sys-elevation-level2); Already set by .modal-content */
    width: 90%; /* Overrides general modal width for this specific modal if needed */
    max-width: 600px; /* Specific max-width for about modal */
    max-height: 85vh; /* Max height for about modal content */
    /* display: flex; Already set by .modal-content */
    /* flex-direction: column; Already set by .modal-content */
}

/* .modal-header is already styled globally, these are minor adjustments if needed or can be merged */
#aboutAppModal .modal-header {
    /* display: flex; justify-content: space-between; align-items: center; Already set by .modal-header */
    padding: 16px 24px; /* Consistent with other modal headers */
    margin-bottom: 0; /* Remove extra margin if padding is sufficient */
}

#aboutAppModal .modal-body {
    padding: 0 24px 24px 24px; /* Add padding to the body content */
    overflow-y: auto;
    color: var(--md-sys-color-on-surface-variant); /* Default text color for the body */

}
#aboutAppModal .modal-body h3 {
    margin-top: 24px; /* More space above headings */
    margin-bottom: 12px; /* Space below headings */
    font-size: 1.15em; /* Slightly larger */
    font-weight: 500;
    color: var(--md-sys-color-on-surface); /* Headings more prominent */
}

#aboutAppModal .modal-body p {
    margin-bottom: 18px; /* Generous space between paragraphs */
    line-height: 1.65; /* Improve readability */
}

#aboutAppModal .modal-body p strong,
#aboutAppModal .modal-body li strong {
    color: var(--md-sys-color-on-surface); /* Make strong text stand out */
    font-weight: 500;
}

#aboutAppModal .modal-body ul {
    margin-bottom: 18px;
    padding-left: 24px; /* Standard list indentation */
}

#aboutAppModal .modal-body li {
    margin-bottom: 10px; /* Space between list items */
    line-height: 1.6;
}

#aboutAppModal .modal-body ul ul { /* Nested lists */
    margin-top: 8px;
    margin-bottom: 8px;
}

@media (max-width: 480px) {
    .page-container { max-width: 100%; padding-bottom: 0; }
    /* .voucher-list-wrapper { padding-bottom: 80px; } Removed, handled by FAB positioning */
    .bottom-nav { display: flex; }
    /* .extended-fab { right: 16px; bottom: 96px; } Old FAB */
    .split-fab-container {
      right: 16px;
      /* bottom: 96px; This will be set by JS or :has if bottom-nav is visible */
    }
    body.on-main-page .split-fab-container {
        bottom: var(--fab-bottom-position, 96px); /* Default to higher if bottom nav exists */
    }


    .modal { padding: 0; align-items: flex-start; }
    .modal-content { margin: 5vh auto 0 auto; width: 90%; border-radius: 28px; max-height: 90vh; }
    .detail-content-wrapper { max-height: calc(90vh - 56px - 57px - 73px); }
    .header .app-logo-container { text-align: left; margin-left: 0; }
    .header h1#header-title-text { text-align: left; margin-left: 8px;}

    .menu-btn { font-size: 26px; }

    .toast.show {
        width: calc(100% - 32px);
        left: 16px;
        transform: translateX(0);
    }
    /* body.on-main-page .toast.show {
        bottom: 160px !important;
    } */ /* Replaced by dynamic calculation */
}
@media (min-width: 481px) {
    .bottom-nav { display: none; }
    /* .extended-fab { right: 24px; bottom: 24px; } Old FAB */
    .split-fab-container {
        right: 24px;
        bottom: 24px; /* Default for larger screens */
    }
    /* body.on-main-page .toast.show {
        bottom: 88px !important;
    } */ /* Replaced by dynamic calculation */
}
