/* Tasbih Counter - Styles */

:root {
    /* Base Variables (Default/Emerald) */
    --color-primary: #0D7377;
    --color-primary-rgb: 13, 115, 119;
    --color-primary-dark: #095053;
    --color-accent: #D4AF37;

    --color-bg-light: #FDF6E3;
    --color-bg-dark: #1a1a2e;
    --color-text-light: #333333;
    --color-text-dark: #ecf0f1;
    --color-surface-light: #ffffff;
    --color-surface-dark: #16213e;

    /* Typography */
    --font-main: 'Inter', system-ui, sans-serif;
    --font-arabic: 'Amiri', serif;

    /* Spacing & Sizes */
    --tap-btn-size: 260px;
    --tap-btn-size-mobile: 224px;
    --transition-speed: 0.3s;
}

/* Theme: Royal Gold */
[data-color-theme="gold"] {
    --color-primary: #D4AF37;
    --color-primary-rgb: 212, 175, 55;
    --color-primary-dark: #8a7018;
    /* Darker Gold */
}

/* Theme: Midnight Blue */
[data-color-theme="blue"] {
    --color-primary: #4e54c8;
    /* Indigo/Blue */
    --color-primary-rgb: 78, 84, 200;
    --color-primary-dark: #363b96;
}

/* Theme: Rose Petal */
[data-color-theme="rose"] {
    --color-primary: #d63384;
    /* Soft Pink/Magenta */
    --color-primary-rgb: 214, 51, 132;
    --color-primary-dark: #a61e61;
}

[data-theme="dark"] {
    --bg-body: var(--color-bg-dark);
    --text-body: var(--color-text-dark);
    --bg-surface: var(--color-surface-dark);
    --bg-pattern-opacity: 0.05;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-inset: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg-body: var(--color-bg-light);
    --text-body: var(--color-text-light);
    --bg-surface: var(--color-surface-light);
    --bg-pattern-opacity: 0.08;
    --shadow-soft: 0 10px 30px rgba(var(--color-primary-rgb), 0.15);
    --shadow-inset: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    padding: 0;
}

/* Toast Message */
.toast-msg {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 2000;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast-msg.hidden {
    opacity: 0;
}

/* Accessibility: Focus Indicators */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Sound Toggle Visuals */
.sound-on {
    color: var(--color-primary);
    filter: drop-shadow(0 0 5px rgba(var(--color-primary-rgb), 0.4));
}

.sound-off {
    color: var(--text-body);
    opacity: 0.5;
}

/* Tooltip Styles */
.tooltip {
    position: absolute;
    background: var(--bg-surface);
    color: var(--text-body);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    font-size: 0.9rem;
    z-index: 1000;
    width: max-content;
    max-width: 260px;
    opacity: 0;
    visibility: hidden;
    /* Use visibility for accessibility */
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    pointer-events: none;
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    transform: translateY(10px);
    backdrop-filter: blur(10px);
}

.tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip h4 {
    margin-bottom: 0.4rem;
    color: var(--color-primary);
}

.tooltip p {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.4;
}

/* Hold-to-Reset Visual Feedback */
#reset-btn {
    position: relative;
    overflow: hidden;
}

#reset-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(231, 76, 60, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 1.5s linear, height 1.5s linear;
    /* Match hold duration */
}

#reset-btn.holding::before {
    width: 200%;
    height: 200%;
}


/* Animations */
@keyframes patternDrift {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 100px 100px;
    }
}

@keyframes floatOrb {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
        opacity: 0.4;
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
        opacity: 0.6;
    }
}

