/* CSS Custom Properties */
:root {
    color-scheme: light;
    --accent: #f09819;
    --accent-soft: rgba(240, 152, 25, 0.14);
    --surface: rgba(255, 255, 255, 0.72);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --surface-border: rgba(93, 62, 18, 0.14);
    --text-primary: #24201a;
    --text-secondary: rgba(36, 32, 26, 0.68);
    --app-background: linear-gradient(180deg, #fff7bd 0%, #ffd16b 48%, #f2a23a 100%) no-repeat fixed;
    --app-background-color: #f2a23a;
    --button-text: #24201a;
    --panel-header: rgba(255, 246, 214, 0.88);
    --panel-item: rgba(255, 255, 255, 0.46);
    --panel-item-hover: rgba(255, 248, 224, 0.76);
    --control-surface: rgba(255, 255, 255, 0.9);
    --modal-surface: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --footer-surface: rgba(255, 248, 212, 0.72);
    --primary-gradient: linear-gradient(135deg, #ffcf54 0%, #f09819 100%);
    --toolbar-gradient: linear-gradient(135deg, #fff4bf 0%, #ffd164 100%);
    --button-gradient: linear-gradient(135deg, #fff4bf 0%, #f5aa2b 100%);
    --dark-gradient: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.95) 100%);
    --focus-ring: 0 0 0 3px rgba(240, 152, 25, 0.4);
    --shadow-sm: 0 2px 8px rgba(52, 36, 8, 0.08);
    --shadow-md: 0 8px 22px rgba(52, 36, 8, 0.14);
    --shadow-lg: 0 18px 44px rgba(52, 36, 8, 0.2);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --footer-height: 24px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --accent: #ffad3d;
    --accent-soft: rgba(255, 173, 61, 0.18);
    --surface: rgba(34, 29, 23, 0.78);
    --surface-strong: rgba(28, 24, 19, 0.96);
    --surface-border: rgba(255, 173, 61, 0.24);
    --text-primary: #f7efe3;
    --text-secondary: rgba(247, 239, 227, 0.68);
    --app-background: linear-gradient(180deg, #14110d 0%, #251a12 50%, #4a250f 100%) no-repeat fixed;
    --app-background-color: #14110d;
    --button-text: #20160f;
    --panel-header: rgba(43, 35, 27, 0.94);
    --panel-item: rgba(255, 255, 255, 0.06);
    --panel-item-hover: rgba(255, 173, 61, 0.12);
    --control-surface: rgba(20, 17, 13, 0.92);
    --modal-surface: linear-gradient(135deg, #201a14 0%, #15110d 100%);
    --footer-surface: rgba(20, 17, 13, 0.78);
    --primary-gradient: linear-gradient(135deg, #ffbf4f 0%, #f09819 100%);
    --toolbar-gradient: linear-gradient(135deg, #2a2118 0%, #5c3213 100%);
    --button-gradient: linear-gradient(135deg, #ffbf4f 0%, #f09819 100%);
    --dark-gradient: linear-gradient(135deg, rgba(10, 9, 8, 0.88) 0%, rgba(10, 9, 8, 0.97) 100%);
    --focus-ring: 0 0 0 3px rgba(255, 173, 61, 0.44);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.46);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html {
    height: 100%;
    overflow-x: hidden;
    overscroll-behavior: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
    color: var(--text-primary);
    background: var(--app-background);
    background-color: var(--app-background-color);
    min-height: 100vh;
    margin: 0;
    padding: 0 0 calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: hidden;
}

main {
    max-width: 900px;
    margin: auto;
    padding: 0.5rem;
    text-align: center;
}

.button {
    margin: 5px;
    padding: 12px;
    text-align: center;
    background-size: 200% auto;
    color: var(--button-text);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background-position var(--transition-normal), box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    background-image: var(--button-gradient);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    box-shadow: var(--shadow-sm);
    min-width: 70px;
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.button::before {
    content: none;
}

.button:hover::before {
    left: auto;
}

.button:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.button:hover {
    background-position: right center;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: rgba(93, 62, 18, 0.18);
}

.button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

a:focus-visible,
input:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.button:disabled:hover {
    transform: none;
    box-shadow: none;
}

input {
    margin: 5px;
    padding: 10px;
    appearance: none;
    max-width: 100%;
    font-size: 0.75rem;
    box-sizing: border-box;
    text-align: center;
    border-radius: 10px;
    opacity: 0.9;
    background-color: var(--control-surface);
    color: var(--text-primary);
}

.rotate {
    /* Position and transform set by JavaScript maximizeRotatedImage() */
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    display: block !important;
    visibility: visible !important;
}

/* Rotated state is handled purely by JavaScript inline styles (DirkJan pattern) */

.normal {
    transform: rotate(0deg);
    width: 100%;
    max-width: 900px;
    height: auto;
    display: block;
    margin: 0 auto;
    cursor: pointer;
    pointer-events: auto;
}

#comic-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    transition: all 0.3s ease;
}

#comic {
    transition: transform 0.5s ease-out, opacity 0.4s ease-out;
    opacity: 1;
    cursor: pointer;
    position: relative;
    transform: translateX(0);
    transform-origin: center center;
}

#comic.dissolve {
    opacity: 0;
}

#comic.no-transition {
    transition: none !important;
}

/* Outgoing comic clone for pixelation morph - sits on top and pixelates away */
.comic-pixelate-outgoing {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 900px;
    height: auto;
    pointer-events: none;
    z-index: 2;
    transform-origin: center center;
    transition: filter 0.6s ease-in-out, opacity 0.6s ease-in-out;
    filter: blur(0px);
    opacity: 1;
}

.comic-pixelate-outgoing.morph-out {
    filter: blur(20px);
    opacity: 0;
}

/* Incoming comic starts blurred, then sharpens */
#comic.morph-in {
    filter: blur(20px);
    opacity: 0.5;
}

#comic.morph-resolve {
    transition: filter 0.6s ease-in-out, opacity 0.6s ease-in-out;
    filter: blur(0px);
    opacity: 1;
}

/* Outgoing comic clone for filmstrip effect */
.comic-outgoing {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 900px;
    height: auto;
    transition: transform 0.5s ease-out;
    pointer-events: none;
    z-index: 2;
}

/* Slide animations - no opacity fade, just movement */
#comic.slide-out-left,
.comic-outgoing.slide-out-left {
    transform: translateX(calc(-100% - 20px));
}

#comic.slide-out-right,
.comic-outgoing.slide-out-right {
    transform: translateX(calc(100% + 20px));
}

#comic.slide-in-left {
    transform: translateX(calc(100% + 20px));
}

#comic.slide-in-right {
    transform: translateX(calc(-100% - 20px));
}

