:root {
  color-scheme: light;
  --ink: #172044;
  --ink-soft: #5c657d;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef1f7;
  --line: #dfe3ec;
  --line-strong: #c6ccda;
  --accent: #ef684d;
  --accent-dark: #d94f36;
  --accent-pale: #fff0ec;
  --focus: #4667ff;
  --danger: #b93838;
  --joy: #f5b82e;
  --anger: #e34d4d;
  --sadness: #3b82f6;
  --fun: #22a06b;
  --shadow: 0 22px 60px rgba(23, 32, 68, .16);
  --base-size: 16px;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f4fb;
  --ink-soft: #b2bad0;
  --paper: #0e142a;
  --surface: #18203b;
  --surface-soft: #212a49;
  --line: #323c5e;
  --line-strong: #465272;
  --accent-pale: #3f2930;
  --shadow: 0 22px 60px rgba(0, 0, 0, .38);
}

:root[data-font-size="large"] { --base-size: 18px; }
:root[data-font-size="xlarge"] { --base-size: 20px; }
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); font-size: var(--base-size); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(23,32,68,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,32,68,.025) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 150; padding: .7rem 1rem; background: var(--ink); color: var(--surface); border-radius: .5rem; }
.skip-link:focus { top: 1rem; }
.app-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding: 2rem 1.2rem 1.5rem;
  background: #172044;
  color: white;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .45rem; font-size: 1.28rem; font-weight: 800; letter-spacing: .045em; }
.brand-mascot { width: 3.25rem; height: 3.25rem; object-fit: contain; filter: drop-shadow(0 5px 9px rgba(0,0,0,.2)); }
.nav-list { display: grid; gap: .45rem; }
.nav-item { display: grid; grid-template-columns: 1.5rem 1fr auto; align-items: center; gap: .8rem; width: 100%; min-height: 3rem; padding: .65rem .8rem; border: 0; border-radius: .7rem; color: #dbe0f3; background: transparent; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item .nav-icon { text-align: center; font-size: 1.2rem; }
.nav-item.is-active { background: rgba(255,255,255,.12); color: white; font-weight: 700; }
.nav-count { min-width: 1.6rem; padding: .08rem .38rem; border-radius: 1rem; background: rgba(255,255,255,.12); font-size: .72rem; text-align: center; }
.privacy-note { margin: auto 0 0; padding: 1rem .7rem 0; border-top: 1px solid rgba(255,255,255,.13); color: #aeb7d0; font-size: .78rem; line-height: 1.55; }
.privacy-note span { color: #64d9b0; }

.workspace { width: min(100%, 76rem); margin: 0 auto; padding: 2.7rem clamp(1.4rem, 4.5vw, 4.2rem); }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; }
.eyebrow { margin: 0 0 .2rem; color: var(--accent-dark); font-size: .74rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 2.85rem); line-height: 1.22; letter-spacing: -.04em; }
h2 { line-height: 1.35; }

.primary-button, .secondary-button, .text-button, .icon-button, .filter-button, .danger-button, .danger-text-button, .favorite-button {
  border: 0;
  border-radius: .65rem;
  min-height: 2.8rem;
}
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1.15rem; background: var(--accent); color: white; font-weight: 800; box-shadow: 0 8px 20px rgba(239,104,77,.23); }
.primary-button:hover { background: var(--accent-dark); }
.primary-button span { font-size: 1.25rem; line-height: 1; }
.secondary-button, .filter-button { padding: .65rem 1rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 700; }
.secondary-button:hover, .filter-button:hover { background: var(--surface-soft); }
.text-button, .danger-text-button { padding: .5rem .2rem; background: transparent; color: var(--accent-dark); font-weight: 800; }
.text-button:hover, .danger-text-button:hover { text-decoration: underline; }
.danger-text-button { color: var(--danger); }
.icon-button, .favorite-button { width: 2.8rem; padding: 0; background: transparent; color: var(--ink-soft); font-size: 1.8rem; }
.favorite-button { font-size: 1.65rem; }
.favorite-button[aria-pressed="true"] { color: var(--accent); }
.danger-button { padding: .65rem 1rem; background: var(--danger); color: white; font-weight: 800; }
.dialog-spacer { flex: 1; }

