@import url(https://fonts.googleapis.com/css?family=Roboto:100,300);

:root {
    color-scheme: light dark;
}

body {
    forced-color-adjust: none;
}

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    }

    .glass-card {
        background: rgba(30, 41, 59, 0.95) !important;
        color: #f1f5f9 !important;
        border: 1px solid rgba(71, 85, 105, 0.3);
    }

    /* Navigation */
    .nav-btn:not(.bg-gradient-to-r) {
        color: #e2e8f0 !important;
    }

    .nav-btn:not(.bg-gradient-to-r):hover {
        background: rgba(51, 65, 85, 0.5) !important;
    }

    /* Text colors */
    h2,
    h3,
    h4 {
        color: #f1f5f9 !important;
    }

    .text-gray-800 {
        color: #e2e8f0 !important;
    }

    .text-gray-700 {
        color: #cbd5e1 !important;
    }

    .text-gray-600 {
        color: #94a3b8 !important;
    }

    .text-gray-500 {
        color: #64748b !important;
    }

    /* Promo cards */
    .promo-card {
        background: rgba(30, 41, 59, 0.95) !important;
        border: 1px solid rgba(71, 85, 105, 0.3);
    }

    .promo-card:hover {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }

    /* Forms and inputs */
    input,
    textarea,
    select {
        background: rgba(15, 23, 42, 0.6) !important;
        border-color: #475569 !important;
        color: #f1f5f9 !important;
    }

    input:focus,
    textarea:focus,
    select:focus {
        background: rgba(15, 23, 42, 0.8) !important;
        border-color: #8b5cf6 !important;
    }

    input::placeholder,
    textarea::placeholder {
        color: #64748b !important;
    }

    /* Badges and tags */
    .bg-blue-100 {
        background-color: rgba(30, 64, 175, 0.3) !important;
    }

    .text-blue-700 {
        color: #93c5fd !important;
    }

    .bg-purple-100 {
        background-color: rgba(109, 40, 217, 0.3) !important;
    }

    .text-purple-700 {
        color: #c4b5fd !important;
    }

    .bg-gray-100 {
        background-color: rgba(51, 65, 85, 0.5) !important;
    }

    .bg-gray-200 {
        background-color: rgba(51, 65, 85, 0.7) !important;
    }

    /* Progress bars */
    .bg-gray-200:has(> .bg-gradient-to-r) {
        background-color: rgba(51, 65, 85, 0.5) !important;
    }

    /* Lock screen */
    #lock-screen {
        background: #000 !important;
    }

    /* Modals */
    .notification-content {
        background: rgba(30, 41, 59, 0.98) !important;
        color: #f1f5f9 !important;
    }

    /* Links */
    a {
        color: #a78bfa !important;
    }

    a:hover {
        color: #c4b5fd !important;
    }

    /* Borders */
    .border-gray-200 {
        border-color: #475569 !important;
    }

    .border-gray-300 {
        border-color: #64748b !important;
    }

    /* Disabled states */
    button:disabled,
    input:disabled {
        opacity: 0.5;
        background: rgba(51, 65, 85, 0.5) !important;
    }
}

[x-cloak] {
    display: none !important;
}

body {
    font-family: Inter, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 80px;
}

.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    forced-color-adjust: none;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 280px;
    margin: auto;
}

#lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.promo-card {
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.promo-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.highlight-shared-challenge {
    box-shadow: 0 0 20px 8px rgba(139, 92, 246, 0.6);
    transform: translateY(-4px);
}

.nav-btn,
.nav-btn-mobile {
    transition: all .2s ease;
}

.nav-btn.active {
    background-image: linear-gradient(to right, #9333ea, #2563eb);
    color: #FFF;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.nav-btn-mobile.active {
    color: #9333ea;
}

.progress-bar {
    transition: width .5s ease;
}

.promo-details {
    transition: all .3s ease-in-out;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.group-progress-details {
    transition: max-height .3s ease-in-out, opacity .3s ease-in-out, margin-top .3s ease-in-out;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.prize-badge {
    max-height: 120px;
    width: auto;
    display: block;
}

#header-logo {
    height: 60px;
}

.e-c-base {
    fill: none;
    stroke: #374151;
    stroke-width: 4px;
}

.e-c-progress {
    fill: none;
    stroke: #8b5cf6;
    stroke-width: 4px;
    transition: stroke-dashoffset .5s linear;
}

.e-c-pointer {
    fill: #FFF;
    stroke: #8b5cf6;
    stroke-width: 2px;
}

#e-pointer {
    transition: transform .5s linear;
}

#lock-goal {
    font-family: Roboto, sans-serif;
    font-weight: 100;
    font-size: 3.2rem;
    line-height: 1;
}

