.ig-widget-shell,
.ig-widget-shell * {
    box-sizing: border-box;
}

.ig-widget-shell {
    width: 100%;
    min-height: 260px;
    color: #111111 !important;
    font-family: Arial, Helvetica, sans-serif;
}

.ig-widget-shell a {
    color: inherit;
    text-decoration: none;
}

.ig-widget-shell .ig-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 220px;
    color: #555555;
    font-size: 14px;
}

.ig-widget-shell .ig-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid #dbdbdb;
    border-top-color: #0095f6;
    border-radius: 50%;
    animation: ig-spin 760ms linear infinite;
}

@keyframes ig-spin {
    to {
        transform: rotate(360deg);
    }
}

.ig-widget-shell .profile {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    justify-content: center;
    gap: 34px;
    max-width: 760px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.ig-widget-shell .profile__identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ig-widget-shell .profile__avatar-ring {
    display: grid;
    width: 58px;
    height: 58px;
    padding: 3px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(145deg, #feda75 0%, #fa7e1e 28%, #d62976 55%, #962fbf 75%, #4f5bd5 100%);
}

.ig-widget-shell .profile__avatar {
    display: block;
    width: 100%;
    height: 100%;
    border: 3px solid #ffffff;
    border-radius: 50%;
    object-fit: cover;
    background: #edf0f4;
}

.ig-widget-shell .profile__text {
    min-width: 0;
}

.ig-widget-shell .profile__name {
    margin: 0 0 4px;
    overflow: hidden;
    color: #111111;
    font-size: 16px;
    line-height: 1.15;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ig-widget-shell .profile__username {
    display: block;
    overflow: hidden;
    color: #555555 !important;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ig-widget-shell .metrics {
    display: flex;
    align-items: center;
    gap: 26px;
    margin: 0;
}

.ig-widget-shell .metrics__item {
    min-width: 54px;
    text-align: center;
}

.ig-widget-shell .metrics__label {
    margin-top: 3px;
    color: #777777 !important;
    font-size: 12px;
    line-height: 1.15;
    font-weight: 400;
}

.ig-widget-shell .metrics__value {
    margin: 0;
    color: #111111 !important;
    font-size: 14px;
    line-height: 1.15;
    font-weight: 700;
}

.ig-widget-shell .profile__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 16px;
    border-radius: 4px;
    background: #0095f6;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.ig-widget-shell .profile__button:hover {
    background: #1877f2;
}

.ig-widget-shell .debug {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px 12px;
    width: min(760px, calc(100% - 32px));
    margin: 0 auto 16px;
    padding: 10px 12px;
    border: 1px solid #dbdbdb;
    border-radius: 6px;
    background: #fafafa;
    color: #555555;
    font-size: 12px;
}

.ig-widget-shell .debug strong {
    color: #111111;
}

.ig-widget-shell .message {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px;
    border: 1px solid #dbdbdb;
    border-radius: 6px;
    background: #fafafa;
    color: #555555;
    text-align: center;
}

.ig-widget-shell .message--debug {
    margin-top: 10px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    text-align: left;
}

.ig-widget-shell .grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    margin: 0 auto;
}

.ig-widget-shell .post {
    position: relative;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    background: #eeeeee;
}

.ig-widget-shell .post__link {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    color: #ffffff;
}

.ig-widget-shell .post img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 180ms ease, filter 180ms ease;
}

.ig-widget-shell .post__video-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.36);
}

.ig-widget-shell .post__video-icon::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 9px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid #ffffff;
}

.ig-widget-shell .post__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 22px;
    background: rgba(0, 0, 0, 0.66);
    color: #ffffff;
    text-align: center;
    opacity: 0;
    transition: opacity 180ms ease;
}

.ig-widget-shell .post__caption {
    display: -webkit-box;
    max-width: 360px;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.ig-widget-shell .post__link:hover img {
    transform: scale(1.035);
    filter: brightness(0.78);
}

.ig-widget-shell .post__link:hover .post__overlay,
.ig-widget-shell .post__link:focus-visible .post__overlay {
    opacity: 1;
}

.ig-widget-shell .post__link:focus-visible {
    outline: 3px solid #0095f6;
    outline-offset: -3px;
}

@media (max-width: 1020px) {
    .ig-widget-shell .profile {
        grid-template-columns: 1fr auto;
        justify-content: stretch;
        gap: 18px 22px;
        max-width: 680px;
    }

    .ig-widget-shell .metrics {
        grid-column: 1 / -1;
        justify-content: center;
        order: 3;
    }

    .ig-widget-shell .profile__button {
        justify-self: end;
    }

    .ig-widget-shell .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .ig-widget-shell .profile {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 14px;
        margin-bottom: 18px;
        text-align: center;
    }

    .ig-widget-shell .profile__identity {
        flex-direction: column;
        gap: 8px;
    }

    .ig-widget-shell .metrics {
        width: 100%;
        justify-content: space-around;
        gap: 10px;
        order: initial;
    }

    .ig-widget-shell .metrics__item {
        min-width: 0;
    }

    .ig-widget-shell .profile__button {
        width: min(260px, 100%);
        justify-self: center;
    }

    .ig-widget-shell .debug {
        justify-content: flex-start;
        width: calc(100% - 20px);
        font-size: 11px;
    }

    .ig-widget-shell .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px;
    }

    .ig-widget-shell .post__overlay {
        display: none;
    }

    .ig-widget-shell .post__video-icon {
        top: 6px;
        right: 6px;
        width: 22px;
        height: 22px;
    }

    .ig-widget-shell .post__video-icon::before {
        top: 5px;
        left: 8px;
    }
}

