html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  font: 13px/1.5 system-ui, sans-serif;
  overflow: hidden;
}

#thermion_canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#status {
  position: fixed;
  top: 16px;
  left: 16px;
  margin: 0;
  padding: 12px;
  max-width: 40ch;
  background: rgba(0, 0, 0, .55);
  border-radius: 8px;
  white-space: pre-line;
}

#status:empty {
  display: none;
}

.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, .55);
  border-radius: 8px;
  max-width: 52ch;
}

.hud-hint {
  margin-top: 8px;
  opacity: .85;
}

#world-chat {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  width: min(19rem, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid #b1d4c780;
  border-radius: 12px;
  background: #133637ed;
  box-shadow: 0 3px 12px #142a3040;
  color: #f6f5e8;
}
#world-chat summary { cursor: pointer; font-weight: 650; }
#world-feed {
  max-height: min(8rem, 19dvh);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  margin: 6px 0;
  list-style: none;
  overflow-wrap: anywhere;
}
#world-feed li { padding: 2px 0; }
#world-feed bdi { color: #a5e9d1; font-weight: 650; }
#world-feed .world-event, #world-feed .world-event bdi { color: #efdca7; }
#chat-form { display: flex; gap: 6px; }
#chat-input, #chat-send {
  border: 1px solid #87a69b;
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
}
#chat-input { flex: 1; min-width: 0; background: #0e272b; color: white; }
#chat-input::placeholder { color: #b7c9c3; }
#chat-send { color: #12332d; background: #ade2c5; cursor: pointer; }
#chat-notice { margin: 4px 0 0; color: #f6d8ac; }
#chat-notice:empty { display: none; }
@media (max-width: 780px) {
  #world-chat { bottom: calc(70px + env(safe-area-inset-bottom)); }
}

#plot-owner {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  inset-inline: 16px;
  z-index: 1;
  display: flex;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 140ms ease-in, transform 140ms ease-in, visibility 0s 140ms;
}

#plot-owner.visible {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 180ms ease-out, transform 240ms ease-out;
}

.plot-owner-card {
  box-sizing: border-box;
  display: inline-flex;
  align-items: baseline;
  gap: .45em;
  max-width: min(100%, 420px);
  padding: 9px 18px 10px;
  border: 1px solid #c6cfb1;
  border-radius: 14px;
  box-shadow: 0 3px 12px #13393940;
  background: #173e40f5;
  color: #dbe6d6;
  line-height: 1.3;
  white-space: nowrap;
  animation: plot-arrival 260ms ease-out;
}

.plot-owner-card bdi {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff1cf;
  font-size: 18px;
  font-weight: 650;
}

@keyframes plot-arrival {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 900px) {
  .hud { max-width: min(52ch, calc(50vw - 252px)); }
}

@media (max-width: 899px) {
  #plot-owner.visible ~ .hud { top: calc(max(16px, env(safe-area-inset-top)) + 54px); }
}

@media (prefers-reduced-motion: reduce) {
  #plot-owner, #plot-owner.visible, .plot-owner-card {
    transition: none;
    animation: none;
    transform: none;
  }
}

.plot-action {
  position: fixed;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 14px 24px;
  border: 0;
  border-radius: 28px;
  background: #2ee86c;
  color: #10291a;
  box-shadow: 0 2px 8px #0006;
  font: 700 17px system-ui, sans-serif;
  letter-spacing: .2px;
  cursor: pointer;
}
#agent-panel {
  box-sizing: border-box;
  width: min(24rem, calc(100vw - 32px));
  padding: 18px;
  background: #133637;
  color: #f6f5e8;
  border: 1px solid #b1d4c780;
  border-radius: 10px;
}
#agent-panel::backdrop { background: #071c2066; }
#agent-panel h2 { margin: 0; font-size: 18px; }
#agent-panel button { cursor: pointer; margin-top: 5px; }
#agent-copy { background: #ade2c5; color: #12332d; font: inherit; font-weight: 650; border: 0; border-radius: 6px; padding: 6px 12px; }
#agent-privacy { margin-top: 6px; color: #dbe6d6; font-size: 12px; }
#agent-status:empty { display: none; }
#agent-panel a { color: #ade2c5; }
#codex-command { overflow-wrap: anywhere; }

