[hidden] { display: none !important; }
:root {
  --bg: #FBF4E8; --card: #FFFDF8; --ink: #3A2A1E; --muted: #8A7563; --line: #EADBC4;
  --accent: #C96F2D; --accent-ink: #fff; --good: #5E9E5A; --warn: #D9A13B; --bad: #C8553D;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Nunito", system-ui, sans-serif; }
h1, h2, h3 { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; margin: 0; }
h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
button { font: inherit; }
.small { font-size: 13px; } .muted { color: var(--muted); } .spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 22px; line-height: 1; }
.sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.coin { color: #9A6A00; }
.chip.dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; }
.chip.dot.off::before { background: var(--warn); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; padding: 16px; max-width: 1640px; margin: 0 auto; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; padding: 10px; } }

.stage { min-width: 0; }
.scene-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #F3E3C6; aspect-ratio: 1200 / 640; }
#scene { display: block; width: 100%; height: 100%; user-select: none; }
#scene .obj { cursor: default; }
.building #scene .obj { cursor: grab; }
.building #scene .obj.sel { outline: none; filter: drop-shadow(0 0 4px #C96F2D); }
.building #scene { cursor: crosshair; }
#franky { transition: transform 1s linear; }
#night { transition: opacity 3s; }
.tail.wag { animation: wag .45s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-10deg); } to { transform: rotate(14deg); } }
.walking .legs { animation: bob .35s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-6px); } }
.breathing { animation: breathe 3s ease-in-out infinite; transform-origin: 205px 378px; }
@keyframes breathe { 50% { transform: scaleY(1.03); } }

