/* DinoMama阅读活动室 — 清晰易读的复古游戏社区系统 */
:root {
  --ink: #1d1725;
  --ink-soft: #34243a;
  --plum: #4b3151;
  --plum-soft: #77536c;
  --paper: #fff4dc;
  --paper-warm: #f4e2bf;
  --paper-deep: #e6c99b;
  --cream: #fffaf0;
  --text: #342238;
  --muted: #806875;
  --orange: #e98549;
  --orange-light: #f7b16f;
  --gold: #d6a64c;
  --green: #5f9b79;
  --teal: #3b8b87;
  --coral: #d96564;
  --blue: #4f7e9d;
  --danger: #b64e58;
  --line: #ceb386;
  /* Backward-compatible aliases used by Boss and recovery screens. */
  --accent-gold: var(--gold);
  --accent-orange: var(--orange);
  --accent-purple: var(--plum-soft);
  --accent-green: var(--green);
  --text-muted: var(--muted);
  --danger-red: var(--danger);
  --bg-card-inner: var(--cream);
  --shadow: 0 5px 0 var(--ink);
  --shadow-small: 0 3px 0 var(--ink);
  --display: "Cascadia Mono", "Segoe UI Mono", Consolas, "Microsoft YaHei UI", "Microsoft YaHei", monospace;
  --body: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body {
  min-height: 100vh;
  margin: 0;
  padding-bottom: 104px;
  background:
    linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.10) 1px, transparent 1px),
    var(--paper-warm);
  background-size: 8px 8px, 8px 8px, auto;
  color: var(--text);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
a { color: var(--teal); }
.hidden { display: none !important; }

