:root { color-scheme: light; font-family: system-ui, sans-serif; color: #283830; background: #f5f4ef; line-height: 1.6; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.brand { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem max(1rem, calc((100vw - 1120px) / 2)); background: #e9eee8; border-bottom: 1px solid #d7ded5; }
.tagline, .muted { color: #58665e; font-size: .9rem; }
#workspace, #access { max-width: 1120px; margin: auto; padding: 1.5rem; }
#access:empty { display: none; }
#breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
#breadcrumbs > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
h1 { font-family: Georgia, serif; font-weight: normal; font-size: 2rem; margin: .4rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; }
button, input, textarea, select { font: inherit; }
button, .login { border: 1px solid #9aa99c; color: #283830; background: #fff; border-radius: .4rem; padding: .5rem .9rem; cursor: pointer; text-decoration: none; }
button:hover, .login:hover { background: #e9eee8; }
button:disabled { opacity: .6; cursor: wait; }
.primary { background: #345641; color: #fff; border-color: #345641; }
.primary:hover { background: #244530; }
.danger { color: #923a31; }
:focus-visible { outline: 3px solid #387bb1; outline-offset: 3px; }
label { display: block; font-size: .9rem; font-weight: 600; margin: .8rem 0 .3rem; }
input, textarea, select { width: 100%; min-width: 0; border: 1px solid #aeb9ae; border-radius: .35rem; background: #fffefa; color: #26372c; padding: .6rem; }
textarea { resize: vertical; }
#scene-content { min-height: 52vh; font: 1.15rem/1.85 Georgia, serif; padding: 1.5rem; }
.editor { max-width: 850px; margin: auto; }
.editor-top { display: flex; gap: 1rem; align-items: flex-end; }
.editor-top > div:first-child { flex: 1; min-width: 0; }
.editor-top > div:last-child { width: 150px; }
.savebar, .actions, .heading { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.savebar { background: #f5f4ef; padding: .8rem 0; }
#save-status { font-size: .9rem; }
#word-count { margin-left: auto; color: #58665e; font-size: .85rem; }
#notice, .conflict { padding: 1rem; background: #fff1dc; border-left: 4px solid #a66727; overflow-wrap: anywhere; }
.cards { display: grid; gap: .75rem; padding: 0; list-style: none; }
.card { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; border: 1px solid #d6ddd3; background: #fffefa; padding: 1rem; border-radius: .5rem; }
.heading { justify-content: space-between; }
details { margin: 1rem 0; }
summary { cursor: pointer; }
dialog { border: 1px solid #aeb9ae; border-radius: .6rem; padding: 1.5rem; width: min(640px, calc(100% - 2rem)); max-height: 90vh; overflow: auto; color: #283830; background: #f5f4ef; }
dialog::backdrop { background: #17261d88; }
dialog button { margin-top: 1rem; }
.skip { position: absolute; top: -100px; }
.skip:focus { top: 0; z-index: 10; background: white; padding: 1rem; }
@media (max-width: 600px) { #workspace, #access { padding: 1rem; } .tagline { display: none; } .editor-top { flex-wrap: wrap; } .editor-top > div:last-child { width: 100%; } #scene-content { padding: .8rem; } .card { padding: .75rem; } h1 { font-size: 1.7rem; } }

/* Titles are content; opening, renaming and deleting are separate actions. */
button, .login, summary, input, select { min-height: 44px; }
#breadcrumbs button { border: 0; background: transparent; border-radius: .2rem; padding: .4rem; text-decoration: underline; text-underline-offset: .2em; }
.secondary { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: .2em; }
.card-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-main h2 { margin: 0; font-size: 1.2rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .25rem; }
.editor-location { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; }
.editor-location h1 { flex: 1; min-width: 0; font-size: 1.7rem; margin: .4rem 0; }
#scene-details { margin: .3rem 0; }
summary { padding: .5rem 0; }
@media (max-width: 600px) {
  .brand { padding: .5rem 1rem; }
  #workspace { padding: .5rem 1rem 1rem; }
  .is-scene #breadcrumbs { display: none; }
  .editor-location { align-items: flex-start; gap: .15rem; }
  .editor-location h1 { flex-basis: 100%; font-size: 1.4rem; line-height: 1.35; margin: .25rem 0; }
  .editor-location .secondary { padding: .4rem 0; }
  .card-main { flex-basis: 100%; }
  .savebar { padding: .4rem 0; gap: .5rem; }
  #scene-content { min-height: 60vh; }
  .scene-text > label { margin-top: .3rem; }
}

#manuscript-dialog { width: min(850px, calc(100% - 1rem)); max-height: 94vh; }
.manuscript { font: 1.15rem/1.85 Georgia, serif; }
.manuscript h2 { font-size: 1.6rem; margin-top: 2rem; }
.manuscript h3 { font-size: 1.2rem; font-weight: normal; }
.manuscript-chapter, .manuscript-scene { min-width: 0; overflow-wrap: anywhere; }
.manuscript-scene + .manuscript-scene { border-top: 1px solid #d7ded5; margin-top: 2rem; padding-top: 1rem; }
.manuscript-content, .manuscript h2, .manuscript h3 { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) { #manuscript-dialog { padding: 1rem; } }

#manuscript-heading { white-space: pre-wrap; }
.sparring { width: min(800px, 92vw); max-height: 90dvh; overflow: auto; }
.sparring pre, .sparring section p { white-space: pre-wrap; overflow-wrap: anywhere; }
.sparring pre { font-size: .85rem; }
.sparring section { border-bottom: 1px solid #ccc; padding: 1rem 0; }
.sparring input[type=checkbox] { width: auto; margin-right: .5rem; }