.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; margin-top: 2rem; }
.search-box { min-height: 3rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .65rem; padding: 0 .9rem; border: 1px solid var(--line-strong); border-radius: .72rem; background: var(--surface); box-shadow: 0 6px 20px rgba(23,32,68,.04); }
.search-box:focus-within { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 20%, transparent); }
.search-box > span[aria-hidden] { font-size: 1.35rem; transform: rotate(-15deg); color: var(--ink-soft); }
.search-box input { min-width: 0; border: 0; outline: 0; background: transparent; }
.search-box kbd { padding: .1rem .45rem; border: 1px solid var(--line); border-radius: .35rem; color: var(--ink-soft); background: var(--surface-soft); font-size: .72rem; }
.filter-button { display: flex; align-items: center; gap: .45rem; }
.filter-badge { min-width: 1.35rem; padding: .02rem .3rem; border-radius: 1rem; background: var(--accent); color: white; font-size: .7rem; }
.filter-panel { display: grid; grid-template-columns: repeat(5, minmax(7rem, 1fr)) auto; align-items: end; gap: .8rem; margin-top: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); }
.filter-panel label { display: grid; gap: .25rem; color: var(--ink-soft); font-size: .875rem; font-weight: 700; }
.filter-panel select, .filter-panel input, .compact-select select { width: 100%; min-height: 2.45rem; padding: .4rem .5rem; border: 1px solid var(--line-strong); border-radius: .45rem; background: var(--surface); }
.summary-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; padding: .65rem .9rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.summary-strip div { display: flex; align-items: baseline; gap: .38rem; }
.summary-strip strong { color: var(--ink); font-size: 1.3rem; }
.summary-strip span, .summary-strip p { margin: 0; font-size: .86rem; }

