* {
    box-sizing: border-box;
}

:root {
    --bg: #eef3fb;
    --bg-soft: #f6f8fc;
    --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 255, 0.72));
    --panel-solid: #ffffff;
    --panel-2: #f3f6fb;
    --line: rgba(152, 168, 190, 0.24);
    --line-strong: rgba(106, 125, 154, 0.28);
    --text: #18212f;
    --muted: #66758c;
    --muted-2: #8a95a6;
    --accent: #0a84ff;
    --accent-2: #3a8dff;
    --accent-soft: rgba(10, 132, 255, 0.12);
    --accent-glow: 0 0 0 1px rgba(10, 132, 255, 0.08), 0 16px 32px rgba(67, 124, 255, 0.18);
    --shadow: 0 20px 48px rgba(40, 58, 90, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --content: 1260px;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(108, 169, 255, 0.2), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.9), transparent 30%),
        linear-gradient(180deg, #f7faff 0%, #eaf0f9 100%);
    font-family: "Manrope", "Noto Sans SC", sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.56;
    transform: none;
    box-shadow: none;
}

.mobile-only-inline {
    display: none;
}

.desktop-only-inline {
    display: inline;
}

.page {
    min-height: 100vh;
    padding-bottom: 16px;
}

.topbar,
.main,
.footer-inner {
    width: min(calc(100% - 32px), var(--content));
    margin: 0 auto;
}

.topbar {
    padding-top: 10px;
}

.topbar-inner {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 18px;
    align-items: center;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1c95ff, #0069ff);
    color: white;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 10px 24px rgba(31, 112, 255, 0.24);
}

.brand-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 800;
}

.brand-copy span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}

.model-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 220px;
    border: 1px solid rgba(91, 115, 147, 0.18);
    border-radius: 999px;
    background:
        radial-gradient(circle at top left, rgba(65, 144, 255, 0.2), transparent 42%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 246, 255, 0.9));
    padding: 10px 12px 10px 16px;
    color: var(--text);
    box-shadow: 0 18px 30px rgba(42, 78, 140, 0.12);
    cursor: pointer;
}

.model-pill::after {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, #00c271, #00a368);
    box-shadow: 0 0 0 6px rgba(0, 194, 113, 0.12);
}

.model-pill-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.model-pill-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--muted-2);
}

.model-pill-name {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.1;
}

.model-pill-status {
    font-size: 12px;
    color: #0a84ff;
    font-weight: 800;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(10, 132, 255, 0.1);
}

.model-pill[data-model="gemini-3-pro-image-preview"] .model-pill-status {
    color: #7b4dff;
    background: rgba(123, 77, 255, 0.12);
}

.model-pill[data-model="gemini-3.1-flash-image-preview"] .model-pill-status {
    color: #007f87;
    background: rgba(0, 127, 135, 0.12);
}

.model-pill[data-model="gemini-2.5-flash-image"] .model-pill-status {
    color: #0a84ff;
    background: rgba(10, 132, 255, 0.1);
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.top-actions button {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}

.main {
    padding: 12px 0 18px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
    gap: 12px;
    align-items: stretch;
}

.generator-card,
.preview-card,
.settings-card {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 26px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
}

.generator-card,
.preview-card {
    padding: 18px;
    min-height: 640px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.lock-badge {
    position: absolute;
    top: 16px;
    right: 18px;
    z-index: 3;
    display: none;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(10, 132, 255, 0.12);
    border: 1px solid rgba(10, 132, 255, 0.18);
    color: #0a84ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.lock-badge.is-visible {
    display: inline-flex;
    align-items: center;
}

.field-group {
    position: relative;
}

.mobile-settings-anchor {
    display: none;
}

.risk-banner {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 159, 10, 0.18);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 159, 10, 0.12), rgba(255, 159, 10, 0.05));
    color: #9d6702;
    font-size: 12px;
    line-height: 1.55;
}

.risk-banner strong {
    color: #7a4d00;
}

.risk-banner-inline {
    margin-top: 10px;
    margin-bottom: 0;
    padding: 9px 12px;
    font-size: 12px;
}

