* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; background: #16181d; color: #e6e6e6; font: 13px system-ui, sans-serif; }
header { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #2b2f38; }
header .spacer { flex: 1; }
.menu { position: relative; }
#chest-list, #action-list, #account-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 5; min-width: 240px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: #16181d; border: 1px solid #353a46; border-radius: 8px; }
#action-list, #account-list { left: auto; right: 0; min-width: 180px; }
#chest-list[hidden], #action-list[hidden], #account-list[hidden] { display: none; }
#action-list button, #account-list button, #chest-list button { text-align: left; white-space: nowrap; }
button, input, select { font: inherit; color: inherit; background: #242832; border: 1px solid #353a46; border-radius: 6px; padding: 5px 9px; }
button { cursor: pointer; }
button:hover { background: #2e3340; }
button.primary, button.on { background: #3566d6; border-color: #4a7bea; }
button.danger { color: #ff9d9d; }
button.wide { width: 100%; margin-bottom: 8px; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { background: #242832; }
main { flex: 1; display: flex; min-height: 0; }
nav { width: 128px; padding: 8px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid #2b2f38; }
nav button { text-align: left; }
nav small { color: #8b93a5; }
#stage { flex: 1; position: relative; min-width: 0; }
#map, #three { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#map[hidden], #three[hidden] { display: none; }
#floors { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; z-index: 1; }
button.wide + button.wide { margin-top: 0; }
#warnings { position: absolute; right: 8px; bottom: 8px; z-index: 1; width: 320px; max-height: 45%; display: flex; flex-direction: column; background: #16181df0; border: 1px solid #6b5420; border-radius: 8px; }
#warnings[hidden] { display: none; }
#warnings > button { text-align: left; color: #ffcf70; background: none; border: 0; }
#warnings ul { margin: 0; padding: 0 10px 8px 26px; overflow-y: auto; color: #ffcf70; }
#warnings li { margin-bottom: 4px; }
#warnings a { color: #8fb4ff; cursor: pointer; text-decoration: underline; white-space: nowrap; }
#status { position: absolute; left: 8px; bottom: 8px; background: #000a; padding: 4px 8px; border-radius: 6px; pointer-events: none; }
aside { width: 280px; overflow-y: auto; padding: 12px; border-left: 1px solid #2b2f38; }
aside button.item { display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 4px; text-align: left; }
.row.info { display: flex; gap: 8px; margin-bottom: 4px; }
.row.info > span { width: 110px; flex: none; color: #8b93a5; }
.row.info > b { font-weight: normal; overflow-wrap: anywhere; }
aside h3 { margin: 14px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #8b93a5; }
aside h3:first-child { margin-top: 0; }
label.row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
label.row > span { width: 84px; flex: none; }
label.row > input, label.row > select { flex: 1; min-width: 0; }
label.row > input[type=checkbox] { flex: none; margin: 0; }
input[type=color] { height: 28px; padding: 2px; }
input[type=range] { padding: 0; }
label.row > input.unset { opacity: .35; }
label.row > button { flex: none; }
output { width: 40px; text-align: right; flex: none; }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.hint { color: #8b93a5; line-height: 1.5; }
#catalog { width: min(1080px, 92vw); max-height: 86vh; padding: 0; background: #16181d; color: inherit; border: 1px solid #353a46; border-radius: 10px; }
#catalog::backdrop { background: #000a; }
#catalog-search { flex: 1; max-width: 320px; margin-left: 4px; }
#catalog-new { margin-left: auto; }
#catalog article[hidden], #catalog h3[hidden] { display: none; }
#catalog-list h3 { grid-column: 1 / -1; margin: 6px 0 0; font-size: 13px; }
#catalog-none { padding: 0 14px 14px; }
#catalog summary { cursor: pointer; }
/* the note and the field that edits it share one box, so that editing does not move the card */
#catalog .note-view, #catalog .note textarea { box-sizing: border-box; display: block; width: 100%; min-height: 32px; margin: 0; padding: 6px 8px; font: inherit; line-height: 1.4; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; color: #e6d9b0; background: #262a34; border: 1px solid transparent; border-left: 2px solid #ffc857; border-radius: 4px; }
#catalog .note-view { position: relative; padding-right: 26px; cursor: text; }
#catalog .note-view::after { content: '✎'; position: absolute; top: 6px; right: 8px; color: #8b93a5; }
#catalog .note-view:hover { border-color: #ffc857; }
#catalog .note-view.empty { color: #8b93a5; background: none; border: 1px dashed #353a46; cursor: pointer; }
#catalog .note-view.empty::after { content: none; }
#catalog .note-view.empty:hover { color: inherit; border-color: #8b93a5; }
/* an outline outside the box would be clipped by the scrolling card body */
#catalog .note textarea { field-sizing: content; resize: none; border-color: #ffc857; outline: none; }
#catalog .note-view:focus-visible { outline: 2px solid #e6d9b0; outline-offset: -2px; }
#catalog .note [hidden] { display: none; }
#new-category { display: flex; gap: 8px; }
#catalog .places .spots { margin-top: 6px; }
#catalog .stats label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
#catalog .stats input { width: 80px; }
#catalog .stats .changed span { color: #ffc857; }
#catalog .stats button { margin-top: 8px; }
#catalog .config-section { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding: 6px 8px 8px; background: #181b22; border: 1px solid #2b2f38; border-radius: 6px; }
#catalog .config-section .section-title { color: #8b93a5; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
#catalog .stats .config-section label { margin-top: 0; }
#catalog .recipe .ingredient { display: flex; align-items: center; gap: 6px; }
#catalog .recipe .ingredient span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#catalog .recipe .ingredient input { width: 64px; }
#catalog .recipe .ingredient button { margin: 0; padding: 2px 8px; }
#catalog .stats .station select { min-width: 0; width: 130px; }
#catalog .recipe > button { margin: 0; align-self: flex-start; }
#catalog .recipe p { font-size: 12px; }
#catalog .cook .group { display: grid; grid-template-columns: 1fr 52px 52px; align-items: center; gap: 2px 6px; }
#catalog .cook .group input { width: 100%; min-width: 0; }
#catalog .cook .group small { grid-column: 1 / -1; opacity: 0.6; }
#catalog .cook .group.head { font-size: 11px; opacity: 0.6; }
#catalog .cook .station input { width: 64px; }
#catalog .cook .warning { color: #ffc857; }
#catalog .cook [hidden] { display: none; }
#catalog .crop > button { margin: 0; align-self: flex-start; }
#catalog p.edited, #catalog .crop.edited .section-title, #catalog .recipe.edited .section-title { color: #ffc857; }
#catalog .stats .category { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; }
#catalog .stats .category select, #catalog .stats .category input { min-width: 0; width: 130px; }
#catalog .stats .category [hidden], #new-category [hidden] { display: none; }
#catalog .stats .category input { margin-left: auto; }
#catalog-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px 0; }
#catalog-add[hidden] { display: none; }
#new-image { flex: 1; min-width: 220px; }
#new-problem { color: #ff8a75; }
#catalog .title { position: sticky; z-index: 1; top: 0; display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: #16181d; border-bottom: 1px solid #2b2f38; }
#catalog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px; }
#catalog article { height: 440px; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #1d2028; border: 1px solid #2b2f38; border-radius: 8px; }
#catalog .picture { position: relative; flex: none; height: 170px; overflow: hidden; display: grid; place-items: center; background: #8fa6b8; border-radius: 6px; color: #16181d; }
#catalog .picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* an unfolded section needs the room more than the picture does */
#catalog article:has(details[open]) .picture { height: 64px; }
#catalog h4 { margin: 0; font-size: 14px; }
#catalog p { margin: 0; color: #8b93a5; line-height: 1.4; }
#catalog .body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
#catalog .body > * { flex: none; }
#catalog .spots { display: flex; flex-wrap: wrap; gap: 4px; }
#catalog .spots button { padding: 2px 7px; }
#versions { width: min(760px, 92vw); max-height: 80vh; padding: 14px; background: #16181d; color: inherit; border: 1px solid #353a46; border-radius: 10px; }
#versions::backdrop { background: #000a; }
#versions .title, #versions .version { display: flex; gap: 8px; align-items: center; }
#versions .title strong, #versions .version input { flex: 1; }
#versions .version input { min-width: 0; }
#versions .version strong { min-width: 32px; }
#versions .version .by { width: 100px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#versions .version time { min-width: 170px; white-space: nowrap; font-variant-numeric: tabular-nums; color: #8b93a5; }
#versions .version { padding: 8px 0; border-top: 1px solid #2b2f38; }
#versions .title { margin-bottom: 10px; }
#version-list[hidden], #version-diff[hidden] { display: none; }
#versions .compare { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#diff-lines h3 { margin: 14px 0 4px; font-size: 13px; }
#diff-lines ul { margin: 0; padding: 0; list-style: none; }
#diff-lines li { display: flex; gap: 8px; padding: 2px 0; overflow-wrap: anywhere; }
#diff-lines li span { min-width: 0; }
#diff-lines li b { width: 10px; flex: none; }
#diff-lines .added b { color: #7ddc8a; }
#diff-lines .removed b { color: #ff9d9d; }
#diff-lines .changed b { color: #ffc857; }
#unsaved { color: #ffc857; border: 1px solid #ffc857; border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
#unsaved[hidden] { display: none; }
#login, #user-list { width: min(420px, 92vw); max-height: 80vh; padding: 16px; background: #16181d; color: inherit; border: 1px solid #353a46; border-radius: 10px; }
#login::backdrop { background: #16181d; }
#user-list::backdrop { background: #000a; }
#login-form { display: flex; flex-direction: column; gap: 8px; }
#login-form[hidden], #login-created[hidden], #user-created[hidden], #login-form [hidden] { display: none; }
#login p, #user-list p { margin: 8px 0; line-height: 1.5; }
#user-list .title, #user-add, .secret { display: flex; gap: 8px; align-items: center; }
#user-list .title strong, #user-add input, .secret input { flex: 1; min-width: 0; }
.secret input { font-family: ui-monospace, monospace; }
#users-all { padding: 0; list-style: none; }
#users-all li { display: flex; align-items: center; gap: 8px; min-height: 42px; border-top: 1px solid #2b2f38; }
#users-all span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#users-all small { color: #8b93a5; }
.problem { color: #ff8a75; }
#login-created > button { margin-top: 8px; }
