:root {
    color-scheme: light;
    --white: #fff;
    --black: #101010;
    --muted: #595959;
    --line: #dedede;
    --field-line: #c9c9c9;
    --quiet: #f4f4f4;
    --lab: #fafafa;
    --radius: 5px;
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
    font-synthesis: none;
    color: var(--black);
    background: var(--white);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
canvas { display: block; }

:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 3px;
}

.shell {
    width: min(1140px, calc(100% - 72px));
    margin-inline: auto;
}

.site-header { border-bottom: 1px solid var(--line); }

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 69px;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.brand-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: 30px;
    aspect-ratio: 1;
    flex: none;
    border-radius: 4px;
    background: var(--black);
}

.brand-mark::before, .brand-mark::after { content: ""; }
.brand-mark::before { width: 14px; height: 14px; border: 1px solid var(--white); }
.brand-mark::after { position: absolute; width: 4px; height: 4px; background: var(--white); }

.site-nav { align-self: stretch; display: flex; gap: 25px; }

.site-nav a {
    position: relative;
    display: grid;
    align-content: center;
    min-height: 44px;
    padding-inline: 4px;
    color: var(--muted);
    white-space: nowrap;
    font-size: 14px;
}

.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--black); }
.site-nav a[aria-current="page"] { font-weight: 750; }

.site-nav a[aria-current="page"]::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px;
    height: 2px;
    background: var(--black);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-block: 17px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.home { padding-block: 64px 68px; }

.hero {
    display: grid;
    grid-template-columns: 1.05fr minmax(0, 1fr);
    align-items: center;
    gap: clamp(28px, 5vw, 76px);
    min-height: 369px;
    padding-bottom: 49px;
}

.hero h1 {
    font-size: clamp(44px, 6.35vw, 90px);
    line-height: 1.06;
    letter-spacing: -.045em;
    font-weight: 800;
}

.hero-copy p {
    max-width: 29em;
    margin-top: 27px;
    color: var(--muted);
    line-height: 1.9;
}

.hero-art {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    aspect-ratio: 1.51;
    border: 1px solid var(--line);
    background: radial-gradient(#cecece 0.75px, transparent 1px) 0 0 / 14px 14px, var(--lab);
}

.hero-art::before, .hero-art::after {
    content: "";
    position: absolute;
    pointer-events: none;
    background: #d9d9d9;
}

.hero-art::before { inset: 0 auto; width: 1px; }
.hero-art::after { inset: auto 0; height: 1px; }

.art-frame {
    position: relative;
    z-index: 1;
    width: min(70%, 344px);
    padding: 8px;
    border: 1px solid var(--black);
    background: var(--white);
}

.art-grid {
    display: grid;
    grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr));
    aspect-ratio: 1.51;
    gap: 4px;
}

