@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/dm-sans.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/instrument-serif-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/instrument-serif.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: light;
  --paper: #fbf8f3;
  --ink: #29222d;
  --muted: #6f6571;
  --line: #e6dfe4;
  --accent: #513950;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --scene: linear-gradient(160deg, #785366, #d89e87 46%, #5b3e50 78%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { isolation: isolate; margin: 0; background: var(--paper); color: var(--ink); font: 15px var(--sans); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.sr, .choices input, .scenes input, .music-setting input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; padding: 0; border: 0; }
#setup { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); min-height: 100svh; }
.landscape { min-height: 740px; isolation: isolate; position: relative; overflow: hidden; color: #fff5eb; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 4vw, 64px); }
.scenery { position: fixed; pointer-events: none; inset: 0; z-index: -1; overflow: hidden; background: #593e52; animation: gradient-pulse 10s ease alternate infinite; }
.scenery::before { content: ""; position: absolute; inset: -3%; background-image: var(--scene); background-position: center; background-size: cover; animation: drift 35s ease-in-out infinite alternate; }
.scenery::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #1a102f42, transparent 24%, transparent 52%, #210d267a 84%, #1f1229aa); }
@keyframes drift { to { transform: scale(1.09) translateX(1.5%); } }
html[data-scene="desert"] {
  --desert-paper: #e3d2c0;
  --desert-berry: #942a45;
  --desert-clay: #d78366;
  --scene:
    radial-gradient(ellipse at 23% 18%, var(--desert-paper) 0%, transparent 57%),
    radial-gradient(ellipse at 84% 31%, var(--desert-clay) 0%, transparent 59%),
    radial-gradient(ellipse at 25% 94%, var(--desert-berry) 0%, transparent 67%),
    linear-gradient(145deg, var(--desert-paper) 5%, var(--desert-clay) 49%, var(--desert-berry) 96%);
}
html[data-scene="desert"] .scenery::before {
  inset: -11%;
  animation: desert-drift 36s ease-in-out infinite alternate;
}
@keyframes desert-drift {
  from { transform: scale(1.02) translate(-3%, 2%); }
  to { transform: scale(1.12) translate(5%, -3%) rotate(5deg); }
}
html[data-scene="mist"] .scenery {
  background:
    radial-gradient(ellipse at 68% 32%, #ffe6a4 0%, #e8bc78 21%, transparent 58%),
    radial-gradient(ellipse at 14% 55%, #cbd6c5 0%, transparent 66%),
    linear-gradient(155deg, #707c85 3%, #9da69b 48%, var(--mist-ground, #38444e) 100%);
}
html[data-scene="mist"] .scenery::before {
  inset: -14%;
  background-image:
    radial-gradient(ellipse 66% 13% at 33% 44%, #fff8dfb0 0%, #f9edd085 42%, transparent 100%),
    radial-gradient(ellipse 74% 17% at 69% 60%, #e1e9d8bd 0%, #d2e0d76e 52%, transparent 100%),
    radial-gradient(ellipse 70% 22% at 22% 78%, #aebebe95 0%, transparent 100%);
  filter: blur(clamp(10px, 2vw, 30px));
  animation: none;
  opacity: .83;
}
@keyframes gradient-pulse {
  0%, 100% { transform: scale(1); filter: brightness(100%) saturate(100%); }
  50% { transform: scale(1.05); filter: brightness(110%) saturate(120%); }
}
html[data-scene="mirage"] {
  --scene: linear-gradient(0deg, #e3d2c0 0%, #f1c7f7 33%, #fbd0eb 67%, #f3b4cd 100%);
}
.paper-shader { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
html[data-scene="aurora"] { --scene: linear-gradient(150deg,#1d2c6066,#27204a33), url("aurora.jpg"); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 600; letter-spacing: -.07em; }
.brand svg { width: 24px; height: 24px; fill: #fff0dd; stroke: none; }
#scene-name { font-size: 10px; font-weight: 700; letter-spacing: .21em; }
.landscape-title { font: clamp(64px, 7.15vw, 110px)/.87 var(--serif); letter-spacing: -.025em; margin: 0 0 38px; }
.landscape-title em { color: #f4c7c4; }
.scene-bar { display: flex; gap: 17px; align-items: center; padding-top: 21px; border-top: 1px solid #fff4ed40; }
.scenes { display: flex; gap: 10px; }
.scenes label { cursor: pointer; }
.scenes label span:first-of-type { display: block; border-radius: 50%; width: 23px; height: 23px; border: 1px solid #ffffff50; }
.scenes input:checked + span, .scenes input:focus-visible + span { outline: 1px solid #fff0df; outline-offset: 3px; }
.desert { background: linear-gradient(155deg, #e3d2c0, #d78366 56%, #942a45); }
.mist { background: linear-gradient(155deg, #f8d895, #b9c9b9 55%, #58706f); }
.mirage { background: linear-gradient(155deg, #f1c7f7, #fbd0eb 56%, #f3b4cd); }
.aurora { background: linear-gradient(155deg,#82c8ac,#363b70); }
#scene-name { color: #f6e2e1; }
.setup-panel { display: grid; align-items: center; padding: 38px clamp(36px, 6vw, 92px); }
#settings { width: min(100%, 475px); margin-inline: auto; }
.intro { margin-bottom: 27px; }
.intro > p:last-child { color: var(--muted); line-height: 1.55; max-width: 400px; margin: 0; }
.option-group { margin-bottom: 20px; }
legend { padding: 0; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
legend svg, .type-icon { width: 17px; height: 17px; color: #805c77; margin-right: 5px; vertical-align: -4px; }
.type-icon { display: inline-block; font: 17px/1 var(--serif); vertical-align: -1px; }
.choices { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 8px; }
.choices label { position: relative; cursor: pointer; }
.choices label > span { display: flex; align-items: center; justify-content: center; flex-direction: column; min-height: 59px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf9; color: #514853; transition: background .15s, border-color .15s; }
.choices label:hover > span { border-color: #bca3b8; }
.choices input:checked + span { color: #513950; border-color: #a5799c; background: #f2e9f1; }
.choices input:focus-visible + span, .music-setting input:focus-visible + .switch { outline: 2px solid #755070; outline-offset: 2px; }
.choices strong { font-weight: 400; font-size: 25px; line-height: 1; }
.durations strong { font-family: var(--serif); font-size: 30px; }
.choices small { font-size: 10px; margin-top: 3px; }
.durations small { letter-spacing: .09em; font-size: 9px; }
.serif { font-family: var(--serif); }
.sans { font-family: var(--sans); }
.mono { font-family: var(--mono); }
.sounds label > span { min-height: 38px; font-weight: 600; font-size: 12px; }
.music-setting { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding: 14px 0 16px; cursor: pointer; }
.music-setting > svg { width: 18px; color: #805c77; }
.music-setting strong, .music-setting small { display: block; }
.music-setting strong { font-size: 13px; }
.music-setting small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.switch { margin-left: auto; flex: 0 0 36px; border-radius: 20px; height: 21px; background: #e5dce3; padding: 3px; transition: background .2s; }
.switch::after { content: ""; display: block; height: 15px; width: 15px; border-radius: 50%; background: #fff; transition: transform .2s; }
.music-setting input:checked + .switch { background: #795571; }
.music-setting input:checked + .switch::after { transform: translateX(15px); }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 45px; border-radius: 8px; padding: 0 18px; border: 1px solid var(--accent); font-weight: 600; }
.primary { background: var(--accent); color: #fff9f5; }
.primary:hover { background: #684967; }
.secondary { background: transparent; color: var(--accent); }
.secondary:hover { background: #f2e9f1; }
.start { width: 100%; min-height: 50px; }
.note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--muted); margin: 13px 0 0; }
.note svg { width: 14px; height: 14px; }
#session { position: relative; isolation: isolate; min-height: 100svh; color: #fff7f2; }
.session-bar { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; padding: 18px clamp(16px, 4vw, 52px); }
.session-mark svg { fill: currentColor; stroke: none; }
#timer { text-align: center; font: 13px var(--mono); color: #f5e6ef; }
.icon-button { justify-self: end; display: grid; place-items: center; background: #ffffff10; border: 1px solid #ffffff40; border-radius: 50%; width: 39px; height: 39px; color: inherit; }
.icon-button:hover { background: #ffffff25; }

h2 { font: 48px/1 var(--serif); margin: 12px 0; }
#downloads, .dialog-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
dialog { width: min(400px, calc(100% - 36px)); padding: 26px; }
dialog::backdrop { background: #211629a6; }
dialog h2 { font-size: 38px; }
.dialog-actions { justify-content: flex-end; }
@media (max-width: 760px) {
  #setup { display: block; }
  .landscape { min-height: 365px; padding: 26px; }
  .landscape-title { font-size: clamp(60px, 10vw, 84px); margin-bottom: 22px; }
  .scene-bar { padding-top: 13px; }
  .setup-panel { padding: 35px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@font-face {
  font-family: "Courier Prime";
  src: url("fonts/courier-prime.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #fcf8f0;
  --ink: #2e2829;
  --muted: #685c5e;
  --line: #e6ddd1;
  --accent: #513950;
  --typewriter: "Courier Prime", "Courier New", monospace;
}

html[data-scene="aurora"] {
  --scene:
    radial-gradient(ellipse at 68% 5%, #c8d6a9c2 0%, transparent 45%),
    radial-gradient(ellipse at 4% 82%, #a3627c 1%, transparent 58%),
    radial-gradient(ellipse at 88% 55%, #487a7a 3%, transparent 60%),
    conic-gradient(from 25deg at 52% 41%, #526566, #243947, #2d243e, #965e85, #a56e87, #4a7871, #526566);
}

html[data-scene="aurora"] .scenery::before {
  inset: -14%;
  filter: blur(clamp(20px, 5vw, 75px));
  animation: aurora-drift 28s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  from { transform: scale(1.05) rotate(-8deg) translate(-2%, -2%); }
  to { transform: scale(1.24) rotate(13deg) translate(5%, 2%); }
}

#setup { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#setup.is-opening {
  position: fixed;
  inset-inline: 0;
  z-index: 2;
  overflow: clip;
  pointer-events: none;
}
.landscape { min-height: 710px; }
.brand { font: 37px/.95 var(--serif); letter-spacing: -.025em; }
.brand svg { width: 21px; height: 21px; }
.landscape-title { font-size: clamp(68px, 8.3vw, 133px); font-weight: 400; }
.landscape-title em { color: #fee6d6; }
.setup-panel { padding: clamp(31px, 4vw, 62px); background: radial-gradient(ellipse at 90% 6%, #f8eadc90, transparent 53%), var(--paper); }
#settings { width: min(100%, 525px); }
.intro { margin-bottom: 24px; }
.intro h2 { font-size: clamp(38px, 4.45vw, 64px); line-height: .95; margin: 0 0 13px; }
.headline-line { display: block; }
.intro p { margin: 0; max-width: 46ch; color: var(--muted); line-height: 1.55; }
.intro p + p { padding-left: 12px; margin-top: 11px; border-left: 2px solid #d5afa5; font-size: 13px; }
.choices label > span { border-radius: 999px; background: transparent; }
.choices input:checked + span { background: #ecddd9; border-color: #b3939e; }
.durations label > span { flex-direction: row; align-items: baseline; gap: 5px; min-height: 44px; padding: 7px 4px; }
.durations strong { font-size: 26px; }
.fonts label > span { border-radius: 12px; min-height: 58px; }
.fonts label > span small { font-size: 9px; }
.sizes label > span { min-height: 58px; border-radius: 12px; font-family: var(--serif); }
.sizes label:nth-child(1) > span { font-size: 17px; }
.sizes label:nth-child(2) > span { font-size: 22px; }
.sizes label:nth-child(3) > span { font-size: 28px; }
.type-options { display: grid; grid-template-columns: minmax(0, 2.45fr) minmax(0, 1fr); column-gap: 13px; }
.type-options legend { min-height: 17px; }
.typewriter { font-family: var(--typewriter); }
.primary, .secondary { border-radius: 999px; }
.start { width: auto; min-width: 176px; }
.note { justify-content: flex-start; }
.creator-credit { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.creator-credit a { color: inherit; text-underline-offset: 3px; }


#session { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100svh; }
.scenery::after { transition: opacity .55s ease; }
body:has(#session:not([hidden])) .scenery::after { opacity: 0; }

html[data-scene="mirage"] { --scene-ink: #3a2438; }
html[data-scene="mist"] {
  --scene-ink: #29231a;
  --mist-ground: #929b8c;
}
html[data-scene="mist"]:not(:has(#session:not([hidden]))) { --mist-ground: #38444e; }
html[data-scene="mirage"] .scenery::after { display: none; }
html[data-scene="mirage"] :is(.landscape, #scene-name, .landscape-title em),
html:is([data-scene="mirage"], [data-scene="mist"]) :is(#session, #timer, #writing-footer) {
  color: var(--scene-ink);
}
html[data-scene="mirage"] .brand svg { fill: currentColor; }
html:is([data-scene="mirage"], [data-scene="mist"]) #editor { caret-color: var(--scene-ink); }
html[data-scene="mirage"] .scene-bar,
html:is([data-scene="mirage"], [data-scene="mist"]) :is(#writing-footer, .icon-button, #downloads button) {
  border-color: color-mix(in srgb, var(--scene-ink) 35%, transparent);
}
html[data-scene="mirage"] .scenes :is(input:checked, input:focus-visible) + span { outline-color: var(--scene-ink); }
.session-bar { padding-block: 13px; }
html:not([data-scene="mirage"], [data-scene="mist"]) :is(.session-bar .icon-button, #timer, #downloads button) {
  background: #211625ac;
}
#timer { border-radius: 999px; padding: 3px 9px; }
html:not([data-scene="mirage"], [data-scene="mist"]) #writing-footer { text-shadow: 0 1px 5px #211625; }
.session-mark { justify-self: end; }
#exit { justify-self: start; }
.timer-slot { display: grid; place-items: center; }
#entry-title {
  grid-row: 2;
  width: min(750px, calc(100% - 44px));
  min-width: 0;
  margin: clamp(8px, 2vh, 24px) auto 0;
  padding: 2px 6px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  font: clamp(19px, 3vw, 29px)/1.3 var(--serif);
}
html[data-scene="desert"] :is(#editor, #entry-title) {
  color: #281620;
  caret-color: currentColor;
  text-shadow: 0 0 3px #f4cbb2, 0 0 7px #f4cbb2a0;
}
html[data-scene="aurora"] :is(#editor, #entry-title) {
  text-shadow: 0 1px 3px #1f192c, 0 0 7px #1f192c;
}
#entry-title::placeholder { color: inherit; opacity: .7; }
#writing-area {
  grid-row: 3;
  container-type: size;
  width: min(750px, calc(100% - 44px));
  min-height: 0;
  margin: clamp(10px, 6vh, 68px) auto 0;
}
#editor {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 12px max(20px, 50cqh) 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: inherit;
  caret-color: #ffd2be;
  font-size: var(--writing-size, 27px);
  line-height: 1.55;
  scrollbar-width: none;
  transition: opacity .12s, filter .12s;
}
#editor::-webkit-scrollbar { display: none; }
.caret-measure {
  position: fixed;
  inset: 0 auto auto 0;
  visibility: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
#download-status { text-align: center; }
#downloads { flex-shrink: 0; }
#editor[data-size="small"] { --writing-size: clamp(15px, 2.5vw, 20px); }
#editor[data-size="medium"] { --writing-size: clamp(18px, 3vw, 27px); }
#editor[data-size="large"] { --writing-size: clamp(22px, 3.8vw, 35px); }
#writing-footer { grid-row: 4; width: min(750px, calc(100% - 44px)); justify-self: center; display: flex; align-items: center; justify-content: space-between; min-height: 48px; color: #f9e7ea; border-top: 1px solid #fff4ed40; font-size: 12px; }
#downloads { gap: 6px; }
#downloads button { color: inherit; background: #ffffff10; border: 1px solid #ffffff40; border-radius: 999px; padding: 4px 11px; font: 12px var(--mono); }
#downloads button:hover { background: #ffffff25; }
#writing-footer { flex-wrap: wrap; column-gap: 12px; }
#release-draft {
  min-height: 38px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-shadow: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#release-draft:hover { text-decoration-thickness: 2px; }
.draft-dust { position: fixed; z-index: 3; pointer-events: none; }
@media (max-width: 500px) {
  #download-status:not(:empty) { order: 1; width: 100%; padding-bottom: 5px; }
}


#writing-settings {
  position: fixed;
  inset: 80px clamp(16px, 3.5vw, 50px) auto auto;
  width: min(341px, calc(100% - 32px));
  max-height: calc(100dvh - 100px);
  margin: 0;
  padding: 32px 26px;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 2px 6px #21162932;
}
#writing-settings .type-options { grid-template-columns: minmax(0, 1fr); }
#writing-settings .option-group { margin-bottom: 24px; }
#writing-settings .sizes { grid-auto-columns: min(44px, 25%); justify-content: start; }
#writing-settings .sizes label > span { min-height: 58px; }
#writing-settings .sounds label > span { min-height: 42px; padding-inline: 5px; }
#writing-settings .music-setting { border-top: 0; padding-top: 4px; }
.settings-actions { text-align: center; margin-top: 12px; }
.settings-actions .primary { min-width: 90px; min-height: 50px; }

dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 24px; }
dialog p { color: var(--muted); line-height: 1.55; margin: 0 0 20px; }

@media (max-width: 760px) {
  .landscape { min-height: 330px; }
  .landscape-title { font-size: clamp(63px, 11vw, 92px); }
}
@media (max-width: 420px) {
  .type-options { grid-template-columns: minmax(0, 1fr); }
  .sizes label > span { min-height: 37px; }
}
