/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors */
    --bg-color: #ffffff;
    --text-primary: #000000;
    --text-secondary: #666666;
    
    /* Brand colors from the palette */
    --yellow-light: #ffdd55;
    --yellow: #ffcc00;
    --yellow-dark: #e5a700;
    
    --green-light: #7affc3;
    --green: #00f083;
    --green-dark: #00bf68;
    
    --blue-light: #8080ff;
    --blue: #6969ff;
    --blue-dark: #4c4cd4;
    
    --cyan-light: #69e1ff;
    --cyan: #05cdff;
    --cyan-dark: #00a0c8;

    --title-color: #3d3d3d;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --text-primary: #ffffff;
        --text-secondary: #e2e2e2;
        --title-color: #e2e2e2;
    }
}

/* Manual dark theme for night time (8pm - 6am) */
.dark-theme {
    --bg-color: #000000;
    --text-primary: #ffffff;
    --text-secondary: #999999;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Animated gradient background */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 0% 0%, var(--yellow-light) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, var(--yellow) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, var(--yellow-dark) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, var(--cyan-light) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: gradientShift 30s ease infinite;
    z-index: -1;
}

/* Dark theme gradient background */
@media (prefers-color-scheme: dark) {
    .animated-background {
        background: #1a1a2e;
        background:
            radial-gradient(circle at 0% 0%, var(--blue-light) 0%, transparent 70%),
            radial-gradient(circle at 100% 0%, var(--blue) 0%, transparent 70%),
            radial-gradient(circle at 0% 100%, var(--blue-dark) 0%, transparent 70%),
            radial-gradient(circle at 100% 100%, var(--cyan-dark) 0%, transparent 70%),
            #1a1a2e;
    }
}

/* Noise overlay */
.animated-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    z-index: 1;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
}

@keyframes gradientShift {
    0% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 50% 50%;
    }
    50% {
        background-position: 100% 100%;
    }
    75% {
        background-position: 50% 50%;
    }
    100% {
        background-position: 0% 0%;
    }
}

.app {
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: relative;
    padding: 2rem;
    box-sizing: border-box;
    z-index: 1;
}

/* Fixed Header Container (above logo) */
.header-container {
    flex-shrink: 0;
}

/* Logo styles */
.logo-fixed {
    width: 262px;
    height: 58px;
    object-fit: contain;
    display: block;
    opacity: 0;
    filter: drop-shadow(0 0 0px rgba(128, 128, 255, 0));
    animation: fadeIn 1.5s ease-in-out 0.8s both, glow-intro 1s ease-in-out 2.3s both /*, logo-pulse 5s infinite ease-in-out 3.3s */;
    margin: 2rem 0;
}

/* Content Container - transitions happen here */
.content-container {
    flex-shrink: 0;
    position: relative;
    min-height: 100px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Screen Content - using CSS Grid for stable layout */
.screen-content {
    position: absolute;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    top: 0;
    left: 0;
}

.screen-content.active {
    opacity: 1;
    pointer-events: all;
}

/* Typography */
.app-title {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: var(--title-color);
    text-align: center;
    line-height: 4.7rem;
    opacity: 0;
    transform: scale(1);
    animation: fadeIn 1.5s ease-in-out 0.3s both;
    align-self: end;
    margin-bottom: 10%;
}

/* Invisible placeholder for maintaining grid structure */
.app-title.placeholder {
    opacity: 0 !important;
    pointer-events: none;
    animation: none !important;
}

.meditation-instructions {
    position: relative;
    min-height: 1.5rem;
    width: 100%;
    align-self: start;
}

/* Unified instruction text style for all text below logo */
.instruction-text {
    font-size: 1.8rem;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 300;
    letter-spacing: -0.03em;
    align-self: start;
    width: 100%;
}

.instruction-text p {
    margin: 0.5rem 0;
}

/* Duration line spacing */
#duration-line {
    display: block;
    margin-bottom: 0.5rem;
}