.fullscreen-landscape {
    max-height: 95vh;
    max-width: 95vw;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
    border-radius: 4px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    z-index: 10001;
    cursor: pointer;
    pointer-events: auto;
}

/* Fullscreen overlay */
#comic-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

/* Fullscreen toolbar styles */
.fullscreen-toolbar {
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 16px;
    margin: 0;
    width: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                0 4px 12px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    position: fixed;
    z-index: 10002;
}

.fullscreen-toolbar .toolbar-button {
    width: 48px;
    height: 48px;
    margin: 0;
    border-radius: 14px;
}

.fullscreen-toolbar .toolbar-svg {
    width: 24px;
    height: 24px;
}

/* Rotated toolbar (portrait mode with 90° rotation) */
.fullscreen-toolbar.rotated {
    flex-direction: column;
    padding: 16px 10px;
    max-height: 80vh;
    max-width: 70px;
    top: 50%;
    left: 20px;
    bottom: auto;
    transform: translateY(-50%);
    gap: 10px;
}

.fullscreen-toolbar.rotated .toolbar-button {
    margin: 0;
}

#rotated-comic {
    margin: 0 !important;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    opacity: 1;
}

#rotated-comic.dissolve {
    opacity: 0;
}

/* Slide animations for rotated comics (with 90deg rotation) */
#rotated-comic.rotate.slide-out-left,
.rotated-comic-outgoing.rotate.slide-out-left {
    transform: translate(-50%, calc(-50% - 100vh - 20px)) rotate(90deg) !important;
}

#rotated-comic.rotate.slide-out-right,
.rotated-comic-outgoing.rotate.slide-out-right {
    transform: translate(-50%, calc(-50% + 100vh + 20px)) rotate(90deg) !important;
}

#rotated-comic.rotate.slide-in-left {
    transform: translate(-50%, calc(-50% + 100vh + 20px)) rotate(90deg) !important;
}

#rotated-comic.rotate.slide-in-right {
    transform: translate(-50%, calc(-50% - 100vh - 20px)) rotate(90deg) !important;
}

