:root {
    --bg-color: #f6efe1;
    /* Warmer paper/vintage tone */
    --text-main: #54524c;
    /* Deep soft olive-gray */
    --text-muted: #8e8a80;
    /* Muted olive-gray */
    --circle-color: #e3dec9;
    --btn-bg: #afa898;
    /* Soft greenish-beige to match the mockup button */
    --btn-text: #ffffff;
    --border-color: #e0d8cc;
    /* Subtle border framing */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Very subtle CSS Noise overlay for the vintage paper feel. 
   Using low octaves to keep CPU usage absolutely minimal for old Androids. */
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
}

/* SPA View Logic */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
}

/* Centered Layout container */
.content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Typography */
.title {
    font-size: clamp(2rem, 6vw, 2.75rem);
    /* Fluid sizing */
    font-weight: 500;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.vintage-title {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(2.5rem, 8vw, 4rem);
    /* Huge on desktop, scaled perfectly on mobile */
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.125rem);
    color: var(--text-muted);
    margin-bottom: 3.5rem;
    line-height: 1.5;
    max-width: 320px;
}

.vintage-subtitle {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(1.1rem, 4vw, 1.35rem);
    color: var(--text-main);
    margin-bottom: 0;
}

/* Vintage Frame */
.vintage-border {
    position: relative;
    width: 96%;
    /* Push closer to edges on mobile */
    height: 96%;
    max-width: 1200px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.03);
    /* Soft, extremely subtle vignette */
}

/* Corner Accents */
.border-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    /* Tiny circle joints in corners */
}

.top-left {
    top: -8px;
    left: -8px;
    border-right: none;
    border-bottom: none;
}

.top-right {
    top: -8px;
    right: -8px;
    border-left: none;
    border-bottom: none;
}

.bottom-left {
    bottom: -8px;
    left: -8px;
    border-right: none;
    border-top: none;
}

.bottom-right {
    bottom: -8px;
    right: -8px;
    border-left: none;
    border-top: none;
}

.home-content {
    justify-content: space-between;
    height: 100%;
    padding: 3rem 1rem;
}

.titles-wrapper {
    flex-grow: 0;
}

.home-animation-container {
    margin-bottom: 0;
    width: 250px;
    /* Constrain image size on home screen */
    height: auto;
    aspect-ratio: auto;
    /* override inheritance */
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.breathing-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    mix-blend-mode: darken;
    /* Match paper background */
}

.actions-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 0;
}

.secondary-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Base style modifications */
.animation-container {
    width: 100%;
    max-width: 50%;
    /* Ensure it stays responsive on mobile devices */
    height: auto;
    aspect-ratio: 16/9;
    /* Match common video aspect ratios */
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.intro-animation-container {
    margin-bottom: 1rem;
}

/* Video Container with CRT Vignette Overlay */
.video-container {
    border-radius: 8px;
    overflow: hidden;
    /* Contains the vignette inside the border radius */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Inward Vignette Pseudo-element */
.video-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    /* Disables interference with right-clicking/tapping the video */
    border-radius: 8px;
}

.container-inhale {
    transform: scale(1.05);
    transition: transform 4s ease-in-out;
}

.container-hold {
    transform: scale(1.05);
    /* maintain scale */
    transition: transform 4s linear;
}

.container-exhale {
    transform: scale(1);
    /* shrink back to original */
    transition: transform 6s ease-in-out;
}

/* Video Display */
.breathing-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    /* Force strict fit to container */
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    /* Soften edges */
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    mix-blend-mode: darken;
    /* Match paper background */
}

.breathing-video.visible {
    opacity: 1;
}

/* Buttons and Links */
.primary-btn {
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    padding: 20px 40px;
    /* Massive tactile touch target per spec */
    border-radius: 60px;
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, opacity 1s ease;
    width: 100%;
    max-width: 280px;
    margin-bottom: 1.5rem;
}

.vintage-btn {
    font-size: 1.25rem;
    padding: 1.25rem 2rem;
}

.primary-btn:hover {
    transform: scale(1.02);
    background-color: #a09787;
    /* Slightly darker shade on hover */
}

.primary-btn:active {
    transform: scale(0.97);
    background-color: #928a7b;
    /* Button press physics */
}

.secondary-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.2s ease, transform 0.1s ease;
    font-family: inherit;
    /* Touch target optimizations */
    min-height: 48px;
    min-width: 48px;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary-link:hover {
    color: var(--text-main);
}

.secondary-link:active {
    transform: scale(0.95);
    color: var(--text-main);
}

/* Learn View Specific */
.scroll-container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    padding: 4rem 2rem;
    overflow-y: auto;
    text-align: left;
}

.back-link {
    margin-bottom: 3rem;
    display: inline-block;
}

.learn-content h2 {
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    margin-top: 2.5rem;
    color: var(--text-main);
}

.learn-content h2:first-of-type {
    margin-top: 0;
}

.learn-content p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1.05rem;
}

/* Breathing Session View Utils */
#fade-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 1.5s ease;
}

.fade-hidden {
    opacity: 0;
    pointer-events: none;
}

.fade-visible {
    opacity: 1;
    pointer-events: auto;
}

.instruction {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    height: 1.5rem;
    /* Reserve space */
    transition: opacity 1.5s ease;
}

.phase-text {
    font-size: 1.75rem;
    font-weight: 400;
    height: 2.5rem;
    /* Fixed height so it doesn't jump */
    color: var(--text-main);
    transition: opacity 0.8s ease;
    text-transform: capitalize;
}

.timer-section {
    margin-top: 3rem;
    text-align: center;
}

.reassurance {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.timer-clock {
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
}

.quit-btn {
    margin-top: 2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* End Session Screen */
.absolute-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    transition: opacity 1.5s ease;
}

.end-message {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 2.5rem;
    color: var(--text-main);
    line-height: 1.4;
}