/* ============================================
   FBAS - Main Stylesheet (Final v2.3)
   نسخه: 2.3 - بهینه‌سازی نهایی
   ============================================ */

/* ====== Font Faces ====== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-display: swap;
}

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

/* ====== Body ====== */
body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background: #08080e;
    color: #f0f0fa;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ====== Canvas ====== */
#geoCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}

/* ====== Border Wrapper ====== */
.border-wrapper {
    position: relative;
    border-radius: 56px;
    padding: 5px;
    background: transparent;
    max-width: 620px;
    width: 100%;
    margin: 20px auto;
    z-index: 1;
    border: 1px solid rgba(200, 170, 80, 0.10);
}

.border-wrapper::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 60px;
    padding: 6px;
    background: linear-gradient(135deg, #b8942e, #f7e8a0, #d4b85a, #f7e8a0, #b8942e);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: shimmer 6s ease-in-out infinite alternate;
    z-index: -1;
}

.border-wrapper::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    border-radius: 64px;
    background: linear-gradient(135deg, transparent, rgba(255, 215, 0, 0.10), rgba(240, 208, 96, 0.20), rgba(255, 215, 0, 0.10), transparent);
    background-size: 300% 300%;
    animation: shimmer 8s ease-in-out infinite alternate-reverse;
    filter: blur(8px);
    z-index: -2;
    opacity: 0.5;
}

@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

/* ====== Container ====== */
.container {
    width: 100%;
    background: rgba(10, 10, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 52px;
    padding: 36px 24px 40px;
    text-align: center;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

/* ====== Badge ====== */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 4px;
    padding: 8px 24px;
    border-radius: 100px;
    background: rgba(200, 170, 80, 0.10);
    color: #e8d070;
    border: 1px solid rgba(200, 170, 80, 0.15);
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

/* ====== Main Title (FBAS) ====== */
.main-title {
    font-size: clamp(80px, 24vw, 130px);
    font-weight: 900;
    line-height: 1;
    margin: 0 0 2px;
    position: relative;
    z-index: 1;
    letter-spacing: 6px;
    background: linear-gradient(180deg, #f7e8a0 0%, #d4b85a 40%, #b8942e 70%, #e8d070 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fbasGlow 4s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes fbasGlow {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.02);
    }
}

/* ====== Sub Title ====== */
.sub-title {
    font-size: clamp(15px, 2.4vw, 20px);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 8px;
    margin-top: 0;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sub-title .star-left,
.sub-title .star-right {
    display: inline-block;
    font-size: clamp(12px, 1.6vw, 18px);
    color: #e8d070;
    animation: starSpin 8s linear infinite;
}

.sub-title .star-right {
    animation-direction: reverse;
}

@keyframes starSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.sub-title .main-text {
    background: linear-gradient(90deg, #e8d070, #f5e8b0, #e8d070);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 0 4px;
    position: relative;
}

.sub-title .glow-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e8d070;
    box-shadow: 0 0 10px rgba(200, 170, 80, 0.4);
    animation: dotPulse 3s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ====== Mystic Text ====== */
.mystic-wrap {
    position: relative;
    z-index: 1;
    margin: 28px 0 14px;
    min-height: 100px;
}

.mystic-text {
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 700;
    line-height: 1.7;
    color: #ffffff;
    display: inline-block;
    padding: 0 4px;
    min-height: 3.4rem;
}

.mystic-text .hl-gold {
    color: #f0d060;
    font-weight: 900;
}

.mystic-text .hl-silver {
    color: #d0d0ea;
    font-weight: 700;
}

.mystic-text .cursor-blink {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: rgba(200, 170, 80, 0.6);
    margin-right: 3px;
    vertical-align: text-bottom;
    animation: blink 0.9s step-end infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.mystic-sub {
    font-size: clamp(14px, 2vw, 17px);
    color: rgba(255, 255, 255, 0.75);
    font-weight: 300;
    margin-top: 10px;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
    min-height: 2rem;
    transition: opacity 0.3s ease;
}

/* ====== Divider ====== */
.divider {
    width: 80px;
    height: 2px;
    margin: 26px auto 24px;
    background: linear-gradient(90deg, transparent, rgba(200, 170, 80, 0.35), transparent);
    border-radius: 2px;
    position: relative;
    z-index: 1;
}

/* ====== Sound Toggle ====== */
.sound-toggle {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 20;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sound-toggle:active {
    transform: scale(0.92);
}

.sound-toggle .sound-on {
    display: block;
}

.sound-toggle .sound-off {
    display: none;
}

.sound-toggle.muted .sound-on {
    display: none;
}

.sound-toggle.muted .sound-off {
    display: block;
}

/* ====== Countdown ====== */
.countdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 14px 0 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.countdown-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 24px;
    padding: 14px 6px 12px;
    min-width: 72px;
    flex: 1 0 auto;
    max-width: 120px;
    transition: transform 0.2s ease;
    position: relative;
    overflow: visible;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.countdown-item.primary {
    background: rgba(200, 170, 80, 0.05);
    border-color: rgba(200, 170, 80, 0.08);
    min-width: 86px;
    flex: 1.3 0 auto;
}

.countdown-item.primary .countdown-number {
    font-size: clamp(40px, 10vw, 58px);
    color: #f0d060;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.countdown-item.secondary {
    min-width: 74px;
    background: rgba(255, 255, 255, 0.015);
}

.countdown-item.secondary .countdown-number {
    font-size: clamp(26px, 6vw, 36px);
    color: #d0d0ea;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.countdown-number {
    font-weight: 900;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.countdown-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.50);
    font-weight: 300;
    letter-spacing: 3px;
    margin-top: 4px;
    position: relative;
    z-index: 2;
}

.countdown-item.primary .countdown-label {
    color: rgba(200, 170, 80, 0.50);
    letter-spacing: 4px;
}

.countdown-sep {
    font-size: 22px;
    font-weight: 100;
    color: rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    padding: 0 2px;
}

/* ====== Heartbeat ====== */
@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.04); }
    28% { transform: scale(1); }
    42% { transform: scale(1.03); }
    70% { transform: scale(1); }
    100% { transform: scale(1); }
}

.countdown-item.primary .countdown-number.pulse-beat {
    animation: heartbeat 2s ease-in-out infinite;
    display: inline-block;
}

/* ====== Seconds Rings ====== */
.seconds-ring-wrapper {
    position: relative;
    display: inline-block;
    padding: 2px 0;
}

.seconds-ring-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    pointer-events: none;
    z-index: 0;
}

.countdown-item.secondary .seconds-ring-svg {
    width: 76px;
    height: 76px;
}

.seconds-ring-svg .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 2.5;
}

