:root {
    --page-bg: #f5f5f6;
    --card-bg: #ffffff;
    --ink: #17181d;
    --muted: #7a7d87;
    --soft: #f3f3f4;
    --line: #dedfe4;
    --line-soft: #ececef;
    --black: #17181c;
    --green: #55bd87;
    --shadow: 0 12px 30px rgba(22, 23, 28, 0.06);
    --radius-lg: 28px;
    --radius-md: 18px;
}

body {
    background: var(--page-bg);
    color: var(--ink);
}

.main {
    padding-top: 76px;
    min-height: 100vh;
}

.studio-page {
    max-width: 1760px;
    margin: 0 auto;
    padding: 20px 64px 80px;
}

.studio-hero {
    text-align: center;
    padding: 16px 0 58px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 4px 12px rgba(22, 23, 28, 0.06);
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
}

.spark {
    width: 22px;
    height: 22px;
    color: var(--ink);
}

.studio-hero h1 {
    margin: 30px 0 16px;
    font-size: clamp(38px, 4vw, 58px);
    line-height: 1.08;
    letter-spacing: -0.04em;
    font-weight: 900;
}

.studio-hero p {
    color: var(--muted);
    font-size: clamp(18px, 1.6vw, 26px);
    letter-spacing: 0.02em;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 26px;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #777a84;
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

.progress-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: #777a84;
    font-weight: 900;
}

.progress-item.done .progress-dot,
.progress-item.active .progress-dot {
    background: var(--black);
    color: #fff;
}

.progress-item.success {
    color: var(--green);
}

.progress-item.success .progress-dot {
    background: var(--green);
    color: #fff;
}

.progress-line {
    width: 78px;
    height: 1px;
    margin: 0 14px;
    background: #cfd0d5;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
    gap: 46px;
    align-items: start;
}

.left-stack {
    display: grid;
    gap: 30px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.upload-card {
    min-height: 170px;
    padding: 36px;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.title-group {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.icon-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--soft);
    color: #737680;
    flex: 0 0 auto;
}

.title-group h2,
.result-head h2 {
    font-size: 20px;
    line-height: 1.2;
    font-weight: 900;
    margin: 0 0 4px;
}

.title-group p,
.result-head p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.4;
}

.counter {
    color: #6f727d;
    font-size: 17px;
    font-weight: 800;
    padding-top: 8px;
}

.drop-zone {
    display: grid;
    place-items: center;
    min-height: 184px;
    margin-top: 24px;
    border: 2px dashed #dedfe6;
    border-radius: 24px;
    color: #25262b;
    text-align: center;
    font-weight: 800;
    line-height: 1.45;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.3)),
        repeating-linear-gradient(135deg, rgba(23, 24, 29, 0.018) 0 8px, transparent 8px 16px);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop-zone:hover {
    border-color: #b8bac2;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.42)),
        repeating-linear-gradient(135deg, rgba(23, 24, 29, 0.03) 0 8px, transparent 8px 16px);
    transform: translateY(-1px);
}

.drop-zone.is-disabled {
    cursor: not-allowed;
    opacity: 0.58;
    pointer-events: none;
}

.file-input {
    display: none;
}

.upload-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: var(--soft);
    color: #7a7d86;
}

.preview-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 14px;
    margin-top: 22px;
    box-shadow: 0 8px 18px rgba(22, 23, 28, 0.12);
}

.preview-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.preview-item {
    position: relative;
}

.preview-list .preview-image {
    margin-top: 0;
}

.preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--black);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
}

.controls-card {
    padding: 34px;
}

.field-group {
    margin-bottom: 24px;
}

.field-label {
    display: block;
    margin-bottom: 10px;
    color: #777a84;
    font-size: 16px;
    font-weight: 800;
}

.select-like,
.textarea-like {
    width: 100%;
    border: 1px solid var(--line);
    background: #f4f4f5;
    border-radius: 18px;
    color: #202126;
    font-size: 17px;
    line-height: 1.45;
}