#board-read { background: #f7eaca; color: #193e3a; }
#monorail-action { background: #ffe6af; color: #16464c; }
#monorail-action:disabled { background: #214952; color: white; cursor: default; }
#monorail-action:disabled kbd { display: none; }
body:has(#world-demo-claim-plot:not([hidden])) #monorail-action { bottom: calc(max(28px, env(safe-area-inset-bottom)) + 58px); }
#board-read kbd, #monorail-action kbd { margin-left: 5px; font: inherit; font-size: .8em; border: 1px solid #83978c; border-radius: 4px; padding: 1px 5px; }
body:has(#world-demo-claim-plot:not([hidden])) #board-read { bottom: calc(max(28px, env(safe-area-inset-bottom)) + 58px); }
#town-board { width: min(26rem, calc(100vw - 32px)); max-height: 80dvh; box-sizing: border-box; padding: 22px; border: 2px solid #54796e; border-radius: 8px; color: #253c35; background: #fbf2dc; }
#town-board::backdrop { background: #071c2066; }
#town-board h2 { margin: 0 0 12px; font: 700 24px "PT Serif", Georgia, serif; }
#town-board ul { padding: 0; margin: 0; list-style: none; }
#town-board li { padding: 10px 0; border-top: 1px solid #cabfa2; }
#town-board h3, #town-board p { margin: 0; }
#town-board h3 { font-size: 15px; color: #28564c; }
#town-board button { padding: 6px 12px; border: 0; border-radius: 5px; background: #244e45; color: #fff7dd; cursor: pointer; font: inherit; }

:is(#blimp-open, #town-account, #atlas-open) { margin: 4px 0; color: #fff2c8; background: transparent; border: 1px solid #b6c6ac; border-radius: 4px; cursor: pointer; }
:is(#blimp-panel, #town-account-panel, #atlas-panel) { box-sizing: border-box; width: min(26rem, calc(100vw - 32px)); padding: 22px; border: 2px solid #54796e; border-radius: 8px; color: #253c35; background: #fbf2dc; }
:is(#blimp-panel, #town-account-panel, #atlas-panel)::backdrop { background: #071c2066; }
:is(#blimp-panel, #town-account-panel, #atlas-panel) h2 { margin: 0; font: 700 24px "PT Serif", Georgia, serif; }
#blimp-current { margin: 14px 0; padding: 10px 14px; border-inline-start: 3px solid #dca351; background: #f3e4bd; overflow-wrap: anywhere; }
.blimp-byline:not([hidden]) { display: flex; align-items: center; gap: .55rem; margin: .5rem 0 0; color: #265b53; }
#blimp-compose .blimp-byline { margin: 0 0 .75rem; }
.blimp-avatar { position: relative; display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; overflow: hidden; border-radius: 50%; background: #21645f; color: #fff1c6; font-weight: 700; }
.blimp-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
:is(#blimp-panel, #town-account-panel, #atlas-panel) label { display: block; margin-bottom: 4px; }
:is(#blimp-panel, #town-account-panel, #atlas-panel) input { box-sizing: border-box; width: 100%; margin-bottom: 6px; padding: 6px; font: inherit; }
:is(#blimp-panel, #town-account-panel, #atlas-panel) button { padding: 5px 10px; border-radius: 4px; border: 0; background: #28594e; color: white; font: inherit; cursor: pointer; }
:is(#blimp-panel, #town-account-panel, #atlas-panel) form[method="dialog"] { display: inline-block; }
:is(#blimp-authorize, #town-authorize) { color: #18534d; }

#atlas-panel textarea { width:100%; box-sizing:border-box; }
#atlas-panel details { margin: .75em 0; }