/* Slide animations for landscape fullscreen (no rotation) */
#rotated-comic.fullscreen-landscape.slide-out-left,
.rotated-comic-outgoing.fullscreen-landscape.slide-out-left {
    transform: translate(calc(-50% - 100vw - 20px), -50%) !important;
}

#rotated-comic.fullscreen-landscape.slide-out-right,
.rotated-comic-outgoing.fullscreen-landscape.slide-out-right {
    transform: translate(calc(-50% + 100vw + 20px), -50%) !important;
}

#rotated-comic.fullscreen-landscape.slide-in-left {
    transform: translate(calc(-50% + 100vw + 20px), -50%) !important;
}

#rotated-comic.fullscreen-landscape.slide-in-right {
    transform: translate(calc(-50% - 100vw - 20px), -50%) !important;
}

/* Outgoing rotated comic clone for filmstrip effect */
.rotated-comic-outgoing {
    pointer-events: none;
}

/* Blur morph for rotated comic */
.rotated-comic-morph-outgoing {
    pointer-events: none;
    transition: filter 0.6s ease-in-out, opacity 0.6s ease-in-out !important;
    filter: blur(0px);
    opacity: 1;
}

.rotated-comic-morph-outgoing.morph-out {
    filter: blur(15px);
    opacity: 0 !important;
}

#rotated-comic.fullscreen-landscape {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Rotate SVG icons in rotated toolbar */
.fullscreen-toolbar.rotated .toolbar-button:nth-child(1) .toolbar-svg,
.fullscreen-toolbar.rotated .toolbar-button:nth-child(2) .toolbar-svg,
.fullscreen-toolbar.rotated .toolbar-button:nth-child(5) .toolbar-svg {
    transform: rotate(90deg);
}

.fullscreen-toolbar.rotated .toolbar-button:nth-child(3) .toolbar-svg,
.fullscreen-toolbar.rotated .toolbar-button:nth-child(4) .toolbar-svg,
.fullscreen-toolbar.rotated .toolbar-button:nth-child(6) .toolbar-svg,
.fullscreen-toolbar.rotated .toolbar-button:nth-child(7) .toolbar-svg {
    transform: rotate(-90deg);
}

.fullscreen-toolbar:not(.rotated) .toolbar-svg {
    transform: none;
}

/* Landscape toolbar (device rotated to landscape) */
.fullscreen-toolbar.landscape-toolbar {
    flex-direction: row;
    padding: 10px 15px;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    max-width: 90vw;
    gap: 8px;
}

.fullscreen-toolbar.landscape-toolbar .toolbar-button {
    margin: 0;
}

.fullscreen-toolbar.landscape-toolbar .toolbar-svg {
    transform: none;
}

/* Date picker styling */
.date-input-container {
    position: relative;
    margin: 5px;
    border-radius: 10px;
    background-image: linear-gradient(45deg, #fff7bd 0%, #f09819 51%, #fff7bd 100%);
    background-size: 200% auto;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-slow);
    overflow: hidden;
}

.date-input-container:hover {
    background-position: right center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.date-center-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

input[type="date"] {
    width: auto;
    height: 42px;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 500;
    background: transparent;
    border: none;
    color: black;
    text-align: center;
    appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

input[type="date"]::-webkit-datetime-edit {
    width: 100%;
    text-align: center;
}

@media (max-width: 768px) {
    input[type="date"] {
        opacity: 0;
    }

    .date-center-wrapper {
        position: relative;
    }

    .date-center-wrapper::before {
        content: attr(data-display-date);
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: 500;
        pointer-events: none;
    }
}

.logo {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 0;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.logo img {
    max-width: min(84vw, 760px);
    margin: 12px auto 0;
    display: block;
}

#comic-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 58px auto 0;
    padding: 12px 0 10px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

#comic-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    background: var(--app-background);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.settings-footer {
    padding: 10px 15px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

#settingsDIV {
    margin-top: 25px;
    padding: 0 8px;
}

.hidden-during-fullscreen {
    display: none !important;
}

.is-hidden {
    display: none;
}

#controls-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 900px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 12px 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.ad-support-slot {
    width: min(100% - 24px, 900px);
    min-height: 78px;
    margin: 0 auto 10px;
    padding: 8px 10px 10px;
    box-sizing: border-box;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow: var(--shadow-sm);
}

.ad-support-slot[hidden] {
    display: none !important;
}

.ad-support-label {
    margin: 0 0 5px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    line-height: 1;
    text-align: center;
}

.ad-support-frame,
.ad-support-ad {
    min-height: 50px;
    overflow: hidden;
}

.ad-placeholder-preview {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 14px;
    box-sizing: border-box;
    border: 1px dashed rgba(240, 152, 25, 0.45);
    border-radius: 7px;
    background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--surface-strong) 70%, transparent));
    color: var(--text-primary);
}