/* Header / shared chrome */
.pixel-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  max-width: 1180px;
  min-height: 76px;
  margin: 0 auto;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 4px solid var(--orange);
  box-shadow: 0 5px 0 rgba(29,23,37,.18);
}
.header-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto;
  color: var(--ink); background: var(--orange-light); border: 3px solid var(--paper); box-shadow: 3px 3px 0 var(--plum);
  font: 800 13px/1 var(--display); letter-spacing: -1px;
}
.brand { color: var(--paper); font: 800 17px/1.2 var(--body); letter-spacing: .03em; white-space: nowrap; }
.brand-kicker { margin-top: 4px; color: var(--orange-light); font: 700 10px/1 var(--display); letter-spacing: .12em; white-space: nowrap; }
.user-stats-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.coin-badge, .streak-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px;
  color: var(--paper); background: var(--plum); border: 1px solid var(--plum-soft);
  font: 700 10px/1 var(--display); letter-spacing: .02em;
}
.coin-badge strong { color: var(--orange-light); }
.streak-badge strong { color: #f5965b; }
.header-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.audio-toggle, .user-pill {
  border: 2px solid var(--plum-soft); color: var(--paper); background: transparent; cursor: pointer;
}
.audio-toggle { width: 36px; height: 36px; padding: 0; }
.user-pill { display: flex; align-items: center; gap: 8px; max-width: 230px; padding: 5px 9px 5px 5px; text-align: left; }
.user-pill:hover, .audio-toggle:hover { border-color: var(--orange-light); background: var(--plum); }
.avatar-pixel-sm { display: grid; place-items: center; width: 30px; height: 30px; overflow: hidden; background: var(--paper); border: 2px solid var(--orange); color: var(--ink); font-size: 18px; }
.avatar-pixel-sm img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.user-pill > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.role-badge { display: inline-block; color: var(--orange-light); font: 700 9px/1.2 var(--display); white-space: nowrap; }

.music-bar {
  display: flex; align-items: center; gap: 16px; width: 100%; max-width: 1180px; min-height: 38px; margin: 0 auto;
  padding: 7px 22px; background: var(--paper); border-bottom: 2px solid var(--line); color: var(--plum);
}
.music-title-scroll { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 11px/1.2 var(--display); }
.music-controls { display: flex; align-items: center; gap: 6px; }
.music-btn { padding: 4px 8px; border: 2px solid var(--plum); background: var(--cream); color: var(--plum); cursor: pointer; font: 700 10px/1 var(--display); box-shadow: 2px 2px 0 var(--plum); }
.music-btn:active { transform: translate(2px,2px); box-shadow: none; }

/* Illustrated reading room */
.office-viewport {
  position: relative; width: 100%; max-width: 1180px; height: auto; aspect-ratio: 1672 / 941; margin: 0 auto; overflow: hidden;
  background: var(--ink); border-bottom: 4px solid var(--ink); box-shadow: inset 0 -18px 0 rgba(29,23,37,.22);
}
#officeCanvas { display: block; width: 100%; height: 100%; image-rendering: auto; cursor: grab; }
#officeCanvas:active { cursor: grabbing; }
.office-hud-left, .office-hud-right { position: absolute; z-index: 4; top: 16px; }
.office-hud-left { left: 18px; max-width: 330px; padding: 7px 10px; color: var(--paper); background: rgba(29,23,37,.86); border-left: 4px solid var(--orange); font-size: 12px; font-weight: 700; }
.office-world-meta { position: absolute; z-index: 4; left: 18px; top: 52px; max-width: 360px; padding: 5px 8px; color: var(--orange-light); background: rgba(29,23,37,.78); border-left: 3px solid var(--teal); font: 700 9px/1.35 var(--display); letter-spacing: .03em; }
.office-hud-right { right: 18px; }
.hud-btn { padding: 7px 11px; border: 2px solid var(--paper); background: var(--orange); color: var(--ink); cursor: pointer; box-shadow: 3px 3px 0 var(--ink); font: 800 11px/1 var(--display); }
.hud-btn:active { transform: translate(3px,3px); box-shadow: none; }
.scene-switch-row { position: absolute; right: 16px; bottom: 14px; z-index: 5; display: flex; gap: 6px; max-width: calc(100% - 32px); overflow-x: auto; padding: 3px; scrollbar-width: thin; }
.scene-pill { flex: 0 0 auto; padding: 7px 9px; border: 2px solid rgba(255,244,220,.56); background: rgba(29,23,37,.86); color: var(--paper); cursor: pointer; font: 700 10px/1 var(--display); white-space: nowrap; }
.scene-pill:hover, .scene-pill.active { background: var(--orange); border-color: var(--ink); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }

/* Daily quest panel */
.page-container { width: min(100% - 32px, 1120px); margin: 0 auto; padding: 20px 0; }
.daily-atelier {
  display: grid; grid-template-columns: minmax(0,1fr) 225px; grid-template-areas: "copy portrait" "note portrait";
  gap: 18px 24px; margin-bottom: 18px; padding: 22px; overflow: hidden; position: relative;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); isolation: isolate;
}
.daily-atelier::before { content: ""; position: absolute; z-index: -1; inset: auto -25px -40px auto; width: 220px; height: 180px; background: var(--paper-deep); transform: rotate(-8deg); opacity: .45; }
.atelier-copy { grid-area: copy; }
.eyebrow { color: var(--teal); font: 800 10px/1 var(--display); letter-spacing: .16em; }
.atelier-copy h1 { margin: 8px 0 8px; color: var(--ink); font: 900 clamp(24px,4vw,38px)/1.15 var(--body); letter-spacing: -.04em; }
.atelier-copy p { max-width: 650px; margin: 0; color: var(--plum-soft); font-size: 14px; }
.quest-track { max-width: 660px; margin-top: 18px; }
.quest-track-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; color: var(--plum); font: 700 11px/1.2 var(--display); }
.quest-track-label strong { color: var(--coral); }
.quest-track-bar { height: 12px; padding: 2px; background: var(--paper-warm); border: 2px solid var(--plum); }
.quest-track-bar span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width .35s ease; }
.atelier-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; color: var(--muted); font: 700 11px/1.2 var(--display); }
.atelier-stats b { color: var(--ink); font-size: 15px; }
.atelier-portrait-wrap { grid-area: portrait; position: relative; min-height: 230px; align-self: stretch; overflow: hidden; border: 3px solid var(--ink); background: var(--plum); box-shadow: 4px 4px 0 var(--ink); }
.atelier-portrait { width: 100%; height: 100%; min-height: 0; display: block; object-fit: contain; image-rendering: auto; }
.leader-sheet-art {
  background-color: var(--plum);
  background-image: none;
  image-rendering: auto;
}
.atelier-portrait-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; color: var(--paper); font-size: 10px; line-height: 1.3; }
.atelier-portrait-caption strong { max-width: 65%; overflow: hidden; color: var(--orange-light); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.portrait-sticker { position: absolute; right: 8px; bottom: 8px; padding: 5px 7px; background: var(--orange-light); color: var(--ink); border: 2px solid var(--ink); font: 800 10px/1.2 var(--display); transform: rotate(-4deg); }
.atelier-note { grid-area: note; display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; background: #f7ead0; border-left: 4px solid var(--orange); color: var(--plum-soft); font-size: 12px; }
.atelier-note strong { color: var(--ink); }
.note-pin { color: var(--coral); font: 800 22px/1 var(--display); }

.tab-bar { display: flex; gap: 8px; margin-bottom: 18px; padding: 5px; background: var(--ink); border: 3px solid var(--ink); box-shadow: var(--shadow-small); }
.tab-btn { flex: 1; min-height: 38px; padding: 8px 10px; border: 0; background: transparent; color: #cbb8bc; cursor: pointer; font: 800 12px/1.2 var(--body); }
.tab-btn:hover { color: var(--paper); }
.tab-btn.active { background: var(--orange); color: var(--ink); box-shadow: 3px 3px 0 rgba(0,0,0,.35); }
.tab-content { animation: atelierIn .22s ease both; }
@keyframes atelierIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; color: var(--ink); font-size: 19px; font-weight: 900; }
.section-heading small { color: var(--muted); font-size: 11px; font-weight: 600; }

/* Cards, feed, forms */
.pixel-card, .post-card { position: relative; margin-bottom: 14px; padding: 18px; background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow-small); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding-bottom: 9px; border-bottom: 2px dashed var(--paper-deep); color: var(--ink); font-size: 15px; font-weight: 900; }
.section-chip { padding: 4px 6px; color: var(--teal); border: 1px solid var(--teal); font: 700 9px/1 var(--display); }
.post-card { background: var(--cream); }
.post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-avatar { display: grid; place-items: center; width: 45px; height: 45px; flex: 0 0 auto; overflow: hidden; background: var(--paper-warm); border: 3px solid var(--teal); color: var(--ink); font-size: 21px; }
.post-avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.post-meta { min-width: 0; flex: 1; }
.post-name { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.post-sub { margin-top: 2px; color: var(--muted); font: 600 10px/1.3 var(--display); }
.book-tag { display: inline-block; margin-bottom: 10px; padding: 5px 8px; background: #f7ead0; border-left: 4px solid var(--orange); color: var(--plum); font-size: 12px; font-weight: 800; }
.post-content { margin-bottom: 11px; padding: 12px; background: #fffaf1; border: 2px solid var(--paper-deep); color: var(--text); font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.action-btn, .pixel-btn-sm { padding: 7px 10px; border: 2px solid var(--plum); background: var(--cream); color: var(--plum); cursor: pointer; box-shadow: 2px 2px 0 var(--plum); font: 700 11px/1.2 var(--body); }
.action-btn:hover, .pixel-btn-sm:hover { background: var(--paper-warm); }
.action-btn:active, .pixel-btn-sm:active { transform: translate(2px,2px); box-shadow: none; }
.action-btn.liked { border-color: var(--coral); color: var(--coral); }
.comment-area { margin-top: 12px; padding-top: 10px; border-top: 2px dashed var(--paper-deep); }
.comment-item { padding: 4px 0; color: var(--plum-soft); font-size: 12px; }
.comment-item strong { color: var(--teal); }
.comment-input-row { display: flex; gap: 7px; margin-top: 8px; }
.comment-input { min-width: 0; }
.ai-badge { margin: 10px 0; padding: 9px 11px; border: 2px solid; font-size: 12px; line-height: 1.5; }
.ai-badge.ai-high { border-color: var(--green); background: #e8f1df; color: #315f48; }
.ai-badge.ai-mid { border-color: var(--gold); background: #fbf0d6; color: #795d25; }
.ai-badge.ai-low { border-color: var(--danger); background: #f9e0dd; color: #8f3741; }
.review-box { margin: 10px 0; padding: 9px 11px; border-left: 4px solid var(--plum); background: #eee1ef; color: var(--plum); font-size: 12px; }
.review-btn { padding: 6px 8px; border: 2px solid var(--plum); background: var(--plum); color: var(--paper); cursor: pointer; font-size: 10px; font-weight: 800; }
.video-wrap { position: relative; margin-bottom: 10px; overflow: hidden; background: var(--ink); border: 3px solid var(--ink); }
.video-wrap video { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.video-wrap iframe { width: 100%; height: 240px; border: 0; }
.video-wrap.external { padding: 18px; background: var(--plum); }
.ext-link { color: var(--paper); font-weight: 800; }
.drive-badge { position: absolute; right: 8px; bottom: 8px; padding: 4px 7px; color: var(--paper); background: rgba(29,23,37,.86); border: 1px solid var(--orange-light); font: 700 10px/1 var(--display); }
.empty-state { text-align: center; padding: 38px 20px; }
.empty-icon { font-size: 34px; }
.empty-title { margin-top: 8px; color: var(--ink); font-size: 15px; font-weight: 900; }
.empty-sub, .field-note { color: var(--muted); font-size: 11px; line-height: 1.6; }

.pixel-btn-primary, .pixel-btn-secondary, .pixel-btn-danger {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; cursor: pointer; text-align: center; font-weight: 900;
}
.pixel-btn-primary { background: var(--orange); border: 3px solid var(--ink); color: var(--ink); box-shadow: var(--shadow-small); }
.pixel-btn-primary:hover { background: var(--orange-light); }
.pixel-btn-secondary { background: var(--cream); border: 2px solid var(--plum); color: var(--plum); box-shadow: 3px 3px 0 var(--plum); }
.pixel-btn-secondary:hover { background: var(--paper-warm); }
.pixel-btn-danger { background: #f4ded8; border: 2px solid var(--danger); color: var(--danger); box-shadow: 3px 3px 0 var(--danger); }
.pixel-btn-primary:active, .pixel-btn-secondary:active, .pixel-btn-danger:active { transform: translate(3px,3px); box-shadow: none; }
.pixel-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.full-width { width: 100%; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; margin-bottom: 6px; color: var(--plum); font-size: 12px; font-weight: 900; }
.pixel-input, .pixel-textarea {
  width: 100%; padding: 10px 11px; border: 2px solid var(--line); border-radius: 0; outline: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 14px;
}
.pixel-input::placeholder, .pixel-textarea::placeholder { color: #ad9690; }
.pixel-input:focus, .pixel-textarea:focus { border-color: var(--teal); box-shadow: 3px 3px 0 rgba(59,139,135,.18); }
.pixel-textarea { resize: vertical; min-height: 104px; }
.pixel-input[type="file"] { padding: 8px; }
.radar-btn { width: 100%; margin-top: 8px; border-color: var(--teal); color: var(--teal); }
.ai-radar-banner { margin-bottom: 16px; padding: 12px 14px; background: #f7e3d4; border: 2px solid var(--coral); border-left-width: 5px; color: #8d474b; font-size: 12px; line-height: 1.6; }
.ai-radar-banner strong { color: var(--danger); }
.ai-manual-tools { margin-top: 8px; }
.ai-manual-tools[hidden] { display: none !important; }
.ai-precheck-result:not([hidden]) { display: block; margin-top: 9px; }
.video-upload-guidance { margin-top: 8px; padding: 10px 12px; background: #f6f1e2; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 6px; }
.video-upload-guidance strong { display: block; margin-bottom: 4px; color: var(--ink); }
.video-upload-guidance ul { display: grid; gap: 3px; margin: 0; padding-left: 1.25em; }
.video-upload-guidance li { padding-left: 1px; }

/* Character workshop */
.workshop-intro { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.avatar-style-picker { display: grid; gap: 6px; margin: 0 0 13px; padding: 10px; background: var(--paper-warm); border: 2px solid var(--paper-deep); }
.avatar-style-picker .form-label { margin: 0; }
.avatar-style-picker .pixel-input { min-height: 38px; }
.avatar-style-picker .field-note { margin: 0; }
.profession-picker { margin-top: -5px; }
.emotions-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.emotion-box { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 10px 6px; background: var(--cream); border: 2px dashed var(--line); color: var(--text); cursor: pointer; text-align: center; }
.emotion-box:hover, .emotion-box.has-img { border-color: var(--orange); background: #fff5dc; transform: translateY(-2px); }
.emotion-thumb { display: grid; place-items: center; width: 62px; height: 62px; overflow: hidden; margin-bottom: 7px; background: var(--ink); border: 2px solid var(--plum); color: var(--paper); font-size: 27px; }
.emotion-thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.emotion-label { color: var(--plum); font-size: 11px; font-weight: 900; }
.emotion-desc { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.workshop-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--paper-deep); color: var(--muted); font: 600 10px/1.4 var(--display); }
.boss-action { margin-top: 8px; border-color: var(--plum); color: var(--plum); }
.profile-actions-card { display: grid; gap: 8px; }

/* Bottom punch CTA */
.fab-punch-container { position: fixed; right: 0; bottom: 22px; left: 0; z-index: 90; display: flex; justify-content: center; pointer-events: none; }
.fab-punch-btn { display: flex; align-items: center; gap: 10px; pointer-events: auto; padding: 12px 18px; background: var(--ink); border: 3px solid var(--orange-light); color: var(--paper); cursor: pointer; box-shadow: 0 5px 0 var(--orange); font-weight: 900; }
.fab-punch-btn:hover { background: var(--plum); }
.fab-punch-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange); }
.fab-icon { color: var(--orange-light); font-size: 19px; }
.fab-coin-badge { padding: 4px 6px; background: var(--orange); color: var(--ink); font: 800 10px/1 var(--display); }

/* Drawers / dialogs */
.modal-overlay { display: none !important; position: fixed; inset: 0; z-index: 200; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(29,23,37,.66); }
.modal-overlay.is-open { display: flex !important; }
.modal-drawer { width: min(100%, 650px); max-height: 88vh; overflow-y: auto; padding: 20px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 7px 0 var(--ink); animation: drawerIn .2s ease both; }
@keyframes drawerIn { from { transform: translateY(18px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; padding-bottom: 10px; border-bottom: 2px solid var(--paper-deep); }
.modal-header h3 { margin: 0; color: var(--ink); font-size: 19px; font-weight: 900; }
.close-btn { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; border: 2px solid var(--plum); background: var(--cream); color: var(--plum); cursor: pointer; font-size: 22px; line-height: 1; }
.close-btn:hover { background: var(--orange-light); }
.modal-cancel { margin-top: 9px; }
.playlist-scroll { max-height: 360px; overflow-y: auto; }
.music-preview-card { display: grid; gap: 5px; margin-bottom: 12px; padding: 10px; background: var(--paper-warm); border: 2px solid var(--teal); color: var(--plum); font-size: 11px; line-height: 1.4; }
.music-preview-card span { color: var(--muted); font-size: 10px; }
.music-preview-card audio { width: 100%; height: 32px; }
.playlist-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 7px; border-bottom: 1px dashed var(--paper-deep); color: var(--plum); cursor: pointer; font-size: 12px; }
.playlist-item:hover, .playlist-item.playing { background: var(--paper-warm); color: var(--ink); }
.member-profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.member-profile-header > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.member-profile-avatar { display: grid; place-items: center; width: 82px; height: 82px; overflow: hidden; background: var(--ink); border: 3px solid var(--orange); }
.member-profile-avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.member-post-card { margin-bottom: 10px; padding: 10px; background: var(--bg-card-inner); }
.member-post-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--accent-gold); font-size: 11px; }
.member-post-meta span:first-child { min-width: 0; overflow-wrap: anywhere; }
.member-post-meta span:last-child { flex: 0 0 auto; color: var(--text-muted); white-space: nowrap; }
.member-post-copy { color: var(--text); font-size: 12px; line-height: 1.55; margin-top: 8px; }
.member-video-layout { display: grid; grid-template-columns: minmax(0, 1fr) 106px; gap: 10px; align-items: stretch; }
.member-video-player { position: relative; min-width: 0; overflow: hidden; background: var(--ink); border: 2px solid var(--ink); }
.member-video-player video, .member-video-player iframe { display: block; width: 100%; height: 190px; border: 0; object-fit: contain; background: #101523; }
.member-video-stats { display: flex; flex-direction: column; justify-content: center; gap: 9px; padding: 8px; background: var(--paper-warm); border: 2px solid var(--paper-deep); color: var(--plum); }
.member-stat { display: grid; gap: 2px; font-size: 10px; }
.member-stat strong { font-size: 13px; color: var(--ink); }
.member-stat span { color: var(--plum-soft); }
.member-video-stats .pixel-btn-sm { min-height: 38px; padding: 7px 5px; }
.member-post-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; color: var(--text-muted); font-size: 10px; }
@media (max-width: 560px) {
  .member-video-layout { grid-template-columns: 1fr; }
  .member-video-player video, .member-video-player iframe { height: min(54vw, 240px); }
  .member-video-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
  .member-video-stats .pixel-btn-sm { grid-column: 1 / -1; }
}
.leader-modal-art {
  width: 148px;
  aspect-ratio: 1;
  margin: 0 auto 12px;
  background-color: var(--plum);
  background-image: url('/assets/characters/character-atlas-female-v2.png?v=20260916-character2');
  background-size: 400% 300%;
  background-position: 0 0;
  background-repeat: no-repeat;
  border: 3px solid var(--orange);
  box-shadow: 4px 4px 0 var(--ink);
  image-rendering: auto;
}
.pixel-toast { position: fixed; left: 50%; bottom: -90px; z-index: 9999; max-width: min(560px, 90%); padding: 11px 16px; transform: translateX(-50%); background: var(--ink); border: 3px solid var(--orange); color: var(--paper); box-shadow: 4px 4px 0 var(--plum); font-size: 13px; font-weight: 800; text-align: center; transition: bottom .25s ease; pointer-events: none; }
.pixel-toast.toast-show { bottom: 96px; }
.pixel-toast.toast-success { border-color: var(--green); }
.pixel-toast.toast-error { border-color: var(--danger); }
.pixel-toast.toast-coin { border-color: var(--gold); }

/* Rankings / achievements */
.lb-row { display: flex; align-items: center; gap: 10px; padding: 10px 5px; border-bottom: 1px dashed var(--paper-deep); color: var(--plum); font-size: 13px; }
.lb-row.lb-top .lb-name { color: var(--ink); font-weight: 900; }
.lb-rank { width: 30px; flex: 0 0 auto; text-align: center; font-size: 16px; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: var(--coral); font-weight: 900; }
.ach-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.ach-card { padding: 11px 7px; background: var(--cream); border: 2px solid var(--line); text-align: center; }
.ach-card.unlocked { border-color: var(--gold); background: #fff1cf; }
.ach-card.progress { border-color: var(--teal); background: #edf5e8; }
.ach-card.locked { opacity: .55; filter: grayscale(.7); }
.ach-icon { font-size: 26px; }
.ach-icon .badge-icon { width: 42px; height: 42px; display: inline-block; }
.ach-name { margin-top: 4px; color: var(--ink); font-size: 11px; font-weight: 900; }
.ach-desc { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.ach-progress-label { margin-top: 7px; color: var(--teal); font: 800 10px/1.2 var(--display); }
.ach-card.locked .ach-progress-label { color: var(--muted); }
.ach-progress-track { display: block; height: 5px; margin-top: 5px; overflow: hidden; background: rgba(52, 42, 43, .12); }
.ach-progress-track i { display: block; height: 100%; background: var(--teal); transition: width .25s ease; }
.ach-reward { margin-top: 5px; color: var(--coral); font: 800 10px/1 var(--display); }

/* Login and recovery */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 28px; background: var(--ink); }
.login-shell { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(360px,.88fr); gap: 28px; width: min(1120px, 100%); align-items: center; }
.login-art-panel { position: relative; min-height: 610px; overflow: hidden; background: var(--plum); border: 4px solid var(--orange); box-shadow: 8px 8px 0 #0e0a13; }
.login-art-panel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(29,23,37,.75)); pointer-events: none; }
.login-art { display: block; width: 100%; height: 100%; min-height: 610px; object-fit: cover; object-position: 28% 55%; image-rendering: auto; }
.login-art-copy { position: absolute; z-index: 2; right: 22px; bottom: 21px; left: 22px; color: var(--paper); }
.login-art-copy .eyebrow { color: var(--orange-light); }
.login-art-copy h2 { margin: 7px 0 4px; font: 900 32px/1.15 var(--body); }
.login-art-copy p { max-width: 480px; margin: 0; color: #f8dfbf; font-size: 13px; }
.login-container { width: 100%; max-width: 470px; margin: 0 auto; }
.login-logo { margin-bottom: 17px; color: var(--paper); }
.dino-logo { width: 60px; height: 60px; display: grid; place-items: center; margin-bottom: 11px; background: var(--orange); border: 3px solid var(--paper); color: var(--ink); font-size: 31px; box-shadow: 4px 4px 0 var(--plum-soft); }
.login-title { margin: 0; color: var(--paper); font-size: 27px; font-weight: 900; letter-spacing: -.04em; }
.login-subtitle { margin-top: 6px; color: var(--orange-light); font: 700 10px/1.4 var(--display); letter-spacing: .12em; }
.login-card { background: var(--paper); box-shadow: 7px 7px 0 #0e0a13; }
.login-card.is-failure { animation: loginFailureNudge .42s ease-out; }
@keyframes loginFailureNudge {
  18% { transform: translateX(-7px); }
  38% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  82% { transform: translateX(2px); }
}
.login-world-portal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  color: #fff7df;
  background: radial-gradient(circle at 50% 46%, #47775b 0, #1a3d39 38%, #111b2c 100%);
  pointer-events: none;
}
.login-success .login-world-portal {
  visibility: visible;
  animation: bookWorldReveal 1.35s ease-in both;
}
.portal-book {
  display: grid;
  width: min(280px, 66vw);
  aspect-ratio: .76;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 22px;
  color: #293d32;
  text-align: center;
  background: linear-gradient(90deg, #bf8050 0 7%, #fff1d1 7% 50%, #f7e3b9 50% 94%, #9c623e 94%);
  border: 5px solid #e5c078;
  border-radius: 12px 22px 22px 12px;
  box-shadow: 0 0 0 5px rgba(24, 34, 34, .8), 0 20px 65px rgba(0, 0, 0, .42);
  transform: scale(.18) rotate(-16deg);
}
.login-success .portal-book { animation: bookOpens 1.25s cubic-bezier(.18,.76,.25,1) both; }
.portal-book-seal { padding: 6px 10px; color: #fff4d4; background: #315f4c; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.portal-book strong { font-size: clamp(24px, 7vw, 38px); line-height: 1.35; }
.portal-book-hint { color: #6c634d; font-size: 13px; }
.login-world-portal > p { margin: 0; font-weight: 800; text-shadow: 0 1px 5px #15231d; }
.login-success .login-shell { animation: loginPulledIntoBook .82s .12s cubic-bezier(.45,0,.95,.5) both; }
@keyframes bookWorldReveal { 0% { opacity: 0; } 28% { opacity: 1; } 100% { opacity: 1; } }
@keyframes bookOpens {
  0% { transform: scale(.18) rotate(-16deg); }
  42% { transform: scale(1.12) rotate(4deg); }
  70% { transform: scale(1) rotate(0); }
  100% { transform: scale(3.8) rotate(0); }
}
@keyframes loginPulledIntoBook {
  0% { transform: scale(1) rotate(0); opacity: 1; }
  62% { transform: scale(.72) rotate(-2deg); opacity: .86; }
  100% { transform: scale(.04) rotate(13deg); opacity: 0; }
}
.start-prompt { margin-bottom: 17px; color: var(--teal); font: 800 11px/1 var(--display); letter-spacing: .1em; }
.press-start-btn { display: block; width: 100%; min-height: 48px; padding: 12px 16px; background: var(--orange); border: 3px solid var(--ink); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-small); font-weight: 900; }
.press-start-btn:hover { background: var(--orange-light); }
.press-start-btn:active { transform: translate(3px,3px); box-shadow: none; }
.pwd-toggle { position: absolute; top: 0; right: 0; width: 42px; height: 100%; border: 0; background: transparent; color: var(--plum); cursor: pointer; }
.error-msg { margin-bottom: 12px; padding: 9px 11px; background: #f7e0dd; border-left: 4px solid var(--danger); color: var(--danger); font-size: 12px; }
.login-hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.copyright { color: #aa8c8e !important; }

/* Boss console */
.boss-table { width: 100%; border-collapse: collapse; min-width: 680px; background: var(--cream); color: var(--plum); font-size: 12px; }
.boss-table th, .boss-table td { padding: 9px 8px; border-bottom: 1px solid var(--paper-deep); text-align: left; }
.boss-table th { background: var(--plum); color: var(--paper); font-size: 11px; }
.toggle-switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--paper-deep); }
.toggle-label { color: var(--ink); font-weight: 800; }
.toggle-desc { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.toggle-input { width: 46px; height: 24px; accent-color: var(--teal); }
.coin-adjust-box { padding: 12px; background: #fff0d1 !important; border: 2px dashed var(--gold) !important; }

@media (min-width: 760px) {
  body { padding-bottom: 76px; }
  .page-container { padding-top: 25px; }
  .post-card:hover, .pixel-card:hover { border-color: var(--plum); }
}

@media (max-width: 820px) {
  .pixel-header { padding: 10px 14px; }
  .header-left { gap: 10px; }
  .brand-kicker { display: none; }
  .brand { font-size: 14px; }
  .user-stats-row { gap: 5px; }
  .coin-badge, .streak-badge { font-size: 9px; }
  .office-viewport { height: 350px; }
  .login-shell { grid-template-columns: 1fr; max-width: 530px; }
  .login-art-panel { min-height: 300px; max-height: 420px; }
  .login-art { min-height: 300px; max-height: 420px; }
  .login-art-copy h2 { font-size: 27px; }
}

@media (max-width: 600px) {
  body { padding-bottom: 94px; }
  .pixel-header { align-items: flex-start; min-height: 68px; padding: 9px 10px; }
  .header-left { display: block; }
  .brand-mark { width: 34px; height: 34px; font-size: 10px; }
  .brand-lockup { gap: 7px; }
  .brand { max-width: 185px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; }
  .user-stats-row { margin-top: 5px; }
  .header-right { gap: 5px; }
  .user-pill { max-width: 112px; padding-right: 5px; }
  .user-pill > span:nth-child(2), .role-badge { display: none; }
  .music-bar { gap: 8px; padding: 6px 10px; }
  .music-title-scroll { font-size: 9px; }
  .music-playlist-btn { display: none; }
  .office-viewport { height: 305px; }
  .office-hud-left { top: 10px; left: 10px; max-width: 225px; padding: 5px 7px; font-size: 10px; }
  .office-hud-right { top: 10px; right: 10px; }
  .hud-btn { padding: 6px 8px; font-size: 10px; }
  .scene-switch-row { right: 8px; bottom: 8px; left: 8px; max-width: calc(100% - 16px); }
  .scene-pill { padding: 6px 7px; font-size: 9px; }
  .page-container { width: min(100% - 18px, 1120px); padding-top: 14px; }
  .daily-atelier { grid-template-columns: minmax(0,1fr) 112px; grid-template-areas: "copy portrait" "note note"; gap: 12px; padding: 14px; }
  .atelier-copy h1 { font-size: 24px; }
  .atelier-copy p { font-size: 12px; }
  .atelier-portrait-wrap, .atelier-portrait { min-height: 170px; }
  .atelier-stats { gap: 7px 11px; font-size: 9px; }
  .atelier-stats b { font-size: 13px; }
  .atelier-note { font-size: 11px; }
  .tab-bar { gap: 3px; margin-bottom: 14px; }
  .tab-btn { min-height: 34px; padding: 6px 3px; font-size: 10px; }
  .section-heading { font-size: 17px; }
  .section-heading small { display: none; }
  .pixel-card, .post-card { padding: 13px; }
  .emotions-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .emotion-thumb { width: 56px; height: 56px; }
  .workshop-footer { display: block; }
  .workshop-footer span { display: block; }
  .workshop-footer span + span { margin-top: 4px; }
  .modal-overlay { padding: 8px; }
  .modal-drawer { max-height: 92vh; padding: 15px; }
  .modal-header h3 { font-size: 17px; }
  .fab-punch-container { position: static; margin: 12px auto 0; pointer-events: auto; }
  .fab-punch-btn { width: calc(100% - 28px); justify-content: center; padding: 11px 12px; }
  .fab-coin-badge { margin-left: auto; }
  .login-page { padding: 16px; }
  .login-art-panel { min-height: 220px; max-height: 310px; }
  .login-art { min-height: 220px; max-height: 310px; }
  .login-art-copy { right: 13px; bottom: 13px; left: 13px; }
  .login-art-copy h2 { font-size: 22px; }
  .login-art-copy p { font-size: 11px; }
  .login-title { font-size: 23px; }
  .login-card { padding: 15px; }
  .ach-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .post-actions .action-btn { flex: 1; }
  .comment-input-row { align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card.is-failure, .login-success .login-world-portal, .login-success .portal-book, .login-success .login-shell { animation-duration: .12s !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
