:root {
    --bg: #05070d;
    --bg-2: #090f1a;
    --surface: #0d1524;
    --surface-soft: #121d31;
    --text: #e8edf7;
    --muted: #9aa7bf;
    --line: #22314b;
    --focus: #4f9dff;
    --ok: #53d197;
    --error: #ff7d88;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Segoe UI Variable", "Segoe UI", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 0%, rgba(79, 157, 255, 0.22), transparent 45%),
        radial-gradient(circle at 80% 100%, rgba(83, 209, 151, 0.12), transparent 45%),
        linear-gradient(165deg, var(--bg), var(--bg-2));
}

.stage {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    display: grid;
    place-items: center;
    padding: 1.2rem;
}

.center-ui {
    width: min(960px, 100%);
    display: grid;
    gap: 0.9rem;
}

.main-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(13, 21, 36, 0.88);
    color: var(--text);
    padding: 1.05rem 1.08rem;
    font-size: clamp(1.06rem, 2.8vw, 1.45rem);
    text-align: center;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.main-input:focus,
.share-url:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(79, 157, 255, 0.18);
}

.creator-tools {
    display: grid;
    gap: 0.8rem;
}

.settings-card {
    display: grid;
    gap: 0.72rem;
    border: 1px solid rgba(79, 157, 255, 0.24);
    border-radius: 14px;
    background: linear-gradient(130deg, rgba(12, 22, 40, 0.82), rgba(14, 29, 46, 0.7));
    padding: 0.78rem;
}

.setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.72rem;
}

.setting-copy {
    display: grid;
    gap: 0.2rem;
}

.setting-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.setting-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.algo-select {
    width: min(360px, 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 0.72rem 0.8rem;
    font-size: 0.9rem;
}

.algo-select:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(79, 157, 255, 0.18);
}

.switch {
    display: inline-flex;
    align-items: center;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.switch-ui {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid #364f73;
    background: #17253a;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.switch-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #c4d6f3;
    transition: transform 140ms ease;
}

.switch input:checked+.switch-ui {
    border-color: #3e7aca;
    background: linear-gradient(120deg, #174580, #1f5fa8);
}

.switch input:checked+.switch-ui::after {
    transform: translateX(20px);
}

.switch input:focus-visible+.switch-ui {
    box-shadow: 0 0 0 4px rgba(79, 157, 255, 0.18);
}

.switch input:disabled+.switch-ui {
    opacity: 0.52;
}

.salt-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
}

.salt-value {
    width: 100%;
    border: 1px solid #2e476d;
    border-radius: 10px;
    background: rgba(16, 28, 47, 0.86);
    color: #aec4e8;
    padding: 0.6rem 0.7rem;
    font-family: "Cascadia Mono", "Consolas", "Lucida Console", ui-monospace, monospace;
    font-size: 0.78rem;
}

.regen-btn {
    border: 1px solid #3a4f74;
    border-radius: 10px;
    background: linear-gradient(120deg, #0f2748, #153860);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.62rem 0.86rem;
    cursor: pointer;
}

.regen-btn:hover {
    filter: brightness(1.08);
}

.regen-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.url-row {
    display: grid;
    gap: 0.55rem;
}

.share-url {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 0.78rem 0.84rem;
    font-family: "Cascadia Mono", "Consolas", "Lucida Console", ui-monospace, monospace;
    font-size: 0.84rem;
}

.copy-btn {
    border: 1px solid #3a4f74;
    border-radius: 12px;
    background: linear-gradient(120deg, #0f2748, #153860);
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 700;
    padding: 0.78rem 1rem;
    cursor: pointer;
}

.copy-btn:hover {
    filter: brightness(1.08);
}

.status {
    margin: 0;
    min-height: 1.3rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted);
}

.status.ok {
    color: var(--ok);
    font-weight: 700;
}

.status.error {
    color: var(--error);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.art-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    place-items: center;
    padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
    pointer-events: none;
}

.art-footer-inner {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.68rem;
    border: 1px solid rgba(79, 157, 255, 0.26);
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(12, 22, 40, 0.84), rgba(14, 31, 52, 0.66));
    backdrop-filter: blur(10px);
    padding: 0.44rem 0.86rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.footer-divider {
    width: 0.34rem;
    height: 0.34rem;
    border-radius: 999px;
    background: linear-gradient(140deg, #53d197, #4f9dff);
}

.art-footer a {
    color: #bfdcff;
    text-decoration: none;
    font-weight: 700;
}

.art-footer a:hover {
    color: #e4f2ff;
}

@media (min-width: 820px) {
    .url-row {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .copy-btn {
        min-width: 130px;
    }
}

@media (max-width: 740px) {
    .setting-row {
        grid-template-columns: 1fr;
        gap: 0.52rem;
    }

    .algo-select {
        width: 100%;
    }

    .switch {
        justify-self: end;
    }
}
