:root {
  --ink: #1b1446;
  --indigo: #2a22c9;
  --soft: #6b65a8;
  --line: rgba(42, 34, 201, 0.18);
  --pill: rgba(255, 255, 255, 0.94);
  --pink: #ff5fc8;
  --shadow: 0 8px 24px rgba(27, 20, 70, 0.16);
  --card: #f8f7ff;
  --card2: #f1efff;
  --line2: #ece9ff;
  --onbg: #fff;
  --sheet: rgba(255, 255, 255, 0.96);
  --modal: #fff;
  --primary: #1b1446;
  --primary-h: #2a22c9;
  --font: "Nunito", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; height: 100%; overflow: hidden; background: #d6ebff; font-family: var(--font); font-size: 1rem; line-height: 1.4; color: var(--ink); }
html { height: 100%; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; }
.av { width: 22px; height: 22px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 40%, #1b1446 0 9%, transparent 10%), radial-gradient(circle at 65% 40%, #1b1446 0 9%, transparent 10%), #ffd0f0; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--pink); }
.av.big { width: 36px; height: 36px; }

/* ---------- boot ---------- */
#boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #2a22c9 radial-gradient(rgba(255,255,255,.22) 1.5px, transparent 1.8px) 0 0/9px 9px; transition: opacity .5s ease; color: #fff; }
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { width: min(300px, calc(100vw - 32px)); text-align: center; }
.boot-nibble { position: relative; width: 92px; height: 78px; margin: 0 auto 14px; background: #ffd0f0; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; animation: hop .9s ease-in-out infinite; box-shadow: inset -10px -8px 0 rgba(255, 95, 200, .35); }
.boot-nibble .eye { position: absolute; top: 28px; width: 11px; height: 15px; background: var(--ink); border-radius: 50%; }
.boot-nibble .eye.l { left: 26px; } .boot-nibble .eye.r { right: 26px; }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1.04, .96); } 50% { transform: translateY(-16px) scale(.97, 1.03); } }
.boot-title { font-size: 1.875rem; font-weight: 800; }
.boot-progress { height: 8px; margin: 14px 0 8px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; }
#boot-bar { height: 100%; width: 5%; background: #fff; border-radius: 99px; transition: width .3s ease; }
#boot-log { opacity: .85; font-weight: 600; }

