/* Mood backgrounds in a one-to-one chat (message-moods.js). The other person's mood is drawn
   behind the messages: only the figure (a cut-out on a transparent canvas), at full strength, at the
   lower left just above the composer, not scrolling with the messages, over the chat's own normal
   background in either theme. Loaded after message-glass.css so its surfaces win. */
.jm-conversation.jm-mood-able .jm-history{touch-action:manipulation}   /* a double tap is ours, never a zoom */
.jm-conversation.jm-mood-able .jm-day{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
body .jm-workbench .jm-conversation.jm-has-mood .jm-history,.jmm-preview{
  background-image:var(--jm-mood-image);
  background-repeat:no-repeat;
  background-attachment:scroll;
  background-position:left 0 bottom var(--jm-mood-lift,0px);
  background-size:auto var(--jm-mood-h,480px)
}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood .jm-bubble:not(.mine){background:rgba(58,58,64,.78);color:#f5f5f7}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood .jm-bubble:not(.mine) :is(time,.jm-message-meta,.jm-stamp){color:#f0f0f4}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood :is(.jm-day,.jm-history-empty){align-self:center;padding:3px 10px;border-radius:999px;background:#3a3a40;color:#d8d8de}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood :is(.jm-compose-box,.jm-reply-bar,.jm-edit-bar,[data-new-messages],.jm-compose>.jm-typing){background:#2f2f34}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood .jm-compose-box::before{backdrop-filter:none;-webkit-backdrop-filter:none}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood [data-new-messages]{border-radius:999px;box-shadow:0 2px 8px #0006}
:root[data-theme=dark] body .jm-workbench .jm-conversation.jm-has-mood .jm-quote{background:#2c2c31}

/* Your own mood: a small opaque pill just above the composer at the right, placed by message-moods.js. */
.jm-conversation{position:relative}
.jm-conversation.jm-has-pill .jm-history>:last-child{margin-bottom:var(--jm-mood-pill-space,48px)}
.jmm-pill{position:absolute;right:16px;bottom:72px;z-index:6;display:inline-flex;align-items:center;gap:8px;max-width:calc(100% - 32px);min-height:40px;padding:5px 14px 5px 6px;border:1px solid #e2d8cb;border-radius:999px;background:#fffaf3;color:#1c1c1e;font:inherit;font-size:.78rem;line-height:1.2;box-shadow:0 4px 14px #0002;cursor:pointer}
.jmm-pill img{width:28px;height:28px;min-width:28px;border-radius:50%;object-fit:cover;background:#f6ede2}
.jmm-pill span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.jmm-pill:hover{border-color:var(--theme-accent,#08796f)}
.jmm-pill:focus{outline:2px solid var(--theme-accent,#08796f);outline-offset:2px}
.jmm-pill:focus:not(:focus-visible){outline:none}
:root[data-theme=dark] .jmm-pill{background:#34343a;border-color:#4a4a52;color:#f5f5f7;box-shadow:0 4px 14px #0007}
@media(max-width:420px){.jmm-pill{right:10px;max-width:calc(100% - 20px)}}

/* While a mood shows, the bubbles are translucent so the picture reads through them, never blurred
   (a blur would smear it); everything else on it is opaque. Incoming bubbles are white (or grey in
   the dark look) at about three quarters. Your own keep the accent at 72% over a 12% dark layer,
   the accent drawn on ::before because a translucent copy of a chosen colour needs color-mix().
   About a quarter of the figure shows through; over its lightest parts white text measures about
   3.7:1 against the usual 4.0:1 of an accent bubble, so it carries a faint shadow. The owner asked
   for the picture to stay visible behind the text; this is that trade. */
body .jm-workbench .jm-conversation.jm-has-mood .jm-bubble{-webkit-backdrop-filter:none;backdrop-filter:none}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood .jm-bubble:not(.mine){background:rgba(255,255,255,.72);color:#1c1c1e}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood .jm-bubble:not(.mine) :is(time,.jm-message-meta,.jm-stamp){color:#44444a}
body.jm-immersive .jm-workbench .jm-conversation.jm-has-mood .jm-bubble.mine{isolation:isolate;background:rgba(0,0,0,.12);color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.45)}
body.jm-immersive .jm-workbench .jm-conversation.jm-has-mood .jm-bubble.mine::before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1;border-radius:inherit;background:var(--rv-accent,#007aff);opacity:.72;pointer-events:none}
body.jm-immersive .jm-workbench .jm-conversation.jm-has-mood .jm-bubble.mine :is(time,.jm-message-meta,.jm-stamp,small){color:#fff}
:root:not([data-theme=dark]) body:not(.jm-immersive) .jm-workbench .jm-conversation.jm-has-mood .jm-bubble.mine{background:rgba(228,241,235,.78)}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood :is(.jm-day,.jm-history-empty){align-self:center;padding:3px 10px;border-radius:999px;background:#fff;color:#4a4a50}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood :is(.jm-compose-box,.jm-reply-bar,.jm-edit-bar,[data-new-messages],.jm-compose>.jm-typing){background:#fff}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood .jm-compose-box::before{backdrop-filter:none;-webkit-backdrop-filter:none}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood [data-new-messages]{border-radius:999px;box-shadow:0 2px 8px #0002}
:root:not([data-theme=dark]) body .jm-workbench .jm-conversation.jm-has-mood .jm-quote{background:#f3f3f5}

/* ---- The picker: a bottom sheet on a phone, a centred dialog on a wide screen ---- */
.jmm-backdrop{position:fixed;left:0;right:0;top:var(--jm-viewport-top,0px);height:100vh;height:var(--jm-viewport-height,100dvh);z-index:130;display:flex;align-items:flex-end;justify-content:center;background:#0f1b2466;box-sizing:border-box}
.jmm-sheet{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-height:min(92%,100%);border-radius:18px 18px 0 0;background:var(--theme-surface,var(--paper,#fff));color:var(--ink,#1c1c1e);box-shadow:0 -10px 40px #0003;padding-bottom:env(safe-area-inset-bottom,0px);overflow:hidden}
@media(min-width:720px) and (min-height:480px){
  .jmm-backdrop{align-items:center;padding:24px}
  .jmm-sheet{width:min(600px,100%);max-height:min(760px,100%);border-radius:18px;box-shadow:0 20px 60px #0004}
}
.jmm-head{display:flex;align-items:center;gap:6px;padding:10px 10px 6px;flex-shrink:0}
.jmm-head h3{flex:1;min-width:0;margin:0;padding:0 6px;font-size:1.05rem;line-height:1.3;overflow-wrap:break-word}
.jmm-head h3:focus{outline:none}
.jmm-head .jm-icon{flex-shrink:0}
.jmm-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding:4px 16px 16px}
.jmm-help{margin:0 0 12px;font-size:.84rem;line-height:1.5;color:var(--muted,#5b5b60)}
.jmm-groups{display:grid;grid-template-columns:repeat(2,minmax(0,220px));gap:10px}
.jmm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px}
.jmm-phrases{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.jmm-tile{display:flex;flex-direction:column;align-items:stretch;gap:6px;min-width:0;padding:6px 6px 10px;border:1px solid var(--theme-border,#d8d4cc);border-radius:14px;background:#fdf6ee;color:#1c1c1e;font:inherit;text-align:left;cursor:pointer}
.jmm-tile:hover{border-color:var(--theme-accent,#08796f)}
.jmm-tile:focus{outline:2px solid var(--theme-accent,#08796f);outline-offset:2px}
.jmm-tile:focus:not(:focus-visible){outline:none}
.jmm-tile img{display:block;width:100%;height:auto;border-radius:10px;object-fit:cover;background:#f6ede2}
/* The full phrase wraps; it is never cut short. */
.jmm-tile-text{display:grid;gap:2px;padding:0 4px;min-width:0;overflow-wrap:anywhere;white-space:normal}
.jmm-tile-text b{font-size:.86rem;line-height:1.35;font-weight:650}
.jmm-tile-text small{font-size:.76rem;line-height:1.4;color:#5b5b60}
.jmm-current{display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px 12px;align-items:center;margin:0 0 14px;padding:10px;border-radius:14px;background:#fdf6ee;color:#1c1c1e;border:1px solid var(--theme-border,#d8d4cc)}
.jmm-current img{width:72px;height:72px;border-radius:10px;object-fit:cover}
.jmm-current>div:first-of-type{display:grid;gap:2px;min-width:0;overflow-wrap:anywhere}
.jmm-current small{font-size:.74rem;color:#5b5b60}
.jmm-current strong{font-size:.92rem;line-height:1.35}
.jmm-current-note{font-size:.8rem;font-style:italic}
.jmm-current-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.jmm-preview{position:relative;display:flex;flex-direction:column;justify-content:flex-start;gap:8px;height:clamp(220px,46vh,380px);padding:12px;margin:0 0 12px;border-radius:14px;overflow:hidden;border:1px solid var(--theme-border,#e2ded7);background-color:var(--rv-window,#f4f6f9);background-size:auto 100%;background-position:left bottom}
/* The sample bubbles are translucent exactly like the chat's while a mood shows. */
.jmm-preview .jm-bubble{max-width:80%;min-width:0;padding:8px 12px;border-radius:12px 12px 12px 3px;align-self:flex-start;background:rgba(255,255,255,.72);color:#1c1c1e;-webkit-backdrop-filter:none;backdrop-filter:none}
.jmm-preview .jm-bubble.mine{position:relative;isolation:isolate;align-self:flex-end;border-radius:12px 12px 3px 12px;background:rgba(0,0,0,.12);color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.45)}
.jmm-preview .jm-bubble.mine::before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;z-index:-1;border-radius:inherit;background:var(--rv-accent,#007aff);opacity:.72;pointer-events:none}
:root[data-theme=dark] .jmm-preview .jm-bubble:not(.mine){background:rgba(58,58,64,.78);color:#f5f5f7}
.jmm-preview .jm-message-body{font-size:.86rem;line-height:1.5;white-space:normal}
.jmm-phrase{display:grid;gap:2px;margin:0 0 12px;overflow-wrap:anywhere}
.jmm-phrase strong{font-size:1rem;line-height:1.4}
.jmm-phrase small{font-size:.78rem;color:var(--muted,#5b5b60)}
/* The illustration and duration choices: the radio is invisible over its pill, and the pill is the
   span after it, so the chosen look needs no :has() (older iOS and Android WebViews lack it). */
.jmm-choice{margin:0 0 4px;padding:0;border:0;min-width:0;display:flex;flex-wrap:wrap}
.jmm-choice legend{width:100%;padding:0;margin:0 0 6px;font-size:.84rem;font-weight:650}
.jmm-choice label{position:relative;display:inline-block;margin:0 8px 8px 0;cursor:pointer}
.jmm-choice input{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;margin:0;cursor:pointer;z-index:1}
.jmm-choice input+span{display:flex;align-items:center;min-height:44px;box-sizing:border-box;padding:0 16px;border:2px solid #cfc7bb;border-radius:999px;background:#fff;color:#1c1c1e;font-size:.86rem;line-height:1.2}
.jmm-choice input:checked+span{border-color:#08796f;border-color:var(--theme-accent,#08796f);background:#08796f;background:var(--theme-accent,#08796f);color:#fff;font-weight:650}
.jmm-choice input:checked+span::before{content:"\2713";margin-right:6px;font-weight:700}
.jmm-choice input:focus+span{outline:3px solid #f0a500;outline-offset:2px}
.jmm-choice input:focus:not(:focus-visible)+span{outline:none}
/* The illustration switch while browsing: under the title, outside the scrolling list. */
.jmm-browse-figures{flex-shrink:0;align-items:center;margin:0;padding:0 16px 2px}
.jmm-browse-figures[hidden]{display:none}
/* Love & romance: the 12 family names as chips that stay above the list (outside the scrolling
   body) and scroll sideways on a phone; each jumps to its family's heading. */
.jmm-jumps{flex-shrink:0;display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding:2px 16px 8px;scrollbar-width:thin}
.jmm-jumps[hidden]{display:none}
.jmm-jump{flex:none;margin:0 6px 0 0;min-height:36px;padding:0 12px;border:1px solid #cfc7bb;border-radius:999px;background:#fff;color:#1c1c1e;font:inherit;font-size:.8rem;white-space:nowrap;cursor:pointer}
.jmm-jump:hover{border-color:#08796f}
.jmm-jump:focus{outline:2px solid #08796f;outline-offset:2px}
.jmm-jump:focus:not(:focus-visible){outline:none}
:root[data-theme=dark] .jmm-jump{background:#34343a;border-color:#5a5a62;color:#f5f5f7}
.jmm-family{margin:0 0 14px}
.jmm-family h4{margin:6px 0 8px;font-size:.92rem;line-height:1.3;font-weight:700}
.jmm-family h4:focus{outline:none;text-decoration:underline;text-underline-offset:3px}
.jmm-browse-figures legend{float:left;width:auto;margin:0 10px 8px 0;line-height:44px;font-weight:600}
:root[data-theme=dark] .jmm-choice input+span{background:#34343a;border-color:#5a5a62;color:#f5f5f7}
:root[data-theme=dark] .jmm-choice input:checked+span{background:#2aa08f;border-color:#2aa08f;color:#0d1f1c}
.jmm-note{display:grid;gap:4px;margin:0 0 12px;font-size:.84rem;font-weight:650}
#main-content .jmm-note input,.jmm-note input{width:100%;box-sizing:border-box;min-height:42px;font:inherit;font-size:16px;font-weight:400;padding:8px 12px;border-radius:10px}
.jmm-note small{font-weight:400;font-size:.74rem;color:var(--muted,#5b5b60)}
.jmm-foot{flex-shrink:0;padding:10px 16px 14px;border-top:1px solid var(--theme-border,#e2ded7);background:inherit}
.jmm-expiry{margin:0 0 6px;font-size:.82rem;line-height:1.45;overflow-wrap:anywhere}
.jmm-error{margin:0;font-size:.82rem;color:var(--theme-danger,#bb3d36);overflow-wrap:anywhere}
.jmm-error:empty{display:none}
.jmm-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;margin-top:8px}
.jmm-share{max-width:100%;white-space:normal;overflow-wrap:anywhere;text-align:center}
/* A short landscape phone: the preview gives the controls room. */
@media(max-height:480px){.jmm-preview{height:180px}.jmm-sheet{max-height:100%;border-radius:0}.jmm-head{padding-top:4px}}
/* About this background */
.jmm-facts{display:grid;gap:8px;margin:0 0 16px}
.jmm-facts div{display:grid;grid-template-columns:minmax(90px,auto) minmax(0,1fr);gap:10px;font-size:.86rem}
.jmm-facts dt{color:var(--muted,#5b5b60)}
.jmm-facts dd{margin:0;overflow-wrap:anywhere}
.jmm-switch{display:flex;gap:10px;align-items:flex-start;margin:0 0 16px;font-size:.86rem;cursor:pointer}
.jmm-switch input{margin-top:3px;width:auto}
.jmm-switch small{display:block;font-size:.76rem;color:var(--muted,#5b5b60)}
/* The dark look: the sheet follows it; tiles keep their paper so the faces read. */
:root[data-theme=dark] .jmm-sheet{background:#26262a;color:#f5f5f7}
:root[data-theme=dark] :is(.jmm-help,.jmm-phrase small,.jmm-note small,.jmm-facts dt,.jmm-switch small){color:#b9b9c0}
@media(prefers-reduced-motion:no-preference){.jmm-sheet{animation:jmm-rise .22s cubic-bezier(.2,.8,.2,1)}}
@keyframes jmm-rise{from{transform:translateY(16px);opacity:.6}to{transform:none;opacity:1}}
