/* Journal list and editor — mirrors mobile ui/journal (JournalListScreen.kt, JournalItem.kt,
   JournalAddScreen.kt, JournalTypeSelector.kt) with the mobile light theme tokens. */
.journal-page {
  --jr-primary: #00796b;
  --jr-ink: #0e2420;
  --jr-muted: #4b5f5b;
  --jr-outline: #7d908c;
  --jr-line: #dce5e3;
  --jr-surface: #fff;
  --jr-variant: #e7eeec;
  --jr-container: #ddf0ec;
  --jr-shadow: 0 1px 2px #0e24200d, 0 4px 14px #0e242008;
  font-family: Mali, system-ui, sans-serif;
  color: var(--jr-ink);
}
.journal-page h2, .journal-page h3 { font-family: Mali, system-ui, sans-serif; }
.journal-page p { margin: 0; }
.journal-page svg { width: 19px; height: 19px; flex-shrink: 0; }
.journal-page :focus-visible { outline: 2px solid var(--jr-primary); outline-offset: 2px; }
.journal-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#journal-body { min-width: 0; container: journal / inline-size; }

/* Pill buttons (PrimaryPillButton / SecondaryPillButton). */
.journal-pill { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 10px 30px; border: 0; border-radius: 999px; background: var(--jr-primary); color: #fff; font: 600 17px/1.3 Mali, system-ui, sans-serif; white-space: nowrap; cursor: pointer; }
.journal-pill:hover:not(:disabled) { background: #00665a; }
.journal-pill:disabled { opacity: .6; cursor: default; }
.journal-pill svg { width: 21px; height: 21px; }
.journal-pill.secondary { background: var(--jr-surface); color: var(--jr-ink); box-shadow: inset 0 0 0 2px var(--jr-line); }
.journal-pill.secondary:hover { background: #f3f6f5; }
.journal-pill.secondary svg { color: var(--jr-primary); }
.journal-pill.small { min-height: 44px; padding: 8px 18px; font-size: 15px; }

/* Empty / signed-out / loading states (MascotEmptyState). */
.journal-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; max-width: 420px; margin: 0 auto; padding: 56px 8px 32px; min-height: 55dvh; justify-content: center; }
.journal-empty.compact { min-height: 0; padding-top: 24px; }
.journal-empty .journal-mam { width: 190px; margin-bottom: 6px; }
.journal-empty.compact .journal-mam { width: 120px; }
.journal-empty h2 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.35; }
.journal-empty p { font-size: 16px; line-height: 1.5; color: var(--jr-muted); }
.journal-empty .journal-pill { margin-top: 12px; padding-inline: 38px; }

/* ── List (web): page head, date groups, paper-card grid ── */
.journal-list { display: grid; gap: 16px; padding-bottom: 8px; min-width: 0; }
.journal-head { display: none; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }
.journal-has-entries .journal-head { display: flex; }
.journal-summary, .journal-toolbar, .journal-list-bar { display: none !important; }
.journal-has-entries .journal-summary { display: flex !important; }
.journal-has-entries .journal-toolbar { display: flex !important; }
.journal-has-entries .journal-list-bar { display: flex !important; }
.journal-summary { flex: 1 1 280px; align-items: center; gap: 14px; min-width: 0; }
.journal-summary > div { order: 2; flex: 1; display: grid; gap: 0; min-width: 0; }
.journal-summary > div > p:first-child { display: none; }
.journal-summary > div > p:last-child { font-size: 14.5px; color: var(--jr-muted); }
.journal-summary-count { display: flex; align-items: baseline; gap: 8px; font-size: 17px; font-weight: 600; color: var(--jr-ink); }
.journal-summary-count strong { font-size: 34px; font-weight: 600; line-height: 1.15; color: var(--jr-primary); }
.journal-summary-mam { order: 1; width: 72px; flex-shrink: 0; }
.journal-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.journal-toolbar { gap: 8px; align-items: center; min-width: 0; }
.journal-search { position: relative; flex: 1; min-width: 0; width: 300px; }
.journal-search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--jr-outline); pointer-events: none; }
.journal-search input { width: 100%; min-height: 46px; padding: 10px 14px 10px 42px; border: 1px solid var(--jr-line); border-radius: 999px; background: var(--jr-surface); color: var(--jr-ink); font: 400 15px Mali, system-ui, sans-serif; }
.journal-search input:focus { outline: 2px solid var(--jr-primary); outline-offset: 0; border-color: transparent; }
.journal-refresh { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 46px; min-height: 46px; padding: 0; border: 1px solid var(--jr-line); border-radius: 999px; background: var(--jr-surface); color: var(--jr-ink); font: 600 13px Mali, system-ui, sans-serif; cursor: pointer; }
.journal-refresh span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.journal-refresh svg { width: 17px; height: 17px; color: var(--jr-primary); }
.journal-refresh:hover:not(:disabled) { background: #f3f6f5; }
.journal-refresh:disabled svg { animation: journal-spin 1s linear infinite; }
@keyframes journal-spin { to { transform: rotate(360deg); } }
.journal-list-bar .journal-pill { min-height: 46px; padding: 8px 24px 8px 20px; font-size: 16px; box-shadow: 0 2px 8px rgba(0, 121, 107, .22); }
.journal-status { font-size: 12px; color: var(--jr-muted); min-height: 0; }
.journal-status.error { color: #ba1a1a; }
.journal-list > .journal-status { padding-inline: 4px; margin-top: -4px; }
.draft-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 14px 18px; border-radius: 16px; background: var(--jr-container); color: #00413a; font-size: 14px; }
.draft-banner svg { color: var(--jr-primary); }
.draft-banner strong { margin-left: auto; color: var(--jr-primary); font-weight: 600; }
.draft-banner:hover { background: #d0eae4; }
/* Masonry columns: days flow down and across, so one-entry days never leave empty rows. */
.journal-timeline { min-width: 0; }
.journal-timeline:has(> .journal-day) { columns: 3 300px; column-gap: 24px; }
.journal-day { display: block; min-width: 0; padding-bottom: 6px; }
.journal-date { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding-top: 2px; font-size: 15px; font-weight: 600; color: var(--jr-muted); break-after: avoid; }
.journal-date::after { content: ""; flex: 1; height: 1px; background: var(--jr-line); }
.journal-day-entries { display: block; min-width: 0; }
.journal-day-entries > .journal-entry { break-inside: avoid; margin-bottom: 18px; }
/* The entry sits on its nine-slice paper; padding keeps text inside the paper's centre. */
.journal-entry { position: relative; isolation: isolate; display: block; min-width: 0; margin: 0; padding: var(--note-pad, 18px); color: var(--paper-ink, #3c4035); overflow-wrap: anywhere; transition: transform .18s; }
.journal-entry::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-style: solid; border-width: 0; border-image-source: var(--note-image); border-image-slice: var(--note-slices) fill; border-image-width: var(--note-widths); border-image-repeat: stretch; filter: drop-shadow(0 2px 4px rgba(14, 36, 32, .06)); }
.journal-entry:hover { transform: translateY(-2px) rotate(-.3deg); }
.journal-entry-body { min-width: 0; display: grid; gap: 4px; }
.entry-time { font-size: 12px; font-weight: 600; color: inherit; opacity: .6; }
.journal-content { font: 400 15.5px/1.6 Mali, system-ui, sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; color: inherit; }
.journal-bottom-bar { display: flex; gap: 10px; }

/* ── Editor (web): head actions, paper + sticky tools aside ── */
.journal-editor-layout { display: grid; gap: 20px; min-width: 0; }
.journal-editor-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.journal-editor-heading { display: grid; gap: 2px; min-width: 0; }
.journal-editor-kicker { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--jr-primary); }
.journal-editor-date { font-size: 18px; font-weight: 600; color: var(--jr-ink); }
.journal-save-row .journal-pill { min-height: 46px; padding: 8px 24px; font-size: 16px; }
.journal-save-row #journal-save { box-shadow: 0 2px 8px rgba(0, 121, 107, .22); padding-inline: 30px; }
.journal-editor-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; min-width: 0; }
.journal-editor-main { min-width: 0; }
.journal-editor-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; min-width: 0; }
@container journal (min-width: 700px) {
  .journal-editor-split { grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; }
  .journal-editor-aside { grid-template-columns: minmax(0, 1fr); }
  /* The tools column runs longer than the paper: keep the paper in view while using them. */
  .journal-editor-main { position: sticky; top: 88px; }
}
@container journal (min-width: 920px) {
  .journal-editor-split { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; }
}
.journal-tool { margin: 0; padding: 18px 20px; border: 1px solid var(--jr-line); border-radius: 20px; background: var(--jr-surface); box-shadow: var(--jr-shadow); min-width: 0; }
#journal-form { display: flex; flex-direction: column; min-width: 0; }
.mobile-paper {
  position: relative;
  isolation: isolate;
  min-height: var(--note-min-height, 0px);
}
.mobile-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-style: solid;
  border-width: 0;
  border-image-source: var(--note-image);
  border-image-slice: var(--note-slices) fill;
  border-image-width: var(--note-widths);
  border-image-repeat: stretch;
}
.paper-2 {
  --paper-color: #fcf3f2;
  --paper-border: #e7d6d3;
  --paper-rule: #e7d6d380;
}
.paper-3 {
  --paper-color: #fff;
  --paper-border: #dbe0df;
  --paper-rule: #dbe0df80;
}
.paper-4 {
  --paper-color: #f3f0f9;
  --paper-border: #dcd6e9;
  --paper-rule: #dcd6e980;
}
.paper-5 {
  --paper-color: #faeedf;
  --paper-border: #e7d2b9;
  --paper-rule: #e7d2b980;
}
.paper-6 {
  --paper-color: #fae8bb;
  --paper-border: #e4c98d;
  --paper-rule: #e4c98d80;
}
.paper-7 {
  --paper-color: #315a6c;
  --paper-border: #284d60;
  --paper-ink: #f5fcff;
  --paper-rule: #ffffff24;
}
.paper-8 {
  --paper-color: #fff4bf;
  --paper-border: #e7d990;
  --paper-rule: #e7d99080;
}
.paper-9 {
  --paper-color: #f1f5f5;
  --paper-border: #d5dfdf;
  --paper-rule: #d5dfdf80;
}
.paper { --paper-ink: #3c4035; --paper-line: #e4ddca; color: var(--paper-ink); }
.paper-7 { --paper-ink: #f5fcff; --paper-line: #a1c1ce; }
.journal-paper { display: flex; flex-direction: column; padding: 44px 40px 34px; }
.journal-paper textarea { display: block; width: 100%; height: 360px; min-height: 136px; resize: vertical; padding: 0 2px; border: 0; border-radius: 0; background: transparent; color: inherit; font: 400 17px/32px Mali, system-ui, sans-serif; }
.journal-paper textarea::placeholder { color: inherit; opacity: .6; }
.journal-paper textarea:focus { outline: 2px solid var(--paper-line); outline-offset: 6px; border-radius: 2px; }
.editor-count { display: flex; justify-content: flex-end; padding-top: 8px; font-size: 11.5px; opacity: .7; }
#journal-validation { margin-top: 8px; font-size: 13px; }
#journal-validation:empty { display: none; }
.paper-picker { min-width: 0; }
.paper-picker legend { float: left; width: 100%; padding: 0; margin-bottom: 12px; font-size: 15px; font-weight: 600; color: var(--jr-ink); }
.paper-options { clear: both; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.paper-option { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; margin: 0; border-radius: 14px; background: var(--jr-surface); box-shadow: inset 0 0 0 1px var(--jr-line); cursor: pointer; }
.paper-option-art { position: relative; width: 100%; height: 42px; }
.paper-option img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.paper-option-name { font-size: 11.5px; line-height: 1.25; text-align: center; color: var(--jr-muted); max-width: 100%; }
.paper-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.paper-option:hover { box-shadow: inset 0 0 0 1px var(--jr-outline); }
.paper-option:has(input:checked) { box-shadow: inset 0 0 0 2.5px var(--jr-primary); background: rgba(0, 121, 107, .05); }
.paper-option:has(input:checked) .paper-option-name { color: var(--jr-primary); font-weight: 600; }
.paper-option:has(input:focus-visible) { outline: 2px solid var(--jr-primary); outline-offset: 2px; }
.dictionary-panel h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.dictionary-panel h2 svg { color: var(--jr-primary); }
#dictionary-form { display: flex; flex-wrap: wrap; gap: 8px; }
#dictionary-form input { flex: 1 1 160px; min-width: 0; min-height: 44px; padding: 8px 14px; border: 1px solid var(--jr-line); border-radius: 999px; color: var(--jr-ink); font: 400 14px Mali, system-ui, sans-serif; }
/* Web: a search field with a round submit button; the label stays for assistive tech. */
#dictionary-form { flex-wrap: nowrap; }
#dictionary-form .dictionary-submit { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; }
.dictionary-submit-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#dictionary-form:has(#dictionary-feedback:not(:empty)) { flex-wrap: wrap; }
#dictionary-feedback { flex-basis: 100%; }
#dictionary-feedback:empty { display: none; }
.tool-caption { margin: 10px 0 4px !important; font-size: 12px; color: var(--jr-muted); }
.dictionary-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 18px; }
.dictionary-links button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0; border: 0; border-bottom: 1px solid #eef1ef; border-radius: 0; background: none; font: inherit; font-size: 13px; color: var(--jr-primary); text-align: left; cursor: pointer; }
.dictionary-links button:disabled { color: var(--jr-muted); cursor: default; opacity: 1; }
.dictionary-links button:not(:disabled):hover { text-decoration: underline; text-underline-offset: 4px; }
.journal-page summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.dictionary-more summary { font-size: 12.5px; color: var(--jr-muted); }
.writing-tip { padding-block: 4px; background: #eef5f2; border-color: transparent; box-shadow: none; }
.writing-tip summary { font-size: 15px; font-weight: 600; }
.writing-tip p { font-size: 13px; color: var(--jr-muted); margin-bottom: 4px; }
.writing-prompts { display: grid; padding-bottom: 8px; }
.writing-prompts button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 0; border: 0; border-bottom: 1px solid #dfe9e5; background: none; color: var(--jr-ink); font: 400 15px Mali, system-ui, sans-serif; text-align: left; cursor: pointer; }
.writing-prompts button:last-child { border-bottom: 0; }
.writing-prompts button:hover { color: var(--jr-primary); }
.journal-account-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; padding-block: 10px; font-size: 12px; color: var(--jr-muted); }
.draft-feedback { display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: auto; flex-basis: 100%; padding: 4px 0; }
.draft-indicator { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--jr-primary); }
.journal-link-button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--jr-primary); font: 600 12.5px Mali, system-ui, sans-serif; cursor: pointer; }
.journal-link-button svg { width: 15px; height: 15px; }
.journal-link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.journal-account-status #journal-status:empty { display: none; }
.journal-account-status details { position: relative; flex-basis: 100%; }
.journal-account-status details p { position: absolute; left: 0; bottom: 100%; z-index: 16; width: min(300px, 80vw); padding: 14px 16px; border: 1px solid var(--jr-line); border-radius: 14px; background: var(--jr-surface); box-shadow: 0 4px 15px rgba(14, 36, 32, .08); line-height: 1.7; }

