:root {
    color-scheme: dark;
    --bg: #020617;
    --bg-soft: #07111f;
    --surface: rgba(15, 23, 42, 0.78);
    --surface-strong: rgba(15, 23, 42, 0.96);
    --surface-soft: rgba(30, 41, 59, 0.56);
    --line: rgba(148, 163, 184, 0.2);
    --line-strong: rgba(148, 163, 184, 0.32);
    --text: #f8fafc;
    --muted: #94a3b8;
    --muted-strong: #cbd5e1;
    --primary: #38bdf8;
    --primary-strong: #0ea5e9;
    --accent: #a78bfa;
    --success: #22c55e;
    --danger: #fb7185;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.46);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    zoom: 90%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 5%, rgba(56, 189, 248, 0.18), transparent 30%),
        radial-gradient(circle at 78% 0%, rgba(167, 139, 250, 0.2), transparent 28%),
        linear-gradient(135deg, #020617 0%, #07111f 48%, #020617 100%);
    line-height: 1.6;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
input,
select {
    font: inherit;
}

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

a {
    color: inherit;
    text-decoration: none;
}

img,
canvas,
svg {
    display: block;
}

.skip-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 20;
    transform: translateY(-150%);
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-weight: 800;
    transition: transform 180ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.site-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.site-header {
    position: sticky;
    top: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    color: #ecfeff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.28);
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.2;
}

.brand strong {
    font-size: 0.98rem;
    letter-spacing: -0.02em;
}

.brand small {
    margin-top: 0.08rem;
    color: var(--muted);
    font-size: 0.76rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-links a {
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 180ms ease, color 180ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: white;
    background: rgba(148, 163, 184, 0.12);
    outline: none;
}

.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: stretch;
    padding: 72px 0 36px;
}

.hero-copy,
.hero-card,
.panel,
.feature-card,
.tips-panel {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.hero-copy {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 5vw, 56px);
    border-radius: var(--radius-xl);
}

.hero-copy::after {
    position: absolute;
    right: -150px;
    bottom: -170px;
    width: 340px;
    height: 340px;
    content: "";
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.18), transparent 66%);
}

.eyebrow,
.section-kicker,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.08);
    color: #bae6fd;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.eyebrow,
.section-kicker {
    padding: 0.42rem 0.72rem;
}

.pulse-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}

.hero h1 {
    max-width: 820px;
    margin: 1.15rem 0 1rem;
    font-size: clamp(2.45rem, 7vw, 5.4rem);
    line-height: 0.95;
    letter-spacing: -0.075em;
}

.hero p,
.section-heading p,
.panel-header p,
.feature-card p,
.tips-panel p,
.export-notes span {
    color: var(--muted);
}

.hero p {
    max-width: 650px;
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.18rem);
}

.hero-actions,
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.82rem 1.12rem;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.btn-primary {
    color: #06101e;
    background: linear-gradient(135deg, #67e8f9, #60a5fa 48%, #c4b5fd);
    box-shadow: 0 16px 38px rgba(56, 189, 248, 0.24);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    box-shadow: 0 22px 48px rgba(56, 189, 248, 0.32);
}

.btn-secondary {
    border-color: var(--line);
    color: var(--muted-strong);
    background: rgba(15, 23, 42, 0.72);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    border-color: var(--line-strong);
    color: white;
    background: rgba(30, 41, 59, 0.78);
}

.hero-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 360px;
    padding: 24px;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.94)),
        radial-gradient(circle at 75% 10%, rgba(167, 139, 250, 0.18), transparent 40%);
}

.mini-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding: 1rem;
    border: 2px solid #5c5c5c;
    border-radius: 12px;
    background: #1f1f1f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px rgba(0, 0, 0, 0.42);
}

.mini-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 8px;
    background: #111;
    color: #777;
    font-family: "VT323", monospace;
    font-size: 1.65rem;
}

.mini-preview strong,
.mini-preview small {
    display: block;
    font-family: "VT323", monospace;
    line-height: 1;
}

.mini-preview strong {
    color: #ffff55;
    font-size: 1.45rem;
    text-shadow: 2px 2px #3f3f00;
}

.mini-preview small {
    margin-top: 0.25rem;
    color: white;
    font-size: 1.15rem;
    text-shadow: 2px 2px #3f3f3f;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin: 0;
}

.hero-stats div {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.42);
}

.hero-stats dt,
.hero-stats dd {
    margin: 0;
}

.hero-stats dt {
    font-size: 1.35rem;
    font-weight: 900;
}

.hero-stats dd {
    color: var(--muted);
    font-size: 0.78rem;
}

.workspace,
.feature-grid,
.tips-panel {
    scroll-margin-top: 110px;
}

.workspace {
    padding-top: 18px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 18px;
}

.section-heading h2,
.tips-panel h2 {
    margin: 0.75rem 0 0;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.section-heading p {
    max-width: 430px;
    margin: 0;
}

.section-heading.compact {
    display: block;
    margin-top: 56px;
}

.tool-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
    gap: 20px;
}

.panel {
    border-radius: var(--radius-xl);
}

.controls-panel,
.preview-panel {
    padding: clamp(18px, 3vw, 28px);
}

.panel-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 22px;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.28rem;
    letter-spacing: -0.02em;
}

.panel-header p {
    margin: 0.28rem 0 0;
    font-size: 0.92rem;
}