.ad-placeholder-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ad-placeholder-copy strong {
    font-size: 0.84rem;
    line-height: 1.2;
}

.ad-placeholder-copy span {
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.25;
}

.ad-placeholder-badge {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--control-surface);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}

#installBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    margin: 0;
    max-width: 150px;
    z-index: 1000;
    display: none;
}


.vertical {
    max-height: 300px;
    width: auto;
    margin: 0 auto;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.thumbnail-container {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

.thumbnail-notice {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(238, 226, 57, 0.8);
    color: black;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    border-radius: 0 0 10px 10px;
}

.fullscreen-vertical {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto !important;
    max-height: 95vh !important;
    max-width: 95vw !important;
    height: auto !important;
    object-fit: contain;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ========================================
   DRAGGABLE TOOLBAR
   ======================================== */

.toolbar {
    position: fixed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    width: min(92%, 740px);
    max-width: min(92%, 740px);
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--surface-border);
    z-index: 100;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    backdrop-filter: blur(16px) saturate(1.1);
    box-sizing: border-box;
}

.toolbar:active {
    cursor: grabbing;
}

.toolbar-button {
    background: rgba(255, 255, 255, 0.78);
    background-size: 100% auto;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    width: 46px;
    height: 46px;
    min-width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
    box-shadow: 0 1px 4px rgba(52, 36, 8, 0.08);
    position: relative;
    overflow: hidden;
    will-change: transform, background-position;
    flex-shrink: 0;
}

.toolbar-button::before {
    content: none;
}

.toolbar-button:hover::before {
    left: auto;
}

.toolbar-button:hover {
    transform: translateY(-1px);
    background: #fff7d7;
    box-shadow: 0 4px 12px rgba(52, 36, 8, 0.14);
    border-color: rgba(240, 152, 25, 0.28);
}

/* Active toggle state for toolbar buttons. */
.toolbar-button[aria-pressed="true"] {
    background: #2f261b;
    border-color: rgba(240, 152, 25, 0.55);
    box-shadow: 0 0 0 2px rgba(240, 152, 25, 0.22), 0 4px 12px rgba(52, 36, 8, 0.16);
    color: var(--accent);
    transform: none;
}

.toolbar-button[aria-pressed="true"]:hover {
    box-shadow: 0 0 0 2px rgba(240, 152, 25, 0.32), 0 6px 16px rgba(52, 36, 8, 0.18);
    transform: none;
}

/* Force the SVG strokes/fills to inherit the orange accent color */
.toolbar-button[aria-pressed="true"] svg,
.toolbar-button[aria-pressed="true"] svg * {
    stroke: #f09819;
    fill: none;
}

#Shuffle[aria-pressed="true"] {
    background: #2f261b;
    border-color: rgba(240, 152, 25, 0.55);
    box-shadow: 0 0 0 2px rgba(240, 152, 25, 0.22), 0 4px 12px rgba(52, 36, 8, 0.16);
    color: var(--accent);
    transform: none;
}

#Shuffle[aria-pressed="true"]:hover {
    box-shadow: 0 0 0 2px rgba(240, 152, 25, 0.32), 0 6px 16px rgba(52, 36, 8, 0.18);
    transform: none;
}

#Shuffle[aria-pressed="true"]:focus-visible,
#Shuffle[aria-pressed="true"]:active {
    transform: none;
}

#Shuffle[aria-pressed="true"] svg,
#Shuffle[aria-pressed="true"] svg * {
    stroke: #f09819;
    fill: none;
}

#Shuffle[aria-pressed="false"] {
    background: rgba(255, 255, 255, 0.72);
    background-size: 100% auto;
    border-color: rgba(93, 62, 18, 0.12);
    box-shadow: none;
    color: #333;
    transform: none;
}

#Shuffle[aria-pressed="false"]:focus-visible {
    outline: 3px solid rgba(240, 152, 25, 0.4);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
    transform: none;
}

