 :root {
     --bg: #F6F5F9;
     --bg-2: #F1EDF5;
     --card: #FFFFFF;
     --ink: #2B2733;
     --ink-soft: #766F80;
     --accent: #C6467A;
     --accent-dark: #AD3766;
     --accent-soft: #F5DCE7;
     --line: #ECE7F1;

     --m0: #E9E5EF;
     --m1: #8C97F0;
     --m2: #6FB6DE;
     --m3: #EFC168;
     --m4: #EE8F6C;
     --m5: #E14F76;

     --shadow: 0 12px 28px -14px rgba(43, 39, 51, 0.22);
     --shadow-sm: 0 4px 14px -8px rgba(43, 39, 51, 0.2);
     --radius: 16px;
 }

 * {
     box-sizing: border-box;
 }

 body {
     margin: 0;
     font-family: 'Inter', sans-serif;
     color: var(--ink);
     background: var(--bg);
     min-height: 100vh;
     padding: 32px 16px 56px;
 }

 #app {
     max-width: 860px;
     margin: 0 auto;
 }

 @media (prefers-reduced-motion: no-preference) {

     .card,
     header {
         animation: fadeInUp 0.5s ease both;
     }

     header {
         animation-delay: 0s;
     }

     .stats {
         animation: fadeInUp 0.5s ease both;
         animation-delay: 0.08s;
     }

     .card:nth-of-type(1) {
         animation-delay: 0.14s;
     }

     .card:nth-of-type(2) {
         animation-delay: 0.2s;
     }

     .card:nth-of-type(3) {
         animation-delay: 0.26s;
     }

     .card:nth-of-type(4) {
         animation-delay: 0.32s;
     }
 }

 @keyframes fadeInUp {
     from {
         opacity: 0;
         transform: translateY(14px);
     }

     to {
         opacity: 1;
         transform: translateY(0);
     }
 }

 /* ---------- Header ---------- */
 header {
     text-align: center;
     padding: 6px 10px 18px;
 }

 header h1 {
     font-family: 'Poppins', sans-serif;
     font-weight: 700;
     font-size: 2.1rem;
     margin: 0;
     color: var(--ink);
     letter-spacing: -0.3px;
 }

 header h1 span {
     color: var(--accent);
 }

 header p {
     margin: 6px 0 0;
     color: var(--ink-soft);
     font-size: 0.95rem;
 }

 .quick-add {
     display: inline-flex;
     align-items: center;
     gap: 6px;
     margin: 18px auto 0;
     background: var(--accent);
     color: #fff;
     border: none;
     border-radius: 10px;
     padding: 11px 22px;
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     font-size: 0.9rem;
     cursor: pointer;
     box-shadow: var(--shadow-sm);
     transition: background 0.15s ease, transform 0.1s ease;
 }

 .quick-add:hover {
     background: var(--accent-dark);
     transform: translateY(-1px);
 }

 .quick-add:active {
     transform: translateY(0);
 }

 /* ---------- Stat pills ---------- */
 .stats {
     display: flex;
     flex-wrap: wrap;
     gap: 12px;
     justify-content: center;
     margin: 22px 0 24px;
 }

 .pill {
     background: var(--card);
     border-radius: 12px;
     padding: 11px 20px;
     box-shadow: var(--shadow-sm);
     font-weight: 600;
     font-size: 0.9rem;
     display: flex;
     align-items: center;
     gap: 8px;
     border: 1px solid var(--line);
 }

 .pill span.num {
     font-family: 'Poppins', sans-serif;
     color: var(--accent);
     font-size: 1rem;
     font-weight: 700;
 }

 .flame {
     display: inline-block;
     animation: pulse 1.8s ease-in-out infinite;
 }

 @media (prefers-reduced-motion: reduce) {
     .flame {
         animation: none;
     }
 }

 @keyframes pulse {

     0%,
     100% {
         transform: scale(1);
     }

     50% {
         transform: scale(1.18);
     }
 }

 /* ---------- Cards ---------- */
 .card {
     background: var(--card);
     border-radius: var(--radius);
     box-shadow: var(--shadow);
     padding: 24px 24px 28px;
     margin-bottom: 20px;
     border: 1px solid var(--line);
 }

 .card h2 {
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     font-size: 1.08rem;
     margin: 0 0 4px;
     display: flex;
     align-items: center;
     gap: 8px;
 }

 .card .sub {
     color: var(--ink-soft);
     font-size: 0.85rem;
     margin: 0 0 16px;
 }

 /* ---------- Heatmap ---------- */
 .heatmap-scroll {
     overflow-x: auto;
     padding-bottom: 4px;
 }

 .heatmap-inner {
     display: inline-block;
     min-width: 100%;
     animation: fadeIn 0.6s ease both 0.3s;
 }

 @keyframes fadeIn {
     from {
         opacity: 0;
     }

     to {
         opacity: 1;
     }
 }

 .month-labels {
     display: flex;
     height: 16px;
     margin-bottom: 4px;
     margin-left: 26px;
     position: relative;
     font-size: 0.7rem;
     color: var(--ink-soft);
     font-weight: 600;
 }

 .month-labels span {
     position: absolute;
     top: 0;
 }

 .heatmap-body {
     display: flex;
     gap: 4px;
 }

 .day-labels {
     display: grid;
     grid-template-rows: repeat(7, 14px);
     gap: 4px;
     font-size: 0.62rem;
     color: var(--ink-soft);
     font-weight: 600;
     width: 20px;
     text-align: right;
 }

 .heatmap-grid {
     display: grid;
     grid-auto-flow: column;
     grid-template-rows: repeat(7, 14px);
     gap: 4px;
 }

 .cell {
     width: 14px;
     height: 14px;
     border-radius: 3px;
     background: var(--m0);
     cursor: pointer;
     transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.2s ease;
 }

 .cell:hover {
     transform: scale(1.35);
     box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
     z-index: 2;
     position: relative;
 }

 .cell.empty {
     background: transparent;
     cursor: default;
 }

 .cell.empty:hover {
     transform: none;
     box-shadow: none;
 }

 .cell.future {
     background: var(--m0);
     opacity: 0.45;
     cursor: default;
 }

 .cell.future:hover {
     transform: none;
     box-shadow: none;
 }

 .cell.today {
     outline: 2px solid var(--accent);
     outline-offset: 1px;
 }

 .cell.dimmed {
     opacity: 0.25;
 }

 .legend {
     display: flex;
     align-items: center;
     gap: 6px;
     justify-content: flex-end;
     margin-top: 14px;
     font-size: 0.75rem;
     color: var(--ink-soft);
     font-weight: 600;
 }

 .legend .sw {
     width: 12px;
     height: 12px;
     border-radius: 3px;
 }

 /* ---------- Insights ---------- */
 .insights-grid {
     display: flex;
     flex-wrap: wrap;
     gap: 22px;
     align-items: flex-start;
 }

 .insight-block {
     flex: 1;
     min-width: 180px;
 }

 .insight-title {
     font-size: 0.75rem;
     font-weight: 700;
     color: var(--ink-soft);
     text-transform: uppercase;
     letter-spacing: 0.4px;
     margin-bottom: 10px;
 }

 .avg-mood {
     display: flex;
     align-items: baseline;
     gap: 10px;
 }

 .avg-mood .big {
     font-size: 2.2rem;
 }

 .avg-mood .txt {
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     font-size: 1.05rem;
     color: var(--ink);
 }

 .avg-mood .txt small {
     display: block;
     font-family: 'Inter', sans-serif;
     font-weight: 500;
     color: var(--ink-soft);
     font-size: 0.76rem;
 }

 .dist-bars {
     display: flex;
     align-items: flex-end;
     gap: 8px;
     height: 70px;
 }

 .dist-bar {
     flex: 1;
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: flex-end;
     height: 100%;
 }

 .dist-bar .bar {
     width: 100%;
     border-radius: 5px 5px 2px 2px;
     min-height: 4px;
     transition: height 0.4s ease;
 }

 .dist-bar .lbl {
     font-size: 0.75rem;
     margin-top: 5px;
 }

 .trend-wrap {
     min-width: 220px;
     flex: 1.4;
 }

 .trend-wrap svg {
     width: 100%;
     height: 64px;
     display: block;
 }

 .trend-wrap polyline {
     stroke-dasharray: 400;
     stroke-dashoffset: 400;
     animation: drawLine 1s ease forwards 0.3s;
 }

 @keyframes drawLine {
     to {
         stroke-dashoffset: 0;
     }
 }

 @media (prefers-reduced-motion: reduce) {
     .trend-wrap polyline {
         animation: none;
         stroke-dashoffset: 0;
     }
 }

 .insight-note {
     font-size: 0.85rem;
     color: var(--ink);
     background: var(--bg-2);
     border-radius: 10px;
     padding: 10px 14px;
     margin-top: 18px;
 }

 .insight-note b {
     color: var(--accent);
 }

 /* ---------- Word cloud ---------- */
 #wordcloud {
     display: flex;
     flex-wrap: wrap;
     align-items: center;
     justify-content: center;
     gap: 6px 14px;
     min-height: 120px;
     padding: 10px 6px;
 }

 #wordcloud .w {
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     line-height: 1;
     display: inline-block;
     transition: transform 0.15s ease;
     opacity: 0;
     animation: popIn 0.4s ease forwards;
 }

 #wordcloud .w:hover {
     transform: scale(1.12) !important;
 }

 @keyframes popIn {
     from {
         opacity: 0;
         transform: scale(0.6);
     }

     to {
         opacity: 1;
         transform: scale(1);
     }
 }

 @media (prefers-reduced-motion: reduce) {
     #wordcloud .w {
         animation: none;
         opacity: 1;
     }
 }

 .empty-note {
     color: var(--ink-soft);
     font-size: 0.9rem;
     text-align: center;
     width: 100%;
 }

 /* ---------- Entries list ---------- */
 .entries-toolbar {
     display: flex;
     gap: 10px;
     flex-wrap: wrap;
     margin-bottom: 14px;
 }

 #searchInput {
     flex: 1;
     min-width: 160px;
     border: 1px solid var(--line);
     border-radius: 10px;
     padding: 9px 14px;
     font-family: 'Inter', sans-serif;
     font-size: 0.88rem;
     color: var(--ink);
     transition: border-color 0.15s ease;
 }

 #searchInput:focus {
     outline: none;
     border-color: var(--accent);
 }

 .tag-chips {
     display: flex;
     flex-wrap: wrap;
     gap: 6px;
     margin-bottom: 14px;
 }

 .chip {
     background: var(--bg-2);
     border: 1px solid transparent;
     border-radius: 8px;
     padding: 5px 13px;
     font-size: 0.78rem;
     font-weight: 600;
     color: var(--ink-soft);
     cursor: pointer;
     transition: all 0.15s ease;
 }

 .chip.active {
     background: var(--accent);
     color: #fff;
 }

 #entriesList {
     max-height: 340px;
     overflow-y: auto;
     display: flex;
     flex-direction: column;
     gap: 8px;
 }

 .entry-row {
     display: flex;
     align-items: center;
     gap: 12px;
     padding: 10px 12px;
     border-radius: 10px;
     background: var(--bg-2);
     cursor: pointer;
     transition: background 0.15s ease, transform 0.12s ease;
 }

 .entry-row:hover {
     background: var(--accent-soft);
     transform: translateX(2px);
 }

 .entry-row .em {
     font-size: 1.25rem;
 }

 .entry-row .meta {
     flex: 1;
     min-width: 0;
 }

 .entry-row .meta .top {
     display: flex;
     gap: 8px;
     align-items: baseline;
 }

 .entry-row .meta .dt {
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     font-size: 0.86rem;
 }

 .entry-row .meta .tg {
     font-size: 0.72rem;
     color: var(--ink-soft);
 }

 .entry-row .meta .snip {
     font-size: 0.8rem;
     color: var(--ink-soft);
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
 }

 /* ---------- Modal ---------- */
 #modalOverlay {
     position: fixed;
     inset: 0;
     background: rgba(43, 39, 51, 0.4);
     display: flex;
     align-items: center;
     justify-content: center;
     padding: 16px;
     z-index: 50;
 }

 #modalOverlay.hidden {
     display: none;
 }

 #modal {
     background: var(--card);
     border-radius: 18px;
     max-width: 420px;
     width: 100%;
     padding: 26px 24px 22px;
     box-shadow: var(--shadow);
     max-height: 90vh;
     overflow-y: auto;
     animation: modalPop 0.22s ease;
 }

 @keyframes modalPop {
     from {
         opacity: 0;
         transform: scale(0.94) translateY(6px);
     }

     to {
         opacity: 1;
         transform: scale(1) translateY(0);
     }
 }

 @media (prefers-reduced-motion: reduce) {
     #modal {
         animation: none;
     }
 }

 #modal .modal-top {
     display: flex;
     justify-content: space-between;
     align-items: flex-start;
     margin-bottom: 12px;
 }

 #modal h3 {
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     margin: 0;
     font-size: 1.15rem;
 }

 #modal .date-sub {
     color: var(--ink-soft);
     font-size: 0.85rem;
     margin-top: 2px;
 }

 #closeModal {
     background: var(--bg-2);
     border: none;
     border-radius: 8px;
     width: 30px;
     height: 30px;
     font-size: 1rem;
     cursor: pointer;
     color: var(--ink);
     transition: background 0.15s ease;
 }

 #closeModal:hover {
     background: var(--accent-soft);
 }

 .field-label {
     font-weight: 700;
     font-size: 0.85rem;
     margin: 16px 0 8px;
     color: var(--ink);
 }

 .mood-row {
     display: flex;
     gap: 8px;
     justify-content: space-between;
 }

 .mood-btn {
     flex: 1;
     border: 1.5px solid var(--line);
     background: #fff;
     border-radius: 10px;
     padding: 10px 0 6px;
     font-size: 1.35rem;
     cursor: pointer;
     transition: all 0.15s ease;
 }

 .mood-btn:hover {
     border-color: var(--accent-soft);
 }

 .mood-btn.selected {
     border-color: var(--accent);
     background: var(--accent-soft);
     transform: translateY(-2px);
 }

 .mood-btn.pop {
     animation: btnPop 0.28s ease;
 }

 @keyframes btnPop {
     0% {
         transform: scale(1);
     }

     40% {
         transform: scale(1.18) translateY(-2px);
     }

     100% {
         transform: scale(1) translateY(-2px);
     }
 }

 #tagsInput,
 #journalText {
     width: 100%;
     border: 1.5px solid var(--line);
     border-radius: 10px;
     padding: 10px 12px;
     font-family: 'Inter', sans-serif;
     font-size: 0.9rem;
     color: var(--ink);
     resize: vertical;
     transition: border-color 0.15s ease;
 }

 #tagsInput:focus,
 #journalText:focus {
     outline: none;
     border-color: var(--accent);
 }

 #journalText {
     min-height: 110px;
 }

 .tag-hint {
     font-size: 0.75rem;
     color: var(--ink-soft);
     margin-top: 4px;
 }

 .modal-actions {
     display: flex;
     gap: 10px;
     margin-top: 20px;
 }

 .btn {
     border: none;
     border-radius: 10px;
     padding: 11px 16px;
     font-family: 'Poppins', sans-serif;
     font-weight: 600;
     font-size: 0.88rem;
     cursor: pointer;
     transition: background 0.15s ease, opacity 0.15s ease;
 }

 .btn-save {
     background: var(--accent);
     color: white;
     flex: 1;
 }

 .btn-save:hover {
     background: var(--accent-dark);
 }

 .btn-save:disabled {
     opacity: 0.75;
     cursor: default;
 }

 .btn-delete {
     background: var(--bg-2);
     color: var(--accent);
 }

 .btn-delete:hover {
     background: var(--accent-soft);
 }

 /* ---------- Footer ---------- */
 footer {
     text-align: center;
     color: var(--ink-soft);
     font-size: 0.82rem;
     margin-top: 14px;
 }

 footer .heart {
     color: var(--accent);
 }

 #madeByName {
     font-family: 'Poppins', sans-serif;
     font-weight: 700;
     color: var(--accent);
     letter-spacing: 0.5px;
     border-right: 2px solid var(--accent);
     padding-right: 2px;
 }

 /* ---------- Toast ---------- */
 #toast {
     position: fixed;
     bottom: 26px;
     left: 50%;
     transform: translateX(-50%) translateY(20px);
     background: var(--ink);
     color: #fff;
     padding: 11px 20px;
     border-radius: 10px;
     font-size: 0.85rem;
     font-weight: 600;
     box-shadow: var(--shadow);
     opacity: 0;
     pointer-events: none;
     transition: opacity 0.25s ease, transform 0.25s ease;
     z-index: 100;
 }

 #toast.show {
     opacity: 1;
     transform: translateX(-50%) translateY(0);
 }

 ::-webkit-scrollbar {
     height: 8px;
     width: 8px;
 }

 ::-webkit-scrollbar-thumb {
     background: var(--accent-soft);
     border-radius: 10px;
 }