.lock-pause-btn {
    outline: none;
    background: transparent;
    border: none;
    margin-top: .5rem;
    width: 60px;
    height: 60px;
    position: relative;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity .2s;
}

.lock-pause-btn:hover {
    opacity: 1;
}

.modal-enter-active {
    transition: opacity .2s ease-out, transform .2s ease-out;
}

.modal-leave-active {
    transition: opacity .2s ease-in, transform .2s ease-in;
}

.notification-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.notification-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.notification-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 440px;
    text-align: center;
    color: #1f2937;
    padding: 2rem;
}

.notification-btn {
    font-weight: 600;
    font-size: 1rem;
    border-radius: .75rem;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    padding: .75rem 1.5rem;
}

.notification-btn-primary {
    background-image: linear-gradient(to right, #667eea, #764ba2);
    color: #FFF;
}

.notification-btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
}

.promo-details.expanded,
.group-progress-details.expanded {
    max-height: 500px;
    opacity: 1;
    margin-top: 1rem;
}

.modal-enter,
.modal-leave {
    opacity: 0;
    transform: scale(0.9);
}

.ui-toast-stack {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 5.35rem;
    z-index: 10020;
    width: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.ui-toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 0.95rem;
    border: 1px solid rgba(209, 213, 219, 0.95);
    box-shadow: 0 14px 30px rgba(31, 41, 55, 0.2);
    color: #1f2937;
    padding: 0.85rem 0.95rem;
    pointer-events: auto;
}

.ui-toast-success {
    border-left: 4px solid #10b981;
}

.ui-toast-info {
    border-left: 4px solid #3b82f6;
}

.ui-toast-warning {
    border-left: 4px solid #f59e0b;
}

.ui-toast-error {
    border-left: 4px solid #ef4444;
}

.ui-toast-icon {
    font-size: 1rem;
    line-height: 1.4;
    margin-top: 0.1rem;
}

.ui-toast-title {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4b5563;
    font-weight: 700;
}

.ui-toast-message {
    margin: 0.2rem 0 0;
    font-size: 0.92rem;
    line-height: 1.35;
    color: #1f2937;
    word-break: break-word;
}

.ui-toast-close {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1rem;
    transition: color 0.15s ease;
}

.ui-toast-close:hover {
    color: #111827;
}

.ui-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    padding: 1rem;
}

.ui-dialog-panel {
    width: 100%;
    max-width: 32rem;
    max-height: min(88vh, 42rem);
    overflow-y: auto;
    border-radius: 1.1rem;
    border: 1px solid rgba(229, 231, 235, 0.9);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.26);
    color: #1f2937;
    padding: 1.6rem;
}

.ui-dialog-info {
    border-top: 4px solid #3b82f6;
}

.ui-dialog-success {
    border-top: 4px solid #10b981;
}

.ui-dialog-warning {
    border-top: 4px solid #f59e0b;
}

.ui-dialog-error {
    border-top: 4px solid #ef4444;
}

.ui-dialog-icon-wrap {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.85rem;
}

.ui-dialog-icon {
    font-size: 1.45rem;
    line-height: 1;
}

.ui-dialog-title {
    margin: 0;
    text-align: center;
    font-size: 1.35rem;
    line-height: 1.25;
    font-weight: 700;
    color: #111827;
}

.ui-dialog-message {
    margin: 0.95rem 0 1.4rem;
    text-align: center;
    line-height: 1.5;
    color: #374151;
}

.ui-dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ui-dialog-btn {
    width: 100%;
    border: none;
    border-radius: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.78rem 1rem;
    transition: all 0.2s ease;
}

.ui-dialog-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.ui-dialog-btn-secondary:hover {
    background: #e5e7eb;
}

.ui-dialog-btn-primary {
    background-image: linear-gradient(to right, #9333ea, #4f46e5);
    color: #fff;
    box-shadow: 0 10px 18px rgba(79, 70, 229, 0.22);
}

.ui-dialog-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 13px 22px rgba(79, 70, 229, 0.26);
}

