:root {
    --bg: #0A0E14;
    --panel: #111826;
    --panel-alt: #0D1420;
    --panel-border: #1E2938;
    --field-bg: #0B1220;

    --text-primary: #E6EDF3;
    --text-secondary: #7C8B9A;
    --text-muted: #4B5A6A;

    --accent-cyan: #4FD1C5;
    --accent-cyan-soft: rgba(79, 209, 197, .15);
    --accent-amber: #F5A623;
    --accent-red: #FF5F56;
    --dot-yellow: #FFBD2E;
    --dot-green: #27C93F;

    --font-body: 'Vazirmatn', 'Tahoma', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    --radius-lg: 16px;
    --radius-md: 10px;

    --shadow-panel: 0 24px 70px -24px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .02);
}

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

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 8%, rgba(79, 209, 197, .07), transparent 42%),
        radial-gradient(circle at 88% 92%, rgba(245, 166, 35, .05), transparent 42%),
        var(--bg);
    color: var(--text-primary);
    font-family: var(--font-body);

    display: flex;
    justify-content: center;
    align-items: center;

    min-height: 100vh;
    padding: 24px 16px;

    direction: rtl;
    position: relative;
    overflow-x: hidden;
}

.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, .015) 0px,
        rgba(255, 255, 255, .015) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
    opacity: .5;
}

/* ---- کارت ترمینال ---- */

.terminal {
    width: min(94vw, 560px);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
}

.terminal__chrome {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 13px 18px;
    background: var(--panel-alt);
    border-bottom: 1px solid var(--panel-border);
}

.chrome__dots {
    display: flex;
    gap: 7px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.dot--red { background: var(--accent-red); }
.dot--yellow { background: var(--dot-yellow); }
.dot--green { background: var(--dot-green); }

.chrome__title {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    direction: ltr;
    unicode-bidi: isolate;
}

.terminal__body {
    padding: clamp(20px, 5vw, 34px);
}

/* ---- خط پرامپت ---- */

.prompt {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);

    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;

    margin-bottom: 24px;
}

.prompt__glyph {
    color: var(--text-muted);
}

.prompt__cmd {
    color: var(--accent-cyan);
}

.cursor {
    width: 7px;
    height: 15px;
    background: var(--accent-cyan);
    display: inline-block;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ---- تیتر و توضیح ---- */

.title {
    font-size: clamp(20px, 4.6vw, 26px);
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: 8px;
}

.lead {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.75;
    margin-bottom: 26px;
}

/* ---- فیلد پیام ---- */

.field {
    position: relative;
}

.field__caret {
    position: absolute;
    top: 14px;
    inset-inline-start: 14px;

    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 14px;

    direction: ltr;
    unicode-bidi: isolate;
    pointer-events: none;
}

textarea {
    width: 100%;
    height: 160px;
    resize: none;

    background: var(--field-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);

    padding-block: 14px;
    padding-inline-start: 40px;
    padding-inline-end: 16px;

    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.75;

    direction: rtl;
    outline: none;

    transition: border-color .2s ease, box-shadow .2s ease;
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--accent-cyan-soft);
}

.field-meta {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.char-count {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-muted);
    direction: ltr;
    unicode-bidi: isolate;
}

.char-count.char-count--limit {
    color: var(--accent-amber);
}

/* ---- دکمه ارسال ---- */

.send-btn {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    margin-top: 18px;
    padding: 14px;

    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-cyan);
    color: #0A0E14;

    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15.5px;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}

.send-btn:hover {
    background: #6EE2D6;
    box-shadow: 0 10px 26px -10px rgba(79, 209, 197, .55);
}

.send-btn:active {
    transform: scale(.98);
}

.send-btn:disabled {
    opacity: .6;
    cursor: progress;
    box-shadow: none;
}

.send-btn:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
}

.send-btn__icon {
    font-family: var(--font-mono);
    font-size: 18px;
    direction: ltr;
    unicode-bidi: isolate;
}

/* ---- خط وضعیت (خروجی شبیه ping واقعی) ---- */

.status {
    margin-top: 18px;
    min-height: 18px;

    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
}

.status--pending { color: var(--accent-amber); }
.status--success { color: var(--accent-cyan); }
.status--error   { color: var(--accent-red); }

/* ---- جداکننده ---- */

.divider {
    margin-top: 22px;
    margin-bottom: 4px;
    border-top: 1px dashed var(--panel-border);
}

/* ---- پنل دکمه زنگ ---- */

.ring-panel {
    margin-top: 18px;
    text-align: center;
}

.ring-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 10px 20px;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    background: transparent;
    color: var(--accent-amber);

    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;

    transition: border-color .2s ease, background .2s ease, transform .15s ease;
}

.ring-btn:hover:not(:disabled) {
    border-color: var(--accent-amber);
    background: rgba(245, 166, 35, .08);
}

.ring-btn:active:not(:disabled) {
    transform: scale(.97);
}

.ring-btn:focus-visible {
    outline: 2px solid var(--accent-amber);
    outline-offset: 3px;
}

.ring-btn:disabled {
    color: var(--text-muted);
    border-color: var(--panel-border);
    cursor: default;
}

.ring-btn__icon {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ring-btn--ringing .ring-btn__icon {
    animation: ring-shake .5s ease-in-out;
}

@keyframes ring-shake {
    0%, 100% { transform: rotate(0deg); }
    20%      { transform: rotate(18deg); }
    40%      { transform: rotate(-16deg); }
    60%      { transform: rotate(10deg); }
    80%      { transform: rotate(-6deg); }
}

.ring-status {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-muted);
    min-height: 14px;
}

.ring-total {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--accent-amber);
    min-height: 14px;
}

/* ---- ریسپانسیو ---- */

@media (max-width: 420px) {
    .terminal__body {
        padding: 18px;
    }

    textarea {
        height: 140px;
    }

    .chrome__title {
        display: none;
    }

    .send-btn {
        font-size: 14.5px;
    }
}

@media (max-width: 340px) {
    .prompt {
        font-size: 11.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
        opacity: 1;
    }

    .send-btn,
    textarea {
        transition: none;
    }

    .ring-btn--ringing .ring-btn__icon {
        animation: none;
    }
}
