:root {
    /* Light theme colors */
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --subtext-color: #8e8e93;
    --text-light: #8e8e93;
    --accent-color: #007aff;
    --card-bg: #ffffff;
    --card-border: #e5e5ea;
    --card-hover: #f5f5f7;
    --header-bg: linear-gradient(180deg, #e8f7f9 0%, #ffffff 100%);
    --icon-bg: #e8f7f9;
    --tagline-color: #17a2b8;
    --shadow-color: rgba(0, 0, 0, 0.04);
    --shadow-hover: rgba(0, 0, 0, 0.08);
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --modal-bg: #ffffff;
    --modal-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
    --badge-yellow: #FFD60A;
    --badge-green: #34C759;
    --badge-red: #FF3B30;
    --text-dark: #1a1a1a;

    /* Tab Bar Variables */
    --tabbar-height: 60px;
    --tabbar-bg: rgba(255, 255, 255, 0.85);
    /* Translucent */
    --tabbar-border: rgba(0, 0, 0, 0.1);
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-color: #000000;
    --text-color: #ffffff;
    --subtext-color: #aeaeb2;
    --text-light: #aeaeb2;
    --accent-color: #0a84ff;
    --card-bg: #1c1c1e;
    --card-border: #2c2c2e;
    --card-hover: #2c2c2e;
    --header-bg: linear-gradient(180deg, #1a1a1a 0%, #000000 100%);
    --icon-bg: #2c2c2e;
    --tagline-color: #64d2ff;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --modal-bg: #2c2c2e;
    --modal-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    --text-dark: #ffffff;

    /* Tab Bar Dark */
    --tabbar-bg: rgba(28, 28, 30, 0.85);
    --tabbar-border: rgba(255, 255, 255, 0.1);

    /* Make sure footer respects dark mode */
    footer {
        background-color: #1c1c1e;
        color: #ffffff;
        border-top: 1px solid #2c2c2e;
    }

    /* Improve button text and icon visibility */
    .memo-button {
        color: #ffffff;
    }

    .icon {
        stroke: #64d2ff;
    }

    .icon-wrapper {
        background: #3a3a3c;
    }

    /* Ensure all text in buttons is visible */
    .button-label {
        color: #ffffff;
    }

    /* Adjust placeholder buttons */
    .placeholder .icon {
        stroke: #8e8e93;
    }

    .badge {
        background-color: #3a3a3c;
        color: #8e8e93;
    }
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, fill 0.3s ease, stroke 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Icons', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg-color);
    color: var(--text-color);
    /* Prevent body scroll when fixed elements are used */
    overflow-x: hidden;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-color: #000000;
        --text-color: #ffffff;
        --subtext-color: #8e8e93;
        --accent-color: #0a84ff;
        --card-bg: #1c1c1e;
        --card-border: #2c2c2e;
        --card-hover: #2c2c2e;
        --header-bg: linear-gradient(180deg, #1a1a1a 0%, #000000 100%);
        --icon-bg: #2c2c2e;
        --tagline-color: #64d2ff;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --shadow-hover: rgba(0, 0, 0, 0.4);
        --overlay-bg: rgba(0, 0, 0, 0.7);
        --modal-bg: #2c2c2e;
        --modal-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);

        --tabbar-bg: rgba(28, 28, 30, 0.85);
        --tabbar-border: rgba(255, 255, 255, 0.1);
    }
}

/* MAIN CONTAINER */
.container {
    width: 100%;
    min-height: -webkit-fill-available;
    /* iOS PWA */
    min-height: 100svh;
    /* modern */
    background: var(--bg-color);
    /* Safe Area + TabBar padding */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px) env(safe-area-inset-left);
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

/* Fixed-header layout for profile/admin screens */
#profileScreen,
#adminScreen {
    padding: 0;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

#profileScreen .header,
#adminScreen .header {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    z-index: 1200;
    margin-bottom: 0;
}

#profileScreen .profile-content,
#adminScreen .admin-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(var(--main-header-height, 0px) + 12px);
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px);
}

/* Main menu scroll wrapper */
.main-scroll {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* iOS PWA layout fixes (main menu) */
.ios-pwa #mainMenu {
    padding: 0;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

.ios-pwa #mainMenu .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    background: var(--bg-color);
    padding: calc(20px + env(safe-area-inset-top, 0px))
             calc(16px + env(safe-area-inset-right, 0px))
             16px
             calc(16px + env(safe-area-inset-left, 0px));
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    transform: translateZ(0);
}

.ios-pwa #statsScreen,
.ios-pwa #profileScreen,
.ios-pwa #adminScreen {
    padding: 0;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

.ios-pwa #statsScreen .header,
.ios-pwa #profileScreen .header,
.ios-pwa #adminScreen .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    background: var(--bg-color);
    padding: calc(20px + env(safe-area-inset-top, 0px))
             calc(16px + env(safe-area-inset-right, 0px))
             16px
             calc(16px + env(safe-area-inset-left, 0px));
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    transform: translateZ(0);
}

.ios-pwa #statsScreen .stats-content,
.ios-pwa #profileScreen .profile-content,
.ios-pwa #adminScreen .admin-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(var(--main-header-height, 0px) + 12px);
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px);
}

.ios-pwa #mainMenu .main-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: var(--main-header-height, calc(140px + env(safe-area-inset-top, 0px)));
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px);
    overscroll-behavior: contain;
}

.ios-pwa #mainMenu .page-dots {
    margin: 2px 0 12px 0;
}

.ios-pwa #mainMenu .swipe-container {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
}

.ios-pwa #mainMenu .button-grid-page {
    display: flex;
}

.ios-pwa #mainMenu .button-grid {
    width: 100%;
    align-content: center;
    justify-items: stretch;
    margin: 0 auto;
    flex: 0 0 auto;
    gap: 12px;
}

.ios-pwa #mainMenu .memo-button {
    min-height: clamp(112px, 16vh, 150px);
    padding: 18px 12px;
}

.ios-pwa #mainMenu .button-grid-page .button-grid {
    padding-top: 4px;
    padding-bottom: 12px;
}

/* ADJUST PADDING FOR RECORDING SCREEN (No TabBar) */
#recordingScreen.container {
    padding-bottom: env(safe-area-inset-bottom);
}

.hidden {
    display: none !important;
}

/* iOS PWA: disable bounce/overscroll when onboarding is active */
html.no-scroll, body.no-scroll {
    overflow: hidden;
    overscroll-behavior: none;
    background: #000;
}

.onboarding-screen {
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    overscroll-behavior: contain;
    background: #000;
}

/* ========================================
   ONBOARDING (INLINE)
   ======================================== */
