* {
    box-sizing: border-box;
}

:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: light;
}

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

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 14%, rgba(255,255,255,.88), transparent 28rem),
        linear-gradient(180deg, #f8fafc 0%, var(--page-bg) 100%);
}

button, input, select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.page-shell {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 26px 18px 54px;
}

.generator-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    position: relative;
    width: 38px;
    height: 34px;
}

.brand-mark-yellow,
.brand-mark-blue {
    position: absolute;
    inset: 0;
    display: block;
}

.brand-mark-yellow {
    width: 18px;
    height: 30px;
    top: 2px;
    background: var(--secondary);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.brand-mark-blue {
    left: 10px;
    width: 29px;
    height: 34px;
    background: var(--primary);
    border-radius: 4px 18px 18px 4px;
    clip-path: polygon(0 0, 100% 0, 74% 50%, 100% 100%, 0 100%, 40% 50%);
}

.brand-copy {
    display: grid;
    line-height: 1;
}

.brand-copy strong {
    font-size: 17px;
    letter-spacing: -.02em;
}

.brand-copy small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.generator-nav a {
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.generator-nav a:hover,
.generator-nav a:focus-visible {
    color: var(--primary);
    text-decoration: underline;
}

.hero {
    text-align: center;
    margin: 32px 0 24px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(27px, 4vw, 35px);
    letter-spacing: -.04em;
}

.hero p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.editor-card {
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 18px;
    border: 1px solid rgba(0,0,0,.04);
    border-radius: 24px;
    background: var(--card-bg);
    box-shadow: 0 18px 54px rgba(25, 35, 48, .10);
}

.preview-wrap {
    position: relative;
    width: min(100%, 356px);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 24px;
    overflow: hidden;
    border: 4px solid var(--secondary);
    background: #151515;
    box-shadow: 0 14px 40px rgba(7, 88, 184, .14);
    touch-action: none;
    cursor: grab;
}

.preview-wrap.round-preview {
    border-radius: 50%;
}

.preview-wrap.dragging {
    cursor: grabbing;
}

#photoCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 25px;
    background:
        radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), transparent 8rem),
        #111;
    pointer-events: none;
}

.empty-state.hidden {
    display: none;
}

.camera-bubble {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    font-size: 22px;
}

.empty-state strong {
    font-size: 17px;
}

.empty-state > span {
    margin-top: 6px;
    color: rgba(255,255,255,.72);
    font-size: 13px;
}