#Shuffle[aria-pressed="false"] svg,
#Shuffle[aria-pressed="false"] svg * {
    stroke: #333;
    fill: none;
}

.toolbar-button:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(52, 36, 8, 0.12);
    background: #ffe6a4;
}

.toolbar-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    transform: none;
}

.toolbar-button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: none;
    border: 1px solid rgba(93, 62, 18, 0.08);
}

.toolbar-button:disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: none;
    border: 1px solid rgba(93, 62, 18, 0.08);
}

.toolbar-button:disabled::before {
    display: none;
}

.toolbar-svg {
    width: 22px;
    height: 22px;
    filter: none;
    color: #333;
    stroke: #333;
    fill: none;
    display: block;
}

.toolbar-svg path,
.toolbar-svg polyline,
.toolbar-svg line,
.toolbar-svg circle,
.toolbar-svg rect {
    stroke: #333;
    color: #333;
}

.toolbar-svg circle[fill="currentColor"],
.toolbar-svg rect[fill="currentColor"],
.toolbar-svg path[fill="currentColor"] {
    fill: #333;
}

/* Tooltip styling for toolbar buttons */
.toolbar-button[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease-out 0.5s forwards;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Hidden date picker for toolbar */
#DatePicker {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* ========================================
   MODERN SETTINGS PANEL
   ======================================== */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-strong);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    width: 320px;
    max-width: 90vw;
    max-height: calc(100vh - 24px);
    display: none;
    flex-direction: column;
    border: 1px solid var(--surface-border);
    overflow: hidden;
    transition: none;
}

.settings-panel.visible {
    display: flex;
}

.settings-panel.visible.animate {
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.settings-header {
    background: var(--panel-header);
    padding: 12px 16px;
    margin: -5px -5px 0 -5px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-user-select: none;
    user-select: none;
    border-bottom: 1px solid var(--surface-border);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: none;
    flex-shrink: 0;
}

.settings-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: none;
}

.settings-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.settings-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: none;
}

.settings-content {
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    min-height: 48px;
    box-sizing: border-box;
    flex-shrink: 0;
    background: var(--panel-item);
    border: 1px solid rgba(93, 62, 18, 0.08);
    border-radius: 8px;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.setting-item:hover {
    background: var(--panel-item-hover);
    border-color: rgba(240, 152, 25, 0.18);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
    accent-color: #F09819;
    margin: 0;
    flex-shrink: 0;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    appearance: checkbox;
    position: static;
}

/* Override legacy checkbox styling for settings panel */
.setting-item input[type="checkbox"]::before,
.setting-item input[type="checkbox"]::after {
    content: none !important;
    display: none !important;
}

.setting-item label {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    line-height: 18px;
    display: flex;
    align-items: center;
}

.setting-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(240, 152, 25, 0.3), transparent);
    margin: 4px 0;
    flex-shrink: 0;
}

.setting-item-select {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.setting-item-select .labels {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex: none;
}

.source-select {
    width: 100%;
    padding: 8px 12px;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
    border: 1px solid rgba(240, 152, 25, 0.4);
    border-radius: 8px;
    background: var(--control-surface);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-appearance: auto;
    appearance: auto;
    accent-color: #F09819;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-footer {
    flex-shrink: 0;
}

.source-select:focus {
    outline: none;
    border-color: #F09819;
    box-shadow: 0 0 0 3px rgba(240, 152, 25, 0.2);
}

.source-select:hover {
    border-color: #F09819;
}

.setting-backup {
    flex-direction: column;
    gap: 10px;
    padding: 10px 10px;
    background: rgba(240, 152, 25, 0.08);
}

.backup-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
    flex-shrink: 0;
    background: var(--primary-gradient);
    background-size: 200% auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--button-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.backup-button:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(240, 152, 25, 0.3);
}

.backup-button:active {
    transform: translateY(0);
}

.backup-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.backup-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background: #ccc;
    color: #888;
}

.hidden-file-input {
    display: none;
}

/* ========================================
   GOOGLE DRIVE SYNC
   ======================================== */
.setting-google-sync {
    flex-direction: column;
    gap: 10px;
    padding: 10px 10px;
    background: rgba(66, 133, 244, 0.06);
}

.google-sync-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
}

.google-sync-desc {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    width: 100%;
}