.status-pill {
    flex: 0 0 auto;
    padding: 0.38rem 0.62rem;
    border-color: rgba(34, 197, 94, 0.22);
    background: rgba(34, 197, 94, 0.09);
    color: #bbf7d0;
}

.tool-form {
    display: grid;
    gap: 18px;
}

.field-group {
    display: grid;
    gap: 0.55rem;
}

.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

label,
.label-row {
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 800;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.counter {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.form-control {
    width: 100%;
    min-height: 48px;
    padding: 0.86rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
    color: white;
    background: rgba(2, 6, 23, 0.48);
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.form-control:hover {
    border-color: var(--line-strong);
}

.form-control:focus {
    border-color: rgba(56, 189, 248, 0.78);
    background: rgba(2, 6, 23, 0.66);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

select.form-control {
    cursor: pointer;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, 0.48);
}

.color-grid>div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.color-grid label {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 700;
}

.color-picker {
    width: 100%;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.dropzone {
    position: relative;
    display: grid;
    min-height: 178px;
    place-items: center;
    padding: 1.35rem;
    border: 1.5px dashed rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-align: center;
    cursor: pointer;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.64), rgba(2, 6, 23, 0.56)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 62%);
    transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.dropzone:hover,
.dropzone.dragover,
.dropzone:focus-within {
    border-color: rgba(56, 189, 248, 0.78);
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(2, 6, 23, 0.62)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.2), transparent 66%);
}

.dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.dropzone-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin-bottom: 0.75rem;
    place-items: center;
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 18px;
    color: #67e8f9;
    background: rgba(56, 189, 248, 0.08);
    font-size: 1.55rem;
}

.dropzone strong,
.dropzone small {
    display: block;
}

.dropzone strong {
    color: white;
}

.dropzone small {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

#previewImage {
    display: none;
    width: 64px;
    height: 64px;
    margin-bottom: 0.72rem;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

.template-block {
    display: grid;
    gap: 0.6rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(2, 6, 23, 0.34);
}

.template-block>span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.template-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.template-chip {
    padding: 0.58rem 0.76rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted-strong);
    background: rgba(15, 23, 42, 0.78);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 800;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.template-chip:hover,
.template-chip:focus-visible {
    border-color: rgba(56, 189, 248, 0.48);
    color: white;
    background: rgba(56, 189, 248, 0.12);
    outline: none;
}

.action-row {
    margin-top: 0;
}

.action-row .btn {
    flex: 1 1 150px;
}

.preview-panel {
    min-width: 0;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.86)),
        radial-gradient(circle at 50% 10%, rgba(167, 139, 250, 0.14), transparent 52%);
}

.preview-header {
    align-items: center;
}

.icon-btn {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--muted-strong);
    background: rgba(2, 6, 23, 0.42);
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    border-color: rgba(56, 189, 248, 0.5);
    color: white;
    background: rgba(56, 189, 248, 0.1);
    outline: none;
}

.preview-stage {
    display: grid;
    min-height: 390px;
    place-items: center;
    padding: clamp(16px, 3vw, 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: auto;
    background-color: rgba(2, 6, 23, 0.7);
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

.canvas-frame {
    display: grid;
    min-width: max-content;
    place-items: center;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
}

#achievementCanvas {
    max-width: min(100%, 720px);
    height: auto;
    image-rendering: auto;
}

.export-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 16px;
}

.export-notes div {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(2, 6, 23, 0.34);
}

.export-notes strong,
.export-notes span {
    display: block;
}

.export-notes strong {
    margin-bottom: 0.22rem;
    font-size: 0.9rem;
}

.export-notes span {
    font-size: 0.82rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.feature-grid .section-heading {
    grid-column: 1 / -1;
}

.feature-card {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.feature-card span {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
    place-items: center;
    border-radius: 14px;
    background: rgba(56, 189, 248, 0.1);
    font-size: 1.3rem;
}

.feature-card h3 {
    margin: 0 0 0.45rem;
    font-size: 1.08rem;
}

.feature-card p {
    margin: 0;
    font-size: 0.92rem;
}

.tips-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 20px;
    padding: clamp(22px, 4vw, 34px);
    border-radius: var(--radius-xl);
}

.tips-panel p {
    max-width: 680px;
    margin: 0.75rem 0 0;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 30;
    max-width: min(360px, calc(100vw - 36px));
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: white;
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.noscript-warning {
    position: fixed;
    inset: auto 1rem 1rem;
    z-index: 40;
    padding: 1rem;
    border-radius: 16px;
    background: #7f1d1d;
    color: white;
    font-weight: 800;
}

@media (max-width: 960px) {

    .hero,
    .tool-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding-top: 42px;
    }

    .section-heading,
    .tips-panel {
        align-items: start;
        flex-direction: column;
    }

    .preview-stage {
        min-height: 300px;
    }
}

@media (max-width: 680px) {
    .site-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 10px;
    }

    .site-header {
        position: static;
        align-items: stretch;
        border-radius: 22px;
        flex-direction: column;
    }

    .nav-links {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }

    .nav-links a {
        text-align: center;
    }

    .hero {
        padding-top: 20px;
        gap: 16px;
    }

    .hero-copy,
    .hero-card,
    .panel,
    .tips-panel {
        border-radius: 20px;
    }

    .hero-stats,
    .two-column,
    .export-notes {
        grid-template-columns: 1fr;
    }

    .hero-actions .btn,
    .tips-panel .btn {
        width: 100%;
    }

    .preview-stage {
        justify-content: start;
    }
}