.overlay { position: absolute; inset: 0; pointer-events: none; }
.bubble, .zzz { position: absolute; transform: translate(-50%, -100%); transition: left 1s linear, top 1s linear; }
.bubble { background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 6px 12px; font-family: "Fredoka", sans-serif; font-size: clamp(11px, 1.2vw, 15px); max-width: 240px; text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 12px; height: 12px; background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.bubble.thinking { color: var(--muted); }
.zzz { font-family: "Fredoka", sans-serif; font-weight: 600; color: #4A5A9A; font-size: clamp(12px, 1.6vw, 20px); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { margin-top: -8px; opacity: .6; } }
.build-hint { position: absolute; left: 12px; top: 12px; background: rgba(58,42,30,.85); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 13px; }

.owner-bar { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 14px; cursor: pointer; font-weight: 600; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 3px 9px; font-size: 13px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 110px); overflow: hidden; }
.tabs { flex: none; }
@media (max-width: 980px) { .panel { max-height: none; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: none; padding: 11px 6px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.tab { display: none; padding: 4px 16px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.tab.on { display: block; }

.need { display: grid; grid-template-columns: 92px 1fr 88px; gap: 8px; align-items: center; margin: 6px 0; font-size: 14px; }
.bar { height: 10px; background: #F1E6D4; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width 1s; }
.need .word { color: var(--muted); font-size: 13px; text-align: right; }

.feelings .f { border-left: 4px solid var(--muted); padding: 4px 10px; margin: 6px 0; background: var(--bg); border-radius: 0 8px 8px 0; }
.feelings .f b { font-family: "Fredoka", sans-serif; font-weight: 500; }
.feelings .f.pos { border-color: var(--good); } .feelings .f.neg { border-color: var(--bad); }
.feelings .f span { display: block; font-size: 13px; color: var(--muted); }
.personality p { margin: 4px 0 8px; font-size: 14px; }
.personality .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tagpill { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 13px; }
.tagpill.like { border-color: #BFD9BC; } .tagpill.dislike { border-color: #E9C0B6; }

.wish { border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.wish.granted { border-style: solid; border-color: var(--good); opacity: .75; }
.wish .row { margin-top: 6px; }

.diary .entry { background: #FFFBF0; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.diary .entry .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; letter-spacing: .03em; }
.diary .entry.reflection { background: #F4F0FF; }
.diary .entry.away { background: #EEF6F0; }
.diary .entry.reading { background: #EEF4FB; }

.letters .letter { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.letters .letter.mine { background: var(--bg); }
.letters .letter.unread { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.letters .meta { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
textarea, input[type=text], #chatInput { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; background: #fff; color: var(--ink); }
#chatForm { margin-top: 10px; }

.chat { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }
.chat .msg { max-width: 85%; padding: 7px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.chat .owner { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat .franky { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat .typing { color: var(--muted); font-style: italic; font-size: 13px; }

.log .ev { font-size: 13px; padding: 5px 0; border-bottom: 1px solid #F3EADB; display: grid; grid-template-columns: 74px 1fr; gap: 6px; }
.log .ev .t { color: var(--muted); }
.log .ev.imp2 { font-weight: 700; } .log .ev.imp3 { font-weight: 700; color: var(--accent); }
.log .ev.thought { color: var(--muted); font-style: italic; }

.palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.palette button { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 6px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ink); }
.palette button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.palette svg { width: 100%; height: 54px; display: block; margin-bottom: 4px; }
.selection { margin-top: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }

dialog { border: 1px solid var(--line); border-radius: 16px; max-width: 560px; width: calc(100% - 32px); padding: 20px 22px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(40, 28, 18, .45); }
dialog h2 { margin-bottom: 10px; }
#awayBody ul { padding-left: 18px; font-size: 14px; line-height: 1.6; }
#awayBody .entry { background: #EEF6F0; border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-size: 15px; line-height: 1.5; }

/* ---- rooms ---- */
.roombar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.rooms { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.rooms button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 13px; cursor: pointer; font-weight: 700; color: var(--muted); font-size: 13px; }
.rooms button.on { color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rooms button .here { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 1px; }
.rooms button.add { color: var(--accent); border-style: dashed; }
.follow { white-space: nowrap; }
.elsewhere { position: absolute; right: 12px; bottom: 12px; pointer-events: auto; background: rgba(58,42,30,.88); color: #fff; border: 0; border-radius: 10px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin-top: 4px; }
.swatches button { border: 1px solid var(--line); border-radius: 8px; padding: 0 0 4px; background: var(--card); cursor: pointer; font-size: 11px; font-weight: 700; color: var(--ink); overflow: hidden; }
.swatches button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatches svg { display: block; width: 100%; height: 34px; margin-bottom: 3px; }
.room-settings input { width: 100%; }
#newRoomName, #paletteFilter, .room-settings input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font: inherit; background: #fff; color: var(--ink); width: 100%; }
#paletteFilter { margin-bottom: 8px; }
.palette .cat { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }

/* ---- builder ---- */
.builder textarea { margin-bottom: 4px; }
.draft { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: var(--bg); }
.draft.needs { border-color: var(--warn); background: #FFF8E6; }
.draft .msg { font-size: 14px; margin-bottom: 8px; }
.draft .item { display: grid; grid-template-columns: 76px 1fr; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin: 8px 0; }
.draft .item svg { width: 76px; height: 76px; }
.draft .item ul { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.draft .ask { background: #fff; border: 1px dashed var(--warn); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 8px 0; }
.draft .err { color: var(--bad); font-size: 12px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- reading ---- */
.book { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.book .bar { margin-top: 6px; }
.book details { font-size: 13px; color: var(--muted); margin-top: 4px; }
.diary .entry a { color: var(--accent); }
.diary .entry .fav { font-style: italic; margin-top: 6px; color: var(--muted); }
.tabs button { padding: 11px 4px; font-size: 13px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; word-break: break-all; }

.memories { margin: 4px 0 10px; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.personality details { margin: 4px 0 8px; }

/* ---- sharing & visitors ---- */
body.visitor .owner-only { display: none !important; }
.locked[hidden] { display: none; }
.locked { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.locked-card { text-align: center; max-width: 360px; }
.locked-card svg { width: 120px; height: 96px; }
.sharing .row { flex-wrap: wrap; }
.sharing .person { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.sharing .person input { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; width: 100%; margin-top: 4px; background: #fff; color: var(--ink); }
.sharing .linkbox { font-family: ui-monospace, monospace; font-size: 11px; background: var(--bg); border-radius: 6px; padding: 4px 6px; word-break: break-all; margin-top: 4px; }
.sharing .warn { color: var(--bad); font-size: 12px; }
.chat .who { font-size: 11px; color: var(--muted); font-weight: 700; margin: 4px 4px -2px; }
.chat .who.mine { align-self: flex-end; }
.chat .msg.other { align-self: flex-start; background: #EEF4FB; border: 1px solid #D6E4F2; border-bottom-left-radius: 4px; }

.here { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); font-weight: 700; flex-wrap: wrap; }
.here .p { background: var(--card); border: 1px solid #BFD9BC; color: var(--ink); border-radius: 999px; padding: 4px 10px; }
.here .p::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; }
#othersTyping { margin-top: 6px; }

.logswitch { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 10px 0 8px; }
.logswitch button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 6px; font-weight: 700; color: var(--muted); cursor: pointer; }
.logswitch button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---- household profile picker ---- */
.picker-card { text-align: center; max-width: 520px; width: 100%; }
.picker-card svg { width: 110px; height: 88px; }
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 18px 0; }
.profile { border: 0; background: none; cursor: pointer; font: inherit; font-weight: 700; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 8px; width: 104px; }
.profile .avatar { width: 84px; height: 84px; border-radius: 22px; background: var(--accent); color: #fff; font-family: "Fredoka", sans-serif; font-size: 40px; display: flex; align-items: center; justify-content: center; }
.profile:nth-child(3n+2) .avatar { background: #5E9E5A; } .profile:nth-child(3n+3) .avatar { background: #4A6FA5; }
.profile:hover .avatar { transform: scale(1.05); }
#addProfile summary { list-style: none; display: inline-block; }
#addProfile summary::-webkit-details-marker { display: none; }
.add-form { display: flex; flex-direction: column; gap: 10px; text-align: left; max-width: 300px; margin: 14px auto 0; }
.add-form input:not([type=checkbox]) { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font: inherit; width: 100%; background: #fff; color: var(--ink); }
.err { color: var(--bad); }
#meChip a { color: var(--accent); }
.sharing .person input[type=checkbox] { width: auto; margin: 0 6px 0 0; padding: 0; vertical-align: -2px; }

/* ---- weather in the windows ---- */
.rainfall { animation: rainfall .5s linear infinite; }
@keyframes rainfall { from { transform: translateY(-10px); } to { transform: translateY(10px); } }
.snowfall { animation: snowfall 3s linear infinite; }
@keyframes snowfall { from { transform: translate(0, -12px); } to { transform: translate(4px, 12px); } }
.drift { animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translateX(12px); } }
.bolt { opacity: 0; animation: bolt 5s infinite; }
@keyframes bolt { 0%, 90%, 94%, 100% { opacity: 0; } 91%, 93% { opacity: 1; } }
.chip.holiday { color: #B5601F; border-color: #F0C79E; }

/* ---- Franky's art ---- */
.portfolio { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.piece { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.piece:hover { border-color: var(--accent); }
.piece .thumb { width: 100%; height: auto; border-radius: 6px; display: block; }
.piece.writing .excerpt { font-family: Georgia, serif; font-style: italic; font-size: 13px; color: var(--muted); background: #FFFBF0; border-radius: 6px; padding: 10px; min-height: 80px; }
#artDialog { max-width: 680px; }
#artDialog svg.big { width: 100%; height: auto; border-radius: 10px; margin-top: 10px; background: #F4EEE3; }
.writing-full { font-family: Georgia, serif; font-size: 16px; line-height: 1.7; white-space: pre-wrap; background: #FFFBF0; border-radius: 10px; padding: 16px 18px; margin-top: 10px; max-height: 60vh; overflow: auto; }
.enclosed { margin-top: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; max-width: 220px; }
.enclosed .thumb { width: 100%; border-radius: 6px; border: 1px solid var(--line); }
#hangRoom { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; }

.present-panel { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--card, #fff); border: 1px solid rgba(0,0,0,.12); }
.present-panel .row { display: flex; align-items: center; gap: 8px; }
.present-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 6px; }
.present-grid button { text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(0,0,0,.12); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.present-grid button:hover { border-color: var(--accent); }
.present-grid .kind { display: block; font-size: 11px; opacity: .65; }
.belongings { display: flex; flex-wrap: wrap; gap: 6px; }
.belonging { padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(0,0,0,.12); font-size: 13px; }

.sharing .code { font-family: ui-monospace, monospace; font-weight: 700; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-right: 6px; font-size: 13px; }
.sharing .phead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sharing .here { color: var(--good); font-size: 12px; font-weight: 600; }
.sharing .here::before { content: "● "; }
.sharing .sent { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
.sharing .sent.yes { border-color: #BFD9BC; } .sharing .sent.no { border-color: #E9C0B6; }
.sharing .stats { font-size: 12px; color: var(--muted, #888); margin-top: 4px; }
.sharing .profile-row { font-size: 13px; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); margin-top: 4px; }
.sharing details summary { cursor: pointer; font-size: 12px; margin-top: 6px; }
.add-person { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.add-person input:not([type=checkbox]) { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; width: 100%; margin-bottom: 6px; background: #fff; color: var(--ink); box-sizing: border-box; }
.add-person input[type=checkbox] { vertical-align: -2px; margin-right: 4px; }
.dupwarn { color: var(--bad); margin-top: 4px; }
.sumrow { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin: 6px 0; }
