:root {
    --primary: #0ea5e9;
    /* Sky 500 */
    --primary-dark: #0284c7;
    --accent: #14b8a6;
    /* Teal 500 */
    --surface: rgba(255, 255, 255, 0.9);
    --surface-glass: rgba(255, 255, 255, 0.7);
    --text-main: #1e293b;
    --text-light: #64748b;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    --radius: 1rem;
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 4rem 1rem;
    position: relative;
    margin-bottom: 2rem;
    animation: fadeIn 0.8s ease-out;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Default Light Mode Overlay: White/Blue Tint */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(240, 249, 255, 0.85)), url('bg-abstract.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
    transition: background 0.5s ease;
}

/* Logo Styles */
.logo-wrapper {
    margin-bottom: 2rem;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary-dark);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.85);
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.logo-area:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.95);
}

.logo-icon-svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.logo-area:hover .logo-icon-svg {
    transform: rotate(-10deg) scale(1.1);
}

/* Dark Mode Logo Adaptation */
body.dark-mode .logo-area {
    background: rgba(30, 41, 59, 0.8);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

body.dark-mode .logo-area:hover {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.hero-section h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.cta-button {
    background: var(--text-main);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 99px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    background: black;
}

/* Steps */
.step-section {
    display: none;
    /* Hidden by default */
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 2rem;
    padding: 3rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
    animation: fadeIn 0.5s ease-out;
}

.step-section.active {
    display: block;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step-number {
    font-size: 3rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.05);
    line-height: 1;
}

.step-header h2 {
    font-size: 2rem;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Forms */
.form-group {
    margin-bottom: 2.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.1rem;
}

input[type="range"] {
    width: 100%;
    margin-right: 1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.age-selector {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Option Cards (Age Category) */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.option-card {
    background: white;
    border: 2px solid transparent;
    padding: 1.5rem;
    border-radius: 1rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
}

.option-card i {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
}

.option-card:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.option-card.selected {
    border-color: var(--primary);
    background: #f0f9ff;
    color: var(--primary);
}

/* Conditions Grid */
.conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.condition-card {
    cursor: pointer;
    position: relative;
}

.condition-card input {
    position: absolute;
    opacity: 0;
}

.condition-card .card-content {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    height: 100%;
}

.condition-card input:checked+.card-content {
    border-color: var(--accent);
    background: #f0fdfa;
    /* Teal 50 */
    color: var(--accent);
    box-shadow: 0 4px 6px -1px rgba(20, 184, 166, 0.1);
}

/* Navigation */
.nav-buttons {
    margin-top: 3rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.nav-buttons.centered {
    justify-content: center;
}

.nav-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    transition: all 0.2s;
}

.nav-btn.next,
.nav-btn.primary {
    background: var(--primary);
    color: white;
    border: none;
}

.nav-btn.next:hover,
.nav-btn.primary:hover {
    background: var(--primary-dark);
}

.nav-btn.prev,
.nav-btn.secondary {
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
}

.nav-btn.prev:hover,
.nav-btn.secondary:hover {
    background: #f1f5f9;
}

/* Results */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-card {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.result-card.technique {
    background: linear-gradient(135deg, white 0%, #f0f9ff 100%);
    border-left: 5px solid var(--primary);
}

.technique-video {
    margin-top: 1rem;
    background: #e2e8f0;
    border-radius: 1rem;
    height: 200px;
    /* Placeholder */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 1rem;
}

.card-header i {
    color: var(--primary);
}

h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.detail-text {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.5;
}

ul#res-adjuncts li {
    list-style: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

ul#res-adjuncts li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    font-size: 1.5rem;
    line-height: 0.5;
}

.alert-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 1rem;
    display: flex;
    align-items: start;
    gap: 1rem;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.hidden {
    display: none;
}

/* Top Bar */
.top-bar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Action Link */
.action-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.5rem;
}

.action-link:hover {
    background: #f0f9ff;
}

/* Timer */
.timer-box {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s;
    background: white;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.timer-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
}

.circle-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 3.8;
}

.circle {
    fill: none;
    stroke-width: 2.8;
    stroke-linecap: round;
    /* Stroke is dasharray 100, 100. We will animate stroke-dashoffset from 0 to 100 */
    stroke: var(--accent);
    transition: stroke-dashoffset 1s linear;
}

#timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--text-main);
}

.nav-btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Child Mode Overrides */
body.child-mode {
    --primary: #f59e0b;
    /* Amber */
    --accent: #ec4899;
    /* Pink */
    --bg-gradient: linear-gradient(135deg, #fffbeb 0%, #fdf2f8 100%);
    --font-main: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    /* Playful font fallback */
}

body.child-mode .hero-section h1 {
    color: #d97706;
}

.reward-area {
    text-align: center;
    background: #fff1f2;
    border: 2px dashed #fda4af;
    padding: 2rem;
    border-radius: 1rem;
    margin-top: 2rem;
    animation: float 3s ease-in-out infinite;
}

.reward-area h3 {
    color: #be123c;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Dark Mode Variables */
body.dark-mode {
    --surface: rgba(30, 41, 59, 0.95);
    --surface-glass: rgba(30, 41, 59, 0.8);
    --text-main: #f1f5f9;
    --text-light: #94a3b8;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .option-card,
body.dark-mode .condition-card .card-content,
body.dark-mode .result-card {
    background: #1e293b;
    color: #e2e8f0;
}

body.dark-mode .option-card:hover {
    background: #334155;
    border-color: #475569;
}

body.dark-mode .option-card.selected {
    background: rgba(14, 165, 233, 0.15);
    border-color: var(--primary);
}

body.dark-mode .condition-card input:checked+.card-content {
    background: rgba(20, 184, 166, 0.15);
    color: var(--accent);
}

body.dark-mode .nav-btn.secondary,
body.dark-mode .nav-btn.prev {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

body.dark-mode .nav-btn.secondary:hover,
body.dark-mode .nav-btn.prev:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

body.dark-mode .timer-box {
    background: #1e293b;
}

body.dark-mode .circle-bg {
    stroke: #334155;
}

body.dark-mode .action-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .icon-btn {
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

body.dark-mode .icon-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* Dark Mode Background Adaptation */
body.dark-mode .hero-bg {
    /* Dark Overlay for contrast */
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9)), url('bg-abstract.png');
    background-size: cover;
    background-position: center;
}

/* Fix CTA Button in Dark Mode (White Text on Light Var was invisible) */
body.dark-mode .cta-button {
    background: white;
    color: var(--primary-dark);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
}

body.dark-mode .cta-button:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.5);
}

/* Helper for PDF print */
@media print {
    body {
        background: white;
        color: black;
    }

    .hero-section,
    .nav-buttons,
    #timer-container,
    .top-bar {
        display: none !important;
    }

    .step-section {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    #step-results {
        display: block !important;
    }
}