:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --gradient: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    --option-bg: #fff;
    --option-border: #e5e7eb;
    --option-shadow: 0 2px 8px rgba(16, 185, 129, 0.07);
    --option-selected-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);
    --bg: #f3f4f6;
    --text: #222;
}

body {
    font-family: system-ui, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#app {
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    max-width: 350px;
    width: 100%;
    /* Ensure content stays centered even on very short viewports */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
    text-align: center;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 3.5rem 0 3.5rem 0;
    justify-content: center;
}

.service-btn {
    flex: 1 1 0;
    min-width: 345px;
    max-width: 400px;
    min-height: 110px;
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #FFF;
    border: 1px solid #0000001F;
    border-radius: 16px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 1.1rem 0.4rem 1rem 0.4rem;
    margin: 5px;
    cursor: pointer;
    outline: none;
    position: relative;
}

.service-btn.selected {
    border: 3px solid transparent;
    background: linear-gradient(#fff, #fff) padding-box,
                linear-gradient(156.37deg, #2FC2AA 1.07%, #38CADA 31.15%, #21BECE 99.9%) border-box;
    background-clip: padding-box, border-box;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(54, 199, 202, 0.15);
    z-index: 1;
    position: relative;
}

/* Remove the ::before for selected, not needed with double background */
.service-btn.selected::before {
    display: none !important;
}

.service-btn.selected>* {
    position: relative;
    z-index: 1;
}

/* Remove the unselected ::before border */
.service-btn::before {
    display: none !important;
}

.service-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    min-width: 1.8em;
}

.service-btn .service-icon {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.service-btn .option-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}


.service-btn .option-desc {
    font-size: 20px;
    /* Improved contrast for WCAG AA at small sizes */
    color: #000;
    font-weight: 510;
    margin-bottom: 0.3em;
    display: block;
    line-height: 1.2;
}

.service-btn .option-subtitle {
    font-size: 16px;
    color: #777;
    font-weight: 400;
    display: block;
    line-height: 1.3;
}

.aira-btn {
    width: 100%;
    padding: 1rem 0;
    font-size: 1.1rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 30px;
    background: linear-gradient(92deg, #21BECE 0%, #38DACF 50.6%, #2FC291 100.39%);
    color: #111;
    cursor: pointer;
    font-weight: 700;
    margin-top: 1.5rem;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.10);
    max-width: 329px;
    height: 60px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    letter-spacing: 0.01em;
}

.aira-btn:disabled {
    background: #e5e7eb;
    color: #888;
    opacity: 1;
    cursor: not-allowed;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.vis-service-icon {
    filter: brightness(0) saturate(100%) invert(49%) sepia(2%) saturate(1398%) hue-rotate(170deg) brightness(91%) contrast(89%);
}

.service-btn.selected .vis-service-icon {
    filter: brightness(0) saturate(100%) invert(58%) sepia(84%) saturate(1234%) hue-rotate(134deg) brightness(88%) contrast(94%);
}

.icon-ear-unselected {
    display: block;
}

.icon-ear-selected {
    display: none;
}

.service-btn.selected .icon-ear-unselected {
    display: none;
}

.service-btn.selected .icon-ear-selected {
    display: block;
}

#download-app {
    display: block;
}

/* Unified service content styles (VIS + ASL) */
#vis-content, #asl-content { padding: 1rem; }

.vis-content-container, .asl-content-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 100%;
}

.vis-header, .asl-header {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 1.5rem;
    max-width: 300px;
}

.vis-icon, .asl-icon {
    width: 100%;
    max-width: 100%;
    max-height: 80px;
    height: auto;
    object-fit: contain;
}

.vis-description, .asl-description {
    width: 100%;
    margin-bottom: 2rem;
}

.vis-intro, .asl-intro {
    font-size: 18px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    text-align: left;
}

.vis-features, .asl-features {
    margin: 0;
    padding-left: 1.2rem;
    line-height: 1.7;
    font-size: 16px;
    color: #4a5568;
    text-align: left;
}

.vis-features li, .asl-features li { margin-bottom: 0.5rem; }

.vis-actions, .asl-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    width: 100%;
}

.vis-actions-title, .asl-actions-title {
    margin: 0;
    font-size: 1.2em;
    text-align: center;
    font-weight: 600;
    color: var(--text);
}

.vis-download-btn, .asl-download-btn {
    background: none;
    border: none;
    padding: 0;
    display: block;
}

#vis-download-app, #asl-download-app { display: block; }
/* End unified service content styles */

/* Already Installed Section */
.already-installed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.already-installed p {
    margin: 0;
    font-size: 0.9em;
    color: #6b7280;
    text-align: center;
}

.open-app-link {
    color: #2563eb;
    text-decoration: underline;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
}

.open-app-link:hover {
    color: #1d4ed8;
    text-decoration: none;
}

/* Learn More Section */
.learn-more-section {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.learn-more-link {
    color: #00717B;
    text-decoration: underline;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.learn-more-link:hover {
    color: #005a63;
    text-decoration: none;
}

/* Loading Screen Styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 5rem; /* Increased spacing between logo and loading section */
}

.loading-logo {
    height: 40px; /* Reduced from 60px to make it smaller */
    width: auto;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem; /* Smaller gap between lottie player and loading text */
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.1em; /* Slightly smaller for better proportion */
    font-weight: 500;
    color: var(--text);
    text-align: center;
    margin: 0; /* Remove margin since we're using gap in parent */
}

/* Lottie Animation Styling */
#loading-animation {
    filter: invert(1); /* Turn white to black */
}

/* Alternative approaches for different scenarios */
.lottie-black {
    filter: brightness(0); /* Pure black */
}

.lottie-dark {
    filter: invert(1) hue-rotate(180deg); /* Invert and adjust hue */
}

.service-btn svg.icon-ear-unselected,
.service-btn svg.icon-ear-selected {
    width: 40px; /* match reduced icon size */
    height: 40px;
}