.empty-badge {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.empty-badge small {
    max-width: 145px;
    font-size: 9px;
    font-weight: 900;
    color: var(--secondary);
    text-transform: uppercase;
}

.empty-badge b {
    padding: 3px 10px 5px;
    color: #fff;
    background: var(--primary);
    border-radius: 8px;
    font-size: 25px;
    line-height: 1;
    transform: skew(-7deg);
}

.zoom-row {
    width: min(100%, 316px);
    margin: 13px auto 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    color: #777;
    font-weight: 800;
}

.zoom-row input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.soft-button,
.ghost-button,
.primary-button,
.frame-option {
    border: 0;
    cursor: pointer;
}

.soft-button {
    min-height: 48px;
    border: 1px solid #e5e5e5;
    border-radius: 13px;
    background: #f8f8f8;
    color: #171717;
    font-weight: 750;
}

.soft-button:hover {
    border-color: #d3d3d3;
    background: #f3f3f3;
}

.mirror-option {
    width: fit-content;
    margin: 12px auto 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #252525;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mirror-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--primary);
}

hr {
    height: 1px;
    margin: 20px 0;
    border: 0;
    background: #ededed;
}

.section-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.section-title.compact {
    margin-bottom: 10px;
}

.step {
    flex: 0 0 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #121212;
    font-size: 12px;
    font-weight: 900;
}

.section-title h2 {
    margin: 0;
    font-size: 16px;
}

.section-title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.frame-options {
    margin-top: 13px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 8px;
}

.frame-option {
    min-width: 0;
    padding: 6px 5px 9px;
    border: 1px solid #ececec;
    border-radius: 13px;
    background: #fff;
}

.frame-option.selected {
    border: 2px solid var(--primary);
    padding: 5px 4px 8px;
    background: color-mix(in srgb, var(--primary) 5%, white);
}

.frame-option strong {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    color: #111;
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.frame-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: block;
    overflow: hidden;
    border: 2px solid #d6d6d6;
    border-radius: 50%;
    background: #e6e6e6;
}

.frame-thumb-classic {
    background: linear-gradient(180deg, #0c1b65 0%, #06144c 100%);
    border-color: var(--secondary);
}

.frame-thumb-classic::after,
.frame-thumb-wave::after,
.frame-thumb-minimal::after,
.frame-thumb-duo::after {
    content: "";
    position: absolute;
    left: 4%;
    right: 4%;
    bottom: 5%;
    height: 24%;
    background: var(--primary);
    transform: skew(-12deg);
}

.frame-thumb-classic::before {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    top: 10%;
    bottom: 24%;
    border-radius: 10px;
    background:
        linear-gradient(180deg, transparent 0 65%, rgba(255,212,55,.9) 66% 71%, transparent 72%),
        linear-gradient(180deg, rgba(255,255,255,.9) 0 18%, transparent 19%),
        linear-gradient(180deg, rgba(255,157,32,.95) 18% 41%, transparent 42%),
        linear-gradient(180deg, rgba(255,255,255,.95) 42% 71%, transparent 72%);
}

.frame-thumb-wave::after {
    height: 18%;
    background:
        linear-gradient(165deg, var(--secondary) 0 33%, var(--primary) 34% 100%);
}

.frame-thumb-minimal {
    border: 3px solid var(--primary);
    box-shadow: inset -5px 0 0 var(--secondary);
}

.frame-thumb-minimal::after {
    height: 18%;
    border-radius: 999px;
    transform: none;
}

.frame-thumb-duo {
    background: linear-gradient(180deg, #1355c2 0%, #0c2c91 100%);
    border-color: var(--primary);
}

.frame-thumb-duo::before {
    content: "";
    position: absolute;
    left: 14%;
    top: 18%;
    width: 28%;
    height: 36%;
    border-radius: 50% 50% 46% 46%;
    background: #d7d7d7;
    box-shadow: 32px 4px 0 0 #b8b8b8;
}

.frame-thumb-duo::after {
    height: 21%;
    background: linear-gradient(180deg, #2607b8 0%, #190b93 100%);
    transform: none;
    border-radius: 16px 16px 0 0;
}

.mini-number {
    position: absolute;
    z-index: 2;
    right: 12%;
    bottom: 9%;
    color: white;
    font-size: 8px;
    font-weight: 950;
}

.effect-row select {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #dedede;
    border-radius: 12px;
    background: #fff;
    color: #111;
    outline: none;
}

.effect-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.help {
    margin: 13px 3px 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
}

.footer-actions {
    margin-top: 16px;
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 10px;
}

.ghost-button,
.primary-button {
    min-height: 49px;
    border-radius: 13px;
    font-weight: 850;
}

.ghost-button {
    color: #222;
    background: #f2f2f2;
}

.primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 25%, transparent);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: .45;
    box-shadow: none;
}

.message {
    min-height: 18px;
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.developer-credit {
    margin: 22px 0 0;
    text-align: center;
    font-size: 11px;
    line-height: 1.35;
}

.developer-credit a {
    color: var(--muted);
    text-decoration: none;
}

.developer-credit a:hover,
.developer-credit a:focus-visible {
    color: var(--primary);
    text-decoration: underline;
}

@media (max-width: 540px) {
    .page-shell {
        padding: 18px 11px 32px;
    }

    .brand {
        margin-bottom: 18px;
    }

    .hero {
        margin-bottom: 16px;
    }

    .hero h1 {
        font-size: 25px;
    }

    .hero p {
        padding: 0 15px;
    }

    .editor-card {
        padding: 13px;
        border-radius: 19px;
    }

    .preview-wrap {
        width: min(100%, 330px);
    }

    .frame-options {
        grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
        gap: 6px;
    }

    .frame-option {
        padding-left: 3px;
        padding-right: 3px;
    }
}

@media (max-width: 390px) {
    .frame-option strong {
        font-size: 9px;
    }
}