.art-tile { position: relative; display: block; overflow: hidden; }
.art-orbit { background: radial-gradient(circle at 60% 105%, #111 0 24%, #fff 24.5% 39%, #111 39.5% 51%, #bcbcbc 51.5% 69%, #111 69.5%); }
.art-rays { background: repeating-linear-gradient(131deg, #121212 0 5px, #fff 5px 10px); }
.art-rays::before { content: ""; position: absolute; inset: 0; background: #f1f1f1; clip-path: polygon(0 0, 65% 0, 0 88%); }
.art-bars { background: #e8e8e8; }
.art-bars::before { content: ""; position: absolute; inset: 0; background: #111; clip-path: polygon(0 100%, 0 79%, 21% 79%, 21% 58%, 43% 58%, 43% 38%, 65% 38%, 65% 19%, 84% 19%, 84% 0, 100% 0, 100% 100%); }
.art-mark { display: grid; place-items: center; background: #111; color: #fff; font: 600 clamp(21px, 5vw, 57px)/1 "Segoe UI", system-ui, sans-serif; letter-spacing: -.1em; }

.art-frame > i {
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--black);
    background: var(--white);
}
.art-frame > i:nth-of-type(1) { top: -4px; left: -4px; }
.art-frame > i:nth-of-type(2) { top: -4px; right: -4px; }
.art-frame > i:nth-of-type(3) { bottom: -4px; left: -4px; }
.art-frame > i:nth-of-type(4) { bottom: -4px; right: -4px; }

.tool-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-block: 1px solid var(--black);
}

.tool-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 112px;
    padding: 19px 22px;
    transition: background-color .16s;
}

.tool-card + .tool-card { border-left: 1px solid var(--line); }
.tool-card:hover { background: var(--quiet); }
.tool-card:focus-visible { outline-offset: -3px; }
.tool-card h2 { font-size: 19px; line-height: 1.4; }
.tool-card p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.card-arrow { margin-inline: 6px 0; font: 400 22px/1 system-ui, sans-serif; }

.card-icon {
    display: grid;
    place-content: center;
    width: 46px;
    aspect-ratio: 1;
    border: 1px solid var(--field-line);
    border-radius: var(--radius);
    background: var(--white);
}

.icon-text { font: 650 19px/1 "Segoe UI", system-ui, sans-serif; letter-spacing: -.06em; }
.icon-grid { grid-template: repeat(2, 7px) / repeat(2, 7px); gap: 3px; }
.icon-grid i { background: var(--black); }

.editor { padding-block: 45px 58px; }
.page-intro { margin-bottom: 26px; }
.page-intro h1 { font-size: clamp(32px, 4.4vw, 51px); line-height: 1.18; letter-spacing: -.04em; font-weight: 800; }
.page-intro p { margin-top: 8px; color: var(--muted); }

.workspace {
    display: grid;
    grid-template-columns: minmax(289px, 342px) minmax(0, 1fr);
    align-items: stretch;
    border: 1px solid var(--line);
    border-top-color: var(--black);
}

.panel { min-width: 0; padding: 21px 22px 23px; }
.settings-panel { border-right: 1px solid var(--line); }
.workspace-main { min-width: 0; }
.list-panel { border-top: 1px solid var(--line); }

.panel-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    margin-bottom: 16px;
}

.panel-heading h2 { font-size: 16px; line-height: 1.4; }
.preview-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.preview-meta:empty { display: none; }

.drop-zone {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 17px 10px 13px;
    border: 1px dashed #a4a4a4;
    border-radius: var(--radius);
    background: var(--lab);
}

.drop-zone.is-drag-over, .drop-zone.drag-over { background: #eaeaea; border-color: var(--black); }

.upload-icon {
    display: grid;
    place-items: center;
    width: 29px;
    aspect-ratio: 1;
    border: 1px solid var(--field-line);
    background: var(--white);
    border-radius: var(--radius);
    font: 400 19px/1 system-ui, sans-serif;
}

.drop-zone p, .status { color: var(--muted); font-size: 12px; }
.status:not(:empty) { margin-top: 10px; overflow-wrap: anywhere; }
.status.is-error { padding-left: 8px; border-left: 2px solid var(--black); color: var(--black); }

.settings-form { display: grid; gap: 16px; margin-top: 17px; }
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tab-pane { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field label, .field-label { font-size: 13px; font-weight: 650; }
.field label span, .value { margin-left: 3px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }

.field input:not([type="range"]), .field select {
    width: 100%;
    min-height: 40px;
    padding: 6px 9px;
    border: 1px solid var(--field-line);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--black);
}

.field input[aria-invalid="true"] { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.field input[type="file"] { min-width: 0; padding: 4px; font-size: 13px; }

.field input[type="file"]::file-selector-button {
    padding: 4px 8px;
    margin-right: 7px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--quiet);
    font: inherit;
    cursor: pointer;
}

.range-field, .color-field { grid-template-columns: 1fr auto; align-items: center; }
.range-field input { grid-column: 1 / -1; width: 100%; margin: 0; min-height: 23px; accent-color: var(--black); cursor: pointer; }
.value { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.color-field input[type="color"] { width: 44px; min-height: 30px; height: 30px; padding: 3px 4px; cursor: pointer; }

.segmented {
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--quiet);
}

.segmented button {
    flex: 1;
    min-height: 37px;
    padding: 4px 2px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    white-space: nowrap;
    font-size: 13px;
}

.segmented button:hover { color: var(--black); }
.segmented button[aria-pressed="true"] { background: var(--black); color: var(--white); font-weight: 700; }

.actions { display: flex; gap: 8px; padding-top: 2px; }
.actions .button-primary { flex: 1; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 6px 14px;
    border: 1px solid var(--black);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.button-secondary { color: var(--black); background: var(--white); }
.button-secondary:hover:not(:disabled) { background: var(--quiet); }
.button-primary { color: var(--white); background: var(--black); }
.button-primary:hover:not(:disabled) { background: #333; }
.button:disabled { color: #606060; background: #efefef; border-color: var(--line); }

.empty-preview, .preview-stage {
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 382px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--lab);
}

.empty-preview {
    gap: 11px;
    color: var(--muted);
    font-size: 13px;
    background-image: radial-gradient(#d8d8d8 0.65px, transparent 0.9px);
    background-size: 13px 13px;
}

.preview-stage:not([hidden]) + .empty-preview { display: none; }

.empty-icon {
    display: grid;
    width: 45px;
    height: 38px;
    grid-template: 1fr 1fr / 1.3fr 1fr;
    gap: 3px;
    padding: 5px;
    border: 1px solid var(--black);
    border-radius: 2px;
    background: var(--white);
}

.empty-icon i { border: 1px solid var(--field-line); }
.empty-icon i:first-child { grid-row: span 2; border-color: var(--black); background: var(--black); }

.preview-stage {
    background-image: conic-gradient(#ededed 25%, transparent 0 50%, #ededed 0 75%, transparent 0);
    background-size: 16px 16px;
}

.preview-stage canvas { max-width: 100%; max-height: 620px; height: auto; object-fit: contain; }

.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.image-item { min-width: 0; padding: 5px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--lab); }
.image-item[draggable="true"] { cursor: grab; }
.image-item.is-dragging { opacity: .45; }
.image-item.is-drop-target { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.image-item-preview { width: 100%; height: 68px; object-fit: contain; background: var(--quiet); border-radius: 2px; }
.image-item-actions { display: flex; gap: 3px; margin-top: 4px; }

.image-item-actions button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--white);
    color: var(--black);
    font-size: 16px;
}

.image-item-actions button:hover:not(:disabled) { border-color: var(--black); background: var(--quiet); }
.image-item-actions button:disabled { color: #707070; background: #ededed; }

@media (max-width: 860px) {
    .shell { width: calc(100% - 48px); }
    .home { padding-block: 45px 54px; }
    .hero { min-height: 0; padding-bottom: 35px; }
    .hero h1 { font-size: clamp(44px, 7.35vw, 68px); }
    .hero-copy p { margin-top: 17px; }
    .workspace { grid-template-columns: minmax(255px, 0.9fr) minmax(0, 1.1fr); }
    .panel { padding-inline: 17px; }
}

@media (max-width: 640px) {
    .shell { width: calc(100% - 32px); }
    .header-inner { min-height: 60px; gap: 9px; }
    .brand { gap: 7px; font-size: 13px; }
    .brand-mark { width: 24px; }
    .brand-mark::before { width: 12px; height: 12px; }
    .site-nav { gap: 5px; }
    .site-nav a { padding-inline: 6px; font-size: 12px; }
    .home { padding-block: 38px 42px; }
    .hero { grid-template-columns: 1fr; gap: 24px; padding-bottom: 24px; }
    .hero h1 { font-size: clamp(43px, 10.7vw, 65px); }
    .hero-copy p { font-size: 14px; line-height: 1.7; }
    .hero-art { max-width: 500px; width: 100%; aspect-ratio: 1.84; }
    .art-frame { width: min(63%, 270px); padding: 6px; }
    .art-mark { font-size: clamp(26px, 7.8vw, 48px); }
    .desktop-break { display: none; }
    .tool-cards { grid-template-columns: 1fr; }
    .tool-card { min-height: 78px; padding: 12px 5px; gap: 11px; }
    .tool-card + .tool-card { border-top: 1px solid var(--line); border-left: 0; }
    .tool-card h2 { font-size: 16px; }
    .tool-card p { font-size: 12px; }
    .card-icon { width: 38px; }
    .editor { padding-block: 28px 37px; }
    .page-intro { margin-bottom: 18px; }
    .page-intro p { font-size: 14px; }
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .panel { padding: 15px; }
    .settings-panel { border-right: 0; border-bottom: 1px solid var(--line); }
    .panel-heading { margin-bottom: 12px; }
    .button, .field input:not([type="range"]), .field select { min-height: 44px; }
    .workspace:has(.preview-stage:not([hidden])) .drop-zone { grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; gap: 8px; padding: 7px; }
    .workspace:has(.preview-stage:not([hidden])) .upload-icon { display: none; }
    .empty-preview, .preview-stage { min-height: 196px; padding: 9px; }
    .preview-stage canvas { max-height: 430px; }
    .image-item-actions button { min-height: 42px; }
}

@media (max-width: 340px) {
    .header-inner { flex-wrap: wrap; justify-content: center; padding-top: 10px; }
    .brand { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
