:root{color-scheme:dark;--bg:#101311;--panel:#171b18;--panel2:#1d231f;--line:#2a332d;--text:#eef2ed;--muted:#9ba79e;--dim:#6d7970;--lime:#c5f27a;--lime-dark:#a3d856;--red:#ff8c83;--blue:#9dbbff;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-synthesis:none;text-rendering:optimizeLegibility}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text)}body{min-width:320px;background:radial-gradient(ellipse at 70% -20%,#273329 0,transparent 42%),var(--bg);padding-bottom:calc(86px + env(safe-area-inset-bottom))}button,input,textarea,select{font:inherit}button{touch-action:manipulation;color:inherit}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--lime);outline-offset:2px}.topbar{height:64px;padding:0 max(18px,calc((100vw - 1120px)/2));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #27302a;background:#111512eF;position:sticky;top:0;z-index:10;backdrop-filter:blur(14px)}.brand{display:flex;align-items:center;gap:10px;background:none;border:0;font-size:15px;font-weight:500;cursor:pointer;padding:0}.brand b{font-weight:750}.brand-mark{width:32px;height:32px;border:1px solid #4c6144;border-radius:11px;background:#222d23;color:var(--lime);display:grid;place-items:center;font-size:20px}.top-actions{display:flex;align-items:center;gap:8px}.button{border:1px solid var(--line);background:var(--panel2);min-height:40px;border-radius:11px;padding:0 14px;font-weight:650;font-size:13px;cursor:pointer;transition:background .15s,border-color .15s,transform .15s}.button:hover{background:#29332b;border-color:#52664e}.button:active{transform:scale(.98)}.button-primary{background:var(--lime);border-color:var(--lime);color:#172012}.button-primary:hover{background:#d2ff8b;border-color:#d2ff8b}.button-quiet{background:transparent;color:#bdc8bf}.button-danger{color:var(--red);border-color:#573a39;background:#251a19}.button-small{min-height:32px;padding:0 10px;font-size:12px}.icon-button{width:34px;height:34px;display:grid;place-items:center;border:1px solid var(--line);border-radius:10px;background:#161c18;color:var(--muted);cursor:pointer}.bottom-nav{position:fixed;z-index:12;left:50%;bottom:calc(10px + env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;gap:6px;padding:5px;border:1px solid #354139;border-radius:16px;background:#141a16f2;box-shadow:0 12px 34px #0008;backdrop-filter:blur(16px)}.bottom-nav button{border:0;background:transparent;color:var(--muted);min-width:98px;height:44px;border-radius:12px;display:flex;align-items:center;justify-content:center;gap:8px;font-size:12px;font-weight:650;cursor:pointer}.bottom-nav button span{font-size:17px}.bottom-nav button.active{background:#29362a;color:var(--lime)}#app{width:min(100% - 36px,1040px);margin:0 auto;padding:34px 0 46px}.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin:4px 0 25px}.eyebrow{font-size:10px;letter-spacing:1.6px;text-transform:uppercase;color:var(--lime);font-weight:750}.page-head h1{font-size:clamp(27px,7vw,42px);line-height:1.08;letter-spacing:-1.8px;margin:9px 0 8px}.page-head p{margin:0;color:var(--muted);font-size:14px;line-height:1.55}.stats-row{display:flex;gap:8px;flex-wrap:wrap;margin:20px 0 25px}.stat-pill{border:1px solid var(--line);background:#171d19;border-radius:999px;padding:8px 12px;color:var(--muted);font-size:12px}.stat-pill strong{color:var(--text);font-weight:750}.status-filter{display:flex;gap:7px;overflow-x:auto;padding:1px 1px 9px;margin-bottom:10px;scrollbar-width:none}.status-filter::-webkit-scrollbar{display:none}.filter-chip{white-space:nowrap;background:transparent;border:1px solid var(--line);border-radius:999px;color:var(--muted);padding:8px 12px;font-size:12px;font-weight:650;cursor:pointer}.filter-chip.active{background:#29372a;color:var(--lime);border-color:#526849}.agent-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.agent-card{position:relative;min-width:0;border:1px solid var(--line);border-radius:18px;background:linear-gradient(155deg,#1b211d,#151a17);padding:16px;cursor:pointer;transition:border-color .15s,transform .15s}.agent-card:hover{border-color:#52664e;transform:translateY(-2px)}.agent-card-top{display:flex;align-items:flex-start;gap:11px}.agent-emoji{width:45px;height:45px;flex:none;border:1px solid #38443a;border-radius:15px;background:#252e27;display:grid;place-items:center;font-size:25px}.agent-card-copy{min-width:0;flex:1}.agent-card-copy h2{font-size:16px;line-height:1.25;margin:3px 0 5px;overflow-wrap:anywhere}.agent-role{font-size:12px;color:var(--muted);line-height:1.35}.agent-card-arrow{color:var(--dim);font-size:20px}.badge-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:14px}.badge{display:inline-flex;align-items:center;min-height:24px;padding:3px 8px;border:1px solid var(--line);border-radius:999px;background:#1c231e;color:#b4c0b6;font-size:10px;font-weight:700}.badge.origin{color:#bfd99e;border-color:#3c5037;background:#1d291e}.badge.status-living{color:var(--lime);border-color:#42553a}.badge.status-parked{color:#b8b6ac}.badge.status-ready{color:#9dbbff;border-color:#354867}.badge.status-deployed{color:#d0a7ff;border-color:#523d67}.card-meta{margin-top:14px;padding-top:11px;border-top:1px solid #27302a;display:flex;justify-content:space-between;gap:8px;color:var(--dim);font-size:10px}.empty-state{border:1px dashed #39443b;border-radius:20px;text-align:center;padding:42px 22px;background:#141a16}.empty-icon{font-size:34px;color:var(--lime)}.empty-state h2{font-size:18px;margin:10px 0 7px}.empty-state p{color:var(--muted);font-size:13px;line-height:1.6;max-width:340px;margin:0 auto 18px}.backup-box{margin-top:25px;padding:16px;border:1px solid var(--line);border-radius:16px;background:#151a17;display:flex;align-items:center;justify-content:space-between;gap:14px}.backup-box strong{font-size:13px}.backup-box p{font-size:11px;line-height:1.45;color:var(--muted);margin:4px 0 0}.backup-actions{display:flex;gap:7px;flex:none}.back-link{border:0;background:transparent;color:var(--muted);padding:8px 0;font-weight:650;cursor:pointer}.detail-heading{display:flex;align-items:center;gap:12px;margin:10px 0 20px}.detail-heading .agent-emoji{width:52px;height:52px;font-size:29px}.detail-title{min-width:0;flex:1}.detail-title h1{margin:0 0 4px;font-size:24px;letter-spacing:-.8px;overflow-wrap:anywhere}.detail-title p{margin:0;color:var(--muted);font-size:12px}.detail-actions{display:flex;gap:7px;flex-wrap:wrap;margin:0 0 18px}.conversation-layout{display:grid;grid-template-columns:230px minmax(0,1fr);gap:12px;min-height:570px}.conversation-sidebar,.chat-panel,.settings-card,.profile-card,.add-panel{border:1px solid var(--line);background:#151a17;border-radius:18px;overflow:hidden}.conversation-sidebar{padding:12px;display:flex;flex-direction:column}.sidebar-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:2px 0 10px}.sidebar-head strong{font-size:12px}.conversation-list{display:flex;flex-direction:column;gap:6px;overflow:auto}.conversation-item{display:flex;align-items:center;gap:4px;border:1px solid transparent;border-radius:11px;padding:5px;background:transparent}.conversation-item.active{background:#222b24;border-color:#38463a}.conversation-select{flex:1;min-width:0;text-align:left;border:0;background:transparent;padding:6px;color:var(--text);cursor:pointer}.conversation-select strong,.conversation-select small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conversation-select strong{font-size:11px;font-weight:650}.conversation-select small{font-size:9px;color:var(--dim);margin-top:3px}.conversation-tools{display:flex;gap:2px}.conversation-tools button{width:27px;height:27px;border:0;background:transparent;border-radius:7px;color:var(--dim);cursor:pointer}.conversation-tools button:hover{background:#303a32;color:var(--text)}.chat-panel{display:flex;flex-direction:column;min-height:570px}.chat-topline{height:49px;border-bottom:1px solid var(--line);padding:0 15px;display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:11px}.chat-topline strong{color:var(--text);font-size:12px}.chat-transcript{flex:1;min-height:0;max-height:calc(100dvh - 300px);overflow:auto;padding:18px;display:flex;flex-direction:column;gap:15px;scroll-behavior:smooth}.chat-empty{margin:auto;text-align:center;color:var(--muted);font-size:13px;line-height:1.6;max-width:300px}.message{max-width:88%;display:flex;flex-direction:column;gap:5px}.message.user{align-self:flex-end;align-items:flex-end}.message.assistant{align-self:flex-start}.message-meta{font-size:9px;color:var(--dim)}.message-bubble{border:1px solid #2b352e;border-radius:15px;padding:11px 13px;background:#1c241e;color:#e4ebe4;font-size:13px;line-height:1.6;overflow-wrap:anywhere}.message.user .message-bubble{background:#29382b;border-color:#43593d}.message-bubble p{margin:0 0 8px}.message-bubble p:last-child{margin-bottom:0}.message-bubble h1,.message-bubble h2,.message-bubble h3{font-size:1.08em;margin:8px 0}.message-bubble ul,.message-bubble ol{padding-left:20px;margin:5px 0}.message-bubble pre{white-space:pre-wrap;overflow:auto;background:#101512;border:1px solid #303a32;border-radius:9px;padding:10px;font-size:11px}.message-bubble code{font-family:ui-monospace,SFMono-Regular,monospace;background:#101512;border-radius:4px;padding:1px 4px;font-size:.92em}.message-bubble pre code{padding:0;background:transparent}.message-bubble a{color:var(--lime)}.chat-composer{display:flex;gap:8px;padding:12px;border-top:1px solid var(--line);align-items:flex-end}.chat-composer textarea{resize:none;min-height:43px;max-height:135px;flex:1}.text-input{width:100%;min-height:42px;padding:10px 12px;border:1px solid #364139;border-radius:11px;background:#101512;color:var(--text);font-size:13px}.text-input::placeholder{color:#69756c}.chat-note{font-size:10px;color:var(--dim);padding:0 13px 10px;margin:0}.profile-card,.settings-card,.add-panel{padding:18px}.section-title{margin:0 0 16px;font-size:17px;letter-spacing:-.3px}.profile-form,.settings-form,.agent-form{display:grid;gap:13px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field{display:grid;gap:6px;min-width:0}.field label{font-size:11px;font-weight:700;color:#c7d2c9}.field-hint{font-size:10px;line-height:1.45;color:var(--dim)}.text-input.textarea{min-height:98px;resize:vertical;line-height:1.5}.profile-status{display:flex;flex-wrap:wrap;gap:7px;margin:5px 0 17px}.profile-status button{border:1px solid var(--line);background:#101512;color:var(--muted);padding:8px 12px;border-radius:10px;font-size:11px;font-weight:700;cursor:pointer}.profile-status button.active{color:var(--lime);border-color:#526849;background:#232e24}.change-log{border-top:1px solid var(--line);margin-top:20px;padding-top:16px}.change-log h3{margin:0 0 12px;font-size:13px}.log-list{display:grid;gap:9px}.log-item{display:flex;gap:9px;color:var(--muted);font-size:11px;line-height:1.45}.log-dot{width:7px;height:7px;margin-top:4px;background:var(--lime-dark);border-radius:50%;flex:none}.log-item time{color:var(--dim);display:block;font-size:9px;margin-top:3px}.add-tabs{display:flex;gap:6px;overflow:auto;margin:0 -2px 15px;padding-bottom:5px;scrollbar-width:none}.add-tabs::-webkit-scrollbar{display:none}.add-tabs button{white-space:nowrap;border:1px solid var(--line);border-radius:999px;background:#101512;color:var(--muted);padding:9px 12px;font-size:11px;font-weight:700;cursor:pointer}.add-tabs button.active{background:#29372a;border-color:#526849;color:var(--lime)}.add-panel{max-width:760px;margin:0 auto}.add-panel .section-title{margin-bottom:5px}.add-intro{font-size:12px;color:var(--muted);line-height:1.55;margin:0 0 16px}.form-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.inline-controls{display:flex;gap:8px;align-items:center}.inline-controls .text-input{flex:1;min-width:0}.form-row{display:grid;grid-template-columns:1fr 1fr;gap:11px}.notice{border:1px solid #3b4a38;border-radius:11px;background:#1b261b;color:#c7d9b9;padding:11px 12px;font-size:11px;line-height:1.5}.notice.error{border-color:#694241;background:#2a1c1c;color:#ffb0a8}.code-candidate{padding:14px;margin:12px 0;border:1px solid var(--line);border-radius:14px;background:#111612}.candidate-head{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:12px}.candidate-head strong{font-size:12px;overflow-wrap:anywhere}.candidate-head label{font-size:10px;color:var(--lime);display:flex;gap:6px;align-items:center}.candidate-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.candidate-grid .field.full{grid-column:1/-1}.candidate-grid textarea{min-height:85px}.key-status{font-size:11px;color:var(--muted);margin:0 0 12px}.status-message{min-height:18px;font-size:11px;color:var(--muted)}.toast{position:fixed;z-index:30;left:50%;bottom:calc(82px + env(safe-area-inset-bottom));transform:translate(-50%,14px);opacity:0;pointer-events:none;background:#253128;border:1px solid #526849;color:#e8f4df;border-radius:12px;padding:11px 15px;max-width:calc(100vw - 28px);font-size:12px;box-shadow:0 10px 30px #0009;transition:opacity .2s,transform .2s}.toast.show{opacity:1;transform:translate(-50%,0)}.hidden{display:none!important}.origin-note{color:var(--dim);font-size:10px;line-height:1.45;margin:0}.status-indicator{display:inline-flex;align-items:center;gap:6px}.status-indicator:before{content:"";width:6px;height:6px;border-radius:50%;background:var(--lime)}
@media(max-width:650px){.topbar{height:58px;padding:0 15px}.brand{font-size:14px}.brand-mark{width:30px;height:30px}.desktop-label{display:none}.top-actions{gap:5px}.top-actions .button{min-height:36px;padding:0 11px;font-size:12px}#app{width:calc(100% - 28px);padding:25px 0 32px}.page-head{align-items:flex-start;flex-direction:column;margin-bottom:18px}.page-head h1{font-size:31px}.page-head p{font-size:12px}.stats-row{margin:15px 0 19px}.stat-pill{font-size:11px;padding:7px 10px}.agent-grid{grid-template-columns:1fr;gap:10px}.agent-card{padding:14px;border-radius:16px}.agent-card-top .agent-emoji{width:42px;height:42px}.backup-box{align-items:flex-start;flex-direction:column;padding:14px}.backup-actions{width:100%}.backup-actions .button{flex:1}.conversation-layout{grid-template-columns:1fr;gap:9px;min-height:calc(100dvh - 240px)}.conversation-sidebar{padding:10px;min-height:118px;max-height:155px}.sidebar-head{margin:0 0 7px}.conversation-list{flex-direction:row;overflow-x:auto;overflow-y:hidden}.conversation-item{min-width:180px;max-width:220px;flex:none}.conversation-tools{display:none}.chat-panel{min-height:calc(100dvh - 415px);height:calc(100dvh - 390px)}.chat-transcript{max-height:none;padding:13px}.message{max-width:94%}.chat-composer{padding:9px}.chat-composer .button{padding:0 11px}.detail-heading{align-items:flex-start}.detail-title h1{font-size:20px}.detail-actions .button{min-height:34px;font-size:11px}.profile-card,.settings-card,.add-panel{padding:15px;border-radius:16px}.form-grid,.form-row,.candidate-grid{grid-template-columns:1fr}.candidate-grid .field.full{grid-column:auto}.profile-status{gap:6px}.profile-status button{padding:8px 9px}.topbar .button-quiet{padding-inline:9px}.bottom-nav button{min-width:90px}.toast{bottom:calc(76px + env(safe-area-inset-bottom))}}
@media(max-width:360px){#app{width:calc(100% - 22px)}.agent-card{padding:12px}.card-meta{font-size:9px}.form-actions{flex-wrap:wrap}.form-actions .button{flex:1}.detail-actions{gap:5px}.detail-actions .button{padding:0 9px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition-duration:.01ms!important}}



/* Training Board and proposal cards: stacked rows at every width, no horizontal
   scrolling, and a 44px minimum for every control. */
.board-controls{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px}
.board-filters,.board-sort{display:flex;flex-wrap:wrap;gap:8px}
.board-controls .button{min-height:44px;padding:0 12px}
.board-list{display:flex;flex-direction:column;gap:10px}
.board-row{display:flex;flex-direction:column;gap:10px;padding:14px;border:1px solid rgba(255,255,255,.12);border-radius:16px;background:rgba(255,255,255,.03);overflow-wrap:anywhere;min-width:0}
.board-row.blocked{border-left:3px solid #d9534f}
.board-row-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.board-row-title{flex:1 1 140px;min-width:0}
.board-row-title h3{margin:0;font-size:16px;line-height:1.25}
.board-row-title small{display:block;font-size:11px;opacity:.7;overflow-wrap:anywhere}
.board-row-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0}
.board-row-facts div{min-width:0}
.board-row-facts dt{font-size:10px;text-transform:uppercase;letter-spacing:.04em;opacity:.6}
.board-row-facts dd{margin:2px 0 0;font-size:13px;overflow-wrap:anywhere}
.board-blockers ul{margin:6px 0 0 18px;padding:0}
.board-blockers li{font-size:13px;line-height:1.4;overflow-wrap:anywhere}
.board-row .button{min-height:44px;align-self:flex-start;padding:0 16px}
.proposal-panel{margin:16px 0}
.proposal-card{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid rgba(255,255,255,.12);border-radius:16px;background:rgba(255,255,255,.03);margin-bottom:10px;overflow-wrap:anywhere;min-width:0}
.proposal-card header{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start;justify-content:space-between}
.proposal-card h3{margin:0;font-size:16px}
.proposal-card small{display:block;font-size:11px;opacity:.7;overflow-wrap:anywhere}
.proposal-card.stale{opacity:.65}
.proposal-actions{display:flex;flex-wrap:wrap;gap:8px}
.proposal-actions .button{min-height:44px;padding:0 16px}
@media(max-width:390px){
  .board-row-facts{grid-template-columns:repeat(2,minmax(0,1fr))}
  .board-controls{gap:6px}
  .board-controls .button{flex:1 1 auto}
}
@media(max-width:320px){
  .board-row,.proposal-card{padding:11px}
  .board-row-facts{grid-template-columns:1fr}
  .board-row .button,.proposal-actions .button,.board-controls .button{width:100%}
  .board-row-title h3,.proposal-card h3{font-size:15px}
}


/* Every control is a 44x44 tap target at phone widths, and the top bar keeps a
   short label so the row still fits at 320px without horizontal scrolling. */
.mobile-label{display:none}
.back-link{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 12px}
@media(max-width:650px){
  .desktop-label{display:none}
  .mobile-label{display:inline}
  .top-actions .button{min-height:44px;padding:0 8px;font-size:11px}
  .topbar .button-quiet{padding-inline:8px}
  .bottom-nav button{min-height:44px}
}


/* Small controls keep their compact look but never shrink below a 44x44 target. */
.button.button-small,.agent-tabs button,.profile-status button,.memory-actions .button,.board-controls .button,.proposal-actions .button,.drill-run-actions .button,.conversation-tools button,.emoji-picks button{min-height:44px}
.agent-tabs button,.profile-status button,.text-button{display:inline-flex;align-items:center;justify-content:center}
.text-button{min-height:44px}
.emoji-picks{display:flex;flex-wrap:wrap;gap:6px}
.emoji-picks button{min-width:44px;display:inline-grid;place-items:center}

/* The brand and any icon-only button stay at least 44x44 as well. */
.brand{min-height:44px;min-width:44px}
.button{min-width:44px}


/* The Keys screen offers Dark, Light and Amber. Until now only Dark existed, so
   the picker changed an attribute with no palette behind it. */
body[data-theme=light]{color-scheme:light;--bg:#f5f7f3;--panel:#ffffff;--panel2:#eef2ea;--line:#d6ded2;--text:#18211a;--muted:#57635a;--dim:#78857b;--lime:#4d8b12;--lime-dark:#3d6f0d;--red:#b3261e;--blue:#2c56c9;background:radial-gradient(ellipse at 70% -20%,#e6efe0 0,transparent 42%),var(--bg)}
body[data-theme=amber]{color-scheme:dark;--bg:#191309;--panel:#221a10;--panel2:#2b2214;--line:#3f3320;--text:#f7eedb;--muted:#c0ab89;--dim:#8d7b5e;--lime:#ffc46b;--lime-dark:#e6a949;--red:#ff9a90;--blue:#a9c3ff;background:radial-gradient(ellipse at 70% -20%,#3b2c15 0,transparent 42%),var(--bg)}
body[data-theme=light] .topbar{background:#ffffffeF;border-bottom-color:#e0e6db}
body[data-theme=light] .brand-mark{background:#eef3e8;border-color:#cbd8c2}
body[data-theme=light] .button:hover{background:#e6ece1;border-color:#bccdb2}
body[data-theme=light] .button-primary:hover{background:#5da51b;border-color:#5da51b}
body[data-theme=light] .board-row,body[data-theme=light] .proposal-card{background:#ffffff;border-color:#dde5d8}
body[data-theme=light] .agent-card,body[data-theme=light] .settings-card,body[data-theme=light] .profile-card,body[data-theme=light] .add-panel{background:var(--panel)}
body[data-theme=amber] .board-row,body[data-theme=amber] .proposal-card{background:#241c11;border-color:#3f3320}
body[data-theme=amber] .button-primary{color:#241a06}

/* Quiet and primary buttons keep readable contrast on the light palette. */
body[data-theme=light] .button-quiet{color:#3d4a41}
body[data-theme=light] .button-primary{color:#ffffff}
body[data-theme=light] .brand{color:#18211a}


/* ---------------------------------------------------------------------------
   The world. A portrait map with original building art, pixel residents on
   top, and panels underneath that do real work. Everything is a 44px target
   at phone widths and nothing scrolls sideways.
   --------------------------------------------------------------------------- */
.world-note{margin:0 0 14px}
.world-stats{flex-wrap:wrap}
.world-stage{position:relative;width:100%;max-width:430px;margin:0 auto 6px;aspect-ratio:100/150;border:1px solid var(--line);border-radius:22px;overflow:hidden;background:#121814;isolation:isolate;box-shadow:inset 0 0 60px #0006}
.world-ground{position:absolute;inset:0;width:100%;height:100%;display:block}
.world-buildings,.world-residents{position:absolute;inset:0}
.world-building{position:absolute;width:17%;padding:0;border:0;background:none;cursor:pointer;transform:translate(-50%,-100%);display:grid;justify-items:center;gap:2px;color:var(--text);z-index:5}
.world-building-art{margin:0;width:100%;line-height:0;filter:drop-shadow(0 10px 12px rgba(0,0,0,.42))}
.world-building-art svg{width:100%;height:auto;display:block}
.world-building:hover .world-building-art{filter:drop-shadow(0 12px 16px rgba(0,0,0,.5)) brightness(1.08)}
.world-building:active .world-building-art{transform:translateY(1px)}
.world-building-label{display:flex;align-items:center;gap:5px;padding:2px 8px;border-radius:999px;background:#10161399;border:1px solid #2c362e;backdrop-filter:blur(4px);font-size:9.5px;font-weight:750;letter-spacing:.2px;white-space:nowrap;max-width:100%}
.world-building-label strong{font-weight:750;overflow:hidden;text-overflow:ellipsis}
.world-building-label span{min-width:14px;text-align:center;color:var(--lime);font-variant-numeric:tabular-nums}
.world-building-label .building-count{cursor:help}
.world-building.is-full .world-building-label{border-color:#7a4a3e}
.world-building.pos-plaza .world-building-art{opacity:.9}
.resident-chip{position:absolute;transform:translate(-50%,-96%);display:grid;justify-items:center;gap:1px;padding:2px 3px 1px;border:0;border-radius:10px;background:transparent;cursor:pointer;z-index:3;will-change:transform}
.resident-chip-figure{display:block;line-height:0;transition:transform .25s}
.resident-chip-name{font-size:8px;font-weight:750;letter-spacing:.1px;padding:0 4px;border-radius:6px;background:#0d1210cc;color:#dfe8dd;max-width:64px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:0;transform:translateY(-2px);transition:opacity .15s,transform .15s;pointer-events:none}
.resident-chip:hover .resident-chip-name,.resident-chip:focus-visible .resident-chip-name,.resident-chip.is-selected .resident-chip-name{opacity:1;transform:translateY(0)}
.resident-chip.is-selected .resident-chip-figure{filter:drop-shadow(0 0 6px var(--lime))}
.resident-chip:hover .resident-chip-figure,.resident-chip:focus-visible .resident-chip-figure{transform:translateY(-2px) scale(1.08)}
.resident-chip.is-deployed .resident-chip-figure{opacity:.55;filter:grayscale(.4)}
.world-overflow{margin:8px auto 0;max-width:560px;font-size:10.5px;line-height:1.5;color:var(--dim);text-align:center}
.world-panel{border:1px solid var(--line);border-radius:18px;background:#151a17;padding:16px;margin:14px 0}
.world-panel .section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px;flex-wrap:wrap}
.world-panel h2{font-size:16px;margin:0 0 4px;letter-spacing:-.2px}
.world-panel p{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}
.world-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.world-actions.tight{gap:6px;margin-top:8px}
.world-actions .button{min-height:44px}
.inline-field{display:grid;gap:5px;min-width:160px;flex:1 1 170px}
.inline-field span{font-size:10px;font-weight:750;color:#c7d2c9;text-transform:uppercase;letter-spacing:.05em}
.select-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:8px}
.select-grid.compact{grid-template-columns:repeat(auto-fill,minmax(126px,1fr))}
.select-chip{display:flex;align-items:center;gap:8px;min-height:48px;padding:6px 9px;border:1px solid var(--line);border-radius:12px;background:#101512;color:var(--text);cursor:pointer;text-align:left;min-width:0}
.select-chip.active{border-color:#526849;background:#222f24;box-shadow:inset 0 0 0 1px #526849}
.select-chip-figure{line-height:0;flex:none}
.select-chip-copy{min-width:0;display:grid}
.select-chip-copy strong{font-size:11.5px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.select-chip-copy small{font-size:9px;color:var(--dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.feed-list{display:grid;gap:10px;max-height:520px;overflow:auto;padding-right:2px}
.feed-row{display:flex;gap:9px;align-items:flex-start;border:1px solid #232c26;border-radius:12px;padding:9px 11px;background:#111612}
.feed-dot{width:8px;height:8px;margin-top:5px;border-radius:3px;background:var(--lime-dark);flex:none}
.feed-dot.kind-meeting{background:#8fb6ff}
.feed-dot.kind-drill,.feed-dot.kind-training{background:#ffc46b}
.feed-dot.kind-home,.feed-dot.kind-move{background:#9ee0c2}
.feed-dot.kind-chat{background:#c6a8ff}
.feed-dot.kind-certify{background:#ffd166}
.feed-copy{min-width:0}
.feed-copy p{margin:0;font-size:11.5px;line-height:1.5;color:#dfe7dc;overflow-wrap:anywhere}
.feed-copy small{display:block;margin-top:3px;font-size:9px;color:var(--dim);letter-spacing:.02em}
.resident-row{display:flex;flex-wrap:wrap;gap:10px}
.resident-inline{display:flex;align-items:center;gap:9px;min-height:56px;padding:7px 11px 7px 7px;border:1px solid var(--line);border-radius:14px;background:#101512;color:var(--text);cursor:pointer;text-align:left;min-width:0}
.resident-inline span{display:grid;min-width:0;font-size:12px;font-weight:700}
.resident-inline small{font-weight:500;font-size:9.5px;color:var(--dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:150px}
.resident-inline .figure{border-radius:10px;background:#182119;padding:2px}
.building-head{display:flex;gap:16px;align-items:center;margin:6px 0 16px;flex-wrap:wrap}
.building-hero{margin:0;width:170px;max-width:44%;flex:none;line-height:0;filter:drop-shadow(0 12px 18px rgba(0,0,0,.4))}
.building-hero svg{width:100%;height:auto}
.building-head-copy{min-width:200px;flex:1}
.building-head-copy h1{margin:6px 0 6px;font-size:clamp(24px,6vw,34px);letter-spacing:-1px}
.building-head-copy p{margin:0;font-size:12.5px;line-height:1.55;color:var(--muted)}
.building-columns{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.world-quick{display:flex;flex-wrap:wrap;gap:8px}
.resident-card{border:1px solid var(--line);border-radius:18px;background:linear-gradient(155deg,#1b211d,#151a17);padding:16px;margin-bottom:14px}
.resident-hero{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.resident-hero-figure{line-height:0;flex:none;filter:drop-shadow(0 8px 14px rgba(0,0,0,.4))}
.resident-hero-copy{min-width:190px;flex:1}
.resident-hero-copy h2{margin:5px 0 4px;font-size:22px;letter-spacing:-.6px}
.resident-hero-copy p{margin:0;font-size:11.5px;color:var(--muted)}
.encounter-card{border:1px solid #26302a;border-radius:12px;padding:11px 12px;background:#111612;margin-bottom:9px}
.encounter-card header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:12px}
.encounter-topic{margin:0 0 6px;font-size:10.5px;color:var(--dim);text-transform:uppercase;letter-spacing:.05em}
.encounter-line{margin:0 0 4px;font-size:11.5px;line-height:1.55;color:#dbe3d8}
.figure-pixel{display:block;filter:drop-shadow(0 3px 4px rgba(0,0,0,.45))}
.figure{display:block}
.appearance-preview{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:12px;border:1px dashed #37423a;border-radius:14px;background:#111612}
.appearance-preview .figure{border-radius:12px;background:#182119;padding:4px}
.appearance-copy{flex:1;min-width:150px;font-size:11px;line-height:1.5;color:var(--muted)}
.agent-card-top .resident-avatar,.agent-home-heading .resident-avatar{width:45px;height:45px;flex:none;border:1px solid #38443a;border-radius:15px;background:#252e27;display:grid;place-items:center;overflow:hidden}
.agent-home-heading{display:flex;align-items:center;gap:13px;margin:8px 0 18px;flex-wrap:wrap}
.agent-home-heading .resident-avatar{width:58px;height:58px;border-radius:18px}
.trainer-progress{margin:0 0 12px;font-size:11px;color:var(--muted)}
@media(max-width:720px){
  .building-columns{grid-template-columns:1fr}
  .building-hero{max-width:38%}
  .feed-list{max-height:none}
}
@media(max-width:650px){
  .world-stage{border-radius:18px}
  .world-building{width:15%}
  .world-building-label{font-size:8.5px;padding:1px 6px;gap:3px}
  .resident-chip-name{font-size:7.5px;max-width:54px}
  .world-panel{padding:13px;border-radius:16px;margin:11px 0}
  .world-panel h2{font-size:15px}
  .select-grid,.select-grid.compact{grid-template-columns:repeat(auto-fill,minmax(132px,1fr))}
  .world-actions .button{flex:1 1 auto}
  .inline-field{flex:1 1 100%}
  .building-head{gap:12px}
  .building-hero{width:120px}
  .resident-hero-figure .figure{width:76px!important;height:auto!important}
}
@media(max-width:360px){
  .world-building{width:14%}
  .world-building-label{font-size:8px;padding:1px 5px}
  .resident-chip-name{display:none}
  .select-grid,.select-grid.compact{grid-template-columns:1fr 1fr}
  .resident-inline small{max-width:96px}
}
@media(prefers-reduced-motion:reduce){
  .resident-chip{transition:none}
}
/* The world map keeps its own terrain in the light theme and dims the ground
   so the slate buildings and lime windows still read. */
body[data-theme=light] .world-stage{background:#e7eee2;border-color:#cfdac8;box-shadow:inset 0 0 50px #b9c9b055}
body[data-theme=light] .world-ground{opacity:.4}
body[data-theme=light] .world-building-label{background:#ffffffdd;border-color:#cfdac8;color:#1b261d}
body[data-theme=light] .resident-chip-name{background:#ffffffdd;color:#1b261d}
body[data-theme=light] .world-panel,body[data-theme=light] .resident-card{background:#ffffff;border-color:#dde5d8}
body[data-theme=light] .feed-row,body[data-theme=light] .encounter-card{background:#f7faf4;border-color:#e0e8da}
body[data-theme=light] .feed-copy p,body[data-theme=light] .encounter-line{color:#1d2a20}
body[data-theme=light] .select-chip,body[data-theme=light] .resident-inline{background:#f7faf4;border-color:#dde5d8;color:#1b261d}
body[data-theme=light] .select-chip.active{background:#e9f2e2;border-color:#7fa46d}
body[data-theme=light] .agent-card-top .resident-avatar,body[data-theme=light] .agent-home-heading .resident-avatar{background:#eef3e8;border-color:#cbd8c2}
body[data-theme=light] .appearance-preview{background:#f7faf4;border-color:#cfdac8}

/* Generator and resident card */
.head-actions{display:flex;gap:8px;flex-wrap:wrap}
.proposal-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px;margin-bottom:12px}
.contact-card{border:1px solid #3d5240;border-radius:18px;background:linear-gradient(155deg,#1d2a20,#151b17);padding:16px;margin-bottom:14px}
.contact-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.contact-figure{line-height:0;flex:none;border-radius:12px;background:#182119;padding:4px}
.contact-title{flex:1;min-width:150px}
.contact-title h2{margin:3px 0 2px;font-size:21px;letter-spacing:-.5px}
.contact-title p{margin:0;font-size:11px;color:var(--muted)}
.contact-actions{display:flex;gap:6px;flex-wrap:wrap}
.contact-actions .button{min-height:40px}
.contact-facts{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px;margin:0 0 12px}
.contact-facts div{min-width:0}
.contact-facts dt{font-size:9px;text-transform:uppercase;letter-spacing:.06em;color:var(--dim)}
.contact-facts dd{margin:1px 0 0;font-size:11.5px;overflow-wrap:anywhere;color:#dfe7dc}
.contact-skills h3{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--dim);margin:0 0 6px}
.contact-skills ul{list-style:none;margin:0;padding:0;display:grid;gap:5px}
.contact-skills li{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11.5px;border:1px solid #26302a;border-radius:9px;padding:6px 9px;background:#111612;overflow-wrap:anywhere}
body[data-theme=light] .contact-card{background:#ffffff;border-color:#cfdac8}
body[data-theme=light] .contact-facts dd,body[data-theme=light] .contact-skills li{color:#1d2a20}
body[data-theme=light] .contact-skills li{background:#f7faf4;border-color:#e0e8da}
@media(max-width:650px){
  .head-actions{width:100%}
  .head-actions .button{flex:1}
  .proposal-grid{grid-template-columns:1fr}
}

/* Light theme: the pills, inputs and the floating bar were still painted with
   the dark palette, which left dark-on-dark text. Fixed here for every screen. */
body[data-theme=light] .stat-pill{background:#eef2ea;border-color:#d6ded2;color:#57635a}
body[data-theme=light] .stat-pill strong{color:#18211a}
body[data-theme=light] .text-input{background:#ffffff;border-color:#d6ded2;color:#18211a}
body[data-theme=light] .text-input::placeholder{color:#7b877d}
body[data-theme=light] .filter-chip{background:#ffffff;border-color:#d6ded2;color:#4a574d}
body[data-theme=light] .filter-chip.active{background:#e9f2e2;border-color:#7fa46d;color:#31610c}
body[data-theme=light] .bottom-nav{background:#ffffffef;border-color:#d6ded2;box-shadow:0 12px 34px #0000001f}
body[data-theme=light] .bottom-nav button{color:#57635a}
body[data-theme=light] .bottom-nav button.active{background:#e9f2e2;color:#31610c}
body[data-theme=light] .badge{background:#f1f5ee;border-color:#dde5d8;color:#3f4d43}
body[data-theme=light] .badge.status-living{color:#31610c;border-color:#a9c79a}
body[data-theme=light] .notice{background:#f0f6ea;border-color:#c2d8b6;color:#2c4526}
body[data-theme=light] .notice.error{background:#fdeceb;border-color:#e3b4b0;color:#8d231c}
body[data-theme=light] .backup-box,body[data-theme=light] .conversation-sidebar,body[data-theme=light] .chat-panel,body[data-theme=light] .empty-state{background:#ffffff;border-color:#dde5d8}
body[data-theme=light] .message-bubble{background:#f4f8f1;border-color:#dde5d8;color:#18211a}
body[data-theme=light] .message.user .message-bubble{background:#e9f2e2;border-color:#bcd3ae}
body[data-theme=light] .feed-copy p,body[data-theme=light] .contact-facts dd{color:#1d2a20}
body[data-theme=light] .contact-skills li{color:#1d2a20}
body[data-theme=light] .toast{background:#ffffff;border-color:#7fa46d;color:#1d2a20;box-shadow:0 10px 30px #00000024}

/* The world fills the phone: the map is height-driven, so the whole village is
   visible above the bar and nothing important is cropped. */
#app:has(.world-screen){width:min(100% - 14px, 760px);padding:8px 0 6px}
.world-screen{display:flex;flex-direction:column;gap:8px;min-height:calc(100dvh - 150px)}
.world-strip{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;border:1px solid var(--line);border-radius:14px;background:linear-gradient(155deg,#1a2a1e,#141a16);padding:9px 12px}
.world-strip-copy{min-width:150px;flex:1}
.world-strip-copy p{margin:2px 0 0;font-size:10px;line-height:1.35;color:var(--muted)}
.world-map-holder{flex:1 1 auto;min-height:0;display:flex;justify-content:center;align-items:stretch}
.world-screen .world-stage{height:100%;width:auto;max-width:100%;max-height:none;margin:0}
.world-screen .world-clock{flex-wrap:wrap;gap:8px}
.world-screen .world-clock .button{min-height:36px;padding:0 11px;font-size:11px}
.world-screen .world-stats{margin:0;gap:6px}
.world-screen .world-stats .stat-pill{font-size:10px;padding:5px 9px}
.world-screen .world-panel{padding:12px;margin:8px 0;border-radius:14px}
.world-screen .world-clock{margin:0}
.world-clock-face{font-size:17px}
body[data-theme=light] .world-strip{background:#ffffff;border-color:#d6ded2}

/* The world is the whole screen. The top bar steps aside, the clock and the
   action bar float over the map, and the map keeps its full height. */
body[data-screen=world] .topbar,body[data-screen=building] .topbar{display:none}
body[data-screen=world] #app,body[data-screen=building] #app{width:100%;max-width:none;padding:0}
/* NEXT-8 Item 2: the fixed bottom nav is ~64px tall, so the map and a
   building keep the same room beneath their last card: nothing hides under it. */
body[data-screen=world],body[data-screen=building]{padding-bottom:calc(78px + env(safe-area-inset-bottom))}
#app:has(.world-screen),body[data-screen=building] #app{padding-bottom:calc(78px + env(safe-area-inset-bottom))}
body[data-screen=world] .bottom-nav{background:#0d120ee6}
.world-screen{position:relative;display:block;height:100dvh;min-height:0;padding:0}
.world-map-holder{position:absolute;inset:0;display:flex;justify-content:center;align-items:center;padding:4px 4px 122px}
.world-screen .world-stage{height:100%;width:auto;max-width:100%;max-height:100%;border-radius:18px}
.world-screen .world-stats{position:absolute;left:8px;right:8px;bottom:calc(126px + env(safe-area-inset-bottom));margin:0;padding:0;gap:5px;justify-content:center;pointer-events:none}
.world-screen .world-stats .stat-pill{font-size:9.5px;padding:4px 8px;background:#0e1410cc;backdrop-filter:blur(6px)}
.world-screen .world-clock{position:absolute;top:8px;left:8px;right:8px;z-index:6;display:flex;flex-wrap:wrap;align-items:center;gap:6px;background:#0e1410d9;backdrop-filter:blur(8px);border-color:#2c3a30}
.world-screen .world-overflow{display:none}
.world-screen .world-card{position:absolute;left:8px;right:8px;bottom:calc(84px + env(safe-area-inset-bottom));z-index:9;margin:0;max-height:min(65dvh, 560px);overflow-y:auto;overscroll-behavior:contain;background:#141b16f2;backdrop-filter:blur(10px)}
.world-screen .world-panel{display:none}
.world-actions-bar{position:absolute;left:8px;right:8px;bottom:calc(78px + env(safe-area-inset-bottom));z-index:5;display:flex;gap:6px;overflow-x:auto;padding:2px;scrollbar-width:none}
.world-actions-bar::-webkit-scrollbar{display:none}
.world-actions-bar .button{flex:none;min-height:38px;padding:0 11px;font-size:11px;background:#101612dd;backdrop-filter:blur(6px)}
.world-actions-bar .button-primary{background:var(--lime)}
body[data-theme=light] .world-screen .world-clock,body[data-theme=light] .world-actions-bar .button,body[data-theme=light] .world-screen .world-card{background:#ffffffed;border-color:#d6ded2;color:#18211a}
body[data-theme=light] .world-screen .world-stats .stat-pill{background:#ffffffcc}

/* The clock bar: the label shrinks, the buttons do not stretch — but the bar
   wraps rather than scrolling sideways now that the view switcher rides in it. */
.world-screen .world-clock{flex-wrap:wrap}
.world-screen .world-clock-copy{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.world-screen .world-clock .button{flex:none}

/* Home: everything that is not the world, in categories. Each row is a full-width
   card with the name on its own line and the explanation under it. */
.more-grid{display:grid;gap:9px}
.more-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:58px;padding:11px 14px;border:1px solid var(--line);border-radius:14px;background:#111612;color:var(--text);text-align:left;cursor:pointer;width:100%}
.more-row > span{display:flex;flex-direction:column;gap:3px;min-width:0;align-items:flex-start}
.more-row strong{font-size:13.5px;line-height:1.2;display:block}
.more-row small{font-size:10.5px;line-height:1.45;color:var(--dim);display:block;white-space:normal}
.more-row:hover{background:#1a231c;border-color:#4b6146}
.more-arrow{color:var(--dim);font-size:18px;flex:none}
.world-clock{display:flex;align-items:center;gap:9px;flex-wrap:wrap;justify-content:space-between;border:1px solid var(--line);border-radius:14px;background:#121713;padding:9px 12px;margin:0 0 10px}
.world-clock-face{font-variant-numeric:tabular-nums;font-weight:750;font-size:17px;letter-spacing:.4px;color:var(--lime)}
.world-clock-copy{font-size:10.5px;color:var(--dim);flex:1;min-width:90px}
.world-card{border:1px solid #3d5240;border-radius:16px;background:linear-gradient(155deg,#1d2a20,#151b17);padding:13px;margin:12px 0}
.world-card-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.world-card-head h2{margin:3px 0 2px;font-size:19px;letter-spacing:-.4px}
.world-card-head p{margin:0;font-size:11px;color:var(--muted)}
body[data-theme=light] .more-row{background:#ffffff;border-color:#dde5d8;color:#18211a}
body[data-theme=light] .more-row:hover{background:#f2f7ec}
body[data-theme=light] .more-row small{color:#6b7870}
body[data-theme=light] .world-card{background:#ffffff;border-color:#d6ded2}

/* A resident who is walking gets a small bounce, and one who is working a small
   sway, so the map moves without anything being claimed. Only decoration. */
.resident-chip .figure.is-walking{animation:residentStep 1.8s ease-in-out infinite}
.resident-chip .figure.figure-working{animation:residentWork 2.4s ease-in-out infinite}
.resident-chip .figure{transform-origin:50% 100%}
@keyframes residentStep{0%,100%{transform:translateY(0) rotate(-1.5deg)}50%{transform:translateY(-6%) rotate(1.5deg)}}
@keyframes residentWork{0%,100%{transform:rotate(-2deg)}50%{transform:rotate(2deg)}}
.resident-chip .name{opacity:0;transition:opacity .15s}
.resident-chip:hover .name,.resident-chip:focus-visible .name,.resident-chip[data-focus=true] .name{opacity:1}
@media(prefers-reduced-motion:reduce){.resident-chip .figure.is-walking,.resident-chip .figure.figure-working{animation:none}}

/* The walk is drawn frame by frame: a resident moves along the lane, so no chip
   glides from one spot to another and nothing stands still waiting for an hour. */
.resident-chip.is-walking{z-index:4}
.resident-chip.is-inside{opacity:.5}
.resident-chip.is-inside .resident-chip-figure{filter:saturate(.7) brightness(.9)}
.resident-chip[data-facing=left].is-walking::after{left:auto;right:-9px;transform:scaleX(-1)}
@media(prefers-reduced-motion:reduce){.resident-chip.is-inside{opacity:.7}}
.pile-grid{display:grid;gap:10px}
.pile-card{display:flex;flex-direction:column;gap:9px;border:1px solid var(--line);border-radius:15px;background:#111713;padding:12px}
.pile-card header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.pile-card h3{margin:0;font-size:14px}
.pile-card small{display:block;font-size:10.5px;color:var(--dim)}
.pile-quiet{opacity:.7}
.pile-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.pile-list li{display:flex;flex-direction:column;gap:2px;border-left:2px solid var(--line);padding-left:8px}
.pile-list strong{font-size:11.5px}
.pile-list span{font-size:10px;color:var(--dim);line-height:1.4}
.pile-doing{border-left-color:#10b981}
.pile-todo{border-left-color:#f59e0b}
.pile-done{border-left-color:#8b5cf6}
body[data-theme=light] .pile-card{background:#ffffff;border-color:#dfe7d9}

/* A resident's card is the whole point of tapping them: it sits above the action
   bar, scrolls on its own, and never hides what it says. */
.world-screen .world-card{padding-bottom:14px;box-shadow:0 18px 40px #000a}
.world-card-head{align-items:flex-start}
.world-card-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:10px}
.world-card-actions .button{min-height:40px;padding:0 12px;font-size:11.5px}
.contact-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0 0}
.contact-facts dt{font-size:9.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--dim)}
.contact-facts dd{margin:2px 0 0;font-size:13px;overflow-wrap:anywhere}
.contact-facts div{min-width:0}
body[data-theme=light] .world-screen .world-card{background:#ffffff;border-color:#d6ded2}

/* The instructions and the jobs desk: searchable cards, each with the card it
   names, stacked on one column at every width. */
.manual-search{display:flex;gap:8px;align-items:center;margin:0 0 10px}
.manual-search .text-input{flex:1;min-width:0}
.manual-grid,.job-grid,.job-list{display:grid;gap:10px}
.manual-card,.job-card,.job-row{border:1px solid var(--line);border-radius:15px;background:#111713;padding:13px;display:grid;gap:8px}
.manual-card header,.job-card header,.job-row header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.manual-card h2,.job-card h3,.job-row h3{margin:0;font-size:15px;letter-spacing:-.3px}
.job-card small,.job-row small{display:block;font-size:10.5px;color:var(--dim);line-height:1.45}
.manual-card ul{margin:0;padding-left:18px;display:grid;gap:5px}
.manual-card li{font-size:12px;line-height:1.5;color:var(--muted)}
.job-card ul{margin:0}
body[data-theme=light] .manual-card,body[data-theme=light] .job-card,body[data-theme=light] .job-row{background:#ffffff;border-color:#dfe7d9}
@media(max-width:390px){.manual-card header,.job-card header{flex-direction:column;align-items:stretch}}

/* The board and the cards: full-width rows, one column on a phone, two on a
   laptop, with the level band and the outcome always visible. */
.board-list{display:grid;gap:10px}
.board-job,.board-task{display:grid;gap:8px;border:1px solid var(--line);border-radius:15px;background:#111713;padding:13px}
.board-job header,.board-task header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.board-job h3,.board-task h3{margin:0;font-size:15px;letter-spacing:-.3px}
.board-job small,.board-task small{display:block;font-size:10.5px;color:var(--dim);line-height:1.45}
.board-job-done,.board-task-done{opacity:.65}
.board-job-claimed,.board-task-taken{border-color:#3c5037}
section.settings-card h2:has(+ p),section.settings-card .section-title{letter-spacing:-.4px}
body[data-theme=light] .board-job,body[data-theme=light] .board-task{background:#ffffff;border-color:#dfe7d9}
@media(max-width:390px){.board-job header,.board-task header{flex-direction:column;align-items:stretch}}

/* The civic desks and the tiers: one column, full-width cards, a tier badge. */
.civic-grid,.tier-list{display:grid;gap:10px}
.civic-card{border:1px solid var(--line);border-radius:15px;background:#111713;padding:13px;display:grid;gap:8px}
.civic-card header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.civic-card h3{margin:0;font-size:15px}
.civic-card small{display:block;font-size:10.5px;color:var(--dim);line-height:1.45}
.tier-row{display:flex;align-items:center;gap:11px;border:1px solid var(--line);border-radius:13px;background:#101612;padding:10px 12px}
.tier-badge{display:grid;place-items:center;width:34px;height:34px;border-radius:11px;background:#23302a;color:var(--lime);font-weight:800;font-size:12px;flex:none}
.tier-row strong{display:block;font-size:13px}
.tier-row small{display:block;font-size:10px;color:var(--dim)}
body[data-theme=light] .civic-card,body[data-theme=light] .tier-row{background:#ffffff;border-color:#dfe7d9}
body[data-theme=light] .tier-badge{background:#eef5e6;color:#3f5a2c}

/* A resident who is walking leaves three small dots behind them on the lane, and
   the figure steps as it goes. Decoration only: the diary keeps the words. */
.resident-chip.is-walking .resident-chip-figure{animation:chipStep .9s ease-in-out infinite}
.resident-chip.is-walking::after{content:"";position:absolute;left:-9px;bottom:2px;width:8px;height:2px;background-image:radial-gradient(circle, hsl(150 30% 46% / .8) 1px, transparent 1.4px);background-size:3px 2px;opacity:.9}
@keyframes chipStep{0%,100%{transform:translateY(0)}50%{transform:translateY(-4%)}}
@media(prefers-reduced-motion:reduce){.resident-chip.is-walking .resident-chip-figure{animation:none}}

/* The day, drawn as a strip: the current block is the only one lit, and the
   eight blocks always fit the card on one line. */
.day-strip{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:5px;margin-top:10px;width:100%}
.day-block{display:grid;gap:2px;place-items:center;border:1px solid var(--line);border-radius:9px;background:#0f1512;padding:6px 2px;min-width:0;text-align:center}
.day-block strong{font-size:10px;line-height:1.1;color:var(--dim);font-variant-numeric:tabular-nums}
.day-block small{font-size:8px;line-height:1.2;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;display:block}
.day-block.is-now{border-color:#7fc45e;background:#1d2a1f;box-shadow:0 0 0 1px #3d5a35 inset}
.day-block.is-now strong,.day-block.is-now small{color:var(--lime)}
body[data-theme=light] .day-block{background:#ffffff;border-color:#dfe7d9}
body[data-theme=light] .day-block strong,body[data-theme=light] .day-block small{color:#6b7870}
body[data-theme=light] .day-block.is-now{background:#eef5e6;border-color:#7fc45e}
body[data-theme=light] .day-block.is-now strong,body[data-theme=light] .day-block.is-now small{color:#3f5a2c}
@media(max-width:360px){.day-strip{gap:3px}.day-block{padding:5px 1px}.day-block small{font-size:7px}}

/* The hour tints the world: night is cooler and dimmer, dawn warm, day bright,
   dusk amber. Only the look of the map — nothing behind a resident changes. */
body[data-daypart=night] .world-screen .world-stage{filter:brightness(.72) saturate(.85) hue-rotate(-6deg)}
body[data-daypart=dawn] .world-screen .world-stage{filter:brightness(.9) saturate(1.05) sepia(.12)}
body[data-daypart=dusk] .world-screen .world-stage{filter:brightness(.92) saturate(1.1) sepia(.18)}
body[data-daypart=night] .world-screen .world-clock{border-color:#2b3a46}
body[data-daypart=night] .world-screen .world-clock-face{color:#9dbbff}

/* Premade looks: each is drawn with the same pixel figure the map uses, so the
   one pressed is exactly the resident that stands on the lane. A chosen look is
   ringed in the app's lime; nothing here is a claim about the resident's skill. */
.look-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(74px,1fr));gap:7px;margin:6px 0}
.look-chip{display:grid;justify-items:center;gap:3px;padding:6px 4px 5px;border:1px solid var(--line);border-radius:12px;background:#101612;color:var(--muted);cursor:pointer;font-size:9.5px;line-height:1.2;text-align:center;font-weight:700}
.look-chip:hover{background:#18211b;border-color:#4b6146;color:var(--text)}
.look-chip.active{border-color:var(--lime);box-shadow:inset 0 0 0 1px var(--lime);color:var(--text)}
.look-chip span{display:block;max-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-theme=light] .look-chip{background:#ffffff;border-color:#dde5d8;color:#4a554c}
body[data-theme=light] .look-chip.active{border-color:#4f7a2f;color:#18211a}

/* The two towers are slender on purpose: a narrow tower is tall without
   reaching across the map, so the School and the Fields keep their own corner
   under it and a resident who walks there is never behind a roof. */
.world-stage .world-building.pos-hub,.world-stage .world-building.pos-lodge{width:12%}
@media(max-width:360px){.world-stage .world-building.pos-hub,.world-stage .world-building.pos-lodge{width:11%}}

/* At 320 pixels the world's action bar is five buttons on one row: they keep
   their labels and step down instead of being cut off at the edge. */
@media(max-width:360px){.world-actions-bar{gap:4px}.world-actions-bar .button{padding:0 8px;font-size:10px;min-height:34px}}

/* The card's three contact actions wrap on a small phone instead of pushing
   the facts off the card; a dead resident's Chat is disabled and never opens. */
.contact-actions{flex-wrap:wrap}
@media(max-width:360px){.contact-actions{gap:5px}.contact-actions .button{flex:1 1 auto;min-width:44%}}

/* A resident's portrait card: the same pixel figure the map draws, framed at
   phone width, with the resident's palette and signature item named under it. */
.portrait-card{display:grid;justify-items:center;gap:6px;margin:10px 0;padding:12px;border:1px solid var(--line);border-radius:16px;background:#111713}
.portrait-frame{display:grid;place-items:center;padding:6px;border-radius:14px;background:radial-gradient(circle at 50% 35%,#1e2a20,#0d1310)}
.portrait-card figcaption{font-size:9.5px;letter-spacing:.3px;color:var(--dim)}
body[data-theme=light] .portrait-card{background:#ffffff;border-color:#dde5d8}
@media(max-width:360px){.portrait-card{padding:9px}.portrait-frame .figure{width:96px!important;height:auto!important}}

/* The Directory beside the Village: Cards / Map / Roster over one dataset. */
.view-switcher{display:inline-flex;gap:3px;padding:2px;border:1px solid #354139;border-radius:999px;background:#101613}
.view-chip{border:0;background:transparent;color:var(--muted);min-height:26px;padding:0 9px;border-radius:999px;font-size:10.5px;font-weight:750;cursor:pointer}
.view-chip.active{background:#29372a;color:var(--lime)}
.directory{margin-top:10px}
.directory-controls{display:grid;gap:7px;margin:0 0 10px}
.directory-filters summary{cursor:pointer;font-size:12px;font-weight:700;color:#c7d2c9;padding:4px 0}
.directory-filter-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:6px 0}
.directory-filter-grid .inline-field{display:grid;gap:3px}
.directory-filter-grid .inline-field span{font-size:10px;font-weight:700;color:#c7d2c9}
.directory-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.directory-card{min-width:0;border:1px solid var(--line);border-radius:15px;background:#161c18;overflow:hidden}
.directory-open{display:grid;gap:3px;width:100%;text-align:left;border:0;background:none;color:inherit;padding:12px;cursor:pointer;font:inherit}
.directory-name{font-size:14px;font-weight:750;overflow-wrap:anywhere}
.directory-role{font-size:11.5px;color:var(--muted);overflow-wrap:anywhere}
.directory-meta{font-size:10px;color:var(--dim);line-height:1.45;overflow-wrap:anywhere}
.directory-roster{border:1px solid var(--line);border-radius:15px;background:#141a16;overflow:hidden}
.roster-head{display:grid;grid-template-columns:minmax(84px,1.4fr) 1fr 1fr 0.9fr 0.7fr 0.5fr;gap:6px;align-items:center;margin:0;padding:8px 10px 3px;font-size:8.5px;font-weight:750;letter-spacing:.5px;text-transform:uppercase;color:var(--dim)}
.roster-row{display:grid;grid-template-columns:minmax(84px,1.4fr) 1fr 1fr 0.9fr 0.7fr 0.5fr;gap:6px;align-items:center;width:100%;text-align:left;border:0;border-bottom:1px solid #222a24;background:none;color:inherit;padding:8px 10px;cursor:pointer;font:inherit}
.roster-row:last-child{border-bottom:0}
.roster-row:hover{background:#1b231e}
.roster-name{font-size:11.5px;font-weight:750;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.roster-cell{font-size:9.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:360px){
  .directory-grid{grid-template-columns:1fr}
  .roster-head{display:none}
  .roster-row{grid-template-columns:1fr 1fr;gap:3px 10px}
  .roster-name{grid-column:1/-1;white-space:normal;overflow-wrap:anywhere}
  .roster-cell{white-space:normal;overflow-wrap:anywhere;overflow:visible}
  .roster-cell:before{content:attr(data-label) " ";color:var(--dim);font-size:8.5px;letter-spacing:.3px;text-transform:uppercase}
.section-edit-list{display:grid;gap:8px;margin:12px 0}
.section-edit{border:1px solid var(--line);border-radius:12px;background:#111713;padding:9px 11px}
.section-edit summary{display:flex;align-items:center;justify-content:space-between;gap:8px;cursor:pointer;list-style:none;font-size:12px}
.section-edit summary::-webkit-details-marker{display:none}
.section-edit summary strong{overflow-wrap:anywhere}
.section-edit[open] summary{margin-bottom:9px}
.section-edit .field{margin-bottom:8px}
  .directory-filter-grid{grid-template-columns:1fr}
}

/* The uniform card anatomy: Role · Goal · Backstory, then Produces · Knows · Rhythm. */
.anatomy{display:grid;gap:5px;margin:8px 0 4px;text-align:left}
.anatomy-head{margin:0;font-size:11px;line-height:1.5;color:var(--text);overflow-wrap:anywhere}
.anatomy-head strong{font-weight:750}
.anatomy-back{margin:0;font-size:10.5px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.anatomy-beats{margin:2px 0 0;display:grid;gap:4px}
.anatomy-beats div{display:grid;grid-template-columns:64px 1fr;gap:6px;align-items:baseline}
.anatomy-beats dt{font-size:9px;font-weight:750;letter-spacing:.6px;text-transform:uppercase;color:var(--lime)}
.anatomy-beats dd{margin:0;font-size:10.5px;line-height:1.5;color:#c7d2c9;overflow-wrap:anywhere}

/* One glyph per real state, on avatar heads. */
.status-glyphs{display:inline-flex;gap:3px;vertical-align:middle}
.status-glyph{font-size:12px;line-height:1;filter:saturate(.9)}
.glyph-open-slot{transform:translateY(-1px)}
.glyph-certified{filter:none}
.resident-avatar{position:relative}
.resident-avatar .status-glyphs{position:absolute;right:-4px;bottom:-2px}
.directory-figure{position:relative;display:inline-grid}
.directory-figure .status-glyphs{position:absolute;right:-5px;bottom:-2px}
.resident-inline{position:relative}
.resident-inline .status-glyphs{position:absolute;left:24px;top:-2px}

/* The character sheet on the card: bio, topics, adjectives, style. */
.character-sheet{margin:8px 0 2px;border:1px solid var(--line);border-radius:12px;background:#141a16;padding:0 10px}
.character-sheet summary{cursor:pointer;font-size:11px;font-weight:750;color:#c7d2c9;padding:8px 0}
.character-sheet p{margin:0 0 8px;font-size:10.5px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.character-sheet strong{color:#c7d2c9}

/* The review inbox and its Home badge. */
.inbox-nudge{margin:0 0 10px}
.inbox-row{display:grid;gap:8px;border:1px solid var(--line);border-radius:15px;background:#161c18;padding:12px;margin:0 0 9px}
.inbox-copy{display:grid;gap:4px;justify-items:start}
.inbox-copy p{margin:0;font-size:12.5px;line-height:1.5;color:var(--text);overflow-wrap:anywhere}
.inbox-copy small{color:var(--dim);font-size:9.5px}
.inbox-actions{display:flex;gap:6px;flex-wrap:wrap}

/* A speech bubble above a walking resident: short, from their real state. */
.resident-chip .chip-bubble{display:none;position:absolute;bottom:calc(100% + 4px);left:50%;transform:translateX(-50%);max-width:120px;padding:4px 7px;border:1px solid #3a4a3e;border-radius:9px;background:#101613ee;color:#dfe8dd;font-size:8.5px;line-height:1.35;white-space:normal;text-align:center;pointer-events:none;z-index:5}
.resident-chip.is-speaking .chip-bubble{display:block}
.resident-chip.is-speaking{z-index:6}

/* The Directory remembers where you were: the resident in focus stays marked. */
.directory-card.is-focused{border-color:#526849;box-shadow:0 0 0 1px #52684933}
.roster-row.is-focused{background:#222c24;box-shadow:inset 2px 0 0 var(--lime)}
.room-registry summary{cursor:pointer;list-style:none;font-size:12px;font-weight:750;color:#c7d2c9}
.room-registry summary::-webkit-details-marker{display:none}
.room-row{display:grid;gap:2px;margin-top:9px;padding-top:8px;border-top:1px solid #222a24}
.room-row strong{font-size:11px;color:var(--lime)}
.room-row p{margin:0;font-size:10.5px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}

.button-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.button-row .status-message{flex:1 1 100%;min-height:18px}
.settings-card{overflow:visible}
.field-hint,.notice,.status-message{overflow-wrap:anywhere;word-break:break-word}
.key-pool{display:grid;gap:8px;min-width:0}
.key-pool .pool-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;min-width:0}
.key-pool .pool-label{flex:1 1 160px;min-width:0}
.chat-status-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
@media(max-width:360px){.settings-card{padding:14px}.button-row{gap:6px}.button-row .button{flex:1 1 auto;min-width:44%}}

.board-columns{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:12px}
.board-column{min-width:0;border:1px solid var(--line);border-radius:12px;background:#111713;padding:9px}
.board-column h3{margin:0 0 8px;font-size:11px;letter-spacing:.4px;text-transform:uppercase;color:var(--dim)}
.board-column .board-job{margin:0 0 8px}
@media(max-width:650px){.board-columns{grid-template-columns:1fr}}

/* HABITAT NEXT: the memory panel, the resume line, the ledger and kindness. */
.mind-layer { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; white-space: pre-wrap; background: rgba(127,127,127,0.08); border-radius: 8px; padding: 8px; margin-top: 6px; max-height: 220px; overflow: auto; }
.resume-line { margin: 4px 0 0; font-size: 13px; opacity: 0.85; }
.kindness-line { opacity: 0.9; }
.identity-preview { border-left: 3px solid currentColor; }
.long-diff ul { max-height: 220px; overflow: auto; margin: 6px 0 0; padding-left: 18px; }

/* A-001 — light follows the village clock: the sky itself, per day-phase.
   Colours change on phase change only (the dataset flips with the clock),
   never per frame, and nothing animates — reduced motion is honoured by
   construction. */
.world-screen .world-stage::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; }
body[data-daypart=dawn] .world-screen .world-stage::before { background: linear-gradient(180deg, rgba(255,183,140,0.26), rgba(255,214,165,0.10) 45%, transparent 70%); }
body[data-daypart=day] .world-screen .world-stage::before { background: linear-gradient(180deg, rgba(140,190,255,0.12), transparent 60%); }
body[data-daypart=dusk] .world-screen .world-stage::before { background: linear-gradient(180deg, rgba(255,150,110,0.28), rgba(150,110,200,0.13) 55%, transparent 75%); }
body[data-daypart=night] .world-screen .world-stage::before { background: linear-gradient(180deg, rgba(20,40,80,0.40), rgba(10,20,50,0.18) 60%, transparent 85%); }

/* A-002 — lamps on at dusk and night: pure radial-gradient halos, no element,
   no animation, toggled by the same day-phase class. */
body[data-daypart=dusk] .world-screen .world-stage::after,
body[data-daypart=night] .world-screen .world-stage::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 55%;
  pointer-events: none; z-index: 1;
  background:
    radial-gradient(circle 36px at 12% 97%, rgba(255,196,110,0.32), transparent 70%),
    radial-gradient(circle 30px at 34% 99%, rgba(255,196,110,0.26), transparent 70%),
    radial-gradient(circle 36px at 58% 97%, rgba(255,206,130,0.30), transparent 70%),
    radial-gradient(circle 30px at 82% 99%, rgba(255,196,110,0.24), transparent 70%);
}

/* A-006 — the press answer: one eased 120 ms answer on everything pressable. */
.button:active, .filter-chip:active, .more-row:active, .agent-card:active { transform: scale(0.97); transition: transform 120ms ease; }
@media (prefers-reduced-motion: reduce) {
  .button:active, .filter-chip:active, .more-row:active, .agent-card:active { transform: none; transition: none; }
}

/* NEXT-8 Item 1: the guest's journey, as a warm timeline, never a table. */
.journey-list { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.journey-step { position: relative; padding: 0 0 18px 18px; border-left: 2px solid var(--border); }
.journey-step:last-child { border-left-color: transparent; padding-bottom: 0; }
.journey-dot { position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); }
.journey-now .journey-dot { border-color: #3b82f6; background: #3b82f6; }
.journey-step strong { display: block; font-size: 15px; }
.journey-step small { display: block; color: var(--text-secondary); margin-top: 2px; }

/* NEXT-8 Item 2: the team table scrolls inside its own card on a narrow
   phone, so the page itself never scrolls sideways at 393px or 320px. */
.team-board-table { display: block; width: 100%; max-width: 100%; overflow-x: auto; table-layout: fixed; border-collapse: collapse; }
.team-board-table thead, .team-board-table tbody { display: table; width: 100%; table-layout: fixed; }
.team-board-table th, .team-board-table td { overflow-wrap: anywhere; }
@media (max-width: 400px) { .team-board-table th, .team-board-table td { padding: 6px 4px; font-size: 12px; } }

/* NEXT-8: the ready pool reads as a rack of small cards, one press each. */
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pool-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.pool-card header strong { display: block; font-size: 15px; }
.pool-card header small { display: block; color: var(--text-secondary); font-size: 12px; }
.pool-card code { font-size: 11px; overflow-wrap: anywhere; }
.pool-card.is-taken { opacity: 0.6; }
@media (max-width: 360px) { .pool-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
