@import url("../studio-assets/wenkai-1.530/font.css");

* {box-sizing:border-box}
body {margin:0;padding:24px 16px;background:#f4f0df;color:#483e30;font-family:var(--gallery-writing, serif)}
main {margin:3vh auto;max-width:460px;padding:clamp(22px,5vw,42px);background:#fffdf3;border:1px solid #ded6bd;border-radius:5px 13px 8px 4px;box-shadow:2px 5px 14px #836a3d18}
header {display:flex;align-items:center;gap:14px;margin:30px 0 16px}
header .rachel {display:block;width:clamp(90px,25vw,128px);height:auto;flex:none}
h1 {font-size:clamp(1.35rem,5.5vw,1.75rem);font-weight:400;letter-spacing:.05em}
a {color:#52653c;text-underline-offset:4px}
form {display:grid;gap:8px}
label {margin-top:12px;font-weight:600}
input, button {font:inherit;font-size:16px;padding:12px;border:1px solid #b8b196;border-radius:6px;color:inherit}
input {width:100%;min-width:0;background:#fffcf2}
input::file-selector-button {padding:6px 10px;margin-right:8px}
input:is([type=password],[type=file],[type=date],[type=month]),input::file-selector-button {font-family:system-ui,sans-serif}
button {background:#50663b;color:white;margin-top:18px;cursor:pointer;min-height:48px}
button:disabled {opacity:.6}
#preview {max-height:225px;max-width:100%;margin:8px auto;object-fit:contain}
#status {line-height:1.55}
#status:empty {margin:0}
#day-hint {color:#71674f;line-height:1.5}
#edit-dates {margin-top:26px;border-top:1px dashed #d2c7a9;padding-top:14px}
summary {cursor:pointer;color:#52653c;padding:8px 0}
select {font:inherit;min-height:44px;max-width:100%;background:#fffcf2;color:inherit;border:1px solid #b8b196;border-radius:6px}
[hidden] {display:none!important}
/* Owner tools share the photo form's paper and portrait. */
main {max-width:560px}
h2 {font-size:1.2rem;font-weight:400;margin:20px 0 6px}
p, small {line-height:1.6;overflow-wrap:anywhere}
small {display:block;color:#71674f}
nav {display:flex;flex-wrap:wrap;gap:10px 18px;border-bottom:1px dashed #d2c7a9;padding:10px 0 20px}
section {margin-top:30px;border-top:1px dashed #d2c7a9;padding-top:8px}
section label, #narration-target label, #media-fields label {display:block;margin-bottom:7px}
select {width:100%;min-width:0;padding:10px;font-size:16px}
.muted {font-size:.9rem;color:#71674f}
.filename {font-weight:600;margin-top:18px}
.actions {display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.actions button {flex:1 1 120px;margin-top:8px}
button.secondary {background:#fffcf2;color:#52653c}
button:disabled, input:disabled, select:disabled {cursor:default}
button, a, input, select, summary {touch-action:manipulation}
:focus-visible {outline:3px solid #92783b;outline-offset:3px}
audio, video {display:block;width:100%;max-height:320px;margin:12px 0;border-radius:6px;background:#e9e3d2}
progress {display:block;width:100%;height:14px;accent-color:#50663b}
#media-status {font-size:.92rem}
#media-error {color:#9a3626}
#media-error:empty, #record-status:empty, #download-status:empty {margin:0}
#media-visit, #work-visit {display:inline-block;margin-top:16px}
#work-actions small {margin-top:10px}
@media(max-width:360px) {body{padding:12px 8px}main{padding:18px 14px}header{gap:8px}header .rachel{width:80px}h1{font-size:1.35rem}.actions button{flex-basis:100%}}
.owner-panel {border-top:1px dashed #d2c7a9;margin-top:20px;padding-top:12px;scroll-margin-top:16px}
.owner-panel > summary {font-size:1.2rem;font-weight:600;min-height:44px}
#edit-coauthors-field,#edit-mentions-field {display:grid;gap:8px}
#media-section {border:0;margin:0;padding:0}
#work-actions > details, #trash-panel, #story-panel {margin-top:14px;border-top:1px solid #e4dcc5;padding-top:8px}
textarea {display:block;width:100%;min-width:0;font:inherit;font-size:16px;padding:12px;color:inherit;background:#fffcf2;border:1px solid #b8b196;border-radius:6px;resize:vertical}
#replace-preview {display:block;max-width:100%;max-height:240px;margin:10px auto;object-fit:contain}
.target-note {font-weight:600;background:#edf0df;padding:12px;border-radius:6px}
button.danger {background:#914b39;color:#fff}
dialog {width:min(440px,calc(100% - 24px));max-height:90dvh;overflow:auto;padding:22px;border:1px solid #c7bda1;border-radius:10px;background:#fffdf3;color:#483e30}
dialog::backdrop {background:#302b2370}
.sr-only {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#replace-status:empty, #original-status:empty, #edit-status:empty {margin:0}
.months {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,160px),1fr));gap:8px 14px}
.months label {min-width:0}
.months label span {font:inherit;color:inherit}
.months input {display:block;margin-top:7px;min-height:46px}

.months input[type="date"], .months input[type="month"] {max-width:100%;min-width:0}
#invite-form input[type="datetime-local"] {font-family:system-ui,sans-serif;max-width:100%;min-height:46px}
#invite-suggestions:empty, #invite-status:empty {display:none}
#invite-suggestions button {flex:0 1 auto;overflow-wrap:anywhere;max-width:100%}
#invite-result label {display:block;margin-bottom:8px}
#invite-url {font-family:system-ui,sans-serif;font-size:16px;overflow-wrap:anywhere;word-break:break-all}
/* The owner's library */
main {max-width:1080px}
#login {max-width:460px;margin:0 auto}
#owner-nav a {padding:10px 14px;border-radius:6px;text-decoration:none}
#owner-nav a[aria-current=page] {background:#e8ecd9;color:#354c25;font-weight:600}
.comment-record {padding:20px 0; border-bottom:1px solid #ded6bd; overflow-wrap:anywhere}
.comment-record h3 {margin:0; font-size:1rem; font-weight:600}
.comment-record-body {white-space:pre-wrap; padding:10px 14px; background:#f5f0df; border-radius:4px}
.comment-record dl {display:grid;grid-template-columns:minmax(85px,1fr) minmax(0,4fr);gap:6px 16px;font-size:13px;line-height:1.7}
.comment-record dt {color:#71674f}.comment-record dd {margin:0;overflow-wrap:anywhere}
.comment-record button {margin-top:6px;font-size:14px}
#library-panel {border:0;margin-top:20px;padding:0}
.library-heading,.dialog-heading {display:flex;align-items:center;justify-content:space-between;gap:16px}
.library-heading button,.dialog-heading button {margin:0;flex:none}
.library-heading h2 {margin-top:0}
.library-filters {display:grid;grid-template-columns:minmax(0,1fr) 180px;gap:16px}
.library-filters label {margin:0}
.library-filters input,.library-filters select {margin-top:8px}
.library-toolbar {display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:16px 0}
.library-toolbar button {margin:0;min-height:44px;padding:9px 12px}
#library-count {margin-left:auto;font-size:.9rem}
.library-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:18px}
.work-card {position:relative;min-width:0;border:1px solid #ded6bd;border-radius:9px;background:#fffcf2;overflow:hidden}
.work-check {position:absolute;top:8px;left:8px;z-index:1;margin:0;padding:4px;background:#fffdf3e8;border-radius:5px;line-height:1}
.work-check input {width:21px;height:21px;margin:0;accent-color:#50663b;cursor:pointer}
.work-card-open {display:block;width:100%;text-align:left;background:transparent;color:inherit;border:0;border-radius:0;padding:0 0 12px;margin:0;min-height:0}
.work-card-open strong,.work-card-open small {display:block;padding:0 12px;margin-top:8px;overflow-wrap:anywhere}
.work-card-preview {height:160px;background:#e9e5d6;display:flex;align-items:center;justify-content:center;font-size:2rem;color:#777b60}
.work-card-preview img {display:block;width:100%;height:100%;object-fit:contain}
#add-panel {max-width:620px;margin:auto}
#work-dialog {width:min(700px,calc(100% - 24px))}
#edit-dates {margin-top:14px;border:0;padding:0}
#edit-dates>summary,#edit-date-form>label[for=edit-work],#edit-work {display:none}
#batch-names {max-height:35vh;overflow:auto;padding-left:24px}
#work-preview img {display:block;max-width:100%;max-height:260px;margin:auto}
@media(max-width:560px){body{padding:12px 8px}main{padding:20px 14px}.library-filters{grid-template-columns:1fr}.library-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.work-card-preview{height:130px}.library-heading{align-items:flex-start}#library-count{margin-left:0}.library-toolbar{gap:8px}.library-toolbar button{font-size:14px}.dialog-heading{align-items:flex-start}}

/* Keep the collection within reach as soon as the owner signs in. */
html:not(.single-editor) main:has(#login:not([hidden])) {
  max-width: 460px;
}
html:not(.single-editor) main:has(#login[hidden]) > header {
  margin: 8px 0;
  gap: 18px;
}
html:not(.single-editor) main:has(#login[hidden]) > header .rachel {
  width: 76px;
}
#owner-nav {
  border-bottom: 1px solid #d6cdb4;
  padding-bottom: 10px;
}
.library-heading h2 { margin-bottom: 4px; }
.library-heading .muted { margin: 4px 0 14px; }
.work-card:focus-within { outline: 2px solid #718455; outline-offset: 2px; }
.work-card-open:hover { color: #39532f; background: #f2f1e3; }
.single-tool-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,105px),1fr));
  gap: 7px;
  margin: 6px 0 12px;
}
.single-tool-menu button { margin: 0; min-height: 42px; padding: 7px; font-size: .94rem; }
.single-tool-menu button[aria-pressed="true"] { background: #e6ecd9; border-color: #697c53; }
.single-tool-menu [data-tool="delete"] { color: #884331; }
@media (max-width: 560px) {
  html:not(.single-editor) main:has(#login[hidden]) > header .rachel { width: 55px; }
}

/* One work inside the gallery's modal: navigation stays fixed, only the task scrolls. */
html.single-editor, .single-editor body {height:100%;overflow:hidden;background:transparent;margin:0;padding:0}
.single-editor main {width:100%;height:100%;max-width:none;margin:0;padding:0;border:0;border-radius:0;box-shadow:none;background:transparent;overflow:hidden}
.single-editor main>header,.single-editor main>a,.single-editor #owner-nav,.single-editor #photo-panel,.single-editor #trash-panel,.single-editor #work-dialog-close,.single-editor #work-visit,.single-editor #media-new,.single-editor #refresh-works,.single-editor label[for=edit-work],.single-editor #edit-work,.single-editor #library-panel,.single-editor #comments-panel,.single-editor #add-panel,.single-editor .language-toggle,.single-editor #work-dialog>.dialog-heading,.single-editor #work-actions>.actions,.single-editor #media-purpose,.single-editor #narration-target,.single-editor #media-visit,.single-editor #work-preview {display:none!important}
.single-editor #login {height:100%;max-width:440px;overflow:auto;padding:24px;margin:auto;align-content:start}
.single-editor .single-login-heading {font-size:1.2rem;margin:0 0 16px}
.single-editor #work-dialog {position:static;inset:auto;width:100%;height:100%;max-width:none;max-height:none;overflow:hidden;box-shadow:none;border:0;margin:0;padding:0;background:transparent}
.single-editor #work-dialog::backdrop {display:none}
.single-editor .single-editor-shell {height:100%;display:grid;grid-template-columns:185px minmax(0,1fr);gap:24px;min-height:0}
.single-editor .single-editor-shell[data-mode=narration] {grid-template-columns:minmax(0,1fr)}
.single-editor .single-tool-menu {display:flex;flex-direction:column;flex-wrap:nowrap;gap:4px;margin:0;padding:16px 12px 16px 0;border:0;border-right:1px solid #e4dccb;min-width:0;overflow:auto}
.single-editor .single-tool-menu button {display:flex;align-items:center;gap:10px;text-align:left;margin:0;padding:12px 10px;min-height:52px;width:100%;background:transparent;border:1px solid transparent;border-radius:8px;color:#514c40}
.single-editor .single-tool-menu button strong {font-weight:500;font-size:15px;display:block}
.single-editor .single-tool-menu button small,.single-editor .single-tool-arrow {display:none}
.single-editor .single-tool-menu button[aria-pressed=true] {background:#eaf0e0;color:#425b31;border-color:#d5dfc5}
.single-editor .single-tool-menu button[data-tool=delete] {margin-top:auto;color:#886359;border-top:1px solid #e4dccb;border-radius:0;padding-top:18px}
.single-editor .single-tool-icon {font-family:system-ui,sans-serif;font-size:21px;line-height:1;width:24px;text-align:center;flex:none}
.single-editor .single-editor-scroll {overflow:auto;overscroll-behavior:contain;min-width:0;min-height:0;padding:20px 20px 32px 0;scroll-padding:20px}
.single-editor .single-task-heading {margin-bottom:20px}
.single-editor .single-task-heading h2 {margin:0;font-size:1.25rem;outline:0}
.single-editor .single-task-back {margin:0 0 16px;padding:8px 0;min-height:40px;border:0;background:transparent;font-size:14px}
.single-editor #edit-dates {margin:0;border:0;padding:0}
.single-editor #edit-dates>summary {display:none}
.single-editor #edit-date-form {gap:8px}
.single-editor #edit-date-form>label:first-of-type+select+label {margin-top:0}
.single-editor #work-actions>details {margin:0 0 24px;padding:0;border:0}
.single-editor #work-actions>details>summary {font-weight:600;pointer-events:none;list-style:none;color:#625841;padding:0 0 12px;font-size:1rem}
.single-editor #work-actions>details>summary::-webkit-details-marker {display:none}
.single-editor #invite-panel>summary,.single-editor #delete-panel>summary {display:none}
.single-editor #originals-panel {border-top:1px solid #e4dccb!important;padding-top:20px!important}
.single-editor #media-panel {border:0;padding:0;margin:0}
.single-editor #media-panel>summary,.single-editor #media-section>p.muted:first-of-type {display:none}
.single-editor .single-current-audio {margin:0 0 20px;padding:16px;background:#f2f2e7;border:1px solid #e0e1d2;border-radius:10px}
.single-editor .single-current-audio>p {margin:0;font-size:16px}
.single-editor .single-current-audio>p.muted {font-size:14px;line-height:1.6;margin-top:8px}
.single-editor .single-current-audio audio {margin:12px 0 0}
.single-editor #record-tools {padding:16px;border:1px solid #e0dccb;border-radius:8px;margin:18px 0}
.single-editor #media-draft {border-top:1px solid #e4dccb;padding-top:12px}
.single-editor #narration-note {font-size:13px}
.single-editor #delete-panel {background:#faf3ef;padding:16px!important;border:1px solid #eadbd4!important;border-radius:8px}
.single-editor #delete-work {background:#fffaf7;color:#8b4f3d;border-color:#bd9688}
.single-editor button {margin-top:14px}
.single-editor input,.single-editor select,.single-editor textarea {background:#fffdf6}
.single-editor #edit-date-form>button {justify-self:start;padding-left:28px;padding-right:28px}
.single-editor #delete-dialog {max-height:calc(100dvh - 24px)}
.single-editor .single-editor-shell.single-mobile {display:block}
.single-editor .single-mobile .single-tool-menu {display:none}
.single-editor .single-mobile .single-editor-scroll {height:100%;padding:14px 16px 24px}
.single-editor .single-mobile.single-menu-view .single-editor-scroll {display:none}
.single-editor .single-mobile.single-menu-view .single-tool-menu {height:100%;display:flex;border:0;padding:12px 16px;gap:0}
.single-editor .single-mobile .single-tool-menu button {padding:18px 4px;border:0;border-radius:0;border-bottom:1px solid #e4dccb;gap:14px;min-height:84px}
.single-editor .single-mobile .single-tool-menu button strong {font-size:17px}
.single-editor .single-mobile .single-tool-menu button small {display:block;font-size:13px;font-weight:400;margin-top:4px;line-height:1.5;color:#7c7464}
.single-editor .single-mobile .single-tool-arrow {display:block;font-size:24px;margin-left:auto;color:#9a917e}
.single-editor .single-mobile .single-tool-menu [data-tool=delete] {margin-top:24px;border-bottom:0;border-top:1px solid #e4dccb}
.single-editor .single-mobile .single-task-heading {margin-bottom:18px}
.single-editor .single-mobile #edit-date-form>button {width:100%}
@media(prefers-reduced-motion:reduce) {.single-editor * {scroll-behavior:auto!important}}
.single-editor .single-editor-shell[data-mode=narration] .single-editor-scroll {padding-left:24px;padding-right:24px}
.single-editor .single-mobile[data-mode=narration] .single-editor-scroll {padding-left:16px;padding-right:16px}
.single-editor #record-help,.single-editor #staging-hint,.single-editor #narration-note {display:none}
.single-editor #record-tools {margin:0 0 14px;padding:16px 18px;background:#f5f6ed;border-color:#d5ddc7}
.single-editor #record-tools .actions {margin:0}
.single-editor #record-tools button {margin:0;flex:1 1 100px}
.single-editor #record-start {background:#50663b;color:#fff;border-color:#50663b}
.single-editor #record-status:not(:empty) {margin:12px 0 0}
.single-editor .single-file-picker {padding:14px 16px;border:1px dashed #cbc3af;border-radius:8px}
.single-editor .single-file-picker label {margin:0 0 8px;font-size:14px;font-weight:400}
.single-editor .single-file-picker input {border:0;padding:0;background:transparent;font-size:14px}
.single-editor .single-editor-shell:not(.single-mobile) #edit-date-form {grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:16px}
.single-editor .single-editor-shell:not(.single-mobile) #edit-date-form>* {grid-column:1/-1}
.single-editor .single-editor-shell:not(.single-mobile) #edit-coauthors-field {grid-column:1}
.single-editor .single-editor-shell:not(.single-mobile) #edit-mentions-field {grid-column:2}
/* The direct voice editor has four controls: file, record, one track, confirm. */
.single-editor [data-mode=narration] .single-task-heading,
.single-editor [data-mode=narration] .single-file-picker,
.single-editor [data-mode=narration] #record-tools,
.single-editor [data-mode=narration] #media-filename,
.single-editor [data-mode=narration] #preview-hint,
.single-editor [data-mode=narration] label[for=media-progress],
.single-editor [data-mode=narration] #media-progress,
.single-editor [data-mode=narration] #media-cancel {display:none!important}
.single-editor .single-audio-editor {display:grid;gap:18px}
.single-editor .single-audio-buttons {display:flex;gap:12px}
.single-editor .single-audio-buttons button {flex:1;min-width:0;margin:0;min-height:48px}
.single-editor .single-audio-buttons #record-start {background:#bd4d46;border-color:#a83c36;color:#fff}
.single-editor .single-audio-buttons #record-start[aria-pressed=true] {background:#92342e;box-shadow:0 0 0 3px #bd4d4620}
.single-editor [data-mode=narration] .single-current-audio {margin:0;padding:0;background:transparent;border:0;border-radius:0}
.single-editor [data-mode=narration] .single-current-audio audio {margin:0}
.single-editor .single-audio-confirm button {width:100%;margin:0;min-height:48px}
.single-editor [data-mode=narration] #media-draft {border:0;padding:0;margin:0}
.single-editor [data-mode=narration] #media-draft .actions {margin-top:8px}
.single-editor [data-mode=narration] #media-status {font-size:13px;margin:10px 0 0;color:#71674f}
.single-editor [data-mode=narration] #media-error:empty {display:none}
.single-editor [data-mode=narration] .single-editor-scroll {padding:12px 16px 12px!important}
.single-editor [data-mode=narration] #media-form {gap:0}
.single-editor .single-audio-editor {gap:14px}
.single-editor .single-audio-editor #record-status {margin:0;font-size:13px;line-height:1.45;color:#8c483e}
.single-editor .single-audio-editor #record-status:empty {display:none}
.single-editor [data-mode=narration] #media-status {display:none}
.single-editor [data-mode=narration] #media-draft .actions:has(#media-retry[hidden]) {display:none}