.risk-banner-text-mobile {
    display: none;
}

.setting-row-model {
    align-items: flex-start;
}

.model-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.model-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 88px;
    padding: 16px 16px 15px;
    border: 1px solid rgba(128, 147, 173, 0.22);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.88));
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
}

.model-option::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(10, 132, 255, 0.14), transparent 38%);
    opacity: 0;
    transition: opacity 160ms ease;
}

.model-option strong,
.model-option small {
    position: relative;
    z-index: 1;
}

.model-option strong {
    font-size: 15px;
    font-weight: 800;
}

.model-option small {
    color: var(--muted);
    line-height: 1.4;
}

.model-option:hover::before,
.model-option.is-active::before {
    opacity: 1;
}

.model-option.is-active {
    border-color: rgba(10, 132, 255, 0.36);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(232, 242, 255, 0.92));
    box-shadow: 0 20px 32px rgba(33, 92, 177, 0.14);
}

.model-option.is-active strong {
    color: #0a5fe0;
}

.field-group + .field-group {
    margin-top: 16px;
    padding-top: 16px;
}

.field-group + .field-group::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(146, 161, 181, 0.18);
}

.field-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.field-title span,
.setting-name,
.settings-field label {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.price-note {
    margin-left: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.field-header-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: none;
    background: transparent;
    padding: 0;
    margin-bottom: 12px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.field-tools {
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.upload-box {
    display: block;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}

.upload-box.is-disabled {
    pointer-events: none;
    opacity: 0.55;
}

.upload-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 86px;
}

.upload-tile {
    width: 86px;
    aspect-ratio: 1;
    border: 2px dashed rgba(96, 112, 136, 0.55);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #66748a;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 247, 252, 0.95));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.upload-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-title {
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.upload-count {
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 700;
}

.upload-hint {
    display: block;
    margin-top: 6px;
    max-width: 560px;
    color: var(--muted-2);
    font-size: 12px;
    line-height: 1.55;
}

.upload-box.is-dragover .upload-tile {
    border-color: #0a84ff;
    color: #0a84ff;
    background: linear-gradient(180deg, rgba(10, 132, 255, 0.12), rgba(10, 132, 255, 0.06));
    box-shadow: var(--accent-glow);
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-height: 86px;
    align-content: flex-start;
}

.file-card {
    position: relative;
    width: 86px;
}

.file-card img {
    width: 86px;
    height: 86px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(160, 178, 202, 0.34);
    display: block;
    background: #edf2f8;
}

.file-card span {
    display: none;
}

.file-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #243140;
    cursor: pointer;
    opacity: 0;
}

.file-card:hover .file-remove {
    opacity: 1;
}

.settings-field input,
.settings-field select,
textarea {
    width: 100%;
    border: 1px solid rgba(123, 141, 166, 0.24);
    border-radius: 18px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    outline: none;
}

.settings-field input::placeholder,
textarea::placeholder {
    color: #8f99a8;
}

textarea {
    resize: none;
    min-height: 124px;
    max-height: 160px;
    line-height: 1.65;
    font-size: 14px;
    overflow-y: auto;
}

textarea:focus,
.settings-field input:focus,
.settings-field select:focus {
    border-color: rgba(10, 132, 255, 0.34);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.1);
}

.settings-help {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.prompt-trigger-button {
    border: none;
    background: rgba(10, 132, 255, 0.1);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    border-radius: 999px;
    padding: 8px 12px;
}

.prompt-example-filters {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid rgba(123, 141, 166, 0.16);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 250, 255, 0.74));
}

.prompt-filter-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    row-gap: 8px;
}

.prompt-filter-label {
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding-top: 8px;
}