@keyframes breatheBtn {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Global Styles */
body {
    font-family: 'Inter', sans-serif;
    color: var(--text-body);
    background: var(--bg-body);
    /* Base fallback */
    min-height: 100vh;
    overflow-x: hidden;
}

/* Light mode: warm layered gradient (higher contrast for visible depth) */
[data-theme="light"] body {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(var(--color-primary-rgb), 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 175, 55, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(var(--color-primary-rgb), 0.08) 0%, transparent 80%),
        linear-gradient(150deg, #f8f1e5 0%, #e8efe9 30%, #f4e8d3 65%, #e0e8e3 100%);
}

/* Dark mode: rich multi-stop gradient */
[data-theme="dark"] body {
    background:
        radial-gradient(ellipse at 15% 10%, rgba(var(--color-primary-rgb), 0.12) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 90%, rgba(78, 84, 200, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 40%, rgba(var(--color-primary-rgb), 0.05) 0%, transparent 60%),
        linear-gradient(160deg, #080c14 0%, #0d1b2a 20%, #1b2a4a 45%, #162032 65%, #0a1628 85%, #060a12 100%);
}

/* Ambient Orbs — Larger, richer, more visible */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -2;
    pointer-events: none;
    animation: floatOrb 30s ease-in-out infinite alternate;
}

/* Primary color orb — top left */
body::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.25), transparent 65%);
    top: -200px;
    left: -200px;
    filter: blur(80px);
}

/* Warm accent orb — bottom right */
body::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2), rgba(var(--color-primary-rgb), 0.1), transparent 65%);
    bottom: -150px;
    right: -150px;
    filter: blur(90px);
    animation-delay: -15s;
}

[data-theme="dark"] body::before {
    background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.2), transparent 65%);
    opacity: 0.5;
    filter: blur(100px);
}

[data-theme="dark"] body::after {
    background: radial-gradient(circle, rgba(78, 84, 200, 0.12), rgba(var(--color-primary-rgb), 0.06), transparent 65%);
    opacity: 0.4;
    filter: blur(100px);
}

/* Background Pattern — Geometric + Noise Grain */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    pointer-events: none;
}

/* Geometric pattern layer */
.background-pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%230D7377' stroke-opacity='0.12' stroke-width='0.5'%3E%3Ccircle cx='40' cy='40' r='20'/%3E%3Ccircle cx='40' cy='40' r='35'/%3E%3Cpath d='M40 5 L40 75 M5 40 L75 40' /%3E%3Cpath d='M15 15 L65 65 M65 15 L15 65' /%3E%3C/g%3E%3C/svg%3E");
    animation: patternDrift 200s linear infinite;
}

[data-theme="dark"] .background-pattern::before {
    background-image:
        url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.025' stroke-width='0.5'%3E%3Ccircle cx='40' cy='40' r='20'/%3E%3Ccircle cx='40' cy='40' r='35'/%3E%3Cpath d='M40 5 L40 75 M5 40 L75 40' /%3E%3Cpath d='M15 15 L65 65 M65 15 L15 65' /%3E%3C/g%3E%3C/svg%3E");
}

/* Noise grain texture layer — adds tactile, non-digital feel */
.background-pattern::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.3;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    mix-blend-mode: overlay;
}

[data-theme="dark"] .background-pattern::after {
    opacity: 0.15;
    mix-blend-mode: soft-light;
}

/* Removed starry night effect — replaced with layered premium background above */

/* Header — Clean glassmorphism */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.08);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    position: sticky;
    top: 0;
    width: 100%;
}

[data-theme="dark"] .app-header {
    background: rgba(16, 16, 32, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-primary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-body);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    opacity: 0.75;
}

.icon-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
    opacity: 1;
}

