/* Every framed town task is a workbench modal (createTaskHost): it covers most of the town, which
   stays visible as a thin frame. The host bar steps aside once the page draws its own header. */
.library-task {
  position:fixed;
  inset:0;
  margin:auto;
  padding:0;
  width:min(1440px,calc(100vw - 48px));
  height:calc(100dvh - 48px);
  max-width:none;
  max-height:none;
  border:1px solid #d8c9ae;
  border-radius:14px;
  background:#fbf6ec;
  color:#302d24;
  box-shadow:0 32px 90px #21180d59,0 5px 20px #21180d26,inset 0 1px #fffaf3;
  overflow:hidden;
  font-family:system-ui,-apple-system,'PingFang SC',sans-serif;
}
.library-task[open] { display:flex; flex-direction:column; }
.library-task::backdrop { background:rgba(30,23,13,.26); }
.library-task[data-chrome] .library-task-head { display:none; }
.library-task-head {
  display:flex;
  flex:none;
  align-items:center;
  gap:20px;
  min-height:78px;
  box-sizing:border-box;
  padding:16px 26px;
  border-bottom:1px solid #ded5c4;
  background:#f7f0e3;
  line-height:1.3;
}
.library-task-crumb {
  display:block;
  color:#8a6847;
  font:11px/1.4 'IBM Plex Mono',monospace;
  letter-spacing:1.2px;
}
.library-task-head h1 {
  margin:5px 0 0;
  color:#3b392d;
  font-family:'Bricolage Grotesque',system-ui,-apple-system,'PingFang SC',sans-serif;
  font-size:22px;
  font-weight:500;
  line-height:1.3;
}
.library-task-head>div { margin-right:auto; }
.library-task-close {
  flex:none;
  width:44px;
  height:44px;
  padding:0;
  border:1px solid #d9ccb6;
  border-radius:50%;
  background:#fbf6ec;
  color:#594d3c;
  font:26px/1 system-ui,sans-serif;
  cursor:pointer;
}
.library-task-close:hover { border-color:#b89c72; background:#eee2cd; }
.library-task iframe {
  display:block;
  flex:1;
  min-height:0;
  width:100%;
  border:0;
  background:#fbf6ec;
}
.library-task-status {
  flex:none;
  margin:0;
  padding:12px 26px;
  background:#f5e0bf;
  color:#744724;
  font-size:13px;
  line-height:1.6;
}
.library-task :focus-visible,.town-library-dock :focus-visible {
  outline:2px solid var(--map-green, #405c43);
  outline-offset:3px;
}
.town-library-dock {
  position:absolute;
  z-index:8;
  bottom:var(--base, 24px);
  left:50%;
  display:flex;
  gap:0;
  max-width:calc(100% - 32px);
  box-sizing:border-box;
  padding:10px 16px;
  border:1px solid var(--map-border, #d7c7ad);
  border-radius:22px;
  background:var(--map-cream, #faf3e5);
  box-shadow:0 4px 14px #273b2529;
  transform:translateX(-50%);
}
.town-library-dock[hidden] { display:none; }
.town-library-dock button {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-width:148px;
  min-height:48px;
  padding:0 20px;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--map-ink, #302d24);
  font:600 15px/1.4 system-ui,-apple-system,sans-serif;
  white-space:nowrap;
  cursor:pointer;
}
.town-library-dock button + button { border-left:1px solid var(--map-border, #d7c7ad); }
.town-library-dock button:hover { background:#efe6d4; }
.town-library-dock svg { flex:none; width:26px; height:26px; color:var(--map-green, #405c43); }
.in-library #town-hotbar { display:none; }
.in-library #town-log { opacity:.6; }
body:has(.library-task[open]) #town-log { display:none; }
.town-asset-error {
  position:fixed;
  inset:25% 15% auto;
  z-index:100;
  padding:32px;
  border:1px solid #d7b893;
  border-radius:12px;
  background:#fff8ec;
  color:#493a2b;
  font:16px/1.7 system-ui,sans-serif;
}
@media(max-width:700px) {
  .library-task {
    inset:0;
    margin:0;
    width:100%;
    height:100dvh;
    border:0;
    border-radius:0;
  }
  .library-task-head {
    gap:12px;
    min-height:74px;
    padding:calc(12px + env(safe-area-inset-top)) 18px 12px;
  }
  .library-task-head h1 { font-size:20px; }
  .library-task-crumb { font-size:10px; letter-spacing:.8px; }
  .library-task-close { width:44px; height:44px; }
  .library-task-status { padding:12px 18px; }
  .town-library-dock {
    bottom:max(12px,env(safe-area-inset-bottom));
    max-width:calc(100% - 20px);
    padding:8px;
    border-radius:18px;
  }
  .town-library-dock button { flex-direction:column; min-width:96px; min-height:48px; gap:3px; padding:0 8px; font-size:12px; }
  .town-library-dock svg { width:26px; height:26px; }
  .in-library #town-log { display:none; }
  .town-asset-error { inset:20% 18px auto; padding:24px; }
}
@media(max-width:380px) {
  .library-task-head { gap:8px; padding-right:12px; padding-left:16px; }
  .library-task-head h1 { font-size:18px; }
}