.google-signin-btn {
    background: white !important;
    border: 1px solid #dadce0 !important;
    color: #3c4043 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.google-signin-btn:hover {
    background: #f8f9fa !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.google-signin-btn svg {
    flex-shrink: 0;
}

.google-signout-btn {
    background: rgba(240, 152, 25, 0.15) !important;
    justify-content: center;
    gap: 6px;
}

.google-signout-label {
    font-size: 12px;
    color: #888;
    font-weight: 400;
}

:root[data-theme="dark"] .settings-close,
:root[data-theme="dark"] .donation-close {
    background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .settings-close:hover,
:root[data-theme="dark"] .donation-close:hover {
    background: rgba(255, 173, 61, 0.2);
}

:root[data-theme="dark"] .setting-google-sync {
    background: rgba(66, 133, 244, 0.12);
}

:root[data-theme="dark"] .google-signin-btn {
    background: #211b15 !important;
    border-color: rgba(255, 173, 61, 0.22) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] .google-signin-btn:hover {
    background: #2a2118 !important;
}

:root[data-theme="dark"] .google-signout-label {
    color: var(--text-secondary);
}

:root[data-theme="dark"] .top10-entry:hover {
    background: rgba(255, 173, 61, 0.12);
}

:root[data-theme="dark"] .top10-entry:active {
    background: rgba(255, 173, 61, 0.2);
}

:root[data-theme="dark"] .top10-thumb-placeholder {
    color: var(--text-secondary);
}

/* ========================================
   ICON BUTTONS CONTAINER
   ======================================== */
.settings-icons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    backdrop-filter: blur(12px) saturate(1.1);
}

.icon-button {
    background: rgba(255, 255, 255, 0.72);
    background-size: 100% auto;
    border: 1px solid rgba(93, 62, 18, 0.12);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.icon-button::before {
    content: none;
}

.icon-button:hover::before {
    left: auto;
}

.icon-button:hover {
    transform: translateY(-1px);
    background: #fff7d7;
    box-shadow: 0 4px 12px rgba(52, 36, 8, 0.12);
    border: 1px solid rgba(240, 152, 25, 0.22);
}

.icon-button:active {
    transform: translateY(0);
}

/* Disable sticky :active state on touch devices */
@media (hover: none) and (pointer: coarse) {
    .icon-button:active {
        transform: none;
    }

    /* Explicit touch active state that we control via JS */
    .icon-button.touch-active {
        transform: translateY(0);
        transition: transform 0.1s ease;
    }
}

.icon-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

#favheart[aria-pressed="true"],
#favheart[aria-pressed="false"] {
    background: var(--primary-gradient);
    background-size: 200% auto;
    background-position: left center;
    border-color: rgba(255, 255, 255, 0.36);
    box-shadow: 0 2px 8px rgba(240, 152, 25, 0.2);
    color: #333;
    transform: none;
}

#favheart[aria-pressed="true"]:hover,
#favheart[aria-pressed="false"]:hover,
#favheart[aria-pressed="true"]:active,
#favheart[aria-pressed="false"]:active,
#favheart[aria-pressed="true"].touch-active,
#favheart[aria-pressed="false"].touch-active {
    background-position: left center;
    box-shadow: 0 2px 8px rgba(240, 152, 25, 0.2);
    border-color: rgba(255, 255, 255, 0.36);
    transform: none;
}

#favheart[aria-pressed="true"]:focus-visible,
#favheart[aria-pressed="false"]:focus-visible {
    background-position: left center;
    box-shadow: var(--focus-ring);
    transform: none;
}

.icon-button svg {
    width: 22px;
    height: 22px;
    filter: none;
    color: #333;
    stroke: #333;
}