@media (min-width: 640px) {
    .ui-toast-stack {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(96vw, 50rem);
        bottom: 1rem;
    }

    .ui-dialog-actions {
        flex-direction: row;
    }

    .ui-dialog-btn {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .ui-toast-stack {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 5.15rem;
        width: auto;
    }

    .ui-dialog-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: 0.55rem 0.5rem 0;
    }

    .ui-dialog-panel {
        max-width: none;
        width: 100%;
        border-radius: 1rem 1rem 0 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 1.15rem 1rem calc(1rem + env(safe-area-inset-bottom));
        max-height: 84vh;
    }

    .ui-dialog-icon-wrap {
        width: 2.4rem;
        height: 2.4rem;
        margin-bottom: 0.6rem;
    }

    .ui-dialog-title {
        font-size: 1.15rem;
    }

    .ui-dialog-message {
        margin: 0.7rem 0 1rem;
        font-size: 0.95rem;
    }
}


@media (min-width:768px) {
    .chart-container {
        height: 320px;
    }

    body {
        padding-bottom: 0;
    }
}

/* Heartbeat Animation */
.heartbeat-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    margin-top: 5px;
    margin-bottom: 5px;
    position: relative;
    width: 60px;
}

.heartbeat-dot {
    width: 8px;
    height: 8px;
    background-color: #34d399;
    /* Emerald-400 */
    border-radius: 50%;
    box-shadow: 0 0 10px #34d399;
    animation: pulse-calm var(--beat-speed, 1s) infinite ease-in-out;
}

.heartbeat-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(52, 211, 153, 0.2);
    z-index: -1;
}

@keyframes pulse-calm {
    0% {
        transform: scale(0.9);
        opacity: 0.3;
    }

    10% {
        transform: scale(1.4);
        opacity: 1;
        box-shadow: 0 0 15px #34d399;
    }

    20% {
        transform: scale(1);
        opacity: 0.6;
    }

    40% {
        transform: scale(0.9);
        opacity: 0.3;
        box-shadow: 0 0 5px #34d399;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.3;
    }
}

.location-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.location-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    color: white;
    flex-shrink: 0;
}

.location-search-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.location-search-back:hover {
    background: rgba(255, 255, 255, 0.25);
}

.location-search-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.location-search-input-wrap {
    padding: 16px 16px 8px;
    flex-shrink: 0;
}

.location-search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 14px;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.location-search-input-container:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    background: #ffffff;
}

.location-search-icon {
    width: 20px;
    height: 20px;
    margin-left: 14px;
    color: #9ca3af;
    flex-shrink: 0;
}

.location-search-input {
    flex: 1;
    padding: 14px 12px;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #1f2937;
}

.location-search-input::placeholder {
    color: #9ca3af;
}

.location-search-clear {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    border: none;
    background: none;
    cursor: pointer;
    margin-right: 6px;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.location-search-clear:hover {
    color: #6b7280;
    background: rgba(0, 0, 0, 0.05);
}

.location-search-desc {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #9ca3af;
    line-height: 1.4;
}

.location-search-gps-wrap {
    padding: 4px 16px 12px;
    flex-shrink: 0;
}

.location-search-gps-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
    border: 1.5px solid #a7f3d0;
    border-radius: 12px;
    color: #065f46;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.location-search-gps-btn:hover {
    background: linear-gradient(135deg, #d1fae5 0%, #ccfbf1 100%);
    border-color: #6ee7b7;
}

.location-search-gps-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.location-search-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0 16px;
}

.location-search-loading {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.location-search-resolving {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-search-resolving-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.location-search-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.location-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.location-search-result-item:hover,
.location-search-result-item:active {
    background: #f9fafb;
}

.location-search-result-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 10px;
    color: #6b7280;
    flex-shrink: 0;
}

.location-search-result-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.location-search-result-main {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-search-result-secondary {
    font-size: 0.8rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.location-search-result-arrow {
    width: 18px;
    height: 18px;
    color: #d1d5db;
    flex-shrink: 0;
}

.location-search-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 16px;
    padding: 12px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #b91c1c;
    font-size: 0.85rem;
}

.location-search-attribution {
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    opacity: 0.6;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .location-search-overlay {
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
    }
}