/* Shared News UI primitives: the same paper, spacing and controls in each room. */
:root {
  --ui-paper: #fbfaf6;
  --ui-card: #fffefa;
  --ui-soft: #eff1e8;
  --ui-border: #dfe3d7;
  --ui-ink: #303a30;
  --ui-muted: #687260;
  --ui-accent: #53674d;
  --ui-radius: 16px;
  --ui-shadow: 0 12px 32px #303a3010;
}

/* Keep account actions beside the left-hand identity, with no duplicate menu. */
html[data-page="timeline"] .navbar { display: none; }
.navbar { justify-content: flex-start; gap: 24px; }
.account-actions { display: flex; align-items: center; }
.sign-out { align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; border: 1px solid var(--ui-border); border-radius: 8px; background: transparent; color: var(--ui-muted); font-size: 12px; line-height: 1.5; white-space: nowrap; }
.sign-out:hover { background: var(--ui-soft); }
.discovery-wordmark { margin-bottom: 12px; }
.nav-account { margin-bottom: 28px; }
.nav-account .sign-out, .nav-account .login-button { font-size: 12px; padding: 8px 12px; }
.online-presence { display: flex; align-items: center; gap: 7px; margin: 0 0 14px; color: var(--ui-muted); font-size: 12px; letter-spacing: 0; }
.online-presence[hidden] { display: none; }
.online-presence::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: #a2a89b; }
.online-presence[data-live="true"]::before { background: #6b8558; }
@media (max-width: 720px) {
  .nav-bottom { display: block; margin-top: 12px; }
  .nav-signature { display: none; }
  .online-presence { margin-bottom: 0; }
}

/* Garden and caption are separate layers; all 77 cats reuse the same stage. */
html[data-discovery-view="diary"] .diary-center { padding-top: 58px; }
.diary-heading { margin-bottom: 24px; }
.diary-writing { display: block; padding: 0; overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-card); }
.diary-yard { position: relative; width: 100%; aspect-ratio: 2 / 1; background: #f4efdf url('/static/cats/motion-v2/garden.png') center / cover no-repeat; border-radius: 0; }
.diary-yard.cat-motion-stage { border-radius: 0; }
.diary-yard-caption { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-top: 1px solid #e8e4d7; }
.diary-yard-caption > div { min-width: 0; }
.diary-writing h2 { font-size: 15px; line-height: 1.6; font-weight: 600; color: var(--ui-ink); }
.diary-writing p { font-size: 12px; color: var(--ui-muted); }
.diary-pencil { margin-left: auto; }
.maomao-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Feedback vocabulary is item scoped. Drafts require an explicit save. */
.card-feedback { border-top: 1px solid var(--ui-border); padding-top: 16px; }
.feedback-prompt { margin: 0 0 10px; font-size: 12px; color: var(--ui-muted); }
.card-feedback .card-actions { gap: 8px; }
.card-feedback .card-actions button { min-height: 40px; padding: 8px 14px; border-radius: 10px; border-color: var(--ui-border); font-size: 13px; background: var(--ui-card); }
.card-feedback button[aria-pressed="true"] { background: #e8eddf; border-color: #8b9e7c; color: #354b2e; }
.feedback-editor { margin-top: 12px; padding: 18px; border-color: var(--ui-border); border-radius: 12px; background: #f7f8f1; }
.feedback-editor-title { color: var(--ui-ink); font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.feedback-hint { color: var(--ui-muted); margin-bottom: 14px; }
.feedback-reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.feedback-reasons .feedback-chip { display: block; position: relative; min-width: 0; padding: 12px 30px 12px 12px; border-radius: 10px; text-align: left; line-height: 1.6; background: var(--ui-card); }
.feedback-reason-label { display: block; font-size: 13px; font-weight: 500; }
.feedback-reason-note { display: block; font-size: 11px; margin-top: 3px; color: var(--ui-muted); }
.feedback-chip::after { content: ''; position: absolute; top: 15px; right: 12px; width: 12px; height: 12px; border: 1px solid #a9b39e; border-radius: 4px; }
.feedback-chip[aria-pressed="true"]::after { background: var(--ui-accent); border-color: var(--ui-accent); box-shadow: inset 0 0 0 2px #e8eddf; }
.feedback-editor-actions { gap: 8px; }
.feedback-editor-actions button { min-height: 40px; padding: 8px 14px; border-radius: 8px; }
.feedback-summary { color: var(--ui-accent); }

/* The conversation is another room in the garden, not an unrelated workbench. */
html[data-page="search"] { background: var(--ui-paper); }
html[data-page="search"] body { background: var(--ui-paper); }
html[data-page="search"] .navbar { height: 68px; padding: 0 max(24px, calc((100vw - 1120px) / 2)); background: var(--ui-paper); }
html[data-page="search"] .brand { font-size: 17px; color: var(--ui-accent); }
html[data-page="search"] main { max-width: 960px; height: calc(100dvh - 68px); padding: 0 32px 20px; }
html[data-chat-version="durable"] #app-breadcrumb { min-height: 40px; flex-shrink: 0; padding: 10px 0; color: var(--ui-muted); font-size: 12px; }
html[data-chat-version="durable"] #chat-panel { overflow: hidden; }
.chat-content { display: contents; }
html[data-chat-version="durable"] .chat-heading { align-items: center; gap: 16px; padding: 14px 0 10px; }
.chat-companion-avatar { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 18px; background: #efeee3; padding: 3px; }
.chat-heading-copy { flex: 1; min-width: 0; }
.chat-heading .eyebrow { margin: 0 0 2px; font-size: 11px; color: var(--ui-muted); letter-spacing: 1px; }
html[data-chat-version="durable"] .chat-heading h1 { color: var(--ui-ink); font-size: 26px; line-height: 1.4; }
.chat-heading .chat-intro { font-size: 12px; line-height: 1.6; margin-top: 5px; color: var(--ui-muted); }
.chat-heading #chat-new { min-height: 40px; border-color: var(--ui-border); background: var(--ui-card); font-size: 12px; }
#chat-thread-title.chat-thread-caption { display: block; flex-shrink: 0; min-width: 0; margin: 0 0 12px 80px; color: var(--ui-muted); font-size: 12px; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tools { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 8px; flex-shrink: 0; margin-bottom: 12px; }
.chat-tools > details { flex: 1; min-width: 0; margin: 0; padding: 0; border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-card); color: var(--ui-muted); font-size: 12px; }
.chat-tools > details > summary { min-height: 40px; padding: 10px 14px; line-height: 1.6; }
.chat-tools > details[open] { position: static; width: auto; max-height: none; overflow: hidden; }
.chat-tools .chat-tool-body { max-height: min(230px, 25dvh); overflow: auto; overscroll-behavior: contain; padding: 0 14px 12px; }
.chat-tools > .chat-history { grid-column: 2; }
.chat-tools > details[open] > summary { border-bottom: 1px solid var(--ui-border); margin-bottom: 10px; }
#chat-thread-list { grid-template-columns: 1fr; margin: 0 10px; }
.thread-button { font-size: 12px; line-height: 1.6; padding: 9px 10px; border-radius: 8px; border-color: var(--ui-border); }
html[data-chat-version="durable"] #conversation-log { min-height: 96px; padding: 6px 24px 20px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-card); }
#conversation-log .chat-message { font-size: 15px; line-height: 1.9; margin: 22px 0 26px; }
#conversation-log .chat-message.user { max-width: 86%; margin-left: auto; padding: 11px 16px; border-radius: 14px 14px 4px 14px; background: #eef1e7; }
#conversation-log .message-role { margin-bottom: 7px; font-size: 12px; font-weight: 600; color: var(--ui-accent); }
#conversation-log .chat-empty { margin: 9vh auto; max-width: 300px; font-size: 14px; line-height: 1.9; color: var(--ui-muted); }
html[data-chat-version="durable"] .chat-composer { margin-top: 12px; padding: 12px 16px; border-color: var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-card); }
.chat-composer textarea { min-height: 48px; }
.chat-composer #chat-feedback:empty { display: none; }
.chat-composer .chat-actions { margin-top: 5px; }
.chat-composer .search-option { color: var(--ui-muted); font-size: 12px; min-height: 36px; }
.chat-composer .send-button { min-height: 38px; padding: 8px 18px; border-radius: 10px; font-size: 13px; background: var(--ui-accent); }
.chat-recall, .chat-memory-note { color: var(--ui-muted); font-size: 12px; }

@media (max-width: 720px) {
  .discovery-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
  .discovery-wordmark { min-width: 0; margin-bottom: 16px; }
  .nav-account { margin-bottom: 16px; }
  .discovery-nav nav { grid-column: 1 / -1; }
  html[data-discovery-view="diary"] .diary-center { padding-top: 24px; }
  .diary-heading { margin-bottom: 20px; }
  .diary-yard-caption { gap: 12px; padding: 14px 16px; }
  .diary-writing h2 { font-size: 14px; }
  .diary-writing p { font-size: 12px; }
  html[data-page="search"] body { display: flex; flex-direction: column; height: 100dvh; }
  html[data-page="search"] .navbar { height: auto; min-height: 60px; flex: none; flex-wrap: wrap; gap: 6px 8px; padding: 6px 12px; }
  html[data-page="search"] .navbar .account-actions { margin-left: auto; }
  html[data-page="search"] main { flex: 1; min-height: 0; width: 100%; height: auto; padding: 0 16px max(12px, env(safe-area-inset-bottom)); }
  .chat-content { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; }
  html[data-chat-version="durable"] .chat-heading { gap: 12px; padding-top: 10px; }
  .chat-companion-avatar { width: 48px; height: 48px; flex-basis: 48px; border-radius: 14px; }
  html[data-chat-version="durable"] .chat-heading h1 { font-size: 22px; }
  .chat-heading .chat-intro { display: none; }
  #chat-thread-title.chat-thread-caption { margin-left: 0; }
  .chat-heading #chat-new { padding: 8px 10px; }
  .chat-tools > details > summary { padding: 10px; font-size: 12px; }
  .chat-tools > details[open] { width: 100%; z-index: 1; }
  html[data-chat-version="durable"] #conversation-log { padding: 4px 14px 16px; }
  #conversation-log .chat-message { font-size: 14px; }
  #conversation-log .chat-message.user { max-width: 92%; }
  html[data-chat-version="durable"] .chat-composer { padding: 10px 12px; }
  .chat-composer textarea { font-size: 16px; }
  .chat-composer .send-button { min-height: 44px; }
  #interest-close { min-width: 44px; min-height: 44px; flex-shrink: 0; }
  .feedback-editor { padding: 14px; }
}
@media (max-width: 720px) and (max-height: 680px) {
  html[data-chat-version="durable"] #app-breadcrumb { height: auto; min-height: 36px; padding: 6px 0; }
  html[data-chat-version="durable"] .chat-heading { padding: 6px 0; }
  #chat-thread-title.chat-thread-caption, .chat-tools { margin-bottom: 8px; }
  #chat-discovery-context { max-height: 15dvh; padding: 8px 12px; }
  html[data-chat-version="durable"] .chat-composer { margin-top: 8px; }
}
@media (max-width: 440px) {
  .feedback-reasons { grid-template-columns: 1fr; }
}
@media (pointer: coarse) {
  .sign-out, .chat-tools > details > summary,
  .card-feedback button, .chat-composer .send-button, .chat-heading #chat-new { min-height: 44px; }
}
@media (min-width: 721px) and (max-height: 560px) {
  html[data-chat-version="durable"] #chat-panel { overflow: auto; }
  html[data-chat-version="durable"] #conversation-log { flex: none; min-height: 180px; max-height: 42dvh; }
  .chat-heading .chat-intro { display: none; }
}

/* Only verified private homes can change their own cat. */
.change-cat{display:none;align-items:center;justify-content:center;min-height:40px;padding:8px 10px;border:1px solid var(--ui-border);border-radius:8px;color:var(--ui-muted);font-size:12px;line-height:1.5;white-space:nowrap}.mml-auth[data-access="required"] .change-cat{display:inline-flex}.change-cat:hover{background:var(--ui-soft)}.account-actions{gap:6px;flex-wrap:wrap}@media(pointer:coarse){.change-cat{min-height:44px}}