[data-theme="dark"] .icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Main App Area */
#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 2rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Mode Selector — Custom styled dropdown */
.mode-selector-container select {
    padding: 0.75rem 2.5rem 0.75rem 1.2rem;
    border-radius: 12px;
    border: 1px solid rgba(var(--color-primary-rgb), 0.25);
    background: var(--bg-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230D7377' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    color: var(--text-body);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    appearance: none;
    -webkit-appearance: none;
    text-align: left;
    min-width: 260px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mode-selector-container select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}

[data-theme="dark"] .mode-selector-container select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ecf0f1' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Language selector — styled to match */
#lang-select {
    padding: 0.35rem 1.8rem 0.35rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    background: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%230D7377' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    color: var(--text-body);
    font-family: var(--font-main);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

[data-theme="dark"] #lang-select {
    border-color: rgba(255, 255, 255, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ecf0f1' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Fix option text visibility in dark mode for ALL selects */
[data-theme="dark"] select,
[data-theme="dark"] #lang-select,
[data-theme="dark"] .mode-selector-container select {
    color: var(--color-text-dark);
    background-color: var(--color-surface-dark);
}

[data-theme="dark"] select option,
[data-theme="dark"] #lang-select option,
[data-theme="dark"] .mode-selector-container select option {
    background-color: var(--color-surface-dark);
    color: var(--color-text-dark);
}

/* Progress Ring & Counter Container */
.counter-display {
    position: relative;
    /* Fluid Sizing: 75% of viewport width or height, capped at 360px */
    width: min(360px, 75vmin);
    height: min(360px, 75vmin);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    /* Clean, Modern Glow */
    filter: drop-shadow(0 0 30px rgba(var(--color-primary-rgb), 0.2));
}

[data-theme="dark"] .counter-display {
    filter: drop-shadow(0 0 40px rgba(var(--color-primary-rgb), 0.3));
}

.progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    z-index: 10;
    pointer-events: none;
}

.progress-ring__circle-bg {
    stroke: var(--color-primary);
    opacity: 0.12;
    stroke-width: 8;
}

.progress-ring__circle {
    stroke: var(--color-primary);
    stroke-linecap: round;
    stroke-width: 10;
    transition: stroke-dashoffset 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 12px rgba(var(--color-primary-rgb), 0.5));
    transform-origin: 50% 50%;
    stroke-dasharray: 753.98;
    stroke-dashoffset: 753.98;
}

/* Minimalist Tap Button (Invisible Hit Area) */
.tap-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: none;
    background: transparent;
    /* Invisible */
    cursor: pointer;
    z-index: 5;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    /* Subtle interaction feedback */
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tap-btn:active {
    transform: scale(0.97);
}

/* Frosted glass inner circle for the tap button */
.tap-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88%;
    height: 88%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s, background 0.2s;
}

[data-theme="light"] .tap-btn::after {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(var(--color-primary-rgb), 0.08);
    backdrop-filter: blur(6px);
}

.tap-btn:active::after {
    background: rgba(var(--color-primary-rgb), 0.08);
}


/* Count Container (Text Centered) */
.count-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 80%;
    /* Prevent text from hitting edges */
}

/* Modern Typography for Count */
.main-count {
    font-family: var(--font-main);
    font-size: clamp(3rem, 12vmin, 6rem);
    /* Fluid font size */
    line-height: 1;
    font-weight: 700;
    color: var(--color-primary);
    /* Removed gradients for cleaner look, or keep subtle? */
    /* Let's keep a very subtle gradient */
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(var(--color-primary-rgb), 0.2);
}

[data-theme="dark"] .main-count {
    background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Pill Style Target Badge */
.target-display {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;

    padding: 0.4rem 1rem;
    background: rgba(var(--color-primary-rgb), 0.1);
    border-radius: 20px;
    color: var(--color-primary);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .target-display {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}


.tap-instruction {
    display: none;
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(var(--color-primary-rgb), 0.2);
    /* Match theme */
    transform: scale(0);
    animation: ripple 0.5s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Controls — Refined glassmorphism bar */
.control-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    margin-top: auto;
    border: 1px solid rgba(var(--color-primary-rgb), 0.08);
    z-index: 100;
}

[data-theme="dark"] .control-bar {
    background: rgba(16, 16, 32, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-body);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.65;
}

.control-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    opacity: 1;
}

[data-theme="dark"] .control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#reset-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.control-btn svg {
    width: 22px;
    height: 22px;
}

/* Footer — Refined with accent border */
.app-footer {
    padding: 2rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    margin-top: 2rem;
    color: var(--text-body);
    opacity: 0.85;
    border-top: 1px solid rgba(var(--color-primary-rgb), 0.1);
}

[data-theme="dark"] .app-footer {
    border-top-color: rgba(255, 255, 255, 0.06);
}

.app-footer nav {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.app-footer a {
    color: var(--text-body);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.app-footer a:visited {
    color: var(--text-body);
}

.app-footer a:hover {
    color: var(--color-primary);
}

.app-footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-primary);
    transition: width 0.2s;
}

.app-footer a:hover::after {
    width: 100%;
}

[data-theme="dark"] .app-footer a {
    color: rgba(255, 255, 255, 0.7);
    /* Explicit light color for dark mode */
}

[data-theme="dark"] .app-footer a:hover {
    color: #fff;
}

