:root {
    color-scheme: light;
    --ink: #261b39;
    --muted: #655a73;
    --accent: #6d39bf;
    --deep: #542799;
    --line: #e9dff2;
    --paper: #fffbf6;
    --shadow: 0 16px 40px #45257512;
    font-family: "Nunito", system-ui, sans-serif;
    color: var(--ink);
    background: #f9f4fe;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: radial-gradient(ellipse at 8% 20%, #fceee6, transparent 34rem),
        radial-gradient(ellipse at 91% 58%, #eee1fa, transparent 32rem), #f9f5ff;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #8b53d0; outline-offset: 4px; }
img { max-width: 100%; }
h1, h2, p { margin: 0; }
p { line-height: 1.55; }
.shell { width: min(1240px, calc(100% - 72px)); margin-inline: auto; }
.site-header { background: #fffcfaee; border-bottom: 1px solid #eee4f2; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 71px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 850; font-size: 25px; letter-spacing: -.045em; }
.brand-icon {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border-radius: 12px;
    color: #ffedc6;
    background: linear-gradient(145deg, #b17be0, #6835b1);
    box-shadow: inset 0 0 0 1px #ffffff50;
    font-size: 24px;
}
nav { display: flex; align-items: center; gap: 5px; }
nav a, .account-link { padding: 9px 14px; border-radius: 30px; font-size: 14px; font-weight: 700; white-space: nowrap; }
nav a[aria-current], nav a:hover { background: #f1e6fd; color: var(--deep); }
.account-link { border: 1px solid #ebdff5; background: #fffbff; color: var(--deep); }
.account-link:hover { background: #f0e4fc; }
.account-link span { margin-right: 3px; }

.masthead {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 422px;
    margin-top: 28px;
    border-radius: 32px;
    background: #f5e6ff;
    box-shadow: var(--shadow);
    border: 1px solid #f3e6f6;
    display: flex;
    align-items: center;
}
.masthead-art {
    position: absolute;
    inset: 0 0 0 32%;
    z-index: -2;
    background: url("magic.jpg") center 35% / cover no-repeat;
}
.masthead::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, #fbf0fd 4%, #f9ecfc 32%, #f6e7f3ce 41%, #f6e7f314 58%, transparent 72%);
}
.masthead-copy { padding: 38px 0 40px clamp(28px, 4.6vw, 68px); width: min(62%, 625px); }
.eyebrow { color: #6e3c95; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .13em; }
.eyebrow span { margin-right: 5px; }
.masthead h1 {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(46px, 5.1vw, 74px);
    letter-spacing: -.065em;
    line-height: .94;
    font-weight: 700;
    margin: 15px 0 18px;
}
.masthead h1 em { color: #7244aa; font-weight: inherit; }
.masthead-copy > p:not(.eyebrow) { max-width: 365px; color: #58496b; font-size: 16px; margin-bottom: 22px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 45px;
    padding: 10px 19px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-weight: 800;
    font-size: 14px;
    text-align: center;
    transition: background .16s, box-shadow .16s;
}
.primary { background: linear-gradient(115deg, #9858cf, #6c35bc); color: #fff; box-shadow: 0 7px 16px #7e43ba3d; }
.primary:hover { background: var(--deep); }
.secondary { background: #f5ebff; border-color: #ecdef8; color: #6138a0; }
.secondary:hover { background: #ebdbfa; }
.worlds { margin-top: 33px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 13px; }
.section-heading h2 { font-family: Georgia, serif; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.042em; }
.section-heading p, .soft-card p, .site-footer { color: var(--muted); font-size: 13px; }
.world-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.world-card {
    position: relative;
    display: flex;
    align-items: end;
    overflow: hidden;
    border-radius: 18px;
    min-width: 0;
    aspect-ratio: 1.75;
    color: white;
    background: #423056;
    box-shadow: 0 7px 20px #40245326;
    isolation: isolate;
}
.world-card img, .world-card::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.world-card img { object-fit: cover; z-index: -2; transition: transform .22s; }
.world-card::after { content: ""; z-index: -1; background: linear-gradient(transparent 28%, #171025da); }
.world-card:hover img { transform: scale(1.06); }
.world-card span { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 12px 14px; width: 100%; font-weight: 800; }
.world-card b { font-size: 14px; color: #fff2cf; }
.home-cards { display: grid; grid-template-columns: 1.16fr 1fr; gap: 12px; margin-top: 22px; }
.soft-card { display: flex; align-items: center; gap: 14px; border: 1px solid #f0e6f7; border-radius: 20px; padding: 17px; background: #fffafa; box-shadow: var(--shadow); }
.soft-card h2 { font-size: 18px; margin-bottom: 4px; }
.soft-card .button { margin-left: auto; flex-shrink: 0; }
.feature-icon, .profile-avatar { flex-shrink: 0; width: 52px; height: 52px; border-radius: 16px; }
.feature-icon { display: grid; place-items: center; font-size: 28px; color: #7144ad; background: #f1e5ff; }
.profile-avatar { object-fit: cover; border: 2px solid #ddc6f3; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 38px; padding-block: 19px; border-top: 1px solid #e9dff2; }
.site-footer .brand { font-size: 17px; color: #654295; }

.page-intro { margin: 25px 0 16px; }
.page-intro h1, .account-panel h1 { margin-top: 9px; font: 700 clamp(32px, 5vw, 53px)/1.05 Georgia, serif; letter-spacing: -.045em; }
.back-link { color: var(--deep); font-size: 13px; font-weight: 750; }
.back-link:hover { text-decoration: underline; }
.editor { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.panel { border: 1px solid #eadff4; border-radius: 24px; background: #fffcff; box-shadow: var(--shadow); }
.editor-panel, .preview-panel { padding: clamp(17px, 3vw, 34px); min-width: 0; }
.progress { margin: 0 0 26px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.progress li { position: relative; display: grid; justify-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.progress li:not(:last-child)::after { content: ""; position: absolute; top: 13px; left: calc(50% + 17px); width: calc(100% - 30px); height: 1px; background: #e7d9f0; }
.progress li span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #f4ebf8; }
.progress li[aria-current] span { background: var(--accent); color: white; }
.progress li[aria-current], .progress li.complete { color: var(--deep); }
.progress li.complete span { background: #eadbfa; }
fieldset { margin: 0; min-width: 0; padding: 0; border: 0; }
legend { margin-bottom: 15px; padding: 0; font-size: clamp(19px, 3vw, 24px); font-weight: 850; letter-spacing: -.035em; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option { position: relative; cursor: pointer; min-width: 0; }
.theme-option input { position: absolute; opacity: 0; margin: 0; }
.theme-option > span { display: block; position: relative; overflow: hidden; background: #443056; color: white; border: 3px solid transparent; border-radius: 15px; }
.theme-option img { display: block; width: 100%; height: clamp(78px, 12vw, 131px); object-fit: cover; }
.theme-option b { position: absolute; inset: auto 0 0; padding: 12px 9px 6px; background: linear-gradient(transparent, #140b24e8); font-size: 14px; }
.theme-option input:checked + span { border-color: #9356da; }
.theme-option input:checked + span::after { content: "✓"; position: absolute; right: 7px; top: 7px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #7136bf; }
.theme-option input:focus-visible + span { outline: 3px solid #ab7bdf; outline-offset: 2px; }
.editor-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
#next { margin-left: auto; }
.preview-panel { text-align: center; background: #f3ebfb; }
.preview-panel h2 { color: #684c84; font-size: 14px; margin-bottom: 10px; }
canvas { display: block; width: min(100%, 315px); height: auto; margin-inline: auto; background: #352051; border-radius: 12px; box-shadow: 0 10px 25px #2f18433a; }
.upload { display: grid; justify-items: center; gap: 5px; padding: 18px 10px; text-align: center; border: 2px dashed #cdb1ec; border-radius: 14px; color: var(--deep); background: #faf4ff; cursor: pointer; }
.upload > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #efdefb; font-size: 22px; }
.upload input { width: min(100%, 260px); margin: 5px auto 0; font-size: 13px; }
.saved-hero { display: flex; align-items: center; text-align: left; gap: 9px; width: 100%; border: 1px solid #e7d6fa; border-radius: 15px; background: #f7efff; color: var(--ink); padding: 8px 10px; margin-bottom: 11px; }
.saved-hero > span:last-child { margin-left: auto; color: var(--accent); }
.saved-hero small { display: block; }
.field-help, .fields small, .saved-hero small, .upload small, #photo-status { color: var(--muted); font-size: 13px; }
.field-help, #photo-status:not(:empty) { margin-top: 9px; }
.fields { display: grid; gap: 11px; }
.fields label { display: grid; gap: 4px; font-size: 14px; font-weight: 750; min-width: 0; }
.fields input, .fields textarea { padding: 9px 10px; width: 100%; min-width: 0; min-height: 41px; color: var(--ink); border: 1px solid #ddd0e8; border-radius: 10px; background: white; }
.fields textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.form-error { color: #93254c; padding: 8px 11px; background: #ffeff4; border-radius: 9px; margin: 10px 0; font-size: 13px; }
ul.form-error { padding-left: 28px; }
#download { margin-top: 13px; }
.account-panel { width: min(100%, 520px); padding: clamp(19px, 5vw, 36px); margin: 35px auto; }
.account-panel h1 { font-size: clamp(31px, 5vw, 43px); }
.account-panel p { margin-block: 10px 15px; color: var(--muted); }
.account-switch a, .text-button { color: var(--deep); text-decoration: underline; font-weight: 750; }
.account-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 17px; }
.text-button { border: 0; background: none; padding: 3px 0; font-size: 13px; }
.text-button.danger { color: #96365a; }
.profile-large { width: 96px; height: 96px; margin-bottom: 10px; }
.profile-cta { width: 100%; margin-top: 10px; }
.account-panel .notice { color: #375a43; background: #eef8ed; padding: 8px 11px; border-radius: 9px; }

@media (max-width: 900px) {
    .shell { width: calc(100% - 38px); }
    .home-cards { grid-template-columns: 1fr 1fr; }
    .soft-card { flex-wrap: wrap; }
    .soft-card > div { flex: 1; min-width: 130px; }
}
@media (max-width: 660px) {
    .shell { width: calc(100% - 24px); }
    .header-inner { min-height: 59px; gap: 5px; }
    .brand { font-size: 21px; gap: 4px; }
    .brand-icon { width: 28px; height: 28px; font-size: 19px; border-radius: 9px; }
    nav a, .account-link { padding: 7px 8px; font-size: 12px; }
    nav a:first-child { display: none; }
    .masthead { min-height: 0; margin-top: 13px; border-radius: 22px; flex-direction: column; align-items: stretch; }
    .masthead-art { inset: auto; width: 100%; aspect-ratio: 2 / 1; position: relative; background-position: center 29%; }
    .masthead::after { display: none; }
    .masthead-copy { width: 100%; padding: 18px; }
    .masthead h1 { font-size: clamp(40px, 9vw, 62px); margin: 11px 0; line-height: .91; }
    .desktop-break { display: none; }
    .masthead-copy > p:not(.eyebrow) { font-size: 14px; margin-bottom: 13px; }
    .worlds { margin-top: 22px; }
    .section-heading { display: block; }
    .section-heading p { margin-top: 4px; }
    .world-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .world-card { border-radius: 12px; }
    .world-card span { padding: 8px; font-size: 13px; }
    .home-cards, .editor { grid-template-columns: 1fr; gap: 9px; }
    .home-cards { margin-top: 13px; }
    .site-footer { margin-top: 24px; }
    .site-footer > span { text-align: right; font-size: 11px; }
    .preview-panel { order: 2; }
    canvas { width: min(100%, 270px); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