body.ig-setup-page {
    margin: 0;
    background: #f3f5f7;
    color: #141414;
    font-family: Arial, Helvetica, sans-serif;
}

.ig-setup,
.ig-setup * {
    box-sizing: border-box;
}

.ig-setup {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 44px;
}

.ig-setup__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.ig-setup__eyebrow {
    margin: 0 0 4px;
    color: #666666;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.ig-setup h1,
.ig-setup h2,
.ig-setup p {
    margin-top: 0;
}

.ig-setup h1 {
    margin-bottom: 0;
    font-size: 30px;
    line-height: 1.12;
}

.ig-setup h2 {
    margin-bottom: 16px;
    font-size: 18px;
    line-height: 1.2;
}

.ig-setup__note,
.ig-setup__disabled,
.ig-setup__message {
    margin-bottom: 0;
    color: #555555;
    font-size: 14px;
    line-height: 1.45;
}

.ig-setup code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #e8edf2;
    color: #111111;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.92em;
}

.ig-setup__preview,
.ig-setup__panel {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #d9dee4;
    border-radius: 8px;
    background: #ffffff;
}

.ig-setup__preview .ig-widget-shell {
    padding-top: 8px;
}

.ig-setup__section-title,
.ig-setup__code-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ig-setup__section-title h2,
.ig-setup__code-title span {
    margin-bottom: 0;
}

.ig-setup__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 18px;
}

.ig-setup__status-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.ig-setup__status-list div {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e3e7ec;
    border-radius: 6px;
    background: #f8fafc;
}

.ig-setup__status-list dt {
    margin-bottom: 5px;
    color: #66717c;
    font-size: 12px;
    line-height: 1.2;
}

.ig-setup__status-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #111111;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.ig-setup__form {
    display: grid;
    gap: 14px;
}

.ig-setup__form label {
    display: grid;
    gap: 6px;
    color: #444444;
    font-size: 13px;
    font-weight: 700;
}

.ig-setup__form input[type="text"],
.ig-setup__form input[type="number"] {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #cfd6de;
    border-radius: 6px;
    background: #ffffff;
    color: #111111;
    font-size: 15px;
}

.ig-setup__form input:focus {
    border-color: #0095f6;
    outline: 3px solid rgba(0, 149, 246, 0.16);
}

.ig-setup__check {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 9px !important;
}

.ig-setup__check input {
    width: 18px;
    height: 18px;
}

.ig-setup__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #cfd6de;
    border-radius: 6px;
    background: #ffffff;
    color: #111111;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.ig-setup__button:hover:not(:disabled) {
    border-color: #aeb8c2;
    background: #f6f8fa;
}

.ig-setup__button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.ig-setup__button--primary {
    border-color: #0095f6;
    background: #0095f6;
    color: #ffffff;
}

.ig-setup__button--primary:hover:not(:disabled) {
    border-color: #1877f2;
    background: #1877f2;
}

.ig-setup__button--secondary {
    min-height: 34px;
    font-size: 13px;
}

.ig-setup__message {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #b8d8bf;
    border-radius: 6px;
    background: #f0faf2;
    color: #1e6b2c;
}

.ig-setup__message[data-error="1"] {
    border-color: #e3b6b6;
    background: #fff2f2;
    color: #9a1f1f;
}

.ig-setup__code-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ig-setup__code-title {
    margin-bottom: 8px;
    color: #333333;
    font-size: 14px;
    font-weight: 700;
}

.ig-setup pre {
    min-height: 250px;
    max-height: 360px;
    margin: 0;
    overflow: auto;
    padding: 14px;
    border: 1px solid #dbe0e6;
    border-radius: 6px;
    background: #111820;
    color: #eef6ff;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 900px) {
    .ig-setup__header,
    .ig-setup__section-title,
    .ig-setup__code-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .ig-setup__grid,
    .ig-setup__code-grid {
        grid-template-columns: 1fr;
    }

    .ig-setup__status-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .ig-setup {
        width: min(100% - 20px, 1180px);
        padding-top: 16px;
    }

    .ig-setup h1 {
        font-size: 24px;
    }

    .ig-setup__preview,
    .ig-setup__panel {
        padding: 14px;
    }

    .ig-setup__status-list {
        grid-template-columns: 1fr;
    }

    .ig-setup__button {
        width: 100%;
    }
}