.prompt-filter-chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.prompt-filter-chip {
    padding: 7px 11px;
    border: 1px solid rgba(123, 141, 166, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.prompt-filter-chip.is-active {
    border-color: rgba(10, 132, 255, 0.2);
    background: rgba(10, 132, 255, 0.1);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.04);
}

.prompt-example-scroll {
    display: grid;
    gap: 16px;
    align-content: start;
    grid-auto-rows: max-content;
    overflow-y: auto;
    padding-right: 4px;
}

.prompt-example-group {
    display: grid;
    gap: 14px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.prompt-example-group-head {
    display: none;
}

.prompt-example-group-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.prompt-example-phase {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(10, 132, 255, 0.1);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.prompt-example-subgroup {
    display: grid;
    gap: 8px;
}

.prompt-example-subtitle {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.04em;
}

.prompt-example-group[hidden],
.prompt-example-subgroup[hidden],
.prompt-example-chip[hidden] {
    display: none !important;
}

.prompt-example-scroll::-webkit-scrollbar {
    width: 8px;
}

.prompt-example-scroll::-webkit-scrollbar-thumb {
    background: rgba(123, 141, 166, 0.28);
    border-radius: 999px;
}

.prompt-example-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.prompt-example-chip {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid rgba(123, 141, 166, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    cursor: pointer;
}

.prompt-example-chip:hover {
    border-color: rgba(10, 132, 255, 0.2);
    background: rgba(10, 132, 255, 0.06);
    color: var(--text);
}

.prompt-example-empty {
    padding: 16px 14px;
    border: 1px dashed rgba(123, 141, 166, 0.24);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.66);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.prompt-examples-card {
    width: min(92vw, 920px);
    height: min(82vh, 760px);
    max-height: min(82vh, 760px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.prompt-example-scroll-modal {
    margin-top: 14px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding-right: 8px;
}

.setting-block {
    display: grid;
    gap: 14px;
}

.setting-row {
    display: grid;
    gap: 8px;
}

.setting-toggle {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.setting-toggle:hover,
.setting-toggle:active {
    transform: none;
}

.setting-toggle-summary {
    display: none;
    justify-self: end;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.setting-toggle-icon {
    display: none;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(97, 116, 143, 0.9);
    border-bottom: 2px solid rgba(97, 116, 143, 0.9);
    transform: rotate(45deg);
    transition: transform 160ms ease;
}

.setting-panel {
    min-width: 0;
}

.setting-row-collapsible:not(.is-collapsed) .setting-toggle-icon {
    transform: rotate(225deg);
}

.resolution-options,
.ratio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.resolution-chip,
.ratio-chip {
    border: 1px solid rgba(123, 141, 166, 0.26);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    border-radius: 18px;
    cursor: pointer;
}

.resolution-chip {
    min-width: 160px;
    padding: 12px 16px;
    text-align: left;
}

.resolution-chip strong {
    display: inline-block;
    margin-right: 8px;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 800;
}

.resolution-chip small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.resolution-chip.is-active,
.ratio-chip.is-active {
    border-color: rgba(10, 132, 255, 0.14);
    background: linear-gradient(180deg, #1790ff 0%, #0a84ff 100%);
    color: white;
    box-shadow: var(--accent-glow);
}

.resolution-chip.is-active small,
.ratio-chip.is-active small {
    color: rgba(255, 255, 255, 0.78);
}

.ratio-chip {
    padding: 9px 14px;
    font-size: 12px;
    color: var(--text);
    font-weight: 700;
    min-width: 78px;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 16px;
}

.clear-button,
.generate-button,
.primary-button,
.secondary-button {
    border-radius: 18px;
    cursor: pointer;
    font-weight: 800;
}

.clear-button,
.secondary-button {
    padding: 13px 16px;
    border: 1px solid rgba(123, 141, 166, 0.18);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
}

.clear-button {
    min-width: 132px;
}

.generate-button,
.primary-button {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: linear-gradient(180deg, #1d93ff 0%, #0a84ff 100%);
    color: #ffffff;
    box-shadow: 0 16px 28px rgba(10, 132, 255, 0.2);
    font-size: 16px;
}

.generate-button:hover,
.primary-button:hover {
    box-shadow: 0 18px 34px rgba(10, 132, 255, 0.26);
}

.generate-button:disabled {
    opacity: 0.62;
    cursor: wait;
}

.status-line {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.preview-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.view-tab {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.view-tab.is-active {
    color: var(--text);
    background: rgba(10, 132, 255, 0.12);
    border-color: rgba(10, 132, 255, 0.18);
}

.view-panel {
    display: none;
}

.view-panel.is-active {
    display: block;
}

.preview-card .view-panel.is-active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.preview-stage {
    position: relative;
    min-height: 500px;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    background:
        radial-gradient(circle at top, rgba(10, 132, 255, 0.08), transparent 36%),
        rgba(255, 255, 255, 0.65);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.preview-empty {
    text-align: center;
    max-width: 320px;
}

.preview-feedback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: rgba(245, 248, 253, 0.88);
}

.preview-feedback[data-state="idle"] {
    background: rgba(248, 251, 255, 0.8);
}

.preview-feedback[data-state="error"] {
    background: rgba(255, 242, 244, 0.9);
}

.preview-feedback p {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.preview-feedback span {
    max-width: 340px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-line;
}

.preview-feedback small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-line;
}

.preview-feedback-warning {
    display: none;
    margin-top: 2px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 159, 10, 0.12);
    border: 1px solid rgba(255, 159, 10, 0.2);
    color: #9d6702;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.preview-spinner {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 3px solid rgba(10, 132, 255, 0.14);
    border-top-color: #0a84ff;
    animation: spin 0.9s linear infinite;
}

.preview-feedback[data-state="idle"] .preview-spinner,
.preview-feedback[data-state="error"] .preview-spinner {
    display: none;
}

.preview-empty p {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 800;
}

.preview-empty span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

#preview-image {
    display: none;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
}

#preview-image.is-zoomable {
    cursor: zoom-in;
}

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

.history-list {
    display: grid;
    gap: 10px;
}

.preview-actions {
    display: none;
    justify-content: flex-end;
    margin-top: 10px;
    gap: 10px;
}

.preview-actions.is-visible {
    display: flex;
}

.preview-actions .primary-button,
.preview-actions .secondary-button {
    min-width: 132px;
}

.preview-actions #save-image {
    background: linear-gradient(180deg, #1d93ff 0%, #0a84ff 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 16px 28px rgba(10, 132, 255, 0.2);
}

.preview-actions #rerun-image {
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    border: 1px solid rgba(123, 141, 166, 0.18);
    box-shadow: none;
}

.preview-warning {
    margin-top: 8px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 159, 10, 0.16);
    border-radius: 12px;
    background: rgba(255, 159, 10, 0.06);
    color: #8f6a18;
    font-size: 11px;
    line-height: 1.45;
}

.history-item {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.66);
}

.history-item.is-openable {
    cursor: pointer;
}

.history-item.is-openable:hover {
    border-color: rgba(10, 132, 255, 0.2);
    box-shadow: 0 10px 24px rgba(10, 132, 255, 0.08);
}

.history-item img {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
}

.history-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    border: 1px dashed rgba(123, 141, 166, 0.28);
    background: rgba(255, 255, 255, 0.5);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 10px;
}

.history-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    line-height: 1.45;
}

.history-item p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.history-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-save-button,
.history-apply-button,
.history-delete-button {
    padding: 8px 12px;
    font-size: 12px;
}

.history-delete-button {
    border-color: rgba(207, 71, 67, 0.16);
    color: #b2431e;
    background: rgba(255, 245, 243, 0.92);
}

.footer {
    margin-top: 10px;
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.footer-inner a {
    color: var(--text);
    text-decoration: none;
}

.footer-inner a:hover {
    text-decoration: underline;
}

@media (min-width: 1121px) {
    html,
    body {
        height: 100dvh;
        overflow: hidden;
    }

    .page {
        height: 100dvh;
        min-height: 100dvh;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        padding: 8px 0 6px;
        overflow: hidden;
    }

    .topbar {
        padding-top: 0;
    }

    .topbar-inner {
        padding: 8px 14px;
    }

    .main {
        min-height: 0;
        padding: 10px 0 8px;
        overflow: hidden;
    }

    .workspace {
        height: 100%;
        min-height: 0;
        gap: 10px;
    }

    .generator-card,
    .preview-card {
        min-height: 0;
        height: 100%;
        padding: 14px;
        overflow: hidden;
    }

    .field-group + .field-group {
        margin-top: 12px;
        padding-top: 12px;
    }

    .field-header-button {
        margin-bottom: 10px;
    }

    .upload-row,
    .file-list {
        min-height: 78px;
    }

    .upload-tile,
    .file-card,
    .file-card img {
        width: 78px;
        height: 78px;
    }

    .file-list {
        gap: 6px;
    }

    textarea {
        min-height: 92px;
        max-height: 18vh;
        padding: 14px 16px;
    }

    .setting-block {
        gap: 10px;
    }

    .setting-row {
        gap: 6px;
    }

    .model-options {
        gap: 8px;
    }

    .model-option {
        min-height: 74px;
        padding: 12px 12px 11px;
        gap: 4px;
    }

    .model-option strong {
        font-size: 14px;
    }

    .model-option small {
        font-size: 11px;
        line-height: 1.3;
    }

    .resolution-options,
    .ratio-options {
        gap: 6px;
    }

    .resolution-chip {
        min-width: 132px;
        padding: 10px 12px;
    }

    .resolution-chip strong {
        font-size: 14px;
    }

    .resolution-chip small,
    .ratio-chip {
        font-size: 11px;
    }

    .ratio-chip {
        min-width: 68px;
        padding: 8px 12px;
    }

    .action-row {
        padding-top: 12px;
    }

    .generate-button,
    .primary-button,
    .secondary-button {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .risk-banner-inline {
        margin-top: 8px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .preview-tabs {
        margin-bottom: 8px;
    }

    #view-preview.view-panel.is-active {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 8px;
    }

    #view-history.view-panel.is-active {
        min-height: 0;
        overflow: hidden;
    }

    .preview-stage {
        min-height: 0;
        height: 100%;
        padding: 10px;
    }

    .preview-feedback {
        padding: 18px;
    }

    .preview-feedback p {
        font-size: 16px;
    }

    .preview-feedback span,
    .preview-feedback small,
    .preview-empty span {
        font-size: 12px;
    }

    .preview-actions {
        margin-top: 0;
    }

    .history-list {
        min-height: 0;
        height: 100%;
        overflow: auto;
        padding-right: 4px;
    }

    .history-item {
        grid-template-columns: 88px 1fr;
        gap: 10px;
        padding: 8px;
    }

    .history-item img,
    .history-placeholder {
        width: 80px;
        height: 80px;
    }

    .footer {
        margin-top: 0;
    }

    .footer-inner {
        padding-top: 0;
        font-size: 11px;
    }
}

.settings-modal {
    border: none;
    background: transparent;
    padding: 0;
}

.settings-modal::backdrop {
    background: rgba(95, 111, 136, 0.18);
    backdrop-filter: blur(8px);
}

.settings-card {
    width: min(92vw, 520px);
    padding: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 253, 0.92));
}

.settings-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.settings-head p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.settings-head h3 {
    margin: 0;
    font-size: 24px;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    cursor: pointer;
}

.settings-field {
    margin-top: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.image-lightbox {
    position: relative;
    width: min(92vw, 1400px);
    max-width: none;
    margin: auto;
    padding: 24px;
    border: none;
    border-radius: 24px;
    background: rgba(14, 22, 34, 0.92);
    overflow: hidden;
}

.image-lightbox::backdrop {
    background: rgba(10, 16, 26, 0.72);
    backdrop-filter: blur(8px);
}

.image-lightbox-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(88vw, 1320px);
    height: min(84vh, 920px);
    margin: 0 auto;
    overflow: hidden;
    touch-action: none;
    cursor: default;
}

.image-lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 16px;
    object-fit: contain;
    object-position: center center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 160ms ease-out;
}

.image-lightbox.is-dragging img {
    transition: none;
}

.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 1120px) {
    html,
    body {
        overflow: auto;
    }

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

    .model-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .generator-card,
    .preview-card {
        min-height: auto;
    }
}

@media (max-width: 820px) {
    .mobile-only-inline {
        display: inline;
    }

    .desktop-only-inline {
        display: none;
    }

    body {
        background: #f4f7fb;
    }

    .page {
        padding-bottom: 12px;
    }

    .main,
    .footer-inner {
        width: min(calc(100% - 20px), var(--content));
    }

    .topbar {
        display: none;
    }

    .main {
        padding: 12px 0 12px;
    }

    .workspace {
        gap: 12px;
    }

    .generator-card,
    .preview-card {
        padding: 14px;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.96);
        border-color: rgba(131, 145, 167, 0.14);
        box-shadow: 0 12px 28px rgba(27, 49, 82, 0.08);
        backdrop-filter: none;
    }

    .brand {
        display: none;
    }

    .brand-copy strong {
        font-size: 14px;
    }

    .brand-copy span {
        display: none;
    }

    .brand-logo-img {
        width: 28px;
        height: 28px;
    }

    .model-pill-copy {
        gap: 1px;
    }

    .model-pill-label {
        font-size: 10px;
    }

    .model-pill-name {
        font-size: 13px;
    }

    .model-pill-status {
        padding: 5px 9px;
        font-size: 11px;
    }

    .field-group + .field-group::before {
        background: rgba(146, 161, 181, 0.12);
    }

    .mobile-settings-anchor {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 5;
        display: block;
    }

    .mobile-settings-anchor > button {
        width: auto;
        min-width: 64px;
        border-radius: 999px;
        padding: 10px 14px;
        font-size: 13px;
        font-weight: 800;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(131, 145, 167, 0.18);
        color: var(--text);
        box-shadow: 0 10px 24px rgba(27, 49, 82, 0.12);
    }

    .field-title {
        margin-bottom: 10px;
    }

    .field-title span,
    .setting-name {
        font-size: 14px;
    }

    .model-options {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .model-option {
        min-height: 50px;
        height: 50px;
        padding: 0 5px;
        gap: 1px;
        border-radius: 14px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        align-content: center;
        text-align: center;
    }

    .model-option strong,
    .model-option small {
        display: block;
        width: 100%;
        margin: 0;
    }

    .model-option strong {
        font-size: 11px;
        line-height: 1.1;
    }

    .model-option small {
        font-size: 9px;
        line-height: 1.1;
    }

    .field-header-button {
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 10px;
        padding-right: 82px;
        font-size: 14px;
        line-height: 1.5;
    }

    .field-tools {
        display: none;
    }

    .action-row,
    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .resolution-options {
        display: grid;
        grid-template-columns: repeat(var(--quality-columns, 3), minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }

    .resolution-chip {
        min-width: 0;
        width: 100%;
        padding: 9px 8px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        text-align: center;
        white-space: nowrap;
    }

    .resolution-chip strong,
    .resolution-chip small {
        display: inline;
        margin: 0;
        font-size: 11px;
        line-height: 1.2;
        font-weight: 700;
    }

    .ratio-chip {
        min-width: calc(33.333% - 6px);
        padding: 9px 8px;
        border-radius: 14px;
    }

    .upload-tile {
        width: 72px;
        border-radius: 16px;
    }

    .upload-row {
        flex-wrap: nowrap;
        align-items: stretch;
        min-height: 72px;
        overflow: hidden;
    }

    .file-list {
        flex-wrap: nowrap;
        gap: 6px;
        min-height: 72px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .file-list::-webkit-scrollbar {
        display: none;
    }

    .file-card,
    .file-card img {
        width: 72px;
        height: 72px;
    }

    .field-group + .field-group {
        margin-top: 12px;
        padding-top: 12px;
    }

    textarea {
        min-height: 110px;
        max-height: 180px;
        padding: 14px 16px;
    }

    .setting-block {
        gap: 0;
    }

    .setting-row-model + .setting-row[data-setting-section="quality"] {
        margin-top: 10px;
    }

    .setting-row-collapsible {
        gap: 0;
        padding: 10px 12px;
        border: 1px solid rgba(123, 141, 166, 0.14);
        border-radius: 16px;
        background: #f8fafc;
    }

    .setting-toggle {
        padding: 2px 0;
    }

    .setting-toggle-summary {
        display: block;
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .setting-toggle-icon {
        display: block;
    }

    .setting-panel {
        display: grid;
        grid-template-rows: 1fr;
        transition: grid-template-rows 180ms ease, opacity 180ms ease, padding-top 180ms ease;
        opacity: 1;
        padding-top: 10px;
    }

    .setting-panel > * {
        min-height: 0;
        overflow: hidden;
    }

    .setting-row-collapsible.is-collapsed .setting-panel {
        grid-template-rows: 0fr;
        opacity: 0;
        padding-top: 0;
    }

    .setting-row[data-setting-section="quality"] {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding-bottom: 8px;
    }

    .setting-row[data-setting-section="quality"].is-collapsed {
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
        padding-bottom: 10px;
    }

    .setting-row[data-setting-section="quality"].is-collapsed + .setting-row[data-setting-section="ratio"] {
        display: none;
    }

    .setting-row[data-setting-section="ratio"] {
        margin-top: 0;
        padding-top: 8px;
        border-top: none;
        border-radius: 0 0 16px 16px;
    }

    .setting-row[data-setting-section="ratio"] .setting-toggle {
        display: none;
    }

    .setting-row[data-setting-section="ratio"] .setting-panel,
    .setting-row[data-setting-section="ratio"].is-collapsed .setting-panel {
        display: block;
        grid-template-rows: none;
        opacity: 1;
        padding-top: 0;
    }

    .setting-row[data-setting-section="ratio"].is-quality-host {
        display: grid;
        padding-top: 10px;
        border-top: 1px solid rgba(123, 141, 166, 0.14);
        border-radius: 16px;
    }

    .setting-row[data-setting-section="ratio"].is-quality-host .setting-toggle {
        display: grid;
    }

    .setting-row[data-setting-section="ratio"].is-quality-host .setting-panel {
        display: grid;
        grid-template-rows: 1fr;
        opacity: 1;
        padding-top: 10px;
    }

    .setting-row[data-setting-section="ratio"].is-quality-host.is-collapsed .setting-panel {
        grid-template-rows: 0fr;
        opacity: 0;
        padding-top: 0;
    }

    .preview-stage {
        min-height: 300px;
        border-radius: 16px;
        background: #f8fafc;
    }

    .preview-actions,
    .preview-actions.is-visible {
        display: none !important;
    }

    .preview-tabs {
        gap: 6px;
    }

    .view-tab {
        flex: 1;
        text-align: center;
        border-radius: 999px;
        padding: 9px 10px;
        font-size: 12px;
    }

    .preview-feedback {
        padding: 18px 16px;
    }

    .preview-feedback p {
        font-size: 16px;
    }

    .preview-feedback span,
    .preview-feedback small,
    .preview-empty span,
    .preview-empty p {
        max-width: 100%;
    }

    .risk-banner-inline {
        font-size: 11px;
        line-height: 1.2;
        padding: 8px 10px;
        border-radius: 12px;
        background: #fff7ea;
        border-color: rgba(255, 159, 10, 0.14);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }

    .risk-banner-inline strong {
        display: inline;
    }

    .risk-banner-text-desktop {
        display: none;
    }

    .risk-banner-text-mobile {
        display: inline;
    }

    .image-lightbox {
        width: 100vw;
        min-height: 100vh;
        padding: 16px;
        border-radius: 0;
    }

    .image-lightbox-stage {
        width: 100%;
        height: calc(100vh - 72px);
    }

    .image-lightbox img {
        max-width: 100%;
        max-height: 100%;
    }

    .image-lightbox-close {
        top: 14px;
        right: 14px;
    }

    .file-list {
        min-height: 0;
    }

    .history-item {
        grid-template-columns: 1fr;
        padding: 10px;
        border-radius: 14px;
    }

    .history-item img {
        width: 100%;
        height: 200px;
    }

    .footer {
        margin-top: 6px;
    }

    .footer-inner {
        font-size: 11px;
        line-height: 1.5;
    }
}