/* Grundlegende Onboarding-Styles - Ergänzung zu onboarding-animations.css und onboarding-text-styles.css */
.onboarding-screen {
    background: #000000;
    color: #ffffff;
    padding-bottom: env(safe-area-inset-bottom);
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    max-height: 100vh;
    overscroll-behavior: contain;
}

.onboarding-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(500px 260px at 15% -10%, rgba(10, 132, 255, 0.22), transparent 60%),
        radial-gradient(420px 240px at 110% 0%, rgba(48, 209, 88, 0.18), transparent 60%),
        radial-gradient(380px 220px at 50% 120%, rgba(191, 90, 242, 0.18), transparent 60%);
    pointer-events: none;
}

.onboarding-screen .skip-btn {
    position: absolute;
    top: max(20px, env(safe-area-inset-top));
    right: 20px;
    background: none;
    border: none;
    color: #aeaeb2;
    font-size: 16px;
    font-weight: 500;
    z-index: 10;
    cursor: pointer;
    padding: 10px;
}

.onboarding-screen .swipe-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    width: 100%;
    height: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.onboarding-screen .swipe-container::-webkit-scrollbar {
    display: none;
}

.onboarding-screen .slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 28px;
    text-align: center;
    padding-bottom: 140px;
}

.onboarding-screen .slide-content {
    max-width: 400px;
    width: 100%;
    animation: onboardingFadeIn 0.6s ease-out;
    position: relative;
    z-index: 1;
}

.onboarding-screen .icon-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #1c1c1e;
    color: #64d2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.onboarding-screen .icon-circle::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0.6;
}

.onboarding-screen .icon-circle svg {
    width: 48px;
    height: 48px;
    stroke-width: 2px;
}

/* Onboarding Button Styles */
.onboarding-screen .auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 40px;
    width: 100%;
}

.onboarding-screen .auth-login-hint {
    margin-top: 18px;
    font-size: 13px;
    color: #aeaeb2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.onboarding-screen .link-inline {
    background: #007aff;
    border: none;
    padding: 12px 24px;
    margin: 0;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(10, 132, 255, 0.35);
    min-width: 180px;
}

.onboarding-screen .btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.onboarding-screen .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.onboarding-screen .btn-primary {
    background-color: #0a84ff;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.onboarding-screen .btn-secondary {
    background-color: #1c1c1e;
    color: #0a84ff;
}

.onboarding-screen .btn-tertiary {
    background: none;
    color: #aeaeb2;
    font-size: 15px;
    padding: 12px;
}

/* Onboarding Settings Styles */
.onboarding-screen .onboarding-settings {
    margin: 40px 0;
    text-align: left;
    background: rgba(142, 142, 147, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

.onboarding-screen .setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(142, 142, 147, 0.1);
}

.onboarding-screen .setting-row:last-child {
    border-bottom: none;
}

.onboarding-screen .setting-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

.onboarding-screen .setting-desc {
    display: block;
    font-size: 12px;
    color: #aeaeb2;
    margin-top: 2px;
}

/* Onboarding Toggle Styles */
.onboarding-screen .toggle-switch-wrapper {
    position: relative;
}

.onboarding-screen .ios-toggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.onboarding-screen .ios-toggle-label {
    display: block;
    width: 51px;
    height: 31px;
    background: #39393d;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.onboarding-screen .ios-toggle-label::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.onboarding-screen .ios-toggle:checked+.ios-toggle-label {
    background: #0a84ff;
}

.onboarding-screen .ios-toggle:checked+.ios-toggle-label::after {
    transform: translateX(20px);
}

/* Onboarding Bottom Navigation */
.onboarding-screen .bottom-nav {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.onboarding-screen .pagination {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    align-items: center;
}

.onboarding-screen .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.24);
    opacity: 0.6;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
    transition: all 0.22s ease;
}

.onboarding-screen .dot.active {
    background-color: #0a84ff;
    opacity: 1;
    width: 14px;
    height: 10px;
    border-radius: 999px;
    transform: scale(1.12);
    box-shadow:
      0 0 0 4px rgba(10,132,255,0.18),
      0 8px 18px rgba(0,0,0,0.18);
}

.onboarding-screen .next-btn {
    background: none;
    border: none;
    color: #0a84ff;
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.onboarding-screen .next-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   AUTH SCREENS (LOGIN/REGISTER/FORGOT/RESET)
   ======================================== */
/* Grundlegende Auth-Screen-Styles - Ergänzung zu auth-responsive.css und auth-design-refresh.css */
.auth-screen.container {
    padding-bottom: env(safe-area-inset-bottom);
}

.auth-shell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 48px;
    position: relative;
    overflow: hidden;
}

.auth-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 300px at 20% -10%, rgba(52, 199, 89, 0.15), transparent 60%),
        radial-gradient(500px 260px at 110% 0%, rgba(10, 132, 255, 0.18), transparent 60%),
        linear-gradient(180deg, rgba(232, 247, 249, 0.5) 0%, rgba(255, 255, 255, 0) 60%);
    pointer-events: none;
}

[data-theme="dark"] .auth-shell::before {
    background:
        radial-gradient(600px 300px at 20% -10%, rgba(48, 209, 88, 0.18), transparent 60%),
        radial-gradient(500px 260px at 110% 0%, rgba(10, 132, 255, 0.2), transparent 60%),
        linear-gradient(180deg, rgba(28, 28, 30, 0.6) 0%, rgba(0, 0, 0, 0) 60%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 28px 24px;
    box-shadow: 0 12px 28px var(--shadow-color);
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(52, 199, 89, 0.25);
}

.auth-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-brand-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.2px;
}

.auth-brand-context {
    font-size: 12px;
    font-weight: 700;
    color: #34c759;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

#authLoginScreen .auth-brand-context::after { content: 'Anmeldung'; }
#authRegisterScreen .auth-brand-context::after { content: 'Registrierung'; }
#authForgotScreen .auth-brand-context::after { content: 'Passwort zurücksetzten'; }
#authResetScreen .auth-brand-context::after { content: 'Neues Passwort'; }
#authConfirmScreen .auth-brand-context::after { content: 'Bestätigung'; }

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #34c759;
    background: rgba(52, 199, 89, 0.12);
    margin-bottom: 14px;
}

[data-theme="dark"] .auth-badge {
    background: rgba(48, 209, 88, 0.18);
    color: #30d158;
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-color);
}

.auth-subtitle {
    margin: 0 0 18px;
    font-size: 15px;
    color: var(--subtext-color);
    line-height: 1.4;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--subtext-color);
}