.seconds-ring-svg .ring-progress {
    fill: none;
    stroke: #f0d060;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke 0.3s ease, stroke-dashoffset 0.15s ease;
}

/* ====== Red Warning ====== */
.countdown-number.red-warning {
    color: #ff3333 !important;
    text-shadow: 0 0 15px rgba(255, 51, 51, 0.5) !important;
}

.seconds-ring-svg .ring-progress.red-warning-ring {
    stroke: #ff3333 !important;
    filter: drop-shadow(0 0 6px rgba(255, 51, 51, 0.4));
}

/* ====== Ripple Effect ====== */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0) 70%);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes rippleAnim {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* ====== Status Message ====== */
.status-msg {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    min-height: 28px;
    font-weight: 300;
    margin: 4px 0 18px;
    position: relative;
    z-index: 1;
}

.status-msg .pulse {
    display: inline-block;
    animation: pulseGlow 3s ease-in-out infinite;
    color: rgba(200, 170, 80, 0.45);
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.03);
    }
}

/* ====== Form ====== */
.form-section {
    margin: 18px 0 6px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
    z-index: 1;
}

.form-title {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.form-title strong {
    color: #f0d060;
    font-weight: 700;
}

.form-title .highlight {
    display: inline-block;
    animation: gentlePulse 3s ease-in-out infinite;
}

.form-title .hint {
    color: rgba(255, 255, 255, 0.50);
    font-weight: 300;
    font-size: 0.9em;
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 440px;
    margin: 0 auto;
}

.form-group input {
    width: 100%;
    padding: 18px 24px;
    border-radius: 60px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: #f0f0ff;
    font-size: 17px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
    direction: ltr;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.20);
    font-weight: 300;
    font-size: 15px;
}

.form-group input:focus {
    border-color: rgba(200, 170, 80, 0.40);
    background: rgba(255, 255, 255, 0.05);
}