/* ---------- top needs pill ---------- */
.needs-pill {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--pill); border-radius: 24px; padding: 2px 10px 2px; box-shadow: var(--shadow); backdrop-filter: blur(8px); white-space: nowrap;
}
.mood { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; border: 0; background: transparent; font-weight: 800; font-size: 1rem; cursor: pointer; color: inherit; }
.mood-more { opacity: .6; transition: transform .2s; }
.needs-pill.open .mood-more { transform: rotate(180deg); }
.need-bars { display: none; gap: 16px; align-items: center; padding: 0 8px 10px; }
.needs-pill.open .need-bars, body.bars-always .need-bars { display: flex; }
body.bars-always .mood { display: none; }
body.bars-always .needs-pill { padding-top: 10px; }
.need { display: grid; grid-template-columns: auto 52px; grid-template-rows: auto auto; column-gap: 6px; align-items: center; }
.need .dot { grid-row: 1; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.need .name { grid-row: 1; font-size: 0.75rem; font-weight: 700; color: var(--soft); }
.need .bar { grid-column: 1 / -1; height: 5px; margin-top: 4px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.need .fill { height: 100%; background: var(--c); border-radius: 99px; transition: width .8s ease; }
.need .val { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.need.low .name { color: #e0466e; }
.need.low .fill { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .4; } }

/* ---------- corners ---------- */
.corner-btn {
  position: fixed; top: 14px; left: 14px; z-index: 8; display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--pill); border-radius: 99px; min-height: 44px; padding: 6px 14px 6px 8px; font-weight: 800; box-shadow: var(--shadow); font-size: 1rem;
}
.corner-btn:hover { background: #fff; }
.world-chips { position: fixed; top: 14px; right: 14px; z-index: 8; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 46vw; }
.chip { background: var(--pill); border-radius: 99px; padding: 6px 12px; font-weight: 700; font-size: 0.7812rem; box-shadow: var(--shadow); white-space: nowrap; }
.chip:empty { display: none; }
.chip.brain { color: var(--indigo); }

.bottom-left { position: fixed; left: 14px; bottom: 14px; z-index: 11; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
#minimap { width: 120px; height: 120px; border-radius: 50%; background: #fff; box-shadow: var(--shadow), 0 0 0 4px #fff; cursor: pointer; }
.actions-btn { border: 0; cursor: pointer; background: var(--primary); color: #fff; font-weight: 800; border-radius: 99px; min-height: 44px; padding: 8px 18px; font-size: 1rem; box-shadow: var(--shadow); }
.actions-btn .beta { font-size: 0.75rem; background: var(--pink); border-radius: 99px; padding: 1px 6px; margin-left: 4px; }
.actions-btn.on, .actions-btn:hover { background: var(--primary-h); }
.actions-menu { list-style: none; margin: 0; padding: 6px; position: absolute; bottom: 44px; left: 0; min-width: 230px; background: var(--modal); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow); }
.actions-menu li { border-radius: 12px; }
.actions-menu li > button, .actions-menu li > a { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; font: inherit; font-weight: 700; text-align: left; cursor: pointer; color: inherit; text-decoration: none; }
.actions-menu li > button:hover, .actions-menu li > a:hover { background: var(--card2); }
.actions-menu li.sep { padding: 0; margin: 4px 8px; height: 1px; background: var(--line2); pointer-events: none; }

.status-pill {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 10px;
  background: var(--pill); border-radius: 99px; padding: 8px 18px 8px 8px; box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100vw - 340px); overflow: hidden; text-overflow: ellipsis;
}
#status-text { overflow: hidden; text-overflow: ellipsis; color: var(--soft); font-weight: 600; }
#status-text b { color: var(--pink); }

.toasts { position: fixed; right: 14px; bottom: 14px; z-index: 7; display: flex; flex-direction: column-reverse; gap: 8px; width: 290px; pointer-events: none; }
.toast { display: flex; gap: 8px; background: var(--pill); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 0.8125rem; line-height: 1.35; animation: in .35s ease; transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- speech bubble ---------- */
.bubble { position: fixed; z-index: 5; transform: translate(-50%, -100%); background: #fff; padding: 7px 14px; max-width: 220px; border-radius: 16px; font-weight: 700; pointer-events: none; box-shadow: var(--shadow); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 64px; left: 14px; bottom: 190px; width: 380px; max-width: calc(100vw - 28px); z-index: 9; display: flex; flex-direction: column;
  background: var(--sheet); color: var(--ink); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; animation: slide .25s ease;
}
@keyframes slide { from { transform: translateX(-20px); opacity: 0; } }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 8px 16px; }
.drawer .who { display: flex; gap: 10px; align-items: center; }
.drawer .who small { display: block; color: var(--soft); font-weight: 600; max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--card2); font-size: 1.125rem; font-weight: 800; cursor: pointer; line-height: 1; }
.x:hover { background: #e4e0ff; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 12px 8px; border-bottom: 1px solid var(--card2); }
.tab { min-height: 44px; padding: 0 8px; border: 0; background: transparent; border-radius: 99px; font: inherit; font-weight: 800; color: var(--soft); cursor: pointer; font-size: 0.9375rem; }
.subnav { margin: 8px 12px 0; flex: none; }
.grab { display: none; width: 100%; height: 26px; padding: 0; border: 0; background: transparent; touch-action: none; cursor: grab; flex: none; }
.grab i { display: block; width: 44px; height: 5px; margin: 10px auto 0; border-radius: 99px; background: #c9c3ff; }
.tab.active { background: var(--primary); color: #fff; }
.panel { flex: 1; overflow-y: auto; padding: 10px 14px 16px; }
.panel h4 { margin: 14px 0 6px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .8px; color: var(--soft); }
.diary .entry { padding: 10px 2px 10px 14px; border-left: 3px solid var(--line2); margin-left: 4px; position: relative; }
.diary .entry::before { content: ""; position: absolute; left: -6px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: #c9c3ff; }
.diary .entry.kind-thought::before { background: #ffd84d; }
.diary .entry.kind-gift::before, .diary .entry.kind-reply::before { background: var(--pink); }
.diary .entry.kind-music::before, .diary .entry.kind-art::before { background: #3fcf8e; }
.diary .meta { font-size: 0.75rem; color: var(--soft); display: flex; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.diary .kind { color: var(--ink); }
.diary p { margin: 3px 0 0; line-height: 1.5; }
.diary p.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.diary .more { margin-top: 2px; min-height: 32px; padding: 0 8px; border: 0; background: transparent; color: var(--indigo); font: inherit; font-weight: 800; font-size: 0.8125rem; cursor: pointer; }
.diary a { color: var(--indigo); font-weight: 700; }

.seg { display: flex; gap: 4px; background: var(--card2); border-radius: 99px; padding: 4px; margin-bottom: 10px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: 99px; padding: 6px 10px; font: inherit; font-weight: 800; font-size: 0.9375rem; color: var(--soft); cursor: pointer; }
.seg.mini { margin: 0; flex: none; }
.seg.mini button { min-height: 36px; padding: 4px 14px; flex: none; }
.seg button.on { background: var(--onbg); color: var(--ink); box-shadow: 0 2px 6px rgba(27,20,70,.12); }
.creations { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.creation { background: var(--card); border-radius: 16px; padding: 8px; }
.creation canvas { width: 100%; display: block; border-radius: 10px; background: #fff; }
.creation .ctitle { font-weight: 800; margin-top: 6px; }
.creation .cmeta { font-size: 0.75rem; color: var(--soft); }
.creation pre { font-size: 0.75rem; max-height: 64px; overflow: hidden; background: var(--ink); color: #b6ffd9; padding: 6px; margin: 6px 0; border-radius: 10px; white-space: pre-wrap; }
.creation .row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.creation .row a { text-decoration: none; font-weight: 800; color: var(--indigo); }
.heart { border: 0; background: #fff; border-radius: 99px; min-height: 36px; padding: 4px 14px; font-weight: 800; font-size: 0.75rem; cursor: pointer; color: #e0247f; box-shadow: 0 2px 6px rgba(27,20,70,.12); }
.heart.given, .heart:disabled { background: #ffd0f0; box-shadow: none; cursor: default; }
.empty { color: var(--soft); }
.summary { line-height: 1.45; margin: 4px 0 0; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { background: var(--card2); border-radius: 99px; padding: 3px 10px; font-weight: 700; font-size: 0.7812rem; }
.empty-tag { background: transparent; border: 1px dashed #c9c3ff; color: var(--soft); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 10px; margin-bottom: 6px; background: var(--card); border-radius: 12px; display: flex; justify-content: space-between; gap: 8px; }
.list li.empty { color: var(--soft); }
.stats { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.stats td { padding: 6px 10px; background: var(--card); }
.stats td:first-child { border-radius: 10px 0 0 10px; color: var(--soft); font-weight: 700; }
.stats td:last-child { text-align: right; font-weight: 800; border-radius: 0 10px 10px 0; }

/* ---------- modals ---------- */
.modal { position: fixed; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 340px; max-width: calc(100vw - 24px); background: var(--modal); color: var(--ink); border-radius: 22px; box-shadow: 0 20px 60px rgba(27, 20, 70, .3); padding: 14px 16px 16px; animation: pop .2s ease; }
@keyframes pop { from { transform: translate(-50%, -46%); opacity: 0; } }
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 1.0rem; }
.form label { display: block; margin-bottom: 10px; font-weight: 700; color: var(--soft); font-size: 0.875rem; }
.form input, .form textarea, .form select { display: block; width: 100%; min-height: 44px; margin-top: 4px; font-family: inherit; font-size: 1rem; color: var(--ink); padding: 9px 12px; background: var(--card); border: 2px solid transparent; border-radius: 12px; outline: none; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--indigo); background: var(--onbg); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#note-msg, #gift-msg { font-size: 0.8125rem; color: var(--soft); font-weight: 600; }
.hint { color: var(--soft); font-size: 0.8125rem; line-height: 1.45; margin: 10px 0 0; }
.btn { border: 0; background: var(--card2); color: var(--ink); border-radius: 99px; min-height: 44px; padding: 8px 18px; font: inherit; font-weight: 800; cursor: pointer; }
.btn:hover { background: #e4e0ff; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-h); }
.btn.mini { min-height: 36px; padding: 4px 14px; font-size: 0.8125rem; }
.gift-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.gift-opt { margin: 0 !important; cursor: pointer; text-align: center; background: var(--card); border: 2px solid transparent; border-radius: 14px; padding: 8px 4px; display: flex !important; flex-direction: column; align-items: center; color: var(--ink) !important; }
.gift-opt input { display: none !important; }
.gift-opt span { font-size: 1.625rem; }
.gift-opt small { font-size: 0.75rem; color: var(--soft); }
.gift-opt:has(input:checked) { border-color: var(--indigo); background: var(--onbg); }
.radio { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 10px; border-radius: 16px; background: var(--ink); color: #b6ffd9; font-weight: 800; min-height: 48px; }
.radio .eq { display: flex; gap: 3px; align-items: flex-end; height: 18px; }
.radio .eq i { width: 4px; height: 4px; background: var(--pink); border-radius: 2px; }
.radio.on .eq i { animation: eq .5s ease-in-out infinite alternate; }
.radio.on .eq i:nth-child(2) { animation-delay: -.2s; } .radio.on .eq i:nth-child(3) { animation-delay: -.4s; } .radio.on .eq i:nth-child(4) { animation-delay: -.1s; }
@keyframes eq { to { height: 18px; } }

/* ---------- night ---------- */
body[data-phase="night"] { --pill: rgba(27, 20, 70, 0.88); }
body[data-phase="night"] .needs-pill, body[data-phase="night"] .chip, body[data-phase="night"] .corner-btn, body[data-phase="night"] .status-pill, body[data-phase="night"] .toast { color: #fff; }
body[data-phase="night"] .need .name, body[data-phase="night"] #status-text { color: #c9c3ff; }
body[data-phase="night"] .need .bar { background: rgba(255,255,255,.15); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .needs-pill { top: 58px; max-width: calc(100vw - 16px); }
  .need-bars { gap: 8px; }
  .need { grid-template-columns: auto 38px; }
  .world-chips { max-width: 60vw; }
  #tray-phase, #clock, .chip.brain { display: none; }
  .corner-btn span:last-child { display: none; }
  .corner-btn { padding: 6px; width: 44px; justify-content: center; }
  #minimap { display: none; }
  .status-pill { bottom: 66px; max-width: calc(100vw - 24px); left: 50%; }
  .toasts { display: flex; left: 8px; right: 8px; bottom: 116px; width: auto; flex-direction: column; }
  .toast:nth-child(n+2) { display: none; }
  .bottom-left { bottom: 12px; }
  /* the diary becomes a bottom sheet: half height, or tall when you pull it up. The town stays visible and usable above it. */
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 55vh; height: 55dvh; border-radius: 22px 22px 0 0; animation: sheet .22s cubic-bezier(.2, .8, .2, 1); }
  .drawer.full { height: 92vh; height: 92dvh; }
  .grab { display: block; }
  body:has(.drawer:not(.hidden)) .bottom-left, body:has(.drawer:not(.hidden)) .status-pill, body:has(.drawer:not(.hidden)) .toasts, body:has(.drawer:not(.hidden)) .away { display: none; }
  .away { bottom: 116px; }
}
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } }

/* wishes + web history */
.wishes { display: grid; gap: 10px; }
.wish { background: var(--card); border-radius: 16px; padding: 10px 12px; }
.wish .wtop { display: flex; gap: 10px; align-items: center; }
.wish .wemoji { font-size: 1.625rem; }
.wish b { display: block; }
.wish small { color: var(--soft); font-size: 0.75rem; }
.wish p { margin: 6px 0 4px; font-size: 0.8438rem; }
.wish .row { margin-top: 6px; display: flex; justify-content: flex-end; }
.btn.want.given { opacity: 0.6; }
.site { background: #fff0fa; border: 2px dashed var(--pink, #ff5fc8); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.site .bar { height: 8px; background: #fff; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.site .bar .fill { height: 100%; background: var(--pink, #ff5fc8); transition: width 1s; }
.weblist li { flex-direction: column; gap: 2px; }
.weblist a { font-weight: 800; color: var(--indigo, #2a22c9); text-decoration: none; word-break: break-word; }
.weblist span { font-size: 0.75rem; color: var(--soft); }

/* stories / events cards */
.cards { display: grid; gap: 8px; margin-top: 8px; }
.card { background: var(--card); border-radius: 16px; padding: 10px 12px; display: grid; gap: 4px; }
.card small { color: var(--soft); }
.card p { margin: 0; font-size: 0.8125rem; }
.card .bar { height: 6px; border-radius: 6px; background: #e5e2fb; overflow: hidden; }
.card .bar .fill { height: 100%; background: #ff5a36; }
.card.poster { border: 2px dashed #c9c4f0; }

/* explore mode */
.explore-exit { display: none; position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 12; border: 0; border-radius: 999px; min-height: 48px; padding: 0 22px; font: 800 1rem Nunito, sans-serif; background: #1b1446; color: #fff; box-shadow: var(--shadow); cursor: pointer; }
.joystick { display: none; position: fixed; right: 22px; bottom: 80px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.92); border: 3px solid var(--ink); z-index: 12; touch-action: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: #2a22c9; box-shadow: var(--shadow); pointer-events: none; }
body.exploring .explore-exit { display: block; }
body.exploring .status-pill { display: none; }
@media (pointer: coarse) { body.exploring .joystick { display: block; } }
.actions-menu small { opacity: .55; font-weight: 600; }

.entry .reason { color: var(--soft); font-size: 0.7812rem; font-style: italic; margin-top: 2px; }
.entry.kind-day { background: #fff8e8; border-radius: 14px; padding: 10px 12px; }

/* graphics fallback + GPU-lost notice */
#gpu-note { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 150; max-width: min(92vw, 420px); padding: 10px 16px; border-radius: 14px; background: #1b1446; color: #fff; font-weight: 700; font-size: 0.875rem; text-align: center; box-shadow: 0 6px 20px rgba(27, 20, 70, .35); }
#gpu-note[hidden] { display: none; }
#no-webgl { position: fixed; inset: 0; z-index: 200; overflow: auto; padding: 8vh 6vw; background: #f4f1ff; color: #1b1446; font: 16px/1.5 Nunito, system-ui, sans-serif; }
#no-webgl h2 { margin: 0 0 8px; font-size: 1.5rem; }
#no-webgl ul { padding-left: 20px; }
#no-webgl button { margin-top: 16px; min-height: 44px; padding: 0 22px; border: 0; border-radius: 12px; background: #2a22c9; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }

/* ---------- accessibility ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }
body[data-phase="night"] .needs-pill :focus-visible, body[data-phase="night"] .corner-btn:focus-visible, body[data-phase="night"] .actions-btn:focus-visible { outline-color: #fff; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Calm mode: same as above, chosen by hand in Settings */
body.calm *, body.calm *::before, body.calm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }

/* ---------- boot promise ---------- */
.boot-promise { margin: 14px 0 0; font-weight: 700; line-height: 1.45; }

/* ---------- "while you were away" ---------- */
.away { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 10; width: min(430px, calc(100vw - 24px)); padding: 12px 14px 14px; border-radius: 20px; background: var(--modal); color: var(--ink); box-shadow: var(--shadow); display: grid; gap: 8px; }
.away-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.away ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.away li { display: flex; gap: 8px; line-height: 1.4; }
.away .btn { justify-self: start; }

/* ---------- about + settings ---------- */
.about-ai { padding: 4px 12px 12px; margin-bottom: 8px; background: var(--card); border-radius: 16px; }
.about-ai p { margin: 4px 0; line-height: 1.5; }
.settings { display: grid; gap: 14px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.setting b { display: block; }
.setting small { display: block; color: var(--soft); font-size: 0.8125rem; line-height: 1.35; }
.switch { position: relative; flex: none; width: 56px; height: 32px; border: 0; border-radius: 99px; background: #c9c3ff; cursor: pointer; padding: 0; }
.switch i { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--indigo); }
.switch[aria-checked="true"] i { transform: translateX(24px); }

/* ---------- hide the interface ---------- */
body.ui-hidden :is(.needs-pill, .corner-btn, .world-chips, .bottom-left, .status-pill, .toasts, .drawer, .modal, .away, .explore-exit) { display: none !important; }
#ui-show { position: fixed; top: 14px; left: 14px; z-index: 20; min-height: 44px; padding: 0 16px; border: 0; border-radius: 99px; background: var(--pill); color: var(--ink); font: 800 0.9375rem var(--font); box-shadow: var(--shadow); cursor: pointer; opacity: .85; }
#ui-show[hidden] { display: none; }

/* ---------- night: a dark panel instead of a bright slab over a dark town ---------- */
body[data-phase="night"] :is(.drawer, .modal, .away, .actions-menu) {
  --ink: #f4f1ff; --soft: #b9b3f5; --indigo: #b6b0ff; --card: #2b2480; --card2: #352d92; --line2: #3f37a6; --onbg: #4a40c8;
  --sheet: rgba(24, 17, 72, .97); --modal: #1f1862; --primary: #4a40c8; --primary-h: #5d54e0;
}
body[data-phase="night"] .entry.kind-day, body[data-phase="night"] .site { background: var(--card); }
body[data-phase="night"] .heart { background: #3f37a6; color: #ffd0f0; }
body[data-phase="night"] .heart.given, body[data-phase="night"] .heart:disabled { background: #6a2a8f; color: #fff; }
body[data-phase="night"] .creation canvas { background: #fff; }
body[data-phase="night"] .drawer .x, body[data-phase="night"] .away .x, body[data-phase="night"] .modal .x { color: var(--ink); }
body[data-phase="night"] .need-bars .need .name { color: #c9c3ff; }
body[data-phase="night"] .mood { color: #fff; }

/* research projects */
.research { display: grid; gap: 10px; }
.rcard { background: var(--card, #fff); border: 2px solid var(--ink, #1b1446); border-radius: 12px; padding: 10px 12px; }
.rcard h5 { margin: 0 0 2px; font-size: 15px; line-height: 1.25; }
.rcard .rstate { font-size: 12px; opacity: 0.7; margin-bottom: 6px; }
.rcard.reading { border-style: dashed; }
.rcard.dropped { opacity: 0.65; }
.rcard .why { margin: 0 0 6px; font-size: 13px; font-style: italic; }
.rcard ul, .rcard ol { margin: 0 0 6px; padding: 0; list-style: none; }
.rcard .plan li { font-size: 13px; padding: 1px 0; }
.rcard .plan li em, .rcard .srcs em { opacity: 0.6; font-style: normal; font-size: 12px; margin-left: 6px; }
.rcard .plan li.dry { opacity: 0.6; text-decoration: line-through; }
.rcard .summary { margin: 6px 0; font-weight: 700; font-size: 14px; }
.rcard .findings { list-style: disc; padding-left: 18px; }
.rcard .findings li { font-size: 13px; margin-bottom: 3px; }
.rcard .gaps { margin: 4px 0; font-size: 12.5px; opacity: 0.8; }
.rcard summary { cursor: pointer; font-size: 12.5px; opacity: 0.8; }
.rcard .srcs li { font-size: 12.5px; padding: 2px 0; }
.rcard .srcs li > span { display: inline-block; min-width: 1.4em; opacity: 0.6; }

/* interests: what he keeps coming back to */
.ints { display: grid; gap: 8px; }
.int { border: 2px solid var(--ink, #1b1446); border-radius: 12px; padding: 8px 10px; background: var(--card, #fff); font-size: 14px; }
.int .istage { font-size: 12px; opacity: 0.7; margin-left: 4px; }
.int .ibar { height: 6px; border-radius: 3px; background: rgba(27, 20, 70, 0.12); margin: 6px 0 4px; overflow: hidden; }
.int .ibar i { display: block; height: 100%; background: var(--ink, #1b1446); }
.int.s3 { border-width: 3px; }
.int .imeta, .int .iq { display: block; font-size: 12px; opacity: 0.75; }

/* art v2: smooth pictures, old pixel pictures stay crisp */
.creation canvas.pix, .zbox canvas.pix { image-rendering: pixelated; }
.creation canvas.zoomable { cursor: zoom-in; }
.easel-card { border: 2px dashed var(--ink, #1b1446); }
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(20, 14, 50, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.zoom.hidden { display: none; }
.zbox { background: var(--card, #fff); border-radius: 16px; padding: 12px; max-width: min(92vw, 560px); width: 100%; }
.zbox canvas { width: 100%; display: block; border-radius: 10px; }
.zbox .ztitle { font-weight: 800; margin: 8px 0 4px; }
.zbox .row { display: flex; gap: 8px; flex-wrap: wrap; }