.auth-form input {
    width: 100%;
    padding: 14px 14px;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 15px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .auth-form input {
    background: #0d0d0f;
    border-color: #2c2c2e;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.primary-btn {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: none;
    background: var(--accent-color);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(10, 132, 255, 0.25);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.primary-btn:active {
    transform: scale(0.98);
    box-shadow: 0 4px 10px rgba(10, 132, 255, 0.2);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.auth-links a {
    font-size: 13px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* NATIVE TAB BAR */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    background: var(--tabbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--tabbar-border);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 8px 0 calc(env(safe-area-inset-bottom) + 4px) 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.05);
}

/* PWA Standalone Mode - Extra padding for Home Indicator */
@media (display-mode: standalone) {
    .tabbar {
        padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
        min-height: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 12px);
    }
}

/* Hidden Tab Bar (e.g. for Recording Screen) */
.tabbar.tabbar-hidden {
    transform: translateY(100%);
}

.tab-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 64px;
    height: 100%;
    max-height: 50px;
    cursor: pointer;
    color: var(--subtext-color);
    padding: 0;
    position: relative;
    /* Touch target improvements */
    min-width: 56px;
    min-height: 56px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.tab-item.active {
    color: var(--accent-color);
}

.tab-icon-wrapper {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.tab-icon-wrapper svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.tab-version-icon {
    font-weight: 800;
    font-size: 18px;
    font-family: system-ui, -apple-system, sans-serif;
}

.tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

.tab-item:active .tab-icon-wrapper {
    transform: scale(0.9);
}

/* Ensure Modals are Above TabBar */
.modal-backdrop {
    z-index: 2000;
    /* Higher than tabbar (1000) */
}

/* ... (Keep existing styles below, carefully merging) ... */


/* HEADER */
.header {
    margin-bottom: 32px;
    padding: 32px 16px 24px;
    background: var(--header-bg);
    border-radius: 0 0 24px 24px;
    transition: background 0.3s ease;
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 900;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    text-align: center;
}

.main-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.tagline {
    font-size: 14px;
    color: var(--tagline-color);
    opacity: 0.9;
    margin-bottom: 16px;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.subtitle {
    font-size: 16px;
    color: var(--subtext-color);
    transition: color 0.3s ease;
}

/* PAGE DOTS (tap-friendly: small visual dot, big invisible padding) */
.page-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px 0;
  padding: 0 16px;
}

.page-dot-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.page-dot-btn::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--subtext-color);
  border-radius: 50%;
  opacity: 0.3;
  transition: all 0.3s ease;
}

.page-dot-btn:hover::before {
  opacity: 0.6;
}

.page-dot-btn.active::before {
  background: var(--accent-color);
  opacity: 1;
  transform: scale(1.2);
}

.page-dot-btn:focus {
  outline: none;
}

.page-dot-btn:focus-visible::before {
  box-shadow: 0 0 0 2px var(--accent-color);
}

.page-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--subtext-color);
  opacity: 0.3;
  transition: all 0.3s ease;
}

.page-dot-btn.active .page-dot {
  background-color: #0a84ff;
  opacity: 1;
  width: 14px;
  height: 10px;
  border-radius: 999px;
  transform: scale(1.12);
  box-shadow: 0 0 0 4px rgba(10,132,255,0.18),
              0 8px 18px rgba(0,0,0,0.18);
}

/* SWIPE CONTAINER */
.swipe-container {
  position: relative;
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible; /* allow button glow to show */
  border-radius: 0;
  margin-bottom: auto;
  flex: 1;
  touch-action: pan-x;
}

.swipe-wrapper {
  display: flex;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.swipe-wrapper.is-dragging {
  transition: none;
}

.button-grid-page {
  min-width: 100%;
  flex-shrink: 0;
  display: block;
  /* Remove centering to use full width */
  overflow: visible;
}

.button-grid-page .button-grid {
  /* Restore original padding and remove max-width restriction */
  padding-top: 8px;
  padding-bottom: 20px;
  width: 100%;
  overflow: visible;
}

/* BUTTON GRID */
.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: auto;
    flex: 1;
    /* Add horizontal padding for screen edges + safe-area */
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
}

.button-grid--stack {
    padding-top: 8px;
    padding-bottom: 24px;
}

.memo-button {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    min-height: 160px;
    position: relative;
    box-shadow: 0 1px 3px var(--shadow-color);
    color: var(--text-color);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
}

.memo-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px var(--shadow-hover);
    background-color: var(--card-hover);
}

.memo-button:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

/* ADMIN PERMISSION MANAGEMENT UI */
.user-permission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 12px;
  background: var(--card-bg);
  transition: all 0.2s ease;
}

.user-permission-item:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px var(--shadow-hover);
}

.user-permission-info {
  flex: 1;
  min-width: 0;
}

.user-permission-email {
  font-weight: 600;
  color: var(--text-color);
  font-size: 15px;
  margin-bottom: 4px;
  word-break: break-all;
}

.user-permission-sub {
  font-size: 12px;
  color: var(--subtext-color);
  margin-bottom: 6px;
  word-break: break-all;
}

.user-permission-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--subtext-color);
  flex-wrap: wrap;
}

.role-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: linear-gradient(135deg, #ff6b6b, #ff5252);
  color: white;
}

.role-badge.paid {
  background: linear-gradient(135deg, #4ecdc4, #44a3aa);
  color: white;
}

.role-badge.free {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: white;
}

.permission-status {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.permission-status.custom {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.permission-status.default {
  background: rgba(107, 114, 128, 0.1);
  color: var(--subtext-color);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.permission-count {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(10, 132, 255, 0.1);
  color: var(--accent-color);
  border: 1px solid rgba(10, 132, 255, 0.2);
}

.user-permission-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--subtext-color);
  margin-top: 6px;
}

.user-permission-id {
  opacity: 0.8;
}

.user-permission-blocked {
  margin-top: 6px;
  font-size: 11px;
  color: var(--subtext-color);
}

.user-permission-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 12px;
  margin-top: 8px;
}

.user-permission-details-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--card-bg);
  font-size: 12px;
  color: var(--subtext-color);
}

.user-permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.user-permission-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--subtext-color);
}

.admin-user-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.filter-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 16px;
  min-height: 44px;
}

.filter-select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 16px;
  min-height: 44px;
}

.filter-count {
  font-size: 12px;
  color: var(--subtext-color);
}

.screen-footer {
  margin-top: 40px;
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
}

/* Gender Setting Card Styles */
#genderSettingsSection .setting-desc {
  font-size: 13px;
  line-height: 1.3;
}

.gender-status-row .setting-desc {
  font-size: 12px;
  opacity: 0.8;
}

.gender-note-row .setting-desc {
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.4;
}

.gender-note-row .setting-desc strong {
  color: var(--accent-color);
}

#genderToggle:checked + .ios-toggle-label {
  background: var(--accent-color);
}

#genderToggle:checked + .ios-toggle-label::after {
  transform: translateX(20px);
}

.permission-btn {
  padding: 10px 16px;
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  background: transparent;
  color: var(--accent-color);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

.permission-btn:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3);
}