.records-panel { min-height: 29rem; border: 1px solid var(--line); border-radius: 1rem; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: 0 12px 35px rgba(23,32,68,.055); overflow: hidden; }
.empty-state { display: grid; place-items: center; align-content: center; min-height: 29rem; padding: 3rem 1.5rem; text-align: center; }
.empty-state h2 { margin: 1.5rem 0 .45rem; font-size: 1.2rem; }
.empty-state p { max-width: 28rem; margin-bottom: .55rem; color: var(--ink-soft); }
.empty-box { position: relative; width: 6rem; height: 4.4rem; border: 2px solid var(--ink); border-radius: .45rem .45rem .8rem .8rem; background: var(--surface-soft); box-shadow: 9px 9px 0 var(--accent-pale); }
.empty-box::before { content: ""; position: absolute; left: -.45rem; right: -.45rem; top: -.8rem; height: 1rem; border: 2px solid var(--ink); border-radius: .35rem; background: var(--surface); }
.empty-box span { font-family: Georgia, serif; font-size: 2.8rem; line-height: 1; color: var(--accent); }
.record-list { list-style: none; margin: 0; padding: 0; }
.record-item { border-bottom: 1px solid var(--line); }
.record-item:last-child { border-bottom: 0; }
.record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; width: 100%; min-height: 4.65rem; padding: .8rem 1rem .8rem 1.35rem; border: 0; background: transparent; color: var(--ink); text-align: left; }
.record-row:hover { background: var(--surface-soft); }
.record-content { min-width: 0; display: flex; align-items: center; gap: .8rem; }
.record-copy { min-width: 0; flex: 1; }
.record-photo { width: 3.25rem; height: 3.25rem; flex: 0 0 auto; border-radius: .55rem; object-fit: cover; border: 1px solid var(--line); background: var(--surface-soft); }
.record-copy blockquote { margin: 0; font-size: 1.03rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-meta { display: flex; align-items: center; gap: .55rem; min-width: 0; margin-top: .18rem; color: var(--ink-soft); font-size: .76rem; }
.record-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiny-tags { display: flex; gap: .25rem; flex-shrink: 0; }
.tiny-tag { padding: .08rem .38rem; border-radius: 2rem; background: var(--surface-soft); color: var(--ink-soft); font-size: .66rem; }
.emotion-faces { display: flex; gap: .25rem; flex-shrink: 0; }
.emotion-mini-face { width: 1.2rem; height: 1.2rem; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; font-style: normal; font-size: .86rem; font-weight: 900; line-height: 1; }
.emotion-mini-face.joy { background: var(--joy); color: #4b3300; }
.emotion-mini-face.anger { background: var(--anger); }
.emotion-mini-face.sadness { background: var(--sadness); }
.emotion-mini-face.fun { background: var(--fun); }
.row-favorite { color: var(--accent); font-size: 1.15rem; }
.record-stamp { display: grid; min-width: 3.25rem; padding: .42rem .5rem; border: 1px solid var(--line); border-radius: .5rem; text-align: center; line-height: 1.15; }
.record-stamp strong { font-size: 1rem; }
.record-stamp span { color: var(--ink-soft); font-size: .65rem; }

.mobile-nav { display: none; }
dialog { color: var(--ink); }
.record-dialog, .detail-dialog, .settings-dialog { width: min(46rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 1rem; background: var(--surface); box-shadow: var(--shadow); }
.settings-dialog { width: min(43rem, calc(100% - 2rem)); }
dialog::backdrop { background: rgba(12,18,40,.64); backdrop-filter: blur(3px); }
.dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.15rem 1.4rem; }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 1.35rem; }
.dialog-header .eyebrow { margin: 0; }
.header-actions { display: flex; gap: .25rem; }
.dialog-footer { border-top: 1px solid var(--line); }
.dialog-body { display: grid; gap: 1rem; padding: 1.35rem 1.4rem; overflow: auto; max-height: calc(100vh - 10rem); }
.field { display: grid; gap: .35rem; min-width: 0; font-weight: 700; }
.field > span { font-size: .875rem; }
.field em { margin-left: .3rem; color: var(--accent-dark); font-style: normal; font-size: .7rem; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: .55rem; padding: .68rem .8rem; background: var(--surface); resize: vertical; }
.field textarea:focus, .field input:focus, select:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 22%, transparent); }
.quote-field textarea { font-size: 1.08rem; line-height: 1.7; }
.field small { justify-self: end; color: var(--ink-soft); font-weight: 400; font-size: .7rem; }
.photo-field { display: grid; gap: .55rem; padding: .9rem; border: 1px solid var(--line); border-radius: .65rem; }
.photo-field-heading, .photo-picker-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.photo-field-heading > span { font-size: .875rem; font-weight: 800; }
.photo-field-heading small, .photo-picker-row small, .photo-status { color: var(--ink-soft); font-size: .72rem; }
.photo-select-button { cursor: pointer; }
.photo-preview { margin: .2rem 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: .7rem; background: var(--surface-soft); }
.photo-preview img { display: block; width: 100%; max-height: 18rem; object-fit: contain; background: #10162b; }
.photo-preview figcaption { min-height: 3rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .45rem .75rem; }
.photo-preview figcaption span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-size: .75rem; }
.photo-status { min-height: 1.15rem; margin: 0; }
.tag-catalog { margin-top: -.3rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface-soft); }
.tag-catalog summary { cursor: pointer; color: var(--ink-soft); font-size: .8rem; font-weight: 800; }
.tag-catalog-options { display: flex; flex-wrap: wrap; gap: .38rem; max-height: 11rem; margin-top: .7rem; overflow: auto; }
.tag-catalog-options button { min-height: 2rem; padding: .25rem .55rem; border: 1px solid var(--line-strong); border-radius: 2rem; background: var(--surface); color: var(--ink-soft); font-size: .72rem; }
.tag-catalog-options button:hover { border-color: var(--accent); color: var(--accent-dark); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-error { margin: 0; padding: .7rem .85rem; border-radius: .5rem; background: #fff0f0; color: #a92c2c; font-weight: 700; }
.emotion-fieldset { margin: 0; padding: .85rem; border: 1px solid var(--line); border-radius: .65rem; }
.emotion-fieldset legend { padding: 0 .3rem; font-size: .875rem; font-weight: 800; }
.emotion-fieldset legend small { margin-left: .3rem; color: var(--ink-soft); font-weight: 400; }
.emotion-sliders { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.emotion { display: grid; gap: .25rem; min-width: 0; }
.emotion > span { display: flex; justify-content: space-between; align-items: center; }
.emotion .emotion-face { width: 2.15rem; height: 2.15rem; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 1.25rem; line-height: 1; }
.emotion.joy .emotion-face { background: var(--joy); color: #4b3300; }.emotion.anger .emotion-face { background: var(--anger); }.emotion.sadness .emotion-face { background: var(--sadness); }.emotion.fun .emotion-face { background: var(--fun); }
.emotion output { font-weight: 800; }
.emotion input { width: 100%; accent-color: var(--ink); }

.detail-body { padding: clamp(1.5rem, 4vw, 2.5rem); overflow: auto; max-height: calc(100vh - 9rem); }
.detail-body blockquote { position: relative; margin: .5rem 0 1rem; padding-left: 1.5rem; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(1.55rem, 4vw, 2.3rem); font-weight: 700; line-height: 1.65; }
.detail-body blockquote::before { content: "“"; position: absolute; left: -.1rem; top: -.25rem; color: var(--accent); font-family: Georgia, serif; font-size: 2.5rem; }
.detail-speaker { color: var(--ink-soft); font-weight: 700; }
.detail-photo { margin: 1.1rem 0; overflow: hidden; border-radius: .8rem; border: 1px solid var(--line); background: var(--surface-soft); }
.detail-photo img { display: block; width: 100%; max-height: 28rem; object-fit: contain; background: #10162b; }
.detail-photo figcaption { padding: .45rem .7rem; color: var(--ink-soft); font-size: .72rem; }
.detail-emotions { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.25rem 0; }
.emotion-pill, .tag { display: inline-flex; align-items: center; gap: .28rem; padding: .3rem .58rem; border-radius: 2rem; background: var(--surface-soft); font-size: .76rem; font-weight: 700; }
.emotion-pill .emotion-mini-face { width: 1.35rem; height: 1.35rem; font-size: .9rem; }
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.3rem; margin: 1.3rem 0; }
.detail-meta div { padding-top: .6rem; border-top: 1px solid var(--line); }
.detail-meta dt { color: var(--ink-soft); font-size: .72rem; font-weight: 700; }
.detail-meta dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.detail-meta a { color: var(--focus); }
.detail-note { margin-top: 1.2rem; padding: 1rem; border-left: 3px solid var(--accent); background: var(--accent-pale); border-radius: 0 .55rem .55rem 0; }
.detail-note h3 { margin: 0 0 .25rem; font-size: .78rem; }
.detail-note p { margin: 0; white-space: pre-wrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; }

.reflection-view { margin-top: 2rem; }
.reflection-card { position: relative; min-height: 20rem; display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 6vw, 4rem); overflow: hidden; border-radius: 1rem; background: #172044; color: white; box-shadow: var(--shadow); }
.reflection-card::after { content: "“"; position: absolute; right: 2rem; top: -3rem; color: rgba(255,255,255,.055); font-family: Georgia, serif; font-size: 15rem; line-height: 1; }
.reflection-label { color: #bac2d9; font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.reflection-card blockquote { z-index: 1; max-width: 48rem; margin: 1.1rem 0 .8rem; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(1.55rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.65; }
.reflection-card > p { color: #bac2d9; }
.reflection-actions { display: flex; align-items: center; gap: 1rem; margin-top: .5rem; }
.reflection-card .secondary-button { border-color: rgba(255,255,255,.35); background: transparent; color: white; }
.reflection-card .text-button { color: #ff9e8a; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin: 2.2rem 0 .9rem; }
.section-heading h2 { margin: 0; }
.compact-select { display: grid; grid-template-columns: auto 8rem; align-items: center; gap: .5rem; color: var(--ink-soft); font-size: .76rem; font-weight: 700; }
.insight-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1rem; }
.insight-card { min-height: 13rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); }
.insight-card h3 { margin-bottom: 1rem; font-size: .9rem; }
.bar-chart { display: grid; gap: .65rem; }
.bar-row { display: grid; grid-template-columns: 1.35rem 1fr 2rem; align-items: center; gap: .5rem; font-size: .75rem; }
.bar-track { height: .55rem; overflow: hidden; border-radius: 1rem; background: var(--surface-soft); }
.bar-fill { height: 100%; border-radius: inherit; }
.bar-fill.joy { background: var(--joy); }.bar-fill.anger { background: var(--anger); }.bar-fill.sadness { background: var(--sadness); }.bar-fill.fun { background: var(--fun); }
.tag-cloud { display: flex; flex-wrap: wrap; align-content: start; gap: .45rem; }
.ranking { margin: 0; padding-left: 1.5rem; }
.ranking li { padding: .25rem 0; border-bottom: 1px solid var(--line); }
.insight-empty { color: var(--ink-soft); font-size: .82rem; }

.settings-body { max-height: calc(100vh - 7rem); overflow: auto; padding: 0 1.4rem 1.4rem; }
.settings-body section { padding-top: 1.2rem; }
.settings-body h3 { margin-bottom: .5rem; font-size: .8rem; color: var(--ink-soft); letter-spacing: .08em; }
.settings-row { min-height: 4.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.settings-row > span { display: grid; }
.settings-row small { color: var(--ink-soft); font-size: .72rem; }
.settings-row select { min-width: 10rem; padding: .5rem; border: 1px solid var(--line-strong); border-radius: .45rem; background: var(--surface); }
.export-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.export-actions button { min-height: 2.35rem; padding: .35rem .6rem; border: 1px solid var(--line-strong); border-radius: .4rem; background: var(--surface); }
.local-data-note { margin: 1.2rem 0 0; padding: .8rem; border-radius: .5rem; background: var(--surface-soft); color: var(--ink-soft); font-size: .74rem; }
.confirm-dialog { width: min(25rem, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 1rem; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.confirm-dialog form { padding: 1.6rem; }
.confirm-icon { width: 2.7rem; height: 2.7rem; display: grid; place-items: center; margin: 0 auto .8rem; border-radius: 50%; background: #fde9e9; color: var(--danger); font-weight: 900; }
.confirm-dialog h2 { margin-bottom: .35rem; font-size: 1.2rem; }
.confirm-dialog p { color: var(--ink-soft); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.toast { position: fixed; z-index: 160; right: 1.25rem; bottom: 1.25rem; max-width: min(24rem, calc(100% - 2rem)); padding: .8rem 1rem; border-radius: .6rem; background: #172044; color: white; box-shadow: var(--shadow); }

@media (max-width: 980px) {
  .filter-panel { grid-template-columns: repeat(3, 1fr); }
  .insight-grid { grid-template-columns: 1fr 1fr; }
  .insight-card:first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 1rem 1.2rem; }
  .sidebar .nav-list, .privacy-note { display: none; }
  .workspace { padding: 1.7rem 1rem 7rem; }
  .topbar { align-items: center; }
  .topbar .primary-button { position: fixed; z-index: 60; right: 1rem; bottom: 5.1rem; width: 3.6rem; height: 3.6rem; padding: 0; border-radius: 50%; font-size: 0; }
  .topbar .primary-button span { font-size: 1.8rem; }
  .toolbar { margin-top: 1.3rem; }
  .search-box kbd { display: none; }
  .filter-button { padding-inline: .75rem; }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .records-panel, .empty-state { min-height: 26rem; }
  .record-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: .6rem; padding-left: 1rem; }
  .tiny-tags { display: none; }
  .photo-picker-row { align-items: stretch; flex-direction: column; }
  .photo-picker-row small { align-self: start; }
  .field-row, .emotion-sliders, .detail-meta { grid-template-columns: 1fr; }
  .emotion-sliders { gap: .8rem; }
  .dialog-footer { position: sticky; bottom: 0; z-index: 2; background: var(--surface); }
  .mobile-nav { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: .35rem .4rem max(.35rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); }
  .mobile-nav button { min-height: 3.55rem; display: grid; place-items: center; gap: 0; border: 0; border-radius: .5rem; background: transparent; color: var(--ink-soft); }
  .mobile-nav button > span { font-size: 1.15rem; line-height: 1; }
  .mobile-nav button small { font-size: .66rem; }
  .mobile-nav button.is-active { color: var(--accent-dark); font-weight: 800; }
  .reflection-card { min-height: 24rem; }
  .section-heading { align-items: start; }
  .compact-select { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .insight-card:first-child { grid-column: auto; }
  .settings-row { align-items: start; flex-direction: column; }
  .settings-row select { width: 100%; }
  .action-row { align-items: stretch; }
  .danger-row .danger-button { align-self: start; }
}

@media (max-width: 430px) {
  h1 { font-size: 1.75rem; }
  .filter-panel { grid-template-columns: 1fr; }
  .summary-strip #today-label { display: none; }
  .record-stamp { min-width: 2.9rem; }
  .record-dialog, .detail-dialog, .settings-dialog { width: 100%; max-width: none; max-height: 100vh; height: 100vh; margin: 0; border-radius: 0; }
  .dialog-body, .detail-body { max-height: calc(100vh - 8.5rem); }
}

@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: appear .18s ease-out; }
  .toast { animation: toast-in .2s ease-out; }
  .record-row, .primary-button, .nav-item { transition: background-color .15s ease, transform .15s ease; }
  .primary-button:hover { transform: translateY(-1px); }
  @keyframes appear { from { opacity: 0; transform: translateY(8px) scale(.985); } }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
}

@media print {
  .sidebar, .mobile-nav, .topbar .primary-button, .toolbar, .filter-panel { display: none !important; }
  .app-shell { display: block; }
  .workspace { max-width: none; padding: 0; }
  .records-panel { border: 0; box-shadow: none; }
}