.icon-button svg path,
.icon-button svg polyline,
.icon-button svg line,
.icon-button svg circle,
.icon-button svg rect {
    stroke: #333;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #comic-container {
        margin-top: 62px;
    }

    .toolbar {
        width: min(94%, 740px);
        max-width: min(94%, 740px);
        padding: 7px 8px;
        gap: 6px;
        border-radius: 14px;
        left: 10px;
        transform: none;
    }

    .toolbar-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 12px;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        outline: none;
        transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
    }

    .toolbar-button:active {
        transform: translateY(0);
        background-position: right center;
        box-shadow: inset 0 2px 4px rgba(52, 36, 8, 0.12);
        transition: transform 0.1s ease;
    }

    .toolbar-button:focus-visible {
        outline: none;
        transform: none;
    }

    .toolbar-svg {
        width: 22px;
        height: 22px;
    }

    /* Touch device specific - reset hover on pure touch */
    @media (hover: none) and (pointer: coarse) {
        .toolbar-button:hover {
            transform: none;
            background-position: left center;
        }

        /* Disable sticky :active state */
        .toolbar-button:active {
            transform: none;
        }

        /* Explicit touch active state controlled via JS */
        .toolbar-button.touch-active {
            transform: translateY(0);
            background-position: right center;
            box-shadow: inset 0 2px 4px rgba(52, 36, 8, 0.12);
            transition: transform 0.1s ease;
        }
    }

    .settings-panel {
        width: 280px;
    }

    .settings-icons-container {
        gap: 8px;
    }

    .ad-support-slot {
        width: min(100% - 20px, 728px);
        min-height: 68px;
        margin-bottom: 8px;
        padding: 7px 8px 8px;
    }

    .ad-placeholder-preview {
        min-height: 50px;
        padding: 9px 10px;
        gap: 10px;
    }

    .icon-button {
        width: 44px;
        height: 44px;
    }

    .icon-button svg {
        width: 22px;
        height: 22px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    #comic-container {
        margin-top: 58px;
    }

    .toolbar {
        width: min(95%, 900px);
        max-width: min(95%, 900px);
        padding: 6px 6px;
        gap: 4px;
        left: 8px;
    }

    .toolbar-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 12px;
    }

    .toolbar-svg {
        width: 20px;
        height: 20px;
    }

    .settings-panel {
        width: 260px;
    }

    .icon-button {
        width: 44px;
        height: 44px;
    }

    .icon-button svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 380px) {
    .toolbar {
        gap: 3px;
        padding: 6px 8px;
    }

    .toolbar-button,
    .toolbar-datepicker-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    .toolbar-svg {
        width: 19px;
        height: 19px;
    }
}

/* ========================================
   DONATION MODAL
   ======================================== */
.donation-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
}

.donation-backdrop.visible {
    display: block;
    animation: fadeInBackdrop 0.2s ease-out;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   TOP 10 LEADERBOARD MODAL
   ======================================== */

.top10-button svg {
    stroke: #f09819;
    fill: #f09819;
}

.top10-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--modal-surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 10px 30px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 10001;
    width: 380px;
    max-width: 95vw;
    max-height: 85vh;
    display: none;
    flex-direction: column;
    border: 2px solid rgba(240, 152, 25, 0.3);
    overflow: hidden;
}

.top10-modal.visible {
    display: flex;
    animation: fadeIn 0.15s ease-out;
}

.top10-header {
    background: var(--toolbar-gradient);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.top10-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.top10-list {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.top10-loading,
.top10-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.top10-empty p {
    margin: 0 0 12px;
}

.top10-retry-button {
    width: auto;
    min-width: 120px;
    justify-content: center;
}

.top10-entry {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    gap: 10px;
    text-align: left;
}

.top10-entry:hover {
    background: rgba(240, 152, 25, 0.12);
}

.top10-entry:active {
    background: rgba(240, 152, 25, 0.2);
}

.top10-entry:focus-visible,
.donation-close:focus-visible,
.top10-indicator-exit:focus-visible,
.top10-retry-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.top10-rank {
    width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.top10-thumb-wrap {
    width: 80px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--panel-item);
    display: flex;
    align-items: center;
    justify-content: center;
}

.top10-thumb-placeholder {
    color: #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top10-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top10-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.top10-date {
    font-weight: 500;
}

.top10-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: #e74c3c;
    font-size: 13px;
}

/* ── Top 10 Floating Indicator ──────────────────────────── */

.top10-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(40, 40, 40, 0.85) 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 200;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    animation: fadeIn 0.2s ease-out;
    white-space: nowrap;
}

.top10-indicator-rank {
    font-weight: 700;
    font-size: 16px;
}

.top10-indicator-label {
    font-weight: 500;
    opacity: 0.8;
}

.top10-indicator-count {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #e74c3c;
    font-weight: 600;
}

.top10-indicator-pos {
    opacity: 0.6;
    font-size: 12px;
}

.top10-indicator-exit {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.top10-indicator-exit:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
    .top10-modal {
        width: 95vw;
    }
    .top10-entry {
        padding: 6px 8px;
        gap: 8px;
        font-size: 13px;
    }
    .top10-thumb-wrap {
        width: 64px;
        height: 38px;
    }
    .top10-indicator {
        bottom: 12px;
        padding: 6px 12px;
        gap: 8px;
        font-size: 12px;
    }
}