.permission-btn:active {
  transform: translateY(0);
}

.permission-save-status {
  font-size: 12px;
  color: var(--subtext-color);
  margin: 8px 0 4px;
}

.admin-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--card-border);
  box-shadow: var(--modal-shadow);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-6px);
}

.admin-toast.success {
  border-color: rgba(52, 199, 89, 0.6);
  color: #34c759;
}

.admin-toast.error {
  border-color: rgba(255, 59, 48, 0.6);
  color: #ff3b30;
}

.admin-toast.info {
  border-color: rgba(10, 132, 255, 0.5);
  color: #0a84ff;
}

.admin-user-details-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.user-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.user-details-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
}

.user-details-label {
  font-size: 12px;
  color: var(--subtext-color);
  margin-bottom: 6px;
}

.user-details-value {
  font-size: 14px;
  color: var(--text-color);
  word-break: break-word;
}

.user-details-id-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.user-details-section h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text-color);
}

.user-details-permissions,
.user-details-stats {
  display: grid;
  gap: 8px;
}

.user-details-stat-row,
.user-details-permission-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  font-size: 13px;
}

.user-details-permission-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-details-permission-row .allowed {
  color: #34c759;
}

.user-details-permission-row .blocked {
  color: #ff3b30;
}

/* Permission Modal Improvements */
.permission-grid {
  max-height: 400px;
  overflow-y: auto;
  margin: 20px 0;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
}

.permission-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s ease;
  min-height: 56px;
}

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

.permission-item:hover {
  background: rgba(52, 211, 153, 0.05);
}

.permission-checkbox {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  width: 100%;
}

.permission-checkbox input[type="checkbox"] {
  width: 28px;
  height: 28px;
  cursor: pointer;
  accent-color: var(--accent-color);
}

.permission-category {
  flex: 1;
  font-weight: 600;
  color: var(--text-color);
  font-size: 16px;
}

.permission-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.permission-badge.live {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: white;
}

.permission-badge.bald {
  background: linear-gradient(135deg, #ffd93d, #fbbf24);
  color: #333;
}

.permission-badge.test {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
}

.permission-actions {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.permission-actions button {
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

.permission-actions button:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-1px);
}

.permission-actions button.primary {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.permission-actions button.primary:hover {
  background: #10b981;
  border-color: #10b981;
}

/* User Info in Modal */
.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: linear-gradient(135deg, var(--card-bg), rgba(52, 211, 153, 0.05));
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-bottom: 24px;
}

.user-info-details {
  flex: 1;
}

.user-info-name {
  font-weight: 700;
  color: var(--text-color);
  font-size: 16px;
  margin-bottom: 4px;
}

.user-info-email {
  font-size: 13px;
  color: var(--subtext-color);
}

/* Loading and Error States */
.permission-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--subtext-color);
}

.permission-error {
  padding: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: var(--error-color);
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .user-permission-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .permission-btn {
    width: 100%;
    text-align: center;
  }
  
  .permission-actions {
    flex-direction: column;
  }
  
  .permission-actions button {
    width: 100%;
  }
  
  .user-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
.memo-button.disabled {
    opacity: 0.35 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 59, 48, 0.28),
        0 0 8px 0 rgba(255, 59, 48, 0.18);
}

.memo-button.disabled:hover {
    transform: none !important;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 59, 48, 0.28),
        0 0 8px 0 rgba(255, 59, 48, 0.18);
    background-color: var(--card-bg) !important;
}

.memo-button.disabled:active {
    transform: none !important;
}

.memo-button.disabled .icon-wrapper {
    opacity: 0.5;
}

.memo-button.disabled .button-label {
    opacity: 0.6;
}

.memo-button.disabled .live-badge,
.memo-button.disabled .badge {
    opacity: 0.4;
}

.memo-button.permission-locked {
    cursor: not-allowed;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 214, 10, 0.3),
        0 0 12px 0 rgba(255, 214, 10, 0.22);
}

.memo-button.permission-locked:hover {
    transform: none;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 214, 10, 0.3),
        0 0 12px 0 rgba(255, 214, 10, 0.22);
}

.memo-button.permission-locked::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 214, 10, 0.08);
    pointer-events: none;
    z-index: 1;
}

.memo-button.permission-locked .button-content {
    filter: blur(2px) saturate(0.78) brightness(0.98);
    opacity: 0.82;
}

.memo-button.feature-inactive {
    cursor: not-allowed;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 59, 48, 0.28),
        0 0 12px 0 rgba(255, 59, 48, 0.2);
}

.memo-button.feature-inactive:hover {
    transform: none;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 59, 48, 0.28),
        0 0 12px 0 rgba(255, 59, 48, 0.2);
}

.memo-button.feature-inactive::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 59, 48, 0.08);
    pointer-events: none;
    z-index: 1;
}

.memo-button.feature-inactive .button-content {
    filter: blur(2px) saturate(0.7) brightness(0.95);
    opacity: 0.78;
}

[data-theme="dark"] .memo-button.disabled {
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 99, 91, 0.32),
        0 0 10px 0 rgba(255, 99, 91, 0.22);
}

.icon-wrapper {
    width: 64px;
    height: 64px;
    background: var(--icon-bg);
    border-radius: 16px;
    display: flex;
    transition: background 0.3s ease;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon {
    width: 32px;
    height: 32px;
    stroke: #17a2b8;
    transition: transform 0.2s ease;
}

.memo-button:hover .icon {
    transform: scale(1.1);
}

.button-label {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.3;
}

/* ACTIVE FEATURE BUTTONS - Animated Neon Border using box-shadow (Safari-compatible) */
.memo-button.active-feature {
    animation: neonPulse 2s ease-in-out infinite;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@keyframes neonPulse {

    0%,
    100% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 2px #34d399,
            0 0 6px 0 rgba(52, 211, 153, 0.3);
    }

    50% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 2px #10b981,
            0 0 12px 1px rgba(16, 185, 129, 0.4);
    }
}

/* Dark mode adjustment for neon border */
[data-theme="dark"] .memo-button.active-feature {
    animation: neonPulseDark 2s ease-in-out infinite;
}

@keyframes neonPulseDark {

    0%,
    100% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 2px #4ade80,
            0 0 8px 0 rgba(74, 222, 128, 0.4);
    }

    50% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 2px #22c55e,
            0 0 14px 2px rgba(34, 197, 94, 0.5);
    }
}

/* PUSH NOTIFICATION BUTTON */
.push-button-container {
    padding: 16px;
    padding-top: 8px;
}

/* Header-centered push button container */
.push-button-container-header {
    display: flex;
    justify-content: center;
    margin-top: 16px;
    margin-bottom: 8px;
}

/* Compact version for header placement */
.push-button.push-button-compact {
    width: auto;
    padding: 10px 20px;
    min-height: 44px;
    border-radius: 22px;
    gap: 10px;
}

