/* World and character creation share one flowing field of suggestions. */
:is(#world-builder, #creation) { --dream-ink: #f3ede3; --dream-muted: #bcb8ce; max-width: none; position: relative; isolation: isolate; margin: 1.4rem 0 2rem; padding: 2.7rem 2rem 1rem; border: 1px solid #62617a66; border-radius: 12px; background: #141d29; color: var(--dream-ink); overflow: hidden; }
.dream-builder::before { content: ""; position: absolute; inset: -6%; z-index: -2; pointer-events: none; background: radial-gradient(ellipse at 50% 44%, #08132140, transparent 58%, #08132144), url("./dream-sky.svg") center / cover; animation: dream-clouds 28s ease-in-out infinite alternate; transform-origin: 50% 60%; }
.dream-builder::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 100px #04091355; }
.dream-heading { display: block; height: auto; padding: 0; border: 0; background: transparent; text-align: center; position: relative; }
:is(#world-builder, #creation) .dream-heading h1 { color: var(--dream-ink); font: 400 clamp(1.9rem, 3.6vw, 2.8rem)/1.2 var(--serif); margin: .8rem 0 .65rem; letter-spacing: -.025em; }
.dream-progress { display: flex; justify-content: center; align-items: center; gap: 1.3rem; margin-top: 1.9rem; }
.dream-steps { display: flex; list-style: none; padding: 0; margin: 0; gap: 0; }
.dream-steps li { display: flex; }
.dream-builder .dream-steps button { display: grid; place-items: center; width: 24px; min-height: 32px; padding: 0; border: 0; background: transparent; color: #757489; }
.dream-steps button::after { content: ""; width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; }
.dream-steps button.done::after { background: #b4adcf; border-color: #b4adcf; }
.dream-builder .dream-steps button[aria-current] { color: #eee0ab; }
.dream-steps button[aria-current]::after { width: 8px; height: 8px; background: #eee0ab; box-shadow: 0 0 12px #eee0ab66; }
.dream-builder .dream-steps button:hover:not(:disabled) { color: #fff4ce; background: transparent; }
.dream-stage { position: relative; min-height: 560px; padding: 180px 0 175px; }
.dream-answer { position: relative; z-index: 1; width: 49%; max-width: 520px; margin: 0 auto; pointer-events: none; }
.dream-answer :is(input, textarea, button, a, label, .world-review) { pointer-events: auto; }
:is(#world-builder, #creation) fieldset { margin: 0; text-align: center; }
:is(#world-builder, #creation) legend { display: block; float: left; width: 100%; color: var(--dream-ink); font: 400 clamp(1.65rem, 2.5vw, 2.15rem)/1.2 var(--serif); margin: 0 0 .85rem; text-wrap: balance; }
:is(#world-builder, #creation) legend + * { clear: both; }
:is(#world-builder, #creation) label { text-align: left; color: #c8c0d8; font: .63rem/1.5 var(--sans); letter-spacing: .13em; text-transform: uppercase; margin: 0 0 .45rem; }
:is(#world-builder, #creation).dream-builder fieldset > legend > label[for] { display: block; color: var(--dream-ink); font: inherit; text-align: center; letter-spacing: 0; text-transform: none; margin: 0 0 .45rem; }
:is(#world-builder, #creation).dream-builder legend .optional { display: block; font: .7rem/1.6 var(--sans); margin-top: .4rem; }
:is(#world-builder, #creation) .optional { color: #a9a2bc; letter-spacing: 0; text-transform: none; }
:is(#world-builder, #creation) :is(input:not([type="radio"]), textarea) { border: 1px solid #b7aac278; border-radius: 10px; background: #0b1524; color: #fbf3df; margin: 0; padding: 1rem 1.1rem; font: 1rem/1.7 var(--sans); box-shadow: 0 0 35px #af9be911, inset 0 1px 0 #eee0ff08; }
:is(#world-builder, #creation) input:not([type="radio"]) { min-height: 62px; }
:is(#world-builder, #creation) #world-title { font: 400 1.35rem/1.6 var(--serif); }
:is(#world-builder, #creation) :is(input:not([type="radio"]), textarea)::placeholder { color: #aca8c0; opacity: 1; }
:is(#world-builder, #creation) :is(input:not([type="radio"]), textarea):focus-visible { outline: 2px solid #c8b9e2; outline-offset: 3px; border-color: #c8b9e2; box-shadow: 0 0 32px #b5a0d921; }
:is(#world-builder, #creation) .field-hint, :is(#world-builder, #creation) .publish-note { color: #b5b0c7; text-align: left; font-size: .75rem; }
.dream-ideas { position: absolute; inset: 0; pointer-events: none; overflow: clip; }
.dream-heading, .dream-progress, .dream-footer { position: relative; z-index: 1; }
.idea-slot { pointer-events: auto; animation: dream-drift var(--duration, 17s) ease-in-out infinite; animation-delay: var(--delay, 0s); --drift-x: 24px; --drift-y: 28px; }
.dream-ideas > .roaming-idea { position: absolute; left: 0; top: 0; width: clamp(124px, 17%, 182px); animation: none; will-change: transform, opacity; }
.dream-ideas > .detailed-idea { width: clamp(185px, 21%, 240px); }
.dream-ideas > .reading-idea { width: min(350px, calc(100% - 16px)); z-index: 3; }
:is(#world-builder, #creation) .dream-idea { position: relative; display: block; width: 100%; min-height: 64px; border: 1px solid #c8b9da55; border-radius: 26px 12px 30px 14px; background: #202a3bcc; color: #eee5f4; padding: .8rem 1rem; font: 400 .83rem/1.65 var(--sans); text-align: center; white-space: normal; overflow-wrap: anywhere; box-shadow: 0 8px 32px #070b141c, 0 0 28px #b09bd811; transition: opacity 1.2s, background .2s, border-color .2s, box-shadow .2s; }
:is(#world-builder, #creation) .dream-idea strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #e4d9bc; font: 400 1.03rem/1.4 var(--serif); margin-bottom: .25rem; }
.dream-idea > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.detailed-idea .dream-idea > span { -webkit-line-clamp: 4; }
.reading-idea .dream-idea > span { display: block; overflow: visible; -webkit-line-clamp: unset; }
:is(#world-builder, #creation) .reading-idea .dream-idea { background: #252d43; border-color: #c3b5df; box-shadow: 0 12px 40px #050917aa; font-size: .9rem; }
.detailed-idea .dream-idea { touch-action: pan-y; user-select: none; -webkit-touch-callout: none; }
:is(#world-builder, #creation) .dream-idea:hover:not(:disabled), :is(#world-builder, #creation) .dream-idea:focus-visible { background: #3b4055; color: #fff2d3; border-color: #c3b5df; box-shadow: 0 0 26px #ac94cf24; }
:is(#world-builder, #creation) .dream-idea[aria-pressed="true"] { border-color: #d9c795; background: #46434b; color: #fff0cf; }
.idea-slot:hover, .idea-slot:focus-within, .dream-reduced .idea-slot, .dream-reduced .dream-sky i { animation-play-state: paused; }
.dream-spark { position: absolute; pointer-events: none; z-index: 5; width: 5px; height: 5px; border-radius: 50%; background: #fff0bd; box-shadow: 0 0 9px 2px #d7b976, 0 0 22px #c5a1dd; }
:is(#world-builder, #creation) .dream-quiet { background: transparent; color: #d7c8ed; border: 0; padding: .6rem .5rem; min-height: 40px; font: .75rem/1.5 var(--sans); }
:is(#world-builder, #creation) .dream-quiet:hover:not(:disabled) { color: #fff1d1; background: #b29ccd14; }
:is(#world-builder, #creation) :is(button, a):focus-visible { outline: 2px solid #ddcfa8; outline-offset: 3px; }
:is(#world-builder, #creation) .world-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: .55rem; align-items: stretch; }
:is(#world-builder, #creation) .world-actions .world-primary { width: 100%; }
:is(#world-builder, #creation) .world-actions .world-secondary { align-self: center; min-height: 36px; padding: .4rem .8rem; }
:is(#world-builder, #creation) .problem:empty { display: none; }
:is(#world-builder, #creation) .world-primary { background: #d8c7a4; color: #272534; border-color: #d8c7a4; border-radius: 10px; font-weight: 600; min-height: 48px; padding: .9rem 1.2rem; box-shadow: 0 0 30px #e2c88b12; }
:is(#world-builder, #creation) .world-primary:hover:not(:disabled) { background: #ecdcbb; color: #272534; }
:is(#world-builder, #creation) .world-secondary { color: #c6bfd6; border-color: transparent; background: transparent; }
:is(#world-builder, #creation) .world-secondary:hover:not(:disabled) { color: #fff0d1; background: #b29ccd14; }
:is(#world-builder, #creation) .world-secondary:disabled { opacity: .35; }
:is(#world-builder, #creation) .problem { color: #f2b1b8; font-size: .8rem; }
.dream-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid #b4a8c01a; }
.draft-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
#world-builder .draft-actions button { min-height: 44px; padding: .6rem .8rem; font: .75rem/1.5 var(--sans); }
#world-builder #world-discard, #world-builder #world-discard-yes { color: #f2b1b8; }
.draft-confirm { position: relative; z-index: 4; margin-top: .7rem; padding: 1rem; border: 1px solid #b9829366; border-radius: 10px; background: #252337; }
#world-builder .draft-confirm h2 { margin: 0 0 .5rem; color: var(--dream-ink); font: 400 1.2rem/1.4 var(--serif); text-transform: none; letter-spacing: normal; }
.draft-confirm p { margin: .5rem 0; font-size: .8rem; }
:is(#world-builder, #creation) .world-exit { color: #bdb7ce; font-size: .72rem; flex-shrink: 0; }
:is(#world-builder, #creation) .world-note { color: #a9a5bd; font-size: .67rem; margin: 0; text-align: right; }
.dream-review .dream-answer { width: 100%; max-width: 650px; }
.dream-review .dream-ideas { display: none; }
.dream-review .dream-stage { min-height: 0; padding: 2.5rem 0 1rem; }
:is(#world-builder, #creation) .world-review { text-align: left; border: 1px solid #a89db73b; border-radius: 8px; background: #121c2999; }
:is(#world-builder, #creation) .world-review dt { display: flex; justify-content: space-between; align-items: center; color: #c3b7d8; }
:is(#world-builder, #creation) .world-review h3 { color: #f2e3be; }
.dream-sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.dream-sky i { position: absolute; width: 2px; height: 2px; background: #e0d5b3; border-radius: 50%; box-shadow: 0 0 8px #e0d5b355; animation: dream-twinkle 7s ease-in-out infinite alternate; }
.dream-sky i:nth-child(3n) { width: 3px; height: 3px; background: #b5abd2; animation-delay: -4s; }
.dream-sky i:nth-child(1) { top: 7%; left: 9%; }.dream-sky i:nth-child(2) { top: 19%; left: 81%; }
.dream-sky i:nth-child(3) { top: 41%; left: 6%; }.dream-sky i:nth-child(4) { top: 12%; left: 59%; }
.dream-sky i:nth-child(5) { top: 74%; left: 38%; }.dream-sky i:nth-child(6) { top: 87%; left: 83%; }
.dream-sky i:nth-child(7) { top: 55%; left: 88%; }.dream-sky i:nth-child(8) { top: 92%; left: 17%; }
.dream-sky i:nth-child(9) { top: 29%; left: 26%; }.dream-sky i:nth-child(10) { top: 66%; left: 71%; }
.dream-sky i:nth-child(11) { top: 33%; left: 68%; }.dream-sky i:nth-child(12) { top: 80%; left: 51%; }
@keyframes dream-drift {
  0%, 100% { transform: translate(calc(var(--drift-x) * -.65), calc(var(--drift-y) * -.6)) rotate(-2deg); }
  24% { transform: translate(calc(var(--drift-x) * .4), calc(var(--drift-y) * -1)) rotate(1deg); }
  51% { transform: translate(var(--drift-x), calc(var(--drift-y) * .3)) rotate(2.2deg); }
  76% { transform: translate(calc(var(--drift-x) * -.3), var(--drift-y)) rotate(-.8deg); }
}
@keyframes dream-twinkle { from { opacity: .2; } to { opacity: .85; } }
@keyframes dream-clouds {
  from { transform: translate(-1.2%, .6%) rotate(-1deg) scale(1); }
  to { transform: translate(1.2%, -1%) rotate(1deg) scale(1.06); }
}
@media (max-width: 1050px) {
  :is(#world-builder, #creation) { padding: 2rem 1.2rem 1rem; }
}
@media (max-width: 700px) {
  .dream-builder::before { background-position: center, 68% center; }
  .dream-stage { display: flex; flex-direction: column; min-height: 440px; padding: 5rem 0 8rem; }
  .dream-answer { width: 100%; }
  .dream-ideas { position: absolute; inset: 0; }
  .dream-ideas > .roaming-idea { width: clamp(124px, 34%, 170px); }
  .dream-ideas > .detailed-idea { width: clamp(170px, 48%, 210px); }
  .dream-ideas > .reading-idea { width: min(350px, calc(100% - 16px)); }
}
@media (max-width: 600px) {
  :is(#world-builder, #creation) { margin: 1rem -8px; padding: 1.8rem 1rem 1rem; border-radius: 10px; }
  :is(#world-builder, #creation) .dream-heading h1 { font-size: 1.8rem; }
  .dream-progress { flex-direction: column; gap: .25rem; margin-top: 1.4rem; }
  .dream-builder .dream-steps button { width: 23px; min-height: 28px; }
  :is(#world-builder, #creation) legend { font-size: 1.7rem; }
  .dream-stage { padding-top: 4rem; }
  :is(#world-builder, #creation) .dream-idea { padding: .65rem .75rem; font-size: .72rem; line-height: 1.6; border-radius: 12px 4px; }
  :is(#world-builder, #creation) .dream-idea strong { font-size: .94rem; }
  :is(#world-builder, #creation) .world-primary { flex: none; padding: .8rem .95rem; font-size: .75rem; }
  :is(#world-builder, #creation) .world-secondary { padding-left: 0; }
  .dream-footer { flex-direction: column; gap: .1rem; padding-top: .5rem; }
  :is(#world-builder, #creation) .world-note { text-align: center; }
  .dream-review .dream-stage { padding-top: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dream-builder::before, .dream-builder::after, .dream-builder *, .dream-builder *::before, .dream-builder *::after { animation: none !important; transition: none !important; }
}

/* The world reveal is a real render in progress, then a moment to see it. */
.world-birth { text-align: center; padding: 1.7rem 1rem; }
.world-birth h1 { font: 400 clamp(2rem, 4vw, 3rem)/1.2 var(--serif); margin: .9rem 0; }
.birth-frame { position: relative; overflow: hidden; max-width: 720px; aspect-ratio: 16 / 10; margin: 1.5rem auto 1.4rem; border-radius: 12px; border: 1px solid #9a8baa66; background: #172334; box-shadow: 0 0 60px #ab92d21a; }
.birth-frame .birth-art { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.birth-frame span.birth-art::before, .birth-frame span.birth-art::after { content: ""; position: absolute; inset: 24% 34%; border: 1px solid #bfb0dd88; border-radius: 50%; box-shadow: 0 0 55px #8e6dca55, inset 0 0 45px #b9b4cf22; animation: birth-orbit 7s ease-in-out infinite alternate; }
.birth-frame span.birth-art::after { inset: 34% 25%; animation-direction: alternate-reverse; border-color: #d3c09588; }
.world-birth .problem { color: var(--folio-ink); }
.world-birth .world-primary { min-width: 230px; }
#world-birth-state { font: .95rem/1.6 var(--sans); color: var(--folio-dim); }
#world-birth-state:empty, #world-birth-problem:empty { display: none; }
@keyframes birth-orbit { from { transform: rotate(-25deg) scale(.8); opacity: .4; } to { transform: rotate(40deg) scale(1.25); opacity: 1; } }
#creation .heroname { max-width: none; margin: 0; }
#creation.dream-builder legend { color: var(--dream-ink); text-transform: none; letter-spacing: 0; }
#creation .dream-answer { padding-bottom: .5rem; }
#creation.character-options .dream-answer, #creation.character-review .dream-answer { width: 100%; max-width: 850px; }
#creation.character-options .dream-stage, #creation.character-review .dream-stage { min-height: 0; padding: 2.4rem 0 1rem; }
#creation .options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.2rem; padding: 1rem 1rem 2rem; }
#creation.dream-builder .option { position: relative; width: auto; left: auto; right: auto; top: auto; display: flex; flex-direction: column; gap: .65rem; min-height: 190px; border: 1px solid #a99db65c; border-radius: 18px 8px; background: #293040d9; color: #eee4d3; padding: 1.3rem; text-align: left; --drift-x: 8px !important; --drift-y: 14px !important; }
#creation.dream-builder .option:hover, #creation.dream-builder .option:has(input:checked) { border-color: #ddc58e; background: #3c3b49; box-shadow: inset 0 0 0 1px #ddc58e66; }
#creation .option::after { display: none; }
#creation .ohead { display: flex; gap: .6rem; align-items: center; }
#creation.dream-builder .option .title { margin: 0; font: 400 1.5rem/1.25 var(--serif); color: #f2e2bc; text-transform: none; letter-spacing: 0; }
#creation .option input[type="radio"] { width: 16px; height: 16px; min-height: 0; flex-shrink: 0; accent-color: #ddc58e; }
#creation.dream-builder .option :is(.under, .grants, .kit) { color: #c5c0d3; font: .8rem/1.6 var(--sans); text-transform: none; letter-spacing: 0; }
#creation .grants { display: flex; flex-wrap: wrap; gap: .3rem .6rem; }
#creation .world-actions { max-width: 520px; margin: .55rem auto 0; }
#creation #begin-note { color: #c5c0d3; font: .78rem/1.6 var(--sans); }
#character-summary { text-align: left; }
#character-summary h3 { margin-top: 0; }
#character-summary p { margin-bottom: .7rem; }
#creation.character-profile .dream-stage { padding: 3rem 0 5rem; min-height: 540px; }
#creation.character-profile .dream-answer { width: min(100%, 560px); }
#creation.character-profile .world-actions { max-width: none; }
#creation .character-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; text-align: left; }
#creation .character-fields > div { min-width: 0; }
#creation .character-wide { grid-column: 1 / -1; }
#creation .character-fields label { display: block; color: var(--ink-dim); font: .72rem/1.5 var(--sans); letter-spacing: .08em; text-shadow: var(--text-halo); }
#creation .character-fields :is(input, textarea) { width: 100%; }
#character-summary p { white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 750px) {
  #creation .options { grid-template-columns: 1fr; gap: 2rem; padding: .5rem 12px 2rem; }
  #creation.dream-builder .option { min-height: 0; }
  .birth-frame { margin-top: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .birth-frame span.birth-art::before, .birth-frame span.birth-art::after { animation: none; }
}