/* Specific animations for instruction elements by ID */
#tap-instruction {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 1.3s both, pulse 3s ease-in-out infinite 3s;
}

#pause-instruction {
    display: none;
}

#hint-text {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 0.5s both;
}

#hint-continue {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 2s both, pulse 3s ease-in-out infinite 3.5s;
}

/* Staggered animations for instruction lines */
#instruction-1 {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 0.5s both;
}
#instruction-2 {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 2.5s both;
}
#instruction-3 {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 4.5s both;
}
#instruction-4 {
    opacity: 0;
    animation: fadeIn 1.5s ease-in-out 6.5s both;
}

.congrats-text {
    font-size: 2rem;
    font-weight: 300;
    text-align: center;
    margin: 0;
    line-height: 1.4;
    background: linear-gradient(135deg, var(--green-light) 0%, var(--blue-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* Device-specific text display */
.mobile-text {
    display: none;
}

.desktop-text {
    display: block;
}

@media (max-width: 768px) {
    .mobile-text {
        display: block;
    }

    .desktop-text {
        display: none;
    }
}

/* Fade out animation for transitions */
.fade-out {
    animation: fadeOut 0.5s ease-out forwards !important;
}

/* Animation Keyframes */
@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Title grow and fade animation with blur */
@keyframes titleGrowFade {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: scale(3);
        filter: blur(10px);
    }
}

.app-title.transitioning {
    animation: titleGrowFade 2s ease-out forwards;
}

/* Logo glow animations */
@keyframes glow-intro {
    0% {
        filter: drop-shadow(0 0 0px rgba(128, 128, 255, 0));
    }
    100% {
        filter: drop-shadow(0 0 15px rgba(128, 128, 255, 0.6));
    }
}

@keyframes logo-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 15px rgba(128, 128, 255, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 25px rgba(128, 128, 255, 0.9));
    }
}

/* Dark theme logo glow */
@media (prefers-color-scheme: dark) {
    @keyframes glow-intro {
        0% {
            filter: drop-shadow(0 0 0px rgba(229, 167, 0, 0));
        }
        100% {
            filter: drop-shadow(0 0 15px rgba(229, 167, 0, 0.6));
        }
    }

    @keyframes logo-pulse {
        0%, 100% {
            filter: drop-shadow(0 0 15px rgba(229, 167, 0, 0.6));
        }
        50% {
            filter: drop-shadow(0 0 25px rgba(229, 167, 0, 0.9));
        }
    }
}

/* Tap instruction fade out animation */
@keyframes tapFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

#tap-instruction.transitioning {
    animation: tapFadeOut 0.5s ease-out forwards;
}

/* Info screen */
.info-header {
    align-self: end;
}

.info-content {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    align-self: start;
}

.info-content h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.info-content p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.menu-dots {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-top: 3rem;
    cursor: pointer;
}

/* Touch and hover states */
/* Removed pointer cursor to allow normal text selection */

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: none;
}

/* Responsive adjustments */

/* Desktop styles (tablet and larger) */
@media (min-width: 769px) {
    .app-title {
        font-size: 9rem;
        line-height: normal;
    }

    @keyframes titleGrowFade {
        0% {
            opacity: 1;
            transform: scale(1);
            filter: blur(0px);
        }
        100% {
            opacity: 0;
            transform: scale(2.5);
            filter: blur(8px);
        }
    }

    .congrats-text {
        font-size: 2.5rem;
    }


    .logo-fixed {
        width: 320px;
        height: 71px;
    }

    .info-content {
        max-width: 800px;
    }

    .info-content h1 {
        font-size: 2.5rem;
    }

    .info-content p {
        font-size: 1.3rem;
    }
}

