/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(165deg, #0c1118 0%, #151d2a 40%, #1a2332 70%, #0f1419 100%);
    background-attachment: fixed;
    color: #e8eaed;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
}

/* Rain canvas */
#rainCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* Ambient glow */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(56, 89, 140, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(45, 72, 120, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Main container */
main {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 400px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    background: linear-gradient(180deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.elapsed-time {
    font-size: 3.5rem;
    font-weight: 200;
    letter-spacing: -0.02em;
    color: rgba(255, 255, 255, 0.9);
    font-variant-numeric: tabular-nums;
}

/* Sound grid */
.sound-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 2rem;
}

/* Sound card */
.sound-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.sound-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sound-card:focus {
    outline: none;
}

.sound-card:focus-visible {
    box-shadow: 0 0 0 2px rgba(100, 160, 220, 0.5);
}

.sound-card.active {
    background: rgba(100, 160, 220, 0.12);
    border-color: rgba(100, 160, 220, 0.25);
}

.sound-card.active .sound-icon {
    color: rgba(140, 180, 230, 0.95);
}

.sound-icon {
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.25s ease;
}

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

.sound-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.01em;
}

/* Sound volume slider */
.sound-volume {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sound-card.active .sound-volume {
    opacity: 1;
}

.sound-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.sound-volume::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.sound-volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Master controls */
.master-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

/* Play button */
.play-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.play-button:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.08) 100%);
    transform: scale(1.05);
}

.play-button:focus {
    outline: none;
}

.play-button:focus-visible {
    box-shadow: 0 0 0 3px rgba(100, 160, 220, 0.5), 0 4px 20px rgba(0, 0, 0, 0.2);
}

.play-button:active {
    transform: scale(0.95);
}

.play-button svg {
    width: 28px;
    height: 28px;
}

.play-button .pause-icon {
    display: none;
}

.play-button.playing .play-icon {
    display: none;
}

.play-button.playing .pause-icon {
    display: block;
}

.play-button.playing {
    background: linear-gradient(145deg, rgba(100, 160, 220, 0.3) 0%, rgba(80, 140, 200, 0.15) 100%);
}

/* Timer button */
.timer-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.5);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timer-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.timer-button:focus {
    outline: none;
}

.timer-button:focus-visible {
    box-shadow: 0 0 0 2px rgba(100, 160, 220, 0.5);
}

.timer-button svg {
    width: 14px;
    height: 14px;
}

.timer-button.active {
    background: rgba(100, 160, 220, 0.15);
    border-color: rgba(100, 160, 220, 0.25);
    color: rgba(255, 255, 255, 0.9);
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mobile */
@media (max-width: 400px) {
    body {
        padding: 1.5rem 1rem;
    }

    .header {
        margin-bottom: 2rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .elapsed-time {
        font-size: 3rem;
    }

    .sound-grid {
        gap: 10px;
    }

    .sound-card {
        padding: 16px 12px 14px;
        border-radius: 16px;
    }

    .sound-icon {
        width: 28px;
        height: 28px;
    }

    .sound-label {
        font-size: 0.75rem;
    }

    .play-button {
        width: 64px;
        height: 64px;
    }

    .play-button svg {
        width: 24px;
        height: 24px;
    }
}

/* Selection */
::selection {
    background: rgba(100, 160, 220, 0.3);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #rainCanvas {
        display: none;
    }
}

/* ============================================
   Navigation
   ============================================ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(12, 17, 24, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-logo {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #fff;
}

/* App main adjustment for fixed nav */
.app-main {
    padding-top: 5rem;
}

/* ============================================
   Content Sections
   ============================================ */
.content-section {
    margin-top: 4rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.content-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.content-section p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.feature h3 {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(140, 180, 230, 0.95);
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0;
    line-height: 1.6;
}

.how-to-list {
    padding-left: 1.25rem;
    color: rgba(255, 255, 255, 0.7);
}

.how-to-list li {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.how-to-list strong {
    color: #fff;
}

/* Ad container */
.ad-container {
    margin-top: 2rem;
}

.ad-slot {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    margin-top: 4rem;
    padding: 3rem 2rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto 2rem;
}

.footer-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.footer-section p {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-nav a {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-bottom p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   Page Styles (for non-app pages)
   ============================================ */
.page-main {
    padding: 6rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}

.page-main h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    background: none;
    -webkit-text-fill-color: #fff;
}

.page-main .subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 3rem;
}

.page-main h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.02em;
}

.page-main h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: rgba(140, 180, 230, 0.95);
    margin: 2rem 0 0.75rem;
}

.page-main p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.page-main ul, .page-main ol {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.page-main li {
    margin-bottom: 0.5rem;
}

.page-main a {
    color: rgba(140, 180, 230, 0.95);
    text-decoration: none;
}

.page-main a:hover {
    text-decoration: underline;
}

.page-main strong {
    color: #fff;
}

/* Contact form */
.contact-form {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(140, 180, 230, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.submit-button {
    padding: 0.875rem 2rem;
    background: rgba(100, 160, 220, 0.2);
    border: 1px solid rgba(100, 160, 220, 0.3);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-button:hover {
    background: rgba(100, 160, 220, 0.3);
}

/* Blog styles */
.blog-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.blog-card {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.blog-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.blog-card h2 {
    font-size: 1.25rem;
    color: #fff;
    margin: 0 0 0.5rem;
}

.blog-card p {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.6;
}

.blog-card .blog-meta {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1rem;
}

/* Article styles */
.article-header {
    margin-bottom: 3rem;
}

.article-header h1 {
    margin-bottom: 1rem;
}

.article-meta {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
}

.article-content {
    font-size: 1.0625rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

/* ============================================
   Responsive - Content Pages
   ============================================ */
@media (max-width: 600px) {
    .nav {
        padding: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.8125rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .page-main {
        padding: 5rem 1.25rem 3rem;
    }

    .page-main h1 {
        font-size: 2rem;
    }

    .content-section {
        padding: 1.5rem;
        margin-top: 3rem;
    }
}

/* Tagline for app header */
.header .tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.5rem;
}
