:root { --fg: #222; --muted: #888; --line: #e5e5e5; --ring: #d6249f; --close: #22b14c; --bg: #fff; }
* { box-sizing: border-box; }
body { margin: 0; background: #f4f4f4; color: var(--fg); font: 15px/1.5 -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
a { color: inherit; }
.wrap { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100vh; }
.top { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between;
       padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: 14px; }
.top nav a { margin-right: 10px; font-weight: 600; text-decoration: none; }
main { padding-bottom: 16px; }
footer { padding: 12px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.empty { padding: 24px 12px; color: var(--muted); text-align: center; }
.time, .name { color: var(--muted); font-size: 12px; }
.who { font-weight: 600; text-decoration: none; }

/* story bar */
.stories { display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ring { flex: 0 0 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ring); display: flex; align-items: center; justify-content: center;
        text-decoration: none; font-size: 10px; text-align: center; overflow: hidden; padding: 4px; word-break: break-all; }
.ring.close { border-color: var(--close); }

/* scene card: square, colour fixed per location */
.card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1; width: 100%;
        padding: 16px; color: #fff; text-decoration: none; text-align: center; }
.card .label, .story-view .label { font-weight: 600; }
.card .words, .story-view .words { opacity: .9; }

.post { border-bottom: 1px solid var(--line); }
.post .head, .post .caption, .post .meta { padding: 0 12px; }
.post .head { padding-top: 10px; padding-bottom: 8px; }
.post .caption { margin: 8px 0 4px; white-space: pre-wrap; }
.meta { padding: 6px 12px 12px; font-size: 13px; color: #555; }

/* story view */
.story-view { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; min-height: 70vh; padding: 16px;
              color: #fff; text-align: center; border: 4px solid transparent; }
.story-view.close { border-color: var(--close); }
.story-view .head { align-self: flex-start; }
.story-view .who, .story-view .time, .story-view .name { color: #fff; }
.story-text { font-size: 18px; white-space: pre-wrap; }

/* comments */
.comments { padding: 8px 12px; }
.comment { padding: 6px 0; }
.comment.reply { margin-left: 28px; }

/* profile */
.profile { padding: 12px; }
.profile h2 { margin: 0; font-size: 18px; }
.bio { white-space: pre-wrap; margin: 6px 0; }
.counts { display: flex; gap: 16px; font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid .card { padding: 6px; font-size: 11px; }
.grid .empty { grid-column: 1 / -1; }

/* DM */
h2 { font-size: 17px; padding: 0 12px; }
.dm-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; }
.dm-row .last { grid-column: 1; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-row .time { grid-column: 2; grid-row: 1; }
.bubble { max-width: 75%; margin: 6px 12px; padding: 8px 12px; border-radius: 16px; background: #efefef; white-space: pre-wrap; }
.bubble.mine { margin-left: auto; background: #3797f0; color: #fff; }
.bubble.mine .time { color: #e0eefc; }

/* observer (/lab) only */
.lab { margin: 8px 12px; padding: 8px; background: #fff8e1; border: 1px dashed #e0b84f; font-size: 12px; }
.lab h3 { margin: 4px 0; font-size: 13px; }
.lab ul { margin: 0; padding-left: 16px; }
.lab table { border-collapse: collapse; }
.lab td, .lab th { padding: 2px 8px; text-align: left; }
.comment .lab { margin: 2px 0 0; }

/* W2-min: the human's writes, progress */
.banner { padding: 6px 12px; background: #fff3cd; color: #7a5b00; font-size: 13px; text-align: center; }
.me-bar { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.progress { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
form.inline { display: inline; }
.write { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.write label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.write textarea, .write input[type=text] { font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.heart { border: 0; background: none; padding: 0; font-size: 15px; color: #e0245e; cursor: pointer; }
.heart:disabled { cursor: default; }
.card.photo { padding: 0; }
.card.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.actions { display: flex; gap: 12px; align-items: center; }