/* Responsive & Mobile Optimizations */
@media (max-width: 480px) {
    #app {
        /* Ensure app takes full height but respects safe areas */
        min-height: 100vh;
        min-height: 100dvh;
        padding: 1rem;
        justify-content: space-between;
        /* Distribute vertical space */
        padding-top: 1rem;
        /* Space handled by sticky header */
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .counter-display {
        margin: 1rem 0;
        /* Use fluid size, but ensure it's not TOO big/small */
        width: min(80vmin, 300px);
        height: min(80vmin, 300px);
    }

    .main-count {
        /* Adjust font size for mobile */
        font-size: 18vmin;
    }

    .control-bar {
        width: 100%;
        max-width: 320px;
        justify-content: space-between;
        gap: 0;
        margin-top: 0;
        /* Let flex justify-content handle it */
    }

    .seo-content {
        padding: 1rem;
        margin: 2rem 0;
    }
}

/* Landscape Mobile */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    #app {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        padding-top: 4rem;
    }

    .counter-display {
        /* Smaller in landscape */
        width: 60vmin;
        height: 60vmin;
        margin: 0;
    }

    .control-bar {
        flex-direction: column;
        width: auto;
        height: auto;
        padding: 1.5rem 0.8rem;
    }
}

/* SEO Content Section */
.seo-content {
    max-width: 800px;
    margin: 4rem auto;
    padding: 2.5rem;
    line-height: 1.8;
    color: var(--text-body);
    color: var(--text-body);
    background: var(--bg-surface);
}

[data-theme="dark"] .seo-content {
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(22, 33, 62, 0.6);
}

/* Mobile Adjustments for Header */
@media (max-width: 480px) {
    .logo .text {
        display: none;
    }

    .app-header {
        padding: 0.8rem 1rem;
    }

    #lang-select {
        /* display: none; */
        /* Unhide Language Selector */
        max-width: 60px;
        /* Compact on mobile */
        padding: 0.5rem;
    }
}

/* Zen Mode */
body.zen-mode .app-header {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: none;
}

body.zen-mode .logo,
body.zen-mode .header-controls>*:not(#zen-toggle),
body.zen-mode .control-bar,
body.zen-mode .mode-selector-container,
body.zen-mode .app-footer,
body.zen-mode .seo-content,
body.zen-mode .target-display {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

body.zen-mode #zen-toggle {
    opacity: 1 !important;
    pointer-events: auto;
    background: rgba(var(--color-primary-rgb), 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid var(--color-primary);
    transform: scale(1.1);
}

body.zen-mode .counter-display {
    transform: scale(1.1);
    transition: transform 0.5s ease;
}

.seo-content h1 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
    text-align: center;
    line-height: 1.3;
}

.seo-content h2 {
    font-size: 1.6rem;
    margin-top: 2.5rem;
    margin-bottom: 1.2rem;
    color: var(--color-accent);
    border-bottom: 1px solid rgba(13, 115, 119, 0.2);
    padding-bottom: 0.5rem;
    display: inline-block;
}

[data-theme="dark"] .seo-content h2 {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.seo-content p {
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
    opacity: 0.9;
    text-align: justify;
}

.seo-content ul,
.seo-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    position: relative;
    list-style-type: none;
    /* Custom bullets */
}

.seo-content ul li::before {
    content: "•";
    color: var(--color-primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.seo-content ol {
    counter-reset: item;
}

.seo-content ol li {
    counter-increment: item;
}

.seo-content ol li::before {
    content: counter(item) ".";
    color: var(--color-primary);
    font-weight: bold;
    margin-right: 0.5rem;
}

.seo-content strong {
    color: var(--color-primary);
    font-weight: 700;
}

[data-theme="dark"] .seo-content strong {
    color: var(--color-accent);
}

/* ========================================
   FAQ Section Styles (Step 9)
   ======================================== */
.faq-section {
    max-width: 700px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.faq-section h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--color-primary);
}

.faq-section details {
    border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.15);
    padding: 1rem 0;
}

[data-theme="dark"] .faq-section details {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.faq-section details:last-child {
    border-bottom: none;
}

.faq-section summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-body);
}

.faq-section summary::-webkit-details-marker {
    display: none;
}