/* Tablet/small desktop */
@media (min-width: 769px) and (max-width: 1024px) {
    .logo-fixed {
        width: 300px;
        height: 66px;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .app-title {
        font-size: 3rem;
        margin-bottom: 50%;
    }

    .congrats-text {
        font-size: 2rem;
    }


    .logo-fixed {
        width: 240px;
        height: 53px;
    }
}

@media (max-width: 375px) {
    .logo-fixed {
        width: 200px;
        height: 44px;
    }
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .logo-fixed {
        width: 200px;
        height: 44px;
    }

    .app-title {
        font-size: 3rem;
        margin-bottom: 10rem;
    }

    #tap-instruction {
        margin-top: 1.5rem;
    }
}

/* Temporary Dev Pagination for Testing */
.dev-pagination {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    z-index: 9999;
    flex-wrap: wrap;
}

.dev-btn {
    background: var(--blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

.dev-btn:hover {
    background: var(--blue-light);
}

.dev-btn:active {
    background: var(--blue-dark);
}

/* About page styles */
.about-page {
    background: #ffffff;
    overflow: auto;
    height: auto;
}

/* Dark theme about page */
@media (prefers-color-scheme: dark) {
    .about-page {
        background: #3d3d3d;
    }
}

.about-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.about-header {
    text-align: center;
    margin-bottom: 3rem;
}

.about-logo-link {
    display: inline-block;
    margin-bottom: 2rem;
    cursor: pointer;
    text-decoration: none;
}

.about-logo {
    display: block;
    width: 262px;
    height: 58px;
}

.about-header h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: var(--title-color);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.about-header p {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: -0.03em;
}

.about-page main {
    margin-bottom: 4rem;
}

.about-page section {
    margin-bottom: 3rem;
}

.about-page h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--title-color);
    margin-bottom: 1rem;
    letter-spacing: -0.04em;
}

.about-page p {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.about-intro {
    font-size: 1.5rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Centered promise section */
.promise-section {
    text-align: center;
    margin: 3rem 0;
}

.promise-section h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.promise-list {
    margin: 0 auto 1.5rem;
    max-width: 400px;
}

.promise-list p {
    padding: 0;
    text-align: center;
    margin: 0.5rem 0;
}

/* Footer logo */
.footer-logo-link {
    display: inline-block;
    margin-bottom: 1rem;
}

.footer-logo {
    width: 120px;
    height: 27px;
    display: block;
}

.about-page ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

.about-page li {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.about-page li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.about-footer {
    text-align: center;
    padding: 2rem 0 3rem;
}

.about-footer a {
    font-size: 1.25rem;
    color: var(--blue);
    text-decoration: none;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.about-footer a:hover {
    color: var(--blue-dark);
}

/* URL/Address bar styling */
.url-bar {
    display: inline-block;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, monospace;
    font-size: 0.95rem;
    color: #333;
    white-space: nowrap;
    margin: 0.25rem 0;
}

.url-bar::before {
    content: "🔒 ";
    opacity: 0.6;
}

/* Dark theme URL bar */
@media (prefers-color-scheme: dark) {
    .url-bar {
        background: #2a2a2a;
        border-color: #444;
        color: #ddd;
    }
}

/* Responsive adjustments for about page */
@media (max-width: 768px) {
    .about-container {
        padding: 2rem 1.25rem;
    }

    .about-logo-link {
        margin-bottom: 1.5rem;
    }

    .about-logo {
        width: 196px;
        height: 43px;
    }

    .about-header h1 {
        font-size: 2.25rem;
    }

    .about-header p {
        font-size: 1.25rem;
    }

    .about-page h2 {
        font-size: 1.5rem;
    }

    .about-page p,
    .about-page li {
        font-size: 1.125rem;
    }

    .about-intro {
        font-size: 1.25rem;
    }

    .about-footer a {
        font-size: 1.125rem;
    }
}

@media (min-width: 1024px) {
    .about-container {
        padding: 4rem 2rem;
    }

    .about-logo-link {
        margin-bottom: 2.5rem;
    }

    .about-logo {
        width: 320px;
        height: 71px;
    }

    .about-header h1 {
        font-size: 3.5rem;
    }

    .about-header p {
        font-size: 1.75rem;
    }
}