.push-icon-wrapper-small {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.push-icon-wrapper-small .push-icon {
    width: 18px;
    height: 18px;
}

.push-button {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 1px 3px var(--shadow-color);
    color: var(--text-color);
    min-height: 64px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.push-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
    background-color: var(--card-hover);
}

.push-button:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

.push-icon-wrapper {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.push-icon {
    width: 26px;
    height: 26px;
    stroke: #ffffff;
    transition: transform 0.3s ease;
}

.push-button:hover .push-icon {
    transform: scale(1.1) rotate(-10deg);
}

.push-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    text-align: left;
}

.push-badge {
    background: #ff3b30;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    animation: pushBadgePulse 2s ease-in-out infinite;
}

@keyframes pushBadgePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Push Button Active State (when subscribed) */
.push-button.push-active {
    border-color: #34c759;
}

.push-button.push-active .push-icon-wrapper {
    background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
}

.push-button.push-active .push-label {
    color: #34c759;
}

/* Dark mode adjustments for push button */
[data-theme="dark"] .push-button {
    background: var(--card-bg);
    border-color: var(--card-border);
}

[data-theme="dark"] .push-button:hover {
    background-color: var(--card-hover);
}

[data-theme="dark"] .push-label {
    color: var(--text-color);
}

[data-theme="dark"] .push-button.push-active .push-label {
    color: #30d158;
}

/* PLACEHOLDER BUTTONS */
.memo-button.placeholder {
    background: #fafafa;
    border-color: #e5e5ea;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 59, 48, 0.25),
        0 0 10px 0 rgba(255, 59, 48, 0.18);
}

.memo-button.placeholder .icon-wrapper {
    background: #f0f0f0;
}

.memo-button.placeholder .icon {
    stroke: #c7c7cc;
}

[data-theme="dark"] .memo-button.placeholder {
    background: #1c1c1e;
    border-color: #2c2c2e;
    box-shadow:
        0 1px 3px var(--shadow-color),
        0 0 0 2px rgba(255, 99, 91, 0.3),
        0 0 12px 0 rgba(255, 99, 91, 0.22);
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #FFD60A;
    /* Yellow background for light mode */
    color: #1a1a1a;
    /* Black text for light mode */
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

[data-theme="dark"] .badge {
    background: #FFD60A;
    /* Same yellow in dark mode */
    color: #ffffff;
    /* White text for better contrast in dark mode */
}

/* Live Badge Styles */
.live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #34C759;
    /* Green background for light mode */
    color: #1a1a1a;
    /* Black text for light mode */
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

[data-theme="dark"] .live-badge {
    background: #34C759;
    /* Same green in dark mode */
    color: #ffffff;
    /* White text for dark mode */
}

/* FOOTER */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--subtext-color);
    font-size: 14px;
    margin-top: auto;
    background: var(--card-bg);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid var(--card-border);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.footer p {
    margin: 0;
}

.footer strong {
    color: #17a2b8;
}

/* RECORDING SCREEN */
.recording-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    /* bleibt immer oben */
    top: env(safe-area-inset-top, 0);
    /* iPhone safe area */
    background: #ffffff;
    z-index: 50;
    /* über allen anderen Elementen */
}

.recording-header.solo-title {
    justify-content: center;
}