/* The lookup sheet is the shared dictionary (dictionary.css). */

/* ── Phone (<768): mobile's single column, summary card and sticky bottom bars ── */
@media (max-width: 767px) {
  .journal-list { display: flex; flex-direction: column; gap: 12px; }
  .journal-head, .journal-has-entries .journal-head, .journal-actions { display: contents; }
  .journal-summary { order: 1; min-height: 112px; gap: 0; border: 1px solid var(--jr-line); border-radius: 20px; background: var(--jr-surface); overflow: hidden; flex: none; }
  .journal-summary > div { order: 0; padding: 18px 8px 18px 20px; gap: 2px; }
  .journal-summary > div > p:first-child { display: block; }
  .journal-summary > div > p:first-child, .journal-summary > div > p:last-child { font-size: 13px; color: var(--jr-muted); }
  .journal-summary-count { gap: 6px; font-size: 15px; font-weight: 400; color: var(--jr-muted); }
  .journal-summary-count strong { font-size: 30px; line-height: 1.2; }
  .journal-summary-mam { order: 0; width: 78px; margin: 8px 16px 8px 0; }
  .journal-toolbar { order: 2; }
  .journal-list > .journal-status { order: 3; margin-top: 0; }
  .draft-banner { order: 4; padding: 12px 16px; }
  .journal-timeline, .journal-timeline:has(> .journal-day) { order: 5; columns: auto; display: grid; gap: 8px; }
  .journal-list-bar { order: 6; }
  .journal-search { width: auto; }
  .journal-day { display: grid; gap: 8px; padding: 0; }
  .journal-date { margin: 8px 0 0 4px; font-size: 16px; padding: 0; }
  .journal-date::after { display: none; }
  .journal-day-entries { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .journal-day-entries > .journal-entry { margin: 0; }
  .journal-entry { display: flex; padding: 0; color: var(--jr-ink); border: 1px solid var(--jr-line); border-radius: 18px; background: var(--jr-surface); overflow: hidden; }
  .journal-entry:hover { transform: none; }
  .journal-entry::before { position: static; inset: auto; z-index: auto; flex: 0 0 10px; border-image: none; filter: none; background: var(--paper-strip, #fffdf0); border-right: 1px solid var(--jr-line); }
  .journal-entry-body { flex: 1; padding: 14px 16px; }
  .entry-time { color: var(--jr-outline); opacity: 1; }
  .journal-content { font-size: 16px; }

  .journal-bottom-bar { position: sticky; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 15; gap: 12px; padding: 12px; margin-top: 12px; border: 1px solid var(--jr-line); border-radius: 26px; background: rgba(255, 255, 255, .96); box-shadow: 0 6px 24px rgba(14, 36, 32, .08); }
  .journal-list-bar .journal-pill { flex: 1; min-height: 52px; font-size: 17px; box-shadow: none; }

  .journal-editor-layout { display: flex; flex-direction: column; gap: 16px; }
  .journal-editor-head, .journal-editor-split, .journal-editor-main, .journal-editor-aside { display: contents; }
  .journal-editor-kicker { display: none; }
  .journal-editor-date { font-size: 16px; color: var(--jr-muted); padding-inline: 2px; }
  .journal-save-row { order: 99; margin-top: 0; }
  .journal-save-row .journal-pill { min-height: 52px; padding-inline: 22px; font-size: 17px; }
  .journal-save-row #journal-save { flex: 1; box-shadow: none; }
  .journal-tool { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .paper-picker legend { font-size: 15px; color: var(--jr-muted); margin-bottom: 10px; }
  .paper-options { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
  .paper-option { display: grid; place-items: center; height: 48px; padding: 4px; border-radius: 10px; }
  .paper-option-art { position: absolute; inset: 4px; width: auto; height: auto; }
  .paper-option:has(input:checked) { box-shadow: inset 0 0 0 3px var(--jr-primary); background: var(--jr-surface); }
  .paper-option-name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .dictionary-panel { padding: 16px 18px; border: 1px solid var(--jr-line); border-radius: 20px; background: var(--jr-surface); }
  .dictionary-panel h2 { font-size: 16px; }
  .dictionary-panel input { font-size: 16px !important; }
  #dictionary-form { flex-wrap: wrap; }
  #dictionary-form .dictionary-submit { flex: 0 0 auto; width: auto; padding-inline: 18px; gap: 10px; }
  .dictionary-submit-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .dictionary-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .writing-tip { padding: 2px 18px; border-radius: 20px; background: #eef5f2; }
  .writing-tip summary { font-size: 14px; }
  .journal-account-status { padding: 0 2px; }
  .draft-feedback { flex-basis: auto; padding: 0; }
  .journal-account-status details { flex-basis: auto; }
}
@media (max-width: 620px) {
  .journal-paper { padding: 36px 28px 26px; }
  .journal-paper textarea { height: 300px; font-size: 16px; line-height: 30px; }
  .paper-options { gap: 4px; }
  .paper-option { height: 44px; }
  .paper-option-art { inset: 3px; }
  .journal-refresh span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .journal-refresh { width: 46px; padding: 0; justify-content: center; }
  .journal-bottom-bar { padding: 10px; gap: 8px; border-radius: 24px; }
  .journal-save-row .journal-pill { padding-inline: 16px; font-size: 16px; }
  .journal-empty { padding-top: 32px; min-height: 60dvh; }
  .journal-empty .journal-mam { width: 170px; }
  .journal-summary-mam { width: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  .journal-refresh:disabled svg { animation: none; }
  .journal-entry:hover { transform: none; }
}