.faq-section summary::after {
    content: '+';
    font-size: 1.2rem;
    transition: transform 0.2s;
    color: var(--color-primary);
}

.faq-section details[open] summary::after {
    content: '−';
}

.faq-section p {
    margin-top: 0.75rem;
    line-height: 1.75;
    opacity: 0.85;
    font-size: 0.9rem;
}

/* ========================================
   Hadith Reference Card (Step 13)
   ======================================== */
.hadith-card {
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.85;
    border-left: 3px solid var(--color-primary);
    padding: 0.75rem 1.2rem;
    margin: 0.75rem auto;
    max-width: 420px;
    text-align: left;
    transition: opacity 0.3s;
    background: rgba(var(--color-primary-rgb), 0.05);
    border-radius: 0 8px 8px 0;
    line-height: 1.6;
}

[dir="rtl"] .hadith-card {
    border-left: none;
    border-right: 3px solid var(--color-primary);
    text-align: right;
    border-radius: 8px 0 0 8px;
}

.hadith-card .hadith-source {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    opacity: 0.7;
    font-style: normal;
    font-weight: 600;
    color: var(--color-primary);
}

/* ========================================
   Sunnah Mode Progress Indicator (Step 10)
   ======================================== */
.sunnah-progress {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.sunnah-step {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    border-radius: 1rem;
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--text-body);
    opacity: 0.5;
    transition: all 0.3s;
}

.sunnah-step.active {
    opacity: 1;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.sunnah-step.completed {
    opacity: 0.8;
    text-decoration: line-through;
}

/* ========================================
   Design Improvements (Step 12)
   ======================================== */

/* Counter Button Glow Effect */
.tap-btn:hover::after {
    opacity: 1;
    box-shadow: 0 0 40px rgba(var(--color-primary-rgb), 0.3);
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(var(--color-primary-rgb), 0.15);
    }

    50% {
        box-shadow: 0 0 40px rgba(var(--color-primary-rgb), 0.35);
    }
}

.tap-btn:hover {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Glassmorphism Cards */
.seo-content,
.faq-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 2px solid rgba(var(--color-primary-rgb), 0.3);
    border-radius: 12px;
    padding: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="light"] .seo-content,
[data-theme="light"] .faq-section {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(var(--color-primary-rgb), 0.08);
    border-top: 2px solid rgba(var(--color-primary-rgb), 0.25);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

/* Completion Celebration Animation */
@keyframes celebrationSparkle {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }

    100% {
        opacity: 0;
        transform: scale(0.5) rotate(360deg);
    }
}

@keyframes celebrationBurst {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0.4);
    }

    50% {
        box-shadow: 0 0 0 30px rgba(var(--color-primary-rgb), 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0);
    }
}

.counter-display.celebrating {
    animation: celebrationBurst 0.8s ease-out;
}

.counter-display.celebrating::before {
    content: '✨';
    position: absolute;
    top: 10%;
    left: 50%;
    font-size: 2rem;
    animation: celebrationSparkle 0.8s ease-out;
    z-index: 30;
    pointer-events: none;
}

/* Typography Improvement */
.main-count {
    font-size: clamp(3.5rem, 14vmin, 4.5rem) !important;
    font-weight: 800;
    text-shadow: 0 0 30px rgba(var(--color-primary-rgb), 0.3);
}

@media (min-width: 481px) {
    .main-count {
        font-size: 4.5rem !important;
    }
}

/* Button Hover Microanimations */
.icon-btn,
.control-btn {
    transition: all 0.15s ease;
}

.icon-btn:hover,
.control-btn:hover {
    transform: scale(1.05);
}

.icon-btn:active,
.control-btn:active {
    transform: scale(0.95);
}

/* Dark Mode Background Depth — handled by [data-theme="dark"] body above */

/* Mobile Bottom Safe Area */
.app-footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

/* Count Number Animation */
@keyframes countPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.count-container.count-animate {
    animation: countPulse 0.15s ease-out;
}

/* Progress Ring Smooth Color Transition */
.progress-ring__circle {
    transition: stroke-dashoffset 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        stroke 0.5s ease;
}

/* Streak stat card fire effect */
.stat-card.streak-card .stat-value {
    font-size: 1.5rem;
}