.back-button {
    position: fixed;
    /* immer sichtbar, nicht scrollbar */
    top: env(safe-area-inset-top, 16px);
    /* Safe Area iOS berücksichtigen */
    left: 16px;
    /* Abstand vom linken Rand */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    /* über allen anderen Elementen */

    /* Optionales Styling */
    background: rgba(255, 255, 255, 0.8);
    /* leicht transparentes Hintergrund-Feld */
    border-radius: 50%;
    /* runder Button */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* sanfter Schatten */
    transition: all 0.2s ease;
    /* sanfte Hover-Effekte */
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark mode fix for back button */
[data-theme="dark"] .back-button {
    background: rgba(44, 44, 46, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .back-button:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .back-button svg {
    stroke: #ffffff;
}

/* Dark mode fix for recording header */
[data-theme="dark"] .recording-header {
    background: var(--bg-color, #000000);
}

.recording-header h2 {
    font-size: 20px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

/* RECORDING CONTENT */
.recording-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.timer {
    font-size: 64px;
    font-weight: 300;
    margin-bottom: 24px;
    letter-spacing: -2px;
}

.progress-container {
    width: 200px;
    height: 200px;
    margin-bottom: 24px;
    position: relative;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: #e5e5ea;
    stroke-width: 4;
}

.progress-ring-circle {
    fill: none;
    stroke: #17a2b8;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 0.3s linear;
}

.status-text {
    font-size: 16px;
    color: var(--subtext-color);
    margin-bottom: 32px;
}

/* RECORD BUTTON */
.record-button-container {
    margin-bottom: 16px;
}

.record-button {
    width: 120px;
    height: 120px;
    background: #17a2b8;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(23, 162, 184, 0.3);
    position: relative;
    overflow: hidden;
}

.record-button.recording {
    background: #ff3b30;
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3);
    }

    50% {
        box-shadow: 0 4px 24px rgba(255, 59, 48, 0.5);
    }
}

/* VISUALIZER CANVAS */
#visualizerCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    /* Make it slightly larger than the button */
    height: 150%;
    z-index: 1;
    /* Background layer */
    pointer-events: none;
    /* Don't block touch events on record button */
    -webkit-transform: translateZ(0);
    /* Force hardware acceleration on iOS */
    transform: translateZ(0);
}

.mic-icon-wrapper {
    position: relative;
    z-index: 10 !important;
    /* Force to front */
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-icon {
    width: 48px;
    height: 48px;
    stroke: #ffffff;
    fill: none;
    /* Important for iOS */
    transition: all 0.2s ease;
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    .mic-icon {
        stroke: #ffffff;
        fill: none;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .mic-icon-wrapper {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    #visualizerCanvas {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .record-button {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
}

/* WAVE ANIMATION */
.wave-animation {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.25);
    animation: wavePulse 1.8s infinite ease-out;
    opacity: 0;
}

.record-button.recording .wave-animation {
    opacity: 1;
}

@keyframes wavePulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    70% {
        transform: scale(1.6);
        opacity: 0;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.mic-icon {
    width: 48px;
    height: 48px;
    stroke: #ffffff;
    transition: all 0.2s ease;
}

.record-button.recording .mic-icon {
    width: 40px;
    height: 40px;
}

/* ACTION BUTTONS */
.action-buttons {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.action-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f2f2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    overflow: hidden;
}

.action-btn svg {
    width: 32px;
    height: 32px;
    stroke: #17a2b8;
}

.action-btn:hover {
    transform: translateY(-3px);
}

/* UPLOAD PROGRESS */
.upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e5ea;
    border-top: 3px solid #17a2b8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =========================================
   PROFILE SCREEN & SETTINGS
   ========================================= */
.settings-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 24px;
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.settings-section h3 {
    padding: 16px;
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--subtext-color);
    background: var(--bg-color);
    /* Title outside specific card look if preferred, but here inside card header style */
    border-bottom: 1px solid var(--card-border);
}

.setting-row {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    background: var(--card-bg);
}

.pointer-row {
    cursor: pointer;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
    padding-right: 16px;
}

.setting-label {
    display: block;
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-color);
}

.setting-desc {
    display: block;
    font-size: 13px;
    color: var(--subtext-color);
    line-height: 1.4;
    margin: 0;
}

/* Text Button (e.g. Privacy Info) */
.text-button {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 15px;
    cursor: pointer;
    text-align: left;
    padding: 0;
}

/* iOS Toggle Switch */
.toggle-switch-wrapper {
    position: relative;
}

.ios-toggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-toggle-label {
    display: block;
    width: 51px;
    height: 31px;
    background: #e9e9ea;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ios-toggle-label::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.ios-toggle:checked+.ios-toggle-label {
    background: var(--accent-color);
}

.ios-toggle:checked+.ios-toggle-label::after {
    transform: translateX(20px);
}

/* Dark Mode for Toggle */
[data-theme="dark"] .ios-toggle-label {
    background: #39393d;
}

/* Vertical Modal Actions (for Onboarding) */
.modal-actions.column {
    flex-direction: column;
    width: 100%;
}

.modal-actions.column .modal-btn {
    width: 100%;
}

/* Helper */
.icon-circle-small {
    background: var(--icon-bg);
    color: var(--accent-color);
}

/* ========================================
   STATISTICS SCREEN STYLES
   ======================================== */

/* Footer Content with Gear Button */
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.footer-content p {
    margin: 0;
}

/* Stats Button (Bar Chart Icon) */
.stats-button {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.stats-button .stats-icon {
    width: 22px;
    height: 22px;
    fill: var(--subtext-color);
    transition: all 0.3s ease;
}

.stats-button:hover .stats-icon {
    fill: var(--accent-color);
    transform: scale(1.1);
}

.stats-button:active {
    transform: scale(0.9);
}

[data-theme="dark"] .stats-button .stats-icon {
    fill: var(--subtext-color);
}

[data-theme="dark"] .stats-button:hover .stats-icon {
    fill: var(--accent-color);
}

/* Statistics Screen Layout */
.stats-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 80px 16px;
    -webkit-overflow-scrolling: touch;
}

.stats-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0 8px;
    color: var(--subtext-color);
}

.stats-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 12px 0 8px;
    color: var(--subtext-color);
}

.stats-status p {
    margin: 0;
    font-size: 13px;
}

.stats-status[data-status="error"] {
    color: #ff3b30;
}

.stats-loading p {
    margin: 0;
    font-size: 13px;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

/* Stat Card with Blue Glow */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 120px;
    transition: all 0.2s ease;
    animation: blueGlowPulse 3s ease-in-out infinite;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.stat-card:active {
    transform: scale(0.98);
}

/* Blue Glow Animation for Statistics Cards */
@keyframes blueGlowPulse {

    0%,
    100% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 1px rgba(59, 130, 246, 0.15),
            0 0 8px 0 rgba(59, 130, 246, 0.1);
    }

    50% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 1px rgba(59, 130, 246, 0.25),
            0 0 16px 2px rgba(59, 130, 246, 0.2);
    }
}

/* Dark mode adjustment for blue glow */
[data-theme="dark"] .stat-card {
    animation: blueGlowPulseDark 3s ease-in-out infinite;
}

@keyframes blueGlowPulseDark {

    0%,
    100% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 1px rgba(96, 165, 250, 0.2),
            0 0 10px 0 rgba(96, 165, 250, 0.15);
    }

    50% {
        box-shadow:
            0 1px 3px var(--shadow-color),
            0 0 0 1px rgba(96, 165, 250, 0.35),
            0 0 20px 4px rgba(96, 165, 250, 0.25);
    }
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    line-height: 1.3;
}

.stat-sublabel {
    font-size: 11px;
    color: var(--text-light);
    opacity: 0.7;
    margin-top: 2px;
}

/* Category Stats Section */
.category-stats {
    margin-top: 32px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
    padding: 0 4px;
}

/* Category Detail Card with Blue Glow */
.category-detail-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    animation: blueGlowPulse 3s ease-in-out infinite;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.category-detail-card:active {
    transform: scale(0.99);
}

/* Dark mode adjustment for category detail cards */
[data-theme="dark"] .category-detail-card {
    animation: blueGlowPulseDark 3s ease-in-out infinite;
}

.category-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
}

.category-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.metric-label {
    font-size: 10px;
    color: var(--text-light);
    font-weight: 500;
}

/* Dark Mode Overrides for Stats */
[data-theme="dark"] .stat-card {
    background: var(--card-bg);
    border-color: var(--card-border);
}

[data-theme="dark"] .category-detail-card {
    background: var(--card-bg);
    border-color: var(--card-border);
}

[data-theme="dark"] .category-name {
    border-color: var(--card-border);
}

/* Responsive Stats Grid */
@media (max-width: 430px) {
    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
        min-height: 100px;
    }

    .stat-icon {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    .category-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .category-detail-card {
        padding: 14px;
    }

    .metric-value {
        font-size: 14px;
    }

    .metric-label {
        font-size: 9px;
    }
}

/* MODAL STYLES */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-backdrop.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    width: 80%;
    max-width: 300px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    z-index: 10000;
    transform: translateY(20px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: auto;
}

.modal-backdrop.visible .modal {
    transform: translateY(0);
    opacity: 1;
}

