/* My Feelings Story (history module). All classes prefixed .hx- */

.hx { --hx-gap: 20px; }
.hx .section { margin: 28px 0; }
.hx-card-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin-bottom: .1em; }
.hx-card-head p { margin: 0 0 14px; font-size: .95rem; }
.hx-none { margin: 8px 0; }
.hx-mo { margin: 18px 0 6px; }
.hx-mo .bubble { font-size: 1.12rem; }

/* filter row: one row above everything it scopes */
.hx-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 18px 0 4px; }
.hx-range-note { font-size: .9rem; font-weight: 600; }

/* safety */
.hx-safety { margin: 10px 0 6px; }
.hx-safety .safety-card { max-width: 640px; }

/* empty states */
.hx-empty { margin-top: 24px; }
.hx-empty h2 { margin-top: 6px; }
.hx-empty-lead { max-width: 560px; margin: 0 auto 18px; font-size: 1.1rem; }
.hx-cta { justify-content: center; }
.hx-quiet { display: flex; gap: 18px; align-items: center; }
.hx-quiet h3 { margin-bottom: 4px; }
.hx-quiet .mo { flex: none; }

/* stat tiles */
.hx-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 18px 0 0; }
.hx-stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: #fff; border: 1px solid var(--char-10); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 14px 14px 14px; min-width: 0;
}
.hx-stat-ico { margin-bottom: 4px; }
.hx-stat-v { font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; line-height: 1; color: var(--char); }
.hx-stat-l { font-size: .9rem; font-weight: 600; color: var(--char-80); line-height: 1.2; }
.hx-meter { display: block; width: 100%; height: 6px; border-radius: 3px; background: var(--green-20); margin-top: 8px; overflow: hidden; }
.hx-meter i { display: block; height: 100%; background: var(--zone-calm); border-radius: 3px; }

/* two-up layout */
.hx-grid2 { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--hx-gap); align-items: start; }
.hx-card { min-width: 0; }

