:root {
    color-scheme: light;
    --accent: #5b6cff;
    --accent-ink: #ffffff;
    --ink: #172033;
    --muted: #7b879c;
    --line: #e6ebf4;
    --paper: #eef3fb;
    --card: #ffffff;
    --ok: #178a4a;
    --bad: #c2415b;
    --grid: rgba(148, 163, 184, 0.28);
}

html.dark {
    color-scheme: dark;
    --ink: #f4f7fb;
    --muted: #9aa8bd;
    --line: #2a3548;
    --paper: #0d1422;
    --card: #161e2e;
    --grid: rgba(148, 163, 184, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
    background:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px, 28px 28px, auto;
}

.boot {
    margin: 2rem;
    color: var(--muted);
}

.shell {
    width: min(980px, calc(100% - 1.5rem));
    margin: 1.4rem auto 3rem;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(23, 32, 51, 0.05);
}

.head {
    padding: 1.35rem 1.4rem 1.15rem;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--card)), var(--card) 4.5rem);
}
.body { margin-top: 0.9rem; padding: 1.25rem 1.35rem 1.4rem; }

.brand-row, .tab-row, .split {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.brand { display: flex; gap: 0.9rem; align-items: flex-start; min-width: 0; }

.mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: white;
    font-weight: 800;
    letter-spacing: -0.04em;
    flex: 0 0 auto;
}

.guide {
    margin: 0 0 1rem;
    padding: 0.9rem 1rem 1rem;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 8%, var(--card));
    border: 1px solid var(--line);
}

.guide ol {
    margin: 0.45rem 0 0;
    padding-inline-start: 1.15rem;
}

.guide li { margin: 0.28rem 0; }

#review-session-rows { display: contents; }

.kicker {
    margin: 0;
    color: #1f9d63;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0.1rem 0 0;
    font-size: clamp(1.55rem, 3vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.04em;
}

h2 { margin: 0 0 0.8rem; font-size: 1.05rem; }

.sub, .help { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }

.tools { display: flex; gap: 0.45rem; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lang select {
    appearance: none;
    height: 42px;
    max-width: 11rem;
    padding: 0 2rem 0 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background-color: var(--card);
    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 fill='%237b879c' d='M1.2 1.4 6 6.2 10.8 1.4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

html[dir="rtl"] .lang select {
    padding: 0 0.8rem 0 2rem;
    background-position: left 0.7rem center;
}

html[lang="fa"] body { font-family: Tahoma, "Segoe UI", sans-serif; }

.tool, .tab, .btn {
    font: inherit;
    cursor: pointer;
}

.tool {
    min-width: 42px;
    height: 42px;
    padding: 0 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-weight: 700;
}

.tool.icon { width: 42px; padding: 0; }
#theme-icon {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto;
    border-radius: 50%;
    box-shadow: inset -6px -4px 0 0 var(--ink);
}

html.dark #theme-icon {
    box-shadow: none;
    background: var(--ink);
}

.tab-row { margin-top: 1.15rem; align-items: flex-end; flex-wrap: wrap; }

.tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.3rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--paper) 70%, var(--card));
}

.tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 11px;
    padding: 0.55rem 0.85rem;
    font-weight: 700;
}

.tab.is-on {
    background: var(--card);
    color: var(--accent);
    box-shadow: 0 1px 2px rgba(23, 32, 51, 0.06);
}

.queue {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.86rem;
    white-space: nowrap;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--paper) 70%, var(--card));
    border: 1px solid var(--line);
}