[data-theme="dark"] .modal {
    background: #1c1c1e;
    border: 1px solid #2c2c2e;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.modal h3 {
    margin: 0 0 12px 0;
    color: #1a1a1a;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

[data-theme="dark"] .modal h3 {
    color: #ffffff;
}

.modal p {
    margin: 0 0 20px 0;
    color: #8e8e93;
    font-size: 15px;
    line-height: 1.4;
}

[data-theme="dark"] .modal p {
    color: #aeaeb2;
}

.rpc-diag-list {
    text-align: left;
    margin: 0;
    padding-left: 18px;
    color: var(--text-color);
    font-size: 13px;
    line-height: 1.4;
}

.rpc-diag-detail {
    color: var(--subtext-color);
    font-weight: 500;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-btn.primary {
    background: #007aff;
    color: white;
}

.modal-btn.primary:active {
    transform: scale(0.95);
    background: #0051d5;
}

[data-theme="dark"] .modal-btn.primary {
    background: #0a84ff;
}

[data-theme="dark"] .modal-btn.primary:active {
    background: #0066cc;
}

.modal-btn.secondary {
    background: #f2f2f7;
    color: #007aff;
}

.modal-btn.secondary:active {
    transform: scale(0.95);
    background: #e5e5ea;
}

[data-theme="dark"] .modal-btn.secondary {
    background: #2c2c2e;
    color: #0a84ff;
}

[data-theme="dark"] .modal-btn.secondary:active {
    background: #3a3a3c;
}

.modal button:not(.modal-btn) {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-radius: 12px;
    background: #17a2b8;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal button:not(.modal-btn):active {
    transform: scale(0.95);
    background: #138496;
}

/* SUCCESS ICON ANIMATION */
.success-checkmark {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
}

.success-checkmark svg {
    width: 100%;
    height: 100%;
}

.checkmark-circle {
    stroke: #34d399;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #34d399;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

/* ERROR ICON ANIMATION */
.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
}

.error-icon svg {
    width: 100%;
    height: 100%;
}

.error-circle {
    stroke: #ff3b30;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.error-cross {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #ff3b30;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

/* SUCCESS / ERROR MODAL SPECIFIC STYLES */
#successMessage h3 {
    color: #34d399;
}

[data-theme="dark"] #successMessage h3 {
    color: #34d399;
}

#errorMessage h3 {
    color: #ff3b30;
}

[data-theme="dark"] #errorMessage h3 {
    color: #ff3b30;
}



/* Theme Toggle Button - iOS Optimized */
.theme-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-color);
    transition: transform 0.15s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    z-index: 1000;
}

.theme-toggle:active {
    transform: scale(0.9);
    background-color: var(--card-hover);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* Force iOS to respect touch events */
.theme-toggle * {
    pointer-events: none;
}

/* Hide/show appropriate icon based on theme */
[data-theme="light"] .moon-icon,
[data-theme="dark"] .sun-icon {
    display: none;
}

/* Badge styles with forced colors for iOS */
.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--badge-yellow);
    color: var(--text-dark);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1, 1);
    transform: translateZ(0);
}

/* Live Badge Styles with forced colors */
.live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--badge-green);
    color: var(--text-dark);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1, 1);
    transform: translateZ(0);
}

.status-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--badge-green);
    color: var(--text-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    transition: all 0.3s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1, 1);
    transform: translateZ(0);
}

.status-badge.status-live {
    background: var(--badge-green);
    color: var(--text-dark);
}

.status-badge.status-locked {
    background: var(--badge-yellow);
    color: var(--text-dark);
}

.status-badge.status-inactive {
    background: var(--badge-red);
    color: #ffffff;
}

/* Dark theme overrides */
[data-theme="dark"] .badge {
    background: var(--badge-yellow);
    color: #1a1a1a;
    /* Keep black text for better contrast on yellow */
}

[data-theme="dark"] .live-badge {
    background: var(--badge-green);
    color: #1a1a1a;
    /* Keep black text for better contrast on green */
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {

    .badge,
    .live-badge,
    .status-badge {
        -webkit-text-fill-color: currentColor;
    }

    [data-theme="dark"] .badge,
    [data-theme="dark"] .live-badge,
    [data-theme="dark"] .status-badge {
        -webkit-text-fill-color: #1a1a1a;
    }
}

/* ADMIN DASHBOARD STYLES */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.admin-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.admin-stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.admin-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.admin-stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.admin-user-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-user-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.user-role-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-role-badge.free {
    background: #ff3b30;
    color: white;
}

.user-role-badge.paid {
    background: #34c759;
    color: white;
}

.user-role-badge.admin {
    background: #007aff;
    color: white;
}

.user-count {
    font-weight: 600;
    color: var(--text-color);
}

.admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.admin-action-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    min-height: 56px;
    min-width: 120px;
    touch-action: manipulation;
}

.admin-action-btn .action-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
}

.admin-action-btn .action-desc {
    font-size: 12px;
    color: var(--subtext-color);
    line-height: 1.3;
}

.admin-action-btn:active {
    transform: scale(0.98);
}

.admin-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.admin-action-btn svg {
    transition: transform 0.2s ease;
}

.admin-action-btn:hover svg {
    transform: scale(1.1);
}

.admin-activity-log {
    max-height: 200px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--card-border);
}

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

.activity-time {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.activity-desc {
    font-size: 14px;
    color: var(--text-color);
    flex: 1;
    margin-left: 12px;
}

/* Admin Tab Visibility */
#adminTab.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 430px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .admin-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .admin-user-stats {
        flex-direction: column;
        gap: 8px;
    }
}