@keyframes favHeartPop {
    0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    25%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    50%  { transform: translate(-50%, -50%) scale(0.95); opacity: 1; }
    70%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.fav-heart-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10003;
    pointer-events: none;
    animation: favHeartPop 0.8s ease-out forwards;
}

.fav-heart-overlay svg {
    width: 96px;
    height: 96px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.donation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--modal-surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 10px 30px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 10001;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    display: none;
    flex-direction: column;
    border: 2px solid rgba(240, 152, 25, 0.3);
    overflow: hidden;
}

.donation-modal.visible {
    display: flex;
    animation: fadeIn 0.15s ease-out;
}

.donation-header {
    background: var(--toolbar-gradient);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.donation-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.donation-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    box-sizing: border-box;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.donation-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.donation-message {
    margin: 0;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
    background: rgba(240, 152, 25, 0.06);
    border-bottom: 1px solid rgba(240, 152, 25, 0.1);
}

.donation-supporter {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(240, 152, 25, 0.04);
    border-bottom: 1px solid rgba(240, 152, 25, 0.1);
}

.donation-supporter-help {
    width: 100%;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.35;
    text-align: center;
}

.donation-supporter-code-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.donation-supporter-input {
    flex: 1 1 180px;
    min-width: 0;
    margin: 0;
    padding: 9px 10px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--control-surface);
    color: var(--text-primary);
    font-size: 0.78rem;
    text-align: left;
}

.donation-supporter-button {
    flex: 0 0 auto;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 9px 12px;
    background: var(--control-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.donation-supporter-button:hover {
    background: var(--panel-item-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.donation-supporter-status {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.3;
}

.donation-tabs {
    display: flex;
    padding: 0;
    background: #f0f0f0;
    flex-shrink: 0;
}

.donation-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    transition: all var(--transition-fast);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.donation-tab:hover {
    background: rgba(240, 152, 25, 0.1);
    color: #333;
}

.donation-tab.active {
    color: #333;
    background: white;
    border-bottom-color: #F09819;
}

.donation-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.donation-iframe {
    width: 100%;
    height: 480px;
    border: none;
}

.donation-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #666;
    font-size: 14px;
    z-index: 1;
}

.donation-stripe-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    text-align: center;
    color: #555;
    min-height: 200px;
}

.donation-stripe-overlay svg {
    color: #635bff;
}

.donation-stripe-overlay p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.donation-stripe-button {
    display: inline-block;
    padding: 14px 32px;
    background: #635bff;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.3);
}

.donation-stripe-button:hover {
    background: #4b45c6;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 91, 255, 0.4);
}

@media (max-width: 768px) {
    .donation-modal {
        width: 95vw;
        max-height: 85vh;
    }

    .donation-iframe {
        height: 400px;
    }

    .donation-tab {
        font-size: 12px;
        padding: 10px 6px;
    }
}

/* In-app notification toast */
.notification-toast {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + 16px);
    left: auto;
    transform: translateY(16px);
    background: rgba(45, 37, 27, 0.94);
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(52, 36, 8, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 11000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(360px, calc(100vw - 32px));
    width: auto;
    min-width: 0;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.notification-toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: #F09819;
}

.notification-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.notification-close svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .notification-toast {
        right: 12px;
        bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + 12px);
        padding: 10px 12px;
    }

    .notification-content {
        font-size: 13px;
    }
}

.update-banner {
    position: fixed;
    right: 16px;
    bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 11000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(380px, calc(100vw - 32px));
    padding: 12px 14px;
    color: #fff;
    background: rgba(45, 37, 27, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(52, 36, 8, 0.24);
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    backdrop-filter: blur(16px) saturate(1.1);
}

.update-banner p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.update-banner-button {
    margin: 0;
    min-width: 0;
    white-space: nowrap;
    padding: 9px 12px;
    border-radius: 8px;
}

@media (max-width: 480px) {
    .update-banner {
        right: 12px;
        bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + 12px);
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }
}

/* Copyright Footer */
.copyright-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 4px 10px env(safe-area-inset-bottom, 0px);
    line-height: 1.6;
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--footer-surface);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copyright-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.copyright-footer a:hover {
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}