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

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

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-maroon);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 var(--radius) var(--radius);
    font-weight: 600;
    z-index: 1000;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

:root {
    /* Primary Gold */
    --primary-gold: #C9A23A;
    --primary-gold-hover: #8C6A12;
    --gold-border: rgba(201, 162, 58, 0.25);

    /* Accent */
    --accent-maroon: #B11E35;
    --accent-maroon-hover: #8a1829;

    /* Neutrals */
    --bg-color: #FAF9F6;
    --card-bg: #ffffff;
    --text-primary: #2B2B2B;
    --text-secondary: #6B6B6B;
    --code-bg: #FFF4D6;

    /* Borders */
    --border-color: rgba(201, 162, 58, 0.25);
    --divider-color: #e5e5e5;

    /* Spacing */
    --radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Noto Sans Arabic', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color) url('bg.avif') center center / cover no-repeat;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 500px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    position: relative;
}

.lang-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
}

[dir="ltr"] .lang-toggle {
    left: auto;
    right: 12px;
}

.lang-toggle:hover {
    border-color: var(--primary-gold);
    color: var(--primary-gold-hover);
    background: rgba(201, 162, 58, 0.06);
}

h1 {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.4;
}

h1 .subtitle {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 4px;
}

.code-display {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.code-display:hover {
    border-color: var(--primary-gold);
}

.code {
    font-family: ui-monospace, 'SF Mono', 'SF Mono Regular', 'Consolas', 'Liberation Mono', monospace;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.08em;
    word-break: break-all;
    user-select: all;
}

.placeholder {
    color: var(--text-secondary);
    font-size: 16px;
}

.progress {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.buttons {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-copy {
    background: transparent;
    color: var(--primary-gold);
    font-weight: 600;
    border: 1px solid var(--primary-gold);
}

.btn-copy:hover {
    background: rgba(201, 162, 58, 0.08);
    transform: translateY(-1px);
}

.btn-copy:active {
    transform: translateY(0);
}

.btn-link {
    background: transparent;
    color: var(--primary-gold);
    font-weight: 600;
    border: 1px solid var(--primary-gold);
}

.btn-link:hover {
    background: rgba(201, 162, 58, 0.08);
    transform: translateY(-1px);
}

.btn-link:active {
    transform: translateY(0);
}

.btn-next {
    background: var(--accent-maroon);
    color: white;
    font-weight: 600;
    border: 1px solid var(--accent-maroon);
}

.btn-next:hover {
    background: var(--accent-maroon-hover);
    transform: translateY(-1px);
}

.btn-next:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-maroon);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(177, 30, 53, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Logo */
.logo {
    text-align: center;
}

.logo img {
    width: 140px;
    height: 140px;
    border-radius: var(--radius);
    object-fit: cover;
}

/* How-to section */
.how-to-use {
    margin-top: 24px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.how-to-use h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    text-align: center;
}

.how-to-use ol {
    list-style: none;
    counter-reset: steps;
    padding: 0;
    margin: 0;
}

.how-to-use li {
    counter-increment: steps;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 30px 6px 0;
    position: relative;
    line-height: 1.6;
}

[dir="ltr"] .how-to-use li {
    padding: 6px 0 6px 30px;
}

.how-to-use li::before {
    content: counter(steps);
    position: absolute;
    right: 0;
    top: 6px;
    width: 22px;
    height: 22px;
    background: var(--primary-gold);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

[dir="ltr"] .how-to-use li::before {
    right: auto;
    left: 0;
}

.how-to-use li strong {
    color: var(--text-primary);
}

.how-to-note {
    margin: 12px 0 0 0;
    padding: 10px 12px;
    background: rgba(201, 162, 58, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: var(--primary-gold-hover);
    text-align: center;
    line-height: 1.5;
}

/* Share button */
.btn-share {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 1px dashed var(--primary-gold);
    background: rgba(201, 162, 58, 0.06);
    color: var(--primary-gold-hover);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-share .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-share:hover {
    background: rgba(201, 162, 58, 0.12);
    border-style: solid;
    transform: translateY(-1px);
}

.btn-share:active {
    transform: translateY(0);
}

/* Inline install button */
.btn-install-inline {
    border-style: solid;
    border-color: var(--accent-maroon);
    color: var(--accent-maroon);
    background: rgba(177, 30, 53, 0.04);
}

.btn-install-inline:hover {
    background: rgba(177, 30, 53, 0.1);
    border-color: var(--accent-maroon-hover);
    color: var(--accent-maroon-hover);
}

.btn-install-inline[hidden] {
    display: none;
}

/* Install banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.install-banner.show {
    transform: translateY(0);
}

.install-banner-content {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.install-banner h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.install-banner p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.install-banner-actions {
    display: flex;
    gap: 10px;
}

.install-banner-actions button {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-install-accept {
    background: var(--accent-maroon);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(177, 30, 53, 0.3);
}

.btn-install-accept:hover {
    background: var(--accent-maroon-hover);
    transform: translateY(-1px);
}

.btn-install-dismiss {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--divider-color);
}

.btn-install-dismiss:hover {
    background: #f5f5f5;
}

.install-no-show {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.install-no-show input {
    cursor: pointer;
    accent-color: var(--primary-gold);
}

/* Share modal overlay */
.share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 20px;
}

.share-overlay.active {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.25s ease;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.share-overlay.active .share-modal {
    transform: translateY(0) scale(1);
}

.share-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.share-close:hover {
    background: #e5e5e5;
    color: var(--text-primary);
}

[dir="ltr"] .share-close {
    left: auto;
    right: 12px;
}

.share-modal h2 {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.share-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.share-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    color: white;
}

.share-opt svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.share-opt:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.share-opt:active {
    transform: translateY(0);
}

.share-whatsapp {
    background: #25D366;
}

.share-facebook {
    background: #1877F2;
}

.share-twitter {
    background: #000;
}

.share-copylink {
    background: var(--primary-gold);
}

/* FAQ section */
.faq {
    margin-top: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.faq h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    padding: 16px 20px 12px;
    text-align: center;
}

.faq-item {
    border-top: 1px solid var(--divider-color);
}

.faq-item summary {
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item summary:hover {
    background: rgba(201, 162, 58, 0.04);
}

.faq-item p {
    padding: 0 20px 14px;
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Prayer & Developer sections inside card */
.prayer {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-top: 24px;
    text-align: center;
}

.prayer .arabic {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-gold-hover);
    margin: 0 0 6px 0;
    direction: rtl;
    font-family: 'Traditional Arabic', 'Arial', sans-serif;
}

.prayer .translation {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.developer {
    text-align: center;
    margin-top: 20px;
}

.developer p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 0 10px 0;
}

.developer .name {
    color: var(--primary-gold-hover);
    font-weight: 600;
}

.footer-collab {
    color: var(--text-secondary);
    font-size: 11px;
    margin: 0 0 10px 0;
    opacity: 0.7;
}

.social-links {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.social-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: #f5f5f5;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.social-links a:hover {
    background: var(--code-bg);
    border-color: var(--primary-gold);
    color: var(--primary-gold-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(201, 162, 58, 0.15);
}

.social-links .icon-sm {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--primary-gold);
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 3px solid var(--primary-gold);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(201, 162, 58, 0.2);
}

.code-display:focus-visible {
    outline: 3px solid var(--primary-gold);
    outline-offset: 2px;
    border-color: var(--primary-gold);
}

.social-links a:focus-visible {
    outline: 3px solid var(--primary-gold);
    outline-offset: 2px;
    background: var(--code-bg);
    border-color: var(--primary-gold);
}

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

    .btn:hover,
    .btn-copy:hover,
    .btn-link:hover,
    .btn-next:hover,
    .social-links a:hover {
        transform: none;
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .card {
        padding: 24px 20px;
    }

    .logo img {
        width: 100px;
        height: 100px;
        border-radius: var(--radius);
    }

    h1 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .code-display {
        padding: 20px 16px;
    }

    .code {
        font-size: 22px;
        letter-spacing: 1px;
    }

    .buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .how-to-use {
        margin-top: 20px;
        padding: 14px 16px;
    }

    .how-to-use h2 {
        font-size: 14px;
    }

    .how-to-use li {
        font-size: 12px;
    }

    .faq {
        margin-top: 20px;
    }

    .faq-item summary,
    .faq-item p {
        font-size: 12px;
    }

    .prayer {
        margin-top: 20px;
        padding: 14px 16px;
    }

    .prayer .arabic {
        font-size: 15px;
    }

    .prayer .translation {
        font-size: 11px;
    }

    .developer {
        margin-top: 16px;
    }

    .developer p {
        font-size: 12px;
    }

    .social-links {
        flex-direction: column;
        gap: 8px;
    }

    .social-links a {
        justify-content: center;
    }
}

/* Dark mode support - disabled for white/gold theme */
/* @media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --card-bg: rgba(30, 41, 59, 0.9);
    }
} */