.queue strong { color: var(--accent); font-size: 1.05rem; }
.dot, .live::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
}
.live { display: inline-flex; align-items: center; gap: 0.3rem; color: #1f9d63; font-weight: 700; }

.steps {
    list-style: none;
    display: flex;
    gap: 0.4rem;
    margin: 1rem 0 0.2rem;
    padding: 0;
}

.steps li {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
}

.steps li span {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #eef2f7;
    color: #8b97ab;
    font-size: 0.82rem;
}

.steps li.is-current { color: var(--accent); }
.steps li.is-current span { background: var(--accent); color: white; }
.steps li.is-done { color: #1f9d63; }
.steps li.is-done span { background: #1f9d63; color: white; }
.steps li em { font-style: normal; }
.steps li:not(:last-child)::after {
    content: "";
    flex: 1;
    height: 2px;
    margin-inline-start: 0.35rem;
    background: var(--line);
}
.steps li.is-done:not(:last-child)::after { background: #1f9d63; }

.banner, .note {
    margin: 0.8rem 0 0;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
}

.banner.info { background: #eef4ff; color: #1e3a8a; }
.banner.warn, .banner.error { background: #fff1f2; color: var(--bad); }
.banner.ok { background: #ecfdf3; color: var(--ok); }
.note { background: color-mix(in srgb, var(--paper) 65%, var(--card)); color: var(--ink); }

input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    padding: 0.85rem 0.95rem;
}

textarea {
    min-height: 9rem;
    resize: vertical;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.84rem;
}

input:focus, textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    border-color: var(--accent);
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-weight: 800;
}

.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
}
.btn.block { width: 100%; margin-top: 0.85rem; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.split { margin-top: 0.85rem; }
.split .btn { flex: 1; }
.split .btn.primary { flex: 1.4; }

.status-banner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0 0 0.35rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid transparent;
}

.status-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: white;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
}

.status-kicker {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-title {
    margin: 0.05rem 0 0;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.status-banner.is-ok { background: #ecfdf3; border-color: #b7ebc9; }
.status-banner.is-ok .status-mark { background: #1f9d63; }
.status-banner.is-ok .status-kicker { color: #1f9d63; }

.status-banner.is-bad { background: #fff1f2; border-color: #fecdd3; }
.status-banner.is-bad .status-mark { background: var(--bad); }
.status-banner.is-bad .status-kicker { color: var(--bad); }

.status-banner.is-wait { background: #fff7ed; border-color: #fed7aa; }
.status-banner.is-wait .status-mark { background: #c2410c; }
.status-banner.is-wait .status-kicker { color: #c2410c; }

.status-banner.is-run { background: #eef4ff; border-color: #d5defa; }
.status-banner.is-run .status-mark { background: var(--accent); }
.status-banner.is-run .status-kicker { color: var(--accent); }

html.dark .status-banner.is-ok { background: #10261b; border-color: #1d5c3a; }
html.dark .status-banner.is-bad { background: #2a1520; border-color: #6b2940; }
html.dark .status-banner.is-wait { background: #2a1c12; border-color: #7a4a22; }
html.dark .status-banner.is-run { background: #141c33; border-color: #2c3d73; }

#result .help { margin: 0.75rem 0 0; }

.review { margin: 0.35rem 0 0; }
.review div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}
.review dt { color: var(--muted); }
.review dd { margin: 0; font-weight: 700; text-align: end; word-break: break-all; }

.code {
    margin: 0.7rem 0;
    padding: 0.85rem;
    border-radius: 12px;
    background: #172033;
    color: #f8fafc;
    font-family: ui-monospace, monospace;
    word-break: break-all;
}

.card-alert { margin-top: 0.9rem; }

.vendor-list { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.8rem; }
.vendor-link {
    display: block;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px var(--line);
    font-weight: 700;
}
.vendor-link:hover { box-shadow: inset 0 0 0 1px var(--accent); }

@media (max-width: 1024px) {
    .shell { width: min(860px, calc(100% - 2rem)); }
    .head, .body { padding-left: 1.15rem; padding-right: 1.15rem; }
    .tab-row { align-items: stretch; }
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 0 0 auto; }
    .queue { justify-content: flex-start; }
}

@media (max-width: 768px) {
    body { font-size: 15px; }
    .shell {
        width: min(100% - 1.25rem, 720px);
        margin-top: 0.85rem;
    }
    .brand-row { align-items: flex-start; }
    h1 { font-size: 1.45rem; }
    .sub { font-size: 0.88rem; }
    .mark { width: 46px; height: 46px; border-radius: 12px; }
    .tab-row { gap: 0.75rem; }
    .steps li { font-size: 0.82rem; min-width: 0; }
    .steps li em { overflow-wrap: anywhere; }
    .review div { align-items: flex-start; }
    input, textarea, select, .btn { font-size: 16px; }
    .btn { min-height: 48px; }
}

@media (max-width: 560px) {
    .shell {
        width: 100%;
        margin: 0;
        padding: 0.65rem 0.65rem calc(1.25rem + env(safe-area-inset-bottom));
    }
    .panel { border-radius: 16px; }
    .head, .body { padding: 1rem 0.9rem; }
    .brand { gap: 0.7rem; }
    .tools { flex: 0 0 auto; }
    .tool { min-width: 40px; height: 40px; }
    h1 { font-size: 1.22rem; }
    .kicker { letter-spacing: 0.04em; }
    .steps { gap: 0.2rem; }
    .steps li {
        position: relative;
        flex-direction: column;
        align-items: center;
        gap: 0.28rem;
        font-size: 0.7rem;
        line-height: 1.2;
        text-align: center;
    }
    .steps li:not(:last-child)::after {
        display: block;
        position: absolute;
        top: 11px;
        inset-inline-start: calc(50% + 16px);
        width: calc(100% - 32px);
        margin: 0;
    }
    .steps li span { width: 24px; height: 24px; }
    .queue {
        white-space: normal;
        flex-wrap: wrap;
        row-gap: 0.15rem;
    }
    .split { flex-direction: column-reverse; align-items: stretch; }
    .split .btn, .split .btn.primary { flex: none; width: 100%; }
    .status-title { font-size: 1.25rem; }
    .review div { flex-direction: column; gap: 0.15rem; }
    .review dd { text-align: start; }
    textarea { min-height: 11rem; }
}