.select-like {
    height: 58px;
    padding: 0 20px;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #898c95 50%),
        linear-gradient(135deg, #898c95 50%, transparent 50%);
    background-position:
        calc(100% - 24px) 26px,
        calc(100% - 17px) 26px;
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.textarea-like {
    min-height: 156px;
    padding: 18px 20px;
    color: #202126;
    resize: vertical;
    outline: none;
}

.textarea-wrap {
    position: relative;
}

.textarea-like::placeholder {
    color: #8c8f98;
}

.textarea-like:focus,
.select-like:focus {
    border-color: #bfc1c9;
    box-shadow: 0 0 0 4px rgba(23, 24, 29, 0.05);
}

.select-like:disabled,
.textarea-like:disabled {
    color: #8c8f98;
    cursor: not-allowed;
    opacity: 0.78;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 22px;
}

.primary-action,
.secondary-action {
    width: 100%;
    min-height: 80px;
    border-radius: 20px;
    font-size: 22px;
    font-weight: 900;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.primary-action {
    background: var(--black);
    color: #fff;
    border-color: var(--black);
}

.primary-action.disabled {
    background: #929294;
    border-color: #929294;
}

.primary-action:not(.disabled) {
    cursor: pointer;
}

.primary-action.is-loading {
    cursor: wait;
}

.secondary-action {
    background: #fff;
    color: var(--black);
}

.cost {
    margin-top: -18px;
    color: #9a9ca4;
    text-align: center;
    font-size: 14px;
}

.result-card {
    min-height: 760px;
    padding: 36px;
}

.result-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 52px;
    padding: 0 25px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(22, 23, 28, 0.07);
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
}

.empty-result {
    display: grid;
    place-items: center;
    min-height: 660px;
    color: #8a8d96;
    text-align: center;
    font-size: 18px;
    line-height: 1.5;
}

.empty-result .big-spark,
.analyzing-panel .big-spark,
.generating-panel .big-spark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 92px;
    margin-bottom: 22px;
    border-radius: 50%;
    background: var(--soft);
    color: #737680;
}

.analyzing-panel,
.generating-panel {
    display: grid;
    place-items: center;
    min-height: 660px;
    color: var(--ink);
    text-align: center;
    font-size: 18px;
    line-height: 1.5;
}

.analyzing-inner,
.generating-inner {
    max-width: 420px;
}

.analyzing-panel h3,
.generating-panel h3 {
    font-size: 22px;
    font-weight: 900;
    margin: 0 0 10px;
}

.analyzing-panel p,
.generating-panel p {
    color: var(--muted);
    font-size: 16px;
    margin: 0 0 28px;
}

.analyzing-panel .loading-stack,
.generating-panel .loading-stack {
    text-align: left;
}

.loading-line {
    position: relative;
    overflow: hidden;
    min-height: 18px;
    border-radius: 999px;
    background: #ececf0;
}

.loading-line::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.68), transparent);
    animation: shimmer 1.3s infinite;
}

.loading-stack {
    display: grid;
    gap: 12px;
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

.gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.gallery.multi {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.result-image-card {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    background: #eee;
    box-shadow: 0 10px 26px rgba(22, 23, 28, 0.12);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-image-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(22, 23, 28, 0.16);
}

.result-image-card img {
    width: 100%;
    display: block;
}

.feedback {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: flex;
    gap: 10px;
}

.feedback button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.78);
    color: #5f626b;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 36px;
    background: rgba(10, 11, 14, 0.82);
    backdrop-filter: blur(8px);
}

.image-modal.active {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: min(92vw, 1120px);
    max-height: 90vh;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

.image-modal-close {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.hidden {
    display: none !important;
}

@media (max-width: 1280px) {
    .studio-page {
        padding-left: 28px;
        padding-right: 28px;
    }

    .workspace {
        grid-template-columns: 420px minmax(0, 1fr);
        gap: 28px;
    }
}

@media (max-width: 980px) {
    .studio-page {
        padding: 18px 18px 54px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .progress-bar {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .result-card {
        min-height: auto;
    }

    .empty-result,
    .analyzing-panel,
    .generating-panel {
        min-height: 380px;
    }
}

@media (max-width: 640px) {
    .main {
        padding-top: 64px;
    }

    .studio-hero {
        padding-bottom: 34px;
    }

    .studio-hero h1 {
        font-size: 36px;
    }

    .studio-hero p {
        font-size: 17px;
    }

    .upload-card,
    .controls-card,
    .result-card {
        padding: 22px;
        border-radius: 22px;
    }

    .grid-2,
    .gallery {
        grid-template-columns: 1fr;
    }

    .progress-line {
        width: 32px;
        margin: 0 8px;
    }

    .progress-item {
        font-size: 14px;
    }

    .progress-dot {
        width: 34px;
        height: 34px;
    }
}