/* New Admin Dashboard (glass, iOS-like) */
.admin-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
}
.admin-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--subtext-color);
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #999;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.status-dot.online { background: #34c759; }
.status-dot.offline { background: #ff3b30; }
.pill-button {
    border: none;
    background: linear-gradient(135deg, #0a84ff, #34c759);
    color: #fff;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
    min-height: 44px;
    min-width: 160px;
}

.pill-button.is-loading {
    opacity: 0.8;
    pointer-events: none;
    position: relative;
}

.pill-button.is-loading::after {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.6);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}
.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 10px 0 22px;
}
.admin-card {
    padding: 16px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 14px 30px rgba(0,0,0,0.12);
}
.admin-card.glass {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
}
.admin-card-title {
    font-size: 14px;
    color: var(--subtext-color);
    margin-bottom: 6px;
}
.admin-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-color);
}
.admin-card-sub {
    font-size: 12px;
    color: var(--subtext-color);
    margin-top: 2px;
}
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}
.pill.free  { background: rgba(52,199,89,0.12);  color: #34c759; }
.pill.paid  { background: rgba(10,132,255,0.12); color: #0a84ff; }
.pill.admin { background: rgba(255,149,0,0.12); color: #ff9f0a; }

/* FOOTER ACTIONS */
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.footer p {
    font-size: 13px;
    color: var(--subtext-color);
    margin: 0;
    white-space: nowrap;
}

.stats-button,
.changelog-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--subtext-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    -webkit-tap-highlight-color: transparent;
}

/* Position Stats Button to the right of text */
.stats-button {
    right: 60px;
}

/* Position Changelog Button to the far right */
.changelog-button {
    right: 8px;
    font-weight: 800;
}

.stats-button:hover,
.changelog-button:hover {
    background-color: var(--card-hover);
    color: var(--accent-color);
}

.stats-button:active,
.changelog-button:active {
    transform: translateY(-50%) scale(0.95);
}

.stats-icon {
    width: 24px;
    height: 24px;
}

.version-icon {
    font-size: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1;
    display: block;
}

/* Dark mode hover states */
[data-theme="dark"] .stats-button:hover,
[data-theme="dark"] .changelog-button:hover {
    color: var(--accent-color);
    background-color: #2c2c2e;
}



/* RESPONSIVE */
@media (max-width: 430px) {
    body {
        padding-bottom: calc(var(--tabbar-height) + 4px);
    }
}

/* Specialty Highlights */
.glow-green {
    color: #34c759;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(52, 199, 89, 0.4);
    letter-spacing: 0.2px;
}

/* Glow Effects */
.glow-green {
    color: var(--badge-green);
    font-weight: 600;
}

/* Easter Egg: 5x tap on LUANA in main menu */
@keyframes neon-pulse {
    0% {
        text-shadow: 
            0 0 5px rgba(255, 0, 0, 0.8),
            0 0 10px rgba(255, 0, 0, 0.8),
            0 0 15px rgba(255, 0, 0, 0.8),
            0 0 20px rgba(255, 0, 0, 0.5),
            0 0 35px rgba(255, 0, 0, 0.5),
            0 0 40px rgba(255, 0, 0, 0.4);
        transform: scale(1);
    }
    50% {
        text-shadow: 
            0 0 10px rgba(255, 0, 0, 0.9),
            0 0 20px rgba(255, 0, 0, 0.9),
            0 0 30px rgba(255, 0, 0, 0.9),
            0 0 40px rgba(255, 0, 0, 0.8),
            0 0 70px rgba(255, 0, 0, 0.8),
            0 0 80px rgba(255, 0, 0, 0.7);
        transform: scale(1.03);
    }
    100% {
        text-shadow: 
            0 0 5px rgba(255, 0, 0, 0.8),
            0 0 10px rgba(255, 0, 0, 0.8),
            0 0 15px rgba(255, 0, 0, 0.8),
            0 0 20px rgba(255, 0, 0, 0.5),
            0 0 35px rgba(255, 0, 0, 0.5),
            0 0 40px rgba(255, 0, 0, 0.4);
        transform: scale(1);
    }
}

.easter-egg-active #mainMenu .main-title {
    color: #ff3b30;
    animation: neon-pulse 1.5s infinite ease-in-out;
    transform-origin: center;
}

.easter-egg-active .tabbar {
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.easter-egg-highlight {
    font-weight: 700;
    color: var(--accent-color);
    text-shadow: 0 0 5px rgba(0, 122, 255, 0.5);
}

[data-theme="dark"] .easter-egg-highlight {
    color: #64d2ff;
    text-shadow: 0 0 8px rgba(100, 210, 255, 0.7);
}

/* INFO ICON STYLES */
.info-icon {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 0;
    outline: none;
}

.info-icon-inner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--subtext-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--subtext-color);
    opacity: 0.6;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    line-height: 1;
    pointer-events: none;
    /* Ensure event hits the button */
}

.info-icon:active .info-icon-inner {
    transform: scale(0.85);
    opacity: 1;
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(0, 122, 255, 0.1);
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.2);
}

[data-theme="dark"] .info-icon-inner {
    border-color: var(--subtext-color);
    color: var(--subtext-color);
}

[data-theme="dark"] .info-icon:active .info-icon-inner {
    border-color: #64d2ff;
    color: #64d2ff;
    background: rgba(100, 210, 255, 0.1);
    box-shadow: 0 0 10px rgba(100, 210, 255, 0.3);
}

/* Accessibility focus state */
.info-icon:focus-visible .info-icon-inner {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
/* Pointer Row styling for profile */
.pointer-row:active {
    background-color: var(--card-hover);
}

.setting-accessory {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--subtext-color);
}

.version-badge {
    background: var(--accent-color);
    color: #fff;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
}

/* Modal Wide adjustment */
.modal-wide {
    max-width: 500px;
    width: 90%;
}

#legalModal {
    display: flex;
    flex-direction: column;
    max-height: calc(100svh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    position: relative;
    overflow: hidden;
}

#legalModal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    padding-bottom: 12px;
    overscroll-behavior: contain;
    min-height: 0;
    position: relative;
    /* iOS PWA Scroll Fix */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: scroll-position;
    z-index: 1;
}

#legalModal .modal-body p {
    margin: 0 0 14px 0;
}

#legalModal .modal-body a {
    color: var(--accent-color);
    text-decoration: underline;
    word-break: break-word;
}

#legalModal .legal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: var(--text-color);
}

#legalModal .legal-heading {
    font-size: 16px;
    font-weight: 700;
    margin: 20px 0 10px 0;
    color: var(--text-color);
}

#legalModal .legal-subheading {
    font-size: 14px;
    font-weight: 600;
    margin: 14px 0 6px 0;
    color: var(--text-color);
}

#legalModal .modal-body p {
    line-height: 1.45;
}

#permissionModalContent {
    display: flex;
    flex-direction: column;
    max-height: calc(100svh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: hidden;
}

.button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.status-badge,
.info-icon {
    z-index: 3;
}

#permissionModalContent .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    padding-bottom: 12px;
}

#permissionModalContent .modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--modal-bg);
    margin-top: 0;
    padding-top: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* Changelog Modal Text Alignment */
.modal-wide .modal-body {
    text-align: left;
}

.modal-wide .modal-body h1,
.modal-wide .modal-body h2,
.modal-wide .modal-body h3,
.modal-wide .modal-body h4,
.modal-wide .modal-body h5,
.modal-wide .modal-body h6 {
    text-align: left;
}

.modal-wide .modal-body p,
.modal-wide .modal-body ul,
.modal-wide .modal-body ol {
    text-align: left;
}

.modal-wide .modal-body li {
    text-align: left;
}

.modal-header {
    border-bottom: 0.5px solid var(--tabbar-border);
    padding-bottom: 12px;
}

.modal-close-icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.scrollable-text {
    scrollbar-width: none;
}
.scrollable-text::-webkit-scrollbar {
    display: none;
}

/* ========================================
   NOTES SCREEN
   ======================================== */

/* Fixed-header layout for notes screen */
#notesScreen {
    padding: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#notesScreen .header {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    z-index: 10;
    margin-bottom: 0;
}

#notesScreen .notes-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(180px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 20px);
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Blur overlay for notes content */
#notesScreen .notes-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--header-bg);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

/* Placeholder card */
.notes-placeholder-card {
    position: relative;
    z-index: 1;
    max-width: 340px;
    margin: 20px;
    padding: 32px 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow-color);
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.notes-placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

.notes-placeholder-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 12px 0;
}

.notes-placeholder-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--subtext-color);
    margin: 0;
}

/* iOS PWA adjustments for notes screen */
.ios-pwa #notesScreen {
    padding: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ios-pwa #notesScreen .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding-top: env(safe-area-inset-top, 0px);
}

.ios-pwa #notesScreen .notes-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(180px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 20px);
}



