.iw-modal .modal-dialog {
    max-width: 430px;
    margin: 1.5rem auto;
}

.iw-modal .modal-content {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    padding: 16px 20px 20px;
    max-height: calc(100vh - 3rem);
    overflow: hidden;
}

.iw-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.iw-top {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 32px;
}

.iw-progress {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.iw-progress span {
    display: block;
    height: 100%;
    width: 33%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 180ms ease;
}

.iw-close {
    width: 40px;
    height: 40px;
    margin: -4px -8px -4px 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.iw-close:hover {
    background: var(--surface-hover);
    color: var(--text-main);
}

.iw-close:focus-visible {
    outline: 2px solid var(--accent-line);
    outline-offset: 2px;
}

.iw-art {
    width: 84px;
    height: 84px;
    margin: 22px 0 16px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: var(--accent-tint);
    border: 1px solid var(--accent-border);
    color: var(--accent-text);
}

.iw-art--ok {
    background: var(--ok-bg);
    border-color: var(--ok-bd);
    color: var(--ok);
}

.iw-art--pair {
    width: auto;
    grid-auto-flow: column;
    gap: 12px;
    padding: 0 18px;
}

.iw-art--pair .iw-art-arrow {
    color: var(--text-dim);
}

.iw-art svg {
    display: block;
}

.iw-title {
    margin: 0 0 8px;
    font-size: 1.375rem;
    line-height: 1.22;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.iw-title:focus {
    outline: none;
}

.iw-lead {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.55;
}

.iw-list {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.iw-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.875rem;
    line-height: 1.5;
}

.iw-num {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--accent-text);
    background: var(--accent-soft-bg);
    border: 1px solid var(--accent-border);
}

.iw-list b {
    color: var(--text-main);
    font-weight: 600;
}

.iw-points {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.iw-points li {
    position: relative;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.iw-points li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.45em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.iw-note {
    margin: 14px 0 0;
    color: var(--text-dim);
    font-size: 0.75rem;
    line-height: 1.5;
}

.iw-actions {
    position: sticky;
    bottom: 0;
    display: grid;
    gap: 8px;
    margin-top: 22px;
    padding-top: 4px;
    padding-bottom: 2px;
    background: var(--surface);
}

.iw-actions::before {
    content: "";
    position: absolute;
    left: -20px;
    right: -20px;
    top: -22px;
    height: 22px;
    background: linear-gradient(to bottom, transparent, var(--surface) 72%);
    pointer-events: none;
}

.iw-btn {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.iw-btn:hover,
.iw-btn:focus {
    text-decoration: none;
}

.iw-btn--primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.iw-btn--primary:hover {
    background: var(--accent-hover);
}

.iw-btn--primary:active {
    background: var(--accent-press);
}

.iw-btn--ghost {
    min-height: 44px;
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-main);
}

.iw-btn--ghost:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.iw-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.iw-btn:focus-visible {
    outline: 2px solid var(--accent-line);
    outline-offset: 2px;
}

.iw-link {
    display: inline-block;
    margin-top: 2px;
    padding: 8px 0;
    border: 0;
    background: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}

.iw-link:hover {
    color: var(--danger);
}

.iw-link:focus-visible {
    outline: 2px solid var(--accent-line);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .iw-modal .modal-dialog {
        margin: 0;
        max-width: none;
        min-height: 100%;
        display: flex;
        align-items: flex-end;
    }

    .iw-modal .modal-content {
        border-radius: 20px 20px 0 0;
        border-bottom: 0;
        padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
        max-height: 92vh;
    }

    .iw-art {
        margin-top: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .iw-progress span,
    .iw-btn {
        transition: none;
    }
}

@media (max-height: 720px) {
    .iw-art {
        width: 72px;
        height: 72px;
        margin: 14px 0 12px;
        border-radius: 18px;
    }

    .iw-art--pair {
        width: auto;
        padding: 0 14px;
    }

    .iw-title {
        font-size: 1.25rem;
    }

    .iw-lead {
        font-size: 0.84375rem;
        line-height: 1.45;
    }

    .iw-list {
        gap: 8px;
        margin-top: 12px;
    }

    .iw-note {
        margin-top: 10px;
    }

    .iw-actions {
        margin-top: 14px;
    }
}