/* ---------- calendar ---------- */
.hx-cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hx-month { margin: 0; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 1.35rem; letter-spacing: .02em; }
.hx-navbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--char-20); background: #fff; color: var(--red); display: grid; place-items: center; cursor: pointer; }
.hx-navbtn:hover:not([disabled]) { border-color: var(--red); background: var(--red-10); }
.hx-navbtn[disabled] { color: var(--char-40); cursor: default; }
.hx-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.hx-wd { text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--char-80); padding-bottom: 2px; }
.hx-cell {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; border-radius: 10px; border: 0; padding: 0;
  background: var(--char-5); color: var(--char-80); font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: transform .12s ease, box-shadow .12s ease;
}
button.hx-cell:hover { box-shadow: 0 0 0 2px var(--char-40); }
.hx-cell.has { font-weight: 700; }
.hx-cell.out { opacity: .38; }
.hx-cell.today::after { content: ''; position: absolute; inset: -3px; border: 2px solid var(--char); border-radius: 12px; pointer-events: none; }
.hx-cell.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--red); transform: scale(1.04); z-index: 1; }
.hx-cell.future { background: transparent; color: var(--char-40); cursor: default; border: 1px solid var(--char-5); }
.hx-blank { background: transparent; cursor: default; }
.hx-dn { font-size: .85rem; line-height: 1; font-variant-numeric: tabular-nums; }
.hx-cf { width: 46%; max-width: 32px; height: auto; pointer-events: none; }
.hx-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--char); box-shadow: 0 0 0 1.5px #fff; }
.hx-dot.static { position: static; display: inline-block; box-shadow: none; }
.hx-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: .82rem; font-weight: 600; color: var(--char-80); }
.hx-key-i { display: inline-flex; align-items: center; gap: 6px; }
.hx-ramp { display: inline-flex; gap: 2px; }
.hx-ramp i { width: 9px; height: 14px; border-radius: 2px; display: block; }
.hx-ramp i:first-child { border-radius: 3px 2px 2px 3px; }
.hx-key-note { font-size: .82rem; margin: 6px 0 0; }
.hx-daypanel { margin-top: 16px; border-top: 1px solid var(--char-10); padding-top: 14px; }
.hx-dp-title { font-size: 1.05rem; margin-bottom: 8px; }
.hx-dp-hint { display: flex; gap: 8px; align-items: center; margin: 0; }
.hx-dp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* ---------- events (day panel + timeline) ---------- */
.hx-ev { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--c-soft, var(--char-5)); color: var(--char); text-decoration: none; min-width: 0; }
.hx-ev .hx-face { flex: none; width: 38px; height: auto; }
.hx-ev-ico { flex: none; }
.hx-ev-main { min-width: 0; flex: 1; }
.hx-ev-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.hx-word { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 1.25rem; line-height: 1.05; color: var(--c-ink, var(--char)); letter-spacing: .01em; }
.hx-lvl { font-size: .82rem; font-weight: 700; color: var(--char-80); }
.hx-ev .zone-pill { font-size: .66rem; padding: 2px 8px; }
.hx-ev-meta { display: flex; align-items: center; gap: 5px; font-size: .84rem; color: var(--char-80); margin-top: 2px; }
.hx-ev-meta .ico { color: var(--char-60); }
.hx-ev-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hx-chip { display: inline-block; background: #fff; border: 1px solid var(--char-20); color: var(--char); border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; }
.hx-after { display: inline-flex; align-items: center; gap: 3px; font-size: .8rem; font-weight: 700; color: var(--green-ink); background: #fff; border-radius: 999px; padding: 1px 10px 1px 7px; border: 1px solid var(--green-20); }
.hx-note { margin: 6px 0 0; font-size: .95rem; color: var(--char); overflow-wrap: anywhere; }
.hx-ev-diary { background: #fff; border: 1px solid var(--char-10); }
.hx-ev-diary:hover { border-color: var(--red); }
.hx-ev-diary:hover .hx-open { text-decoration: underline; }
.hx-open { display: inline-flex; align-items: center; gap: 3px; color: var(--red); font-weight: 700; font-size: .85rem; margin-top: 4px; }

.hx-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hx-tl-day { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; color: var(--char-80); margin-top: 10px; padding-bottom: 2px; border-bottom: 1px solid var(--char-10); }
.hx-tl-day:first-child { margin-top: 0; }

/* ---------- charts ---------- */
.hx-chart { position: relative; width: 100%; }
.hx-chart svg { display: block; width: 100%; overflow: visible; }
.hx-t-lab { font: 700 15px var(--font-body); fill: var(--char); }
.hx-t-val { font: 700 14px var(--font-body); fill: var(--char); }
.hx-t-mut { font-weight: 500; fill: var(--char-80); }
.hx-t-tick { font: 500 12px var(--font-body); fill: var(--char-80); font-variant-numeric: tabular-nums; }
.hx-t-mini { font: 600 11px var(--font-body); fill: var(--char-60); text-transform: uppercase; letter-spacing: .06em; }
.hx-t-band { font: 700 10px var(--font-body); fill: var(--char-80); text-transform: uppercase; letter-spacing: .08em; pointer-events: none; paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 3px; stroke-linejoin: round; }
.hx-axis { stroke: var(--char-20); stroke-width: 1; }
.hx-grid { stroke: rgba(51, 61, 71, .07); stroke-width: 1; }
.hx-band.calm { opacity: .09; }
.hx-band.tip { opacity: .12; }
.hx-band.hot { opacity: .07; }
.hx-path { fill: none; stroke: var(--char-20); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.hx-cross { stroke: var(--char-40); stroke-width: 1; pointer-events: none; }
.hx-drop { stroke-width: 1.5; opacity: .55; }
.hx-pt { cursor: pointer; outline: none; }
.hx-pt .hx-dotm { transition: r .12s ease; }
.hx-pt.on .hx-dotm, .hx-pt:focus-visible .hx-dotm { r: 7.5; }
.hx-pt:focus-visible .hx-hitc { stroke: var(--blue); stroke-width: 2.5; }
.hx-mixrow .hx-bar { transition: opacity .12s ease; }
.hx-mixrow.on .hx-bar { opacity: .82; }
.hx-mixrow.on .hx-hit { fill: var(--char-5); }
.hx-mix .hx-bar { transform-box: fill-box; transform-origin: left center; animation: hxGrow .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes hxGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hx-track { stroke: var(--char-10); stroke-width: 6; stroke-linecap: round; }
.hx-db-line { stroke: var(--red-20); stroke-width: 6; stroke-linecap: round; }

.hx-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 140px; max-width: 240px;
  background: #fff; border: 1px solid var(--char-10); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 12px; font-size: .85rem; color: var(--char-80); line-height: 1.35;
}
.hx-tip[hidden] { display: none; }
.hx-tip-v { font-weight: 800; color: var(--char); font-size: .98rem; margin-bottom: 2px; }
.hx-tip-l { display: flex; align-items: center; gap: 6px; }
.hx-tip-key { flex: none; width: 12px; height: 3px; border-radius: 2px; display: inline-block; }

.hx-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; font-size: .84rem; font-weight: 600; color: var(--char-80); }
.hx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hx-lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.hx-lg-dot.hollow { background: #fff; border: 2.5px solid var(--char-60); }
.hx-lg-drop { width: 2px; height: 14px; background: var(--char-40); position: relative; display: inline-block; margin: 0 4px; }
.hx-lg-drop::after { content: ''; position: absolute; left: -3px; bottom: -3px; width: 5px; height: 5px; border-radius: 50%; border: 1.5px solid var(--char-40); background: #fff; }
.hx-caption { margin: 10px 0 0; font-size: .98rem; color: var(--char); }

.hx-table { margin-top: 12px; }
.hx-table summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; color: var(--red); list-style: none; padding: 4px 0; }
.hx-table summary::-webkit-details-marker { display: none; }
.hx-table summary .ico { color: var(--red); }
.hx-table-scroll { overflow-x: auto; margin-top: 8px; max-height: 340px; overflow-y: auto; border: 1px solid var(--char-10); border-radius: 10px; }
.hx-table table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.hx-table th, .hx-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--char-10); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hx-table th { position: sticky; top: 0; background: var(--char-5); font-weight: 700; color: var(--char); }

/* ---------- switch power ---------- */
.hx-sw { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 28px; align-items: start; }
.hx-sw-hero p { margin: 8px 0 0; }
.hx-sw-hero p:first-of-type { font-size: 1.1rem; }
.hx-sw-big { display: flex; align-items: baseline; gap: 10px; }
.hx-sw-num { font-family: var(--font-body); font-weight: 800; font-size: 3.6rem; line-height: 1; color: var(--red); }
.hx-sw-unit { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 1.5rem; color: var(--char); }
.hx-sw-h { font-size: 1rem; margin: 2px 0 6px; color: var(--char-80); text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.hx-sw-empty { display: flex; gap: 16px; align-items: center; }
.hx-sw-empty p { margin: 0 0 10px; }

/* ---------- Mo noticed ---------- */
.hx-ins { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.hx-insight { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; }
.hx-insight h3 { font-size: 1.1rem; margin: 2px 0 4px; }
.hx-insight p { margin: 0; font-size: .98rem; }
.hx-ins-ico { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--red-10); display: grid; place-items: center; }
.hx-ins-ico .illo { width: 42px; height: 42px; }
.hx-ins-empty { display: flex; gap: 16px; align-items: center; }
.hx-ins-empty p { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .hx-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hx-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hx-sw { grid-template-columns: 1fr; gap: 16px; }
  .hx-filter { gap: 6px 12px; }
  .hx .page-head .sub { font-size: 1.1rem; }
}
@media (max-width: 560px) {
  .hx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hx-stat { padding: 12px; }
  .hx-stat-v { font-size: 2.1rem; }
  .hx-cal { gap: 3px; }
  .hx-cell { border-radius: 8px; }
  .hx-wd-rest { display: none; }
  .hx-dn { font-size: .78rem; }
  .hx-cf { width: 50%; }
  .hx-dot { top: 3px; right: 3px; width: 6px; height: 6px; }
  .hx-quiet, .hx-sw-empty, .hx-ins-empty { flex-direction: column; text-align: center; }
  .hx-ins { grid-template-columns: 1fr; }
  .hx-insight { padding: 16px; }
  .hx-ev { padding: 9px 10px; gap: 10px; }
  .hx-ev .hx-face { width: 32px; }
  .hx-word { font-size: 1.15rem; }
  .hx-sw-num { font-size: 3rem; }
  .hx-mo .mo-av svg { width: 60px; height: 60px; }
  .hx-mo .bubble { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-mix .hx-bar { animation: none; }
  .hx-cell, .hx-pt .hx-dotm, .hx-mixrow .hx-bar { transition: none; }
  .hx-cell.sel { transform: none; }
}
@media (forced-colors: active) {
  .hx-cell.sel { outline: 3px solid Highlight; }
  .hx-tip { border: 1px solid CanvasText; }
}
