/* Memory page: "what Ta remembers", per role. Management first (on/off, the
   groups), then a place to look back (the real in-page star map, timeline,
   saved). No relationship level, score or stage. Loaded after app.css; the
   full-screen star map (PR #66) keeps its own shell rules. */

.memory-page .mp-layout { display: flex; flex-direction: column; gap: 14px; }
.memory-page .mp-aside, .memory-page .mp-main { display: contents; }
.mp-head .eyebrow { margin: 6px 0 2px; }
.mp-head h2 { margin: 0; font-size: 28px; overflow-wrap: anywhere; }
.mp-head p:not(.eyebrow) { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.mp-roles { display: flex; gap: 8px; margin: -2px -16px 0; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
.mp-roles::-webkit-scrollbar { display: none; }
.mp-role { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; max-width: 72vw; padding: 0 16px 0 6px; border: 1px solid var(--line); border-radius: 999px; color: #56524d; background: rgba(255, 255, 255, .66); font-size: 14px; }
.mp-role img { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: 50% 25%; }
.mp-role small { padding: 1px 6px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10px; }
.mp-role[aria-selected="true"] { border-color: transparent; color: #fff; background: var(--accent); }
.mp-role[aria-selected="true"] small { color: #fff; background: rgba(255, 255, 255, .2); }
.mp-role:focus-visible, .mp-tile:focus-visible, .mp-moments:focus-visible, .mp-universe:focus-visible, .mp-danger-link:focus-visible, .mp-tabs .memory-view-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mp-card { padding: 18px; border-radius: 24px; background: rgba(255, 253, 249, .92); box-shadow: 0 18px 46px -30px rgba(80, 45, 40, .45); }
.mp-card h3 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 20px; font-weight: 500; }
.mp-status { padding: 14px 18px; }
.mp-status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mp-status-label { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.mp-status > p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.mp-switch { margin: 0; }
.mp-switch input { position: relative; width: 46px; min-height: 0; height: 28px; margin: 0; padding: 0; border: 0; border-radius: 999px; appearance: none; background: #d8d4d0; cursor: pointer; transition: background .2s; }
.mp-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .24s cubic-bezier(.34, 1.56, .64, 1); }
.mp-switch input:checked { background: var(--accent); }
.mp-switch input:checked::after { transform: translateX(18px); }
.mp-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Beta full-screen star map entry (flow from PR #66). */
.mp-universe { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 68px; padding: 10px 16px 10px 10px; border: 0; border-radius: 22px; color: #eef2ff; background: linear-gradient(120deg, #0b0d1f, #251c3f 60%, #3d2335); box-shadow: 0 18px 40px -24px rgba(30, 20, 60, .8); text-align: left; }
.mp-universe[hidden] { display: none; }
.mp-universe-sky { width: 48px; height: 48px; border-radius: 15px; background: radial-gradient(circle at 30% 40%, #ffe8bd 0 2px, transparent 3px), radial-gradient(circle at 70% 30%, #cbd6ff 0 1.5px, transparent 2.5px), radial-gradient(circle at 55% 70%, #f3c3d0 0 2px, transparent 3px), radial-gradient(circle at 50% 50%, rgba(158, 135, 222, .45), rgba(10, 12, 30, .9)); }
.mp-universe strong { display: block; font-family: "Songti SC", "STSong", serif; font-size: 17px; font-weight: 500; }
.mp-universe small { color: rgba(222, 229, 255, .66); font-size: 12px; }
.mp-universe em { color: #ffe8bd; font-size: 22px; font-style: normal; }
.mp-universe:focus-visible { outline-color: #ffe8bd; }

.mp-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mp-tile { display: grid; justify-items: start; align-content: start; gap: 2px; min-height: 104px; padding: 14px 12px; border: 0; border-radius: 20px; color: var(--ink); background: rgba(255, 253, 249, .92); box-shadow: 0 14px 36px -28px rgba(80, 45, 40, .5); text-align: left; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.mp-tile:active { transform: scale(.97); }
.mp-tile strong { color: var(--accent); font-family: "Songti SC", "STSong", serif; font-size: 30px; font-weight: 500; line-height: 1.1; }
.mp-tile span { font-size: 14px; font-weight: 600; }
.mp-tile small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.mp-moments { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 10px 16px; border: 1px dashed rgba(199, 154, 77, .5); border-radius: 18px; color: var(--ink); background: rgba(255, 250, 240, .7); text-align: left; }
.mp-moments strong { display: block; font-size: 14px; font-weight: 600; }
.mp-moments small { color: var(--muted); font-size: 12px; }
.mp-moments em { color: #b0823c; font-size: 20px; font-style: normal; }

/* Look back: the real in-page star map from main, a timeline and saved. */
.mp-explorer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.memory-page .mp-tabs { margin: 0; padding: 3px; border-radius: 999px; background: rgba(245, 241, 235, .95); }
.memory-page .mp-tabs .memory-view-tab { min-width: 52px; border-radius: 999px; font-weight: 600; }
.mp-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.memory-page .mp-caption { min-height: 0; margin: 4px 0 12px; font-size: 12px; }
.memory-page .memory-star-map { border-radius: 18px; }
.memory-page .mp-timeline { gap: 8px; max-height: none; overflow: visible; }
.mp-day { margin: 8px 2px 0; color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.mp-day:first-child { margin-top: 0; }
.memory-page .memory-timeline-item { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 12px 14px; border: 0; border-left: 3px solid #d9cfc8; border-radius: 4px 16px 16px 4px; background: rgba(245, 241, 235, .75); text-align: left; }
.memory-page .memory-timeline-item.pinned { border-left-color: var(--accent); }
.memory-page .memory-timeline-item.fact { border-left-color: #8d9bc4; }
.memory-page .memory-timeline-item.moment, .memory-page .memory-timeline-item.promise { border-left-color: #c79a4d; }
.memory-page .memory-timeline-item .memory-visual-label { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .06em; }
.memory-page .memory-timeline-item strong { font-size: 15px; font-weight: 500; line-height: 1.55; white-space: normal; }
.memory-page .memory-timeline-item small { grid-column: 1; }
.memory-page .memory-timeline-item:hover, .memory-page .memory-timeline-item:focus-visible { background: #fff7f5; outline: 2px solid rgba(141, 38, 55, .3); outline-offset: 0; }

.mp-privacy p { margin: 6px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.mp-danger-link { min-height: 40px; padding: 0; border: 0; border-radius: 8px; color: #9a4a55; background: none; font-size: 13px; text-decoration: underline; text-decoration-color: rgba(154, 74, 85, .35); text-underline-offset: 4px; }
.mp-danger-link:disabled { color: var(--muted); text-decoration: none; cursor: default; opacity: .7; }

@media (min-width: 900px) {
  /* Not in the full-screen star map: that shell must stay edge to edge. */
  body:not([data-view^="memory-universe"]) .memory-page.active { max-width: 1160px; margin-inline: auto; }
  .memory-page .mp-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 0 24px; align-items: start; }
  .memory-page .mp-aside { display: grid; gap: 14px; position: sticky; top: 16px; }
  .memory-page .mp-main { display: grid; gap: 14px; }
  .mp-roles { flex-wrap: wrap; margin: 0; padding: 2px 0; }
  .memory-page .memory-star-map { min-height: 400px; }
}

@media (prefers-reduced-motion: reduce) {
  .mp-tile, .mp-switch input::after { transition: none; }
}