.form-group button {
    width: 100%;
    padding: 18px 20px;
    border-radius: 60px;
    border: none;
    background: linear-gradient(135deg, #d4b85a, #c4a040);
    color: #08080e;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.form-group button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.form-group button:active:not(:disabled) {
    transform: scale(0.97);
}

.form-group button:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    transform: none;
}

.form-feedback {
    font-size: 14px;
    margin-top: 16px;
    min-height: 24px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 300;
    transition: color 0.3s ease;
}

.form-feedback.success {
    color: #8bc9b0;
}

.form-feedback.error {
    color: #d47a7a;
}

/* ====== Footer ====== */
.footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.01);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 3px;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.footer span {
    color: rgba(200, 170, 80, 0.15);
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 768px) {
    .border-wrapper::after {
        display: none;
    }
    
    #geoCanvas {
        opacity: 0.3;
    }
    
    .countdown-item.primary .countdown-number.pulse-beat {
        animation: none;
    }
    
    .sub-title .star-left,
    .sub-title .star-right {
        animation: starSpin 12s linear infinite;
    }
    
    .form-title .highlight {
        animation: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .border-wrapper {
        border-radius: 38px;
        padding: 4px;
    }
    
    .border-wrapper::before {
        border-radius: 42px;
        padding: 5px;
    }
    
    .container {
        padding: 28px 14px 30px;
        border-radius: 34px;
    }
    
    .sound-toggle {
        width: 34px;
        height: 34px;
        font-size: 16px;
        top: 12px;
        left: 12px;
    }
    
    .countdown {
        gap: 2px;
    }
    
    .countdown-item {
        min-width: 52px;
        padding: 10px 4px 8px;
        border-radius: 18px;
    }
    
    .countdown-item.primary {
        min-width: 64px;
    }
    
    .countdown-item.primary .countdown-number {
        font-size: 30px;
    }
    
    .countdown-item.secondary {
        min-width: 58px;
    }
    
    .countdown-item.secondary .countdown-number {
        font-size: 22px;
    }
    
    .countdown-sep {
        font-size: 16px;
        padding: 0 1px;
    }
    
    .seconds-ring-svg {
        width: 62px;
        height: 62px;
    }
    
    .countdown-item.secondary .seconds-ring-svg {
        width: 58px;
        height: 58px;
    }
    
    .badge {
        font-size: 10px;
        padding: 5px 16px;
        letter-spacing: 2px;
    }
    
    .main-title {
        font-size: 56px;
        letter-spacing: 2px;
    }
    
    .mystic-text {
        font-size: 19px;
    }
    
    .form-group input {
        font-size: 16px;
        padding: 16px 18px;
    }
    
    .form-group button {
        font-size: 16px;
        padding: 16px 18px;
    }
    
    .form-title {
        font-size: 15px;
    }
    
    .divider {
        width: 60px;
        margin: 20px auto 18px;
    }
    
    .status-msg {
        font-size: 13px;
    }
    
    .sub-title {
        letter-spacing: 4px;
        gap: 8px;
    }
}

@media (max-width: 380px) {
    .border-wrapper {
        border-radius: 28px;
        padding: 3px;
    }
    
    .border-wrapper::before {
        border-radius: 32px;
        padding: 4px;
    }
    
    .container {
        padding: 20px 10px 24px;
        border-radius: 26px;
    }
    
    .sound-toggle {
        width: 30px;
        height: 30px;
        font-size: 14px;
        top: 10px;
        left: 10px;
    }
    
    .countdown-item {
        min-width: 44px;
        padding: 8px 2px 6px;
        border-radius: 14px;
    }
    
    .countdown-item.primary {
        min-width: 54px;
    }
    
    .countdown-item.primary .countdown-number {
        font-size: 26px;
    }
    
    .countdown-item.secondary {
        min-width: 48px;
    }
    
    .countdown-item.secondary .countdown-number {
        font-size: 18px;
    }
    
    .countdown-sep {
        font-size: 14px;
    }
    
    .seconds-ring-svg {
        width: 50px;
        height: 50px;
    }
    
    .countdown-item.secondary .seconds-ring-svg {
        width: 46px;
        height: 46px;
    }
    
    .main-title {
        font-size: 44px;
    }
    
    .mystic-text {
        font-size: 17px;
    }
    
    .sub-title {
        font-size: 13px;
        letter-spacing: 2px;
    }
}