/* ---------- 테마 색상 ---------- */
/* 라이트 모드 (기본): 따뜻한 아이보리 + 더스티 로즈 + 페리윙클 */
:root {
  --bg: #faf7f3;
  --blob-1: rgba(239, 168, 178, 0.20);
  --blob-2: rgba(160, 172, 238, 0.16);
  --card: #ffffff;
  --cell: #f8f5f1;
  --hover: #f3eee8;
  --border: #eee8e1;
  --text: #3b3431;
  --text-dim: #9b918a;
  --accent: #e0808e;
  --accent-strong: #d26a7a;
  --on-accent: #ffffff;
  --accent-soft: #fbecee;
  --accent-2: #b67aa6;
  --accent-2-soft: #f6ecf3;
  --butter: #f6e3b4;
  --star: #eeb030;
  --danger: #d9606f;
  --danger-soft: #fbe8ea;
  --sun: #d9707f;
  --sat: #6f82d0;
  --shadow-sm: 0 1px 2px rgba(70, 45, 35, 0.04);
  --shadow: 0 1px 2px rgba(70, 45, 35, 0.04), 0 10px 30px -8px rgba(70, 45, 35, 0.10);
  --shadow-accent: 0 6px 16px -6px rgba(224, 128, 142, 0.55);
  --overlay: rgba(40, 30, 28, 0.28);
  --radius: 22px;
  --font-display: "Gowun Dodum", "Noto Sans KR", sans-serif;
  --font-num: "Nunito", "Noto Sans KR", sans-serif;
  --display-weight: 400;
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  /* 기분 달력 칸 배경색 */
  --m-excited: #fff0c4;
  --m-sad: #dfeafc;
  --m-tired: #ebe6f2;
  --m-passion: #ffe0d4;
  --m-sleepy: #e9e2fb;
  --m-calm: #dcf2e4;
  --m-custom: #fbe4ea;
  color-scheme: light;
}

/* 다크 모드 */
:root[data-theme="dark"] {
  --bg: #16141a;
  --blob-1: rgba(240, 150, 166, 0.07);
  --blob-2: rgba(140, 155, 240, 0.08);
  --card: #1f1c23;
  --cell: #26222b;
  --hover: #2e2934;
  --border: #2f2a35;
  --text: #eee8e4;
  --text-dim: #8f8693;
  --accent: #f09aa7;
  --accent-strong: #f5adb8;
  --on-accent: #2a1519;
  --accent-soft: rgba(240, 154, 167, 0.13);
  --accent-2: #d6a0c6;
  --accent-2-soft: rgba(214, 160, 198, 0.13);
  --butter: rgba(246, 222, 160, 0.16);
  --star: #f5c65a;
  --danger: #f08594;
  --danger-soft: rgba(240, 133, 148, 0.13);
  --sun: #f09aa7;
  --sat: #a5b0f2;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -10px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 6px 18px -6px rgba(240, 154, 167, 0.45);
  --overlay: rgba(6, 4, 10, 0.6);
  --m-excited: rgba(255, 210, 100, 0.16);
  --m-sad: rgba(120, 170, 255, 0.16);
  --m-tired: rgba(190, 175, 215, 0.14);
  --m-passion: rgba(255, 140, 100, 0.16);
  --m-sleepy: rgba(170, 140, 255, 0.16);
  --m-calm: rgba(110, 210, 150, 0.14);
  --m-custom: rgba(240, 154, 167, 0.14);
  color-scheme: dark;
}

/* 테마 색 (기본은 로즈, html의 data-accent로 바뀜)
   강조색뿐 아니라 배경·날짜 칸·테두리·글자 톤까지 그 색 계열로 바꿈 */
:root[data-accent="peach"] {
  --bg: #fcf5ef;
  --blob-1: rgba(240, 160, 120, 0.26);
  --blob-2: rgba(250, 205, 140, 0.24);
  --cell: #faf0e8;
  --hover: #f5e6da;
  --border: #f1e1d4;
  --text: #3e312a;
  --text-dim: #a38c7e;
  --accent: #e8906a; --accent-strong: #d9784f; --accent-soft: #fde9de;
  --shadow-accent: 0 6px 16px -6px rgba(232, 144, 106, 0.55);
  --accent-2: #c9963f; --accent-2-soft: #f9eedb;
}
:root[data-theme="dark"][data-accent="peach"] {
  --bg: #1a1411;
  --blob-1: rgba(243, 165, 130, 0.10);
  --blob-2: rgba(250, 200, 140, 0.07);
  --card: #231c18;
  --cell: #2c231e;
  --hover: #362b24;
  --border: #372c26;
  --text: #f0e6e0;
  --text-dim: #9b8a80;
  --accent: #f3a582; --accent-strong: #f7b89a; --accent-soft: rgba(243, 165, 130, 0.15);
  --shadow-accent: 0 6px 18px -6px rgba(243, 165, 130, 0.45);
  --accent-2: #e6bd78; --accent-2-soft: rgba(230, 189, 120, 0.13);
}
:root[data-accent="lavender"] {
  --bg: #f7f4fc;
  --blob-1: rgba(175, 150, 235, 0.26);
  --blob-2: rgba(240, 170, 205, 0.18);
  --cell: #f2eefa;
  --hover: #e9e3f6;
  --border: #e6dff3;
  --text: #352e42;
  --text-dim: #968ca8;
  --accent: #a184d8; --accent-strong: #8d6ecb; --accent-soft: #efe8fb;
  --shadow-accent: 0 6px 16px -6px rgba(161, 132, 216, 0.55);
  --accent-2: #7f88d4; --accent-2-soft: #eceefa;
}
:root[data-theme="dark"][data-accent="lavender"] {
  --bg: #16131e;
  --blob-1: rgba(188, 165, 238, 0.12);
  --blob-2: rgba(240, 154, 190, 0.07);
  --card: #1f1b29;
  --cell: #272233;
  --hover: #302a3e;
  --border: #312b3f;
  --text: #ece6f5;
  --text-dim: #948aa6;
  --accent: #bca5ee; --accent-strong: #cbb8f3; --accent-soft: rgba(188, 165, 238, 0.15);
  --shadow-accent: 0 6px 18px -6px rgba(188, 165, 238, 0.45);
  --accent-2: #a0a9ee; --accent-2-soft: rgba(160, 169, 238, 0.13);
}
:root[data-accent="mint"] {
  --bg: #f3f8f4;
  --blob-1: rgba(110, 200, 155, 0.24);
  --blob-2: rgba(160, 215, 230, 0.22);
  --cell: #edf5ef;
  --hover: #e2eee6;
  --border: #dcebe1;
  --text: #2d3a33;
  --text-dim: #85998d;
  --accent: #5fae8f; --accent-strong: #4a9a7b; --accent-soft: #e1f3ea;
  --shadow-accent: 0 6px 16px -6px rgba(95, 174, 143, 0.55);
  --accent-2: #4f9aae; --accent-2-soft: #e2f0f3;
}
:root[data-theme="dark"][data-accent="mint"] {
  --bg: #111815;
  --blob-1: rgba(127, 203, 170, 0.10);
  --blob-2: rgba(130, 190, 210, 0.07);
  --card: #19211d;
  --cell: #202a25;
  --hover: #28332d;
  --border: #29342e;
  --text: #e4efe8;
  --text-dim: #869a8e;
  --accent: #7fcbaa; --accent-strong: #98d8bb; --accent-soft: rgba(127, 203, 170, 0.14);
  --shadow-accent: 0 6px 18px -6px rgba(127, 203, 170, 0.45);
  --accent-2: #7cc0d0; --accent-2-soft: rgba(124, 192, 208, 0.13);
}
:root[data-accent="sky"] {
  --bg: #f3f7fc;
  --blob-1: rgba(120, 175, 235, 0.26);
  --blob-2: rgba(175, 160, 240, 0.16);
  --cell: #edf2f9;
  --hover: #e2eaf5;
  --border: #dde6f1;
  --text: #2d3441;
  --text-dim: #8792a4;
  --accent: #5f9fd6; --accent-strong: #4a8bc4; --accent-soft: #e3eefa;
  --shadow-accent: 0 6px 16px -6px rgba(95, 159, 214, 0.55);
  --accent-2: #7a7fd0; --accent-2-soft: #ecedfa;
}
:root[data-theme="dark"][data-accent="sky"] {
  --bg: #11151c;
  --blob-1: rgba(133, 185, 232, 0.11);
  --blob-2: rgba(165, 150, 240, 0.07);
  --card: #191e27;
  --cell: #202631;
  --hover: #282f3b;
  --border: #29303c;
  --text: #e4eaf3;
  --text-dim: #8791a3;
  --accent: #85b9e8; --accent-strong: #9ec8ee; --accent-soft: rgba(133, 185, 232, 0.15);
  --shadow-accent: 0 6px 18px -6px rgba(133, 185, 232, 0.45);
  --accent-2: #a3a6f0; --accent-2-soft: rgba(163, 166, 240, 0.13);
}
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 0% 0%, var(--blob-1), transparent 70%),
    radial-gradient(ellipse 50% 45% at 100% 20%, var(--blob-2), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* 3D 기분 이모지 그림 (글자 크기에 맞춰짐) */
.mood-img {
  display: inline-block;
  width: 1em; height: 1em;
  object-fit: contain;
  vertical-align: -0.15em;
  user-select: none;
}

.app { max-width: 1200px; margin: 0 auto; padding: 32px 20px 56px; }

/* ---------- 헤더 ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}
.app-header h1 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header h1 .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 1.4rem;
  transition: transform 0.4s var(--spring);
}
.app-header h1 .logo img { width: 28px; height: 28px; }
.app-header h1:hover .logo { animation: wiggle 0.8s ease-in-out; }
.subtitle { color: var(--text-dim); font-size: 0.88rem; margin-top: 4px; padding-left: 56px; }

/* 라이트/다크 전환 스위치 */
.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 60px; height: 32px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background 0.3s, border-color 0.3s;
}
.theme-toggle:hover { border-color: var(--accent-2); }
.theme-toggle .knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--butter);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.4s var(--spring), background 0.3s;
}
:root[data-theme="dark"] .theme-toggle .knob { transform: translateX(28px); background: var(--accent-2-soft); }

.layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}

.card-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: var(--text);
}

/* ---------- 달력 ---------- */
.calendar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}
.nav-right { display: flex; align-items: center; gap: 6px; }

/* 기분 / 기록 보기 전환 */
.view-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin-right: 4px;
  border-radius: 12px;
  background: var(--cell);
}
.view-toggle button {
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.month-title { display: flex; align-items: center; gap: 10px; }
.month-title h2 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.nav-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 1.35rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.25s var(--spring);
}
.nav-btn:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.nav-btn:active { transform: scale(0.92); }

.today-btn {
  font-size: 0.75rem;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 700;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.today-btn:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

.weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.weekdays {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.sun { color: var(--sun); }
.sat { color: var(--sat); }

.day {
  min-height: 108px;
  background: var(--cell);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.25s var(--spring);
  overflow: hidden;
}
.day:hover { background: var(--card); border-color: var(--border); box-shadow: var(--shadow); transform: translateY(-2px); }
.day:active { transform: scale(0.98); }
.day.other-month { background: transparent; }
.day.other-month > * { opacity: 0.4; }
.day.today { background: var(--accent-soft); }

.day-number {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 0.85rem;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.day.today .day-number {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 50%;
  box-shadow: var(--shadow-accent);
}
.day.sunday .day-number { color: var(--sun); }
.day.saturday .day-number { color: var(--sat); }
.day.holiday .day-number { color: var(--sun); }
.day.today.sunday .day-number,
.day.today.saturday .day-number,
.day.today.holiday .day-number { color: var(--on-accent); }

.day-head { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; flex-shrink: 0; }
.holiday-name {
  min-width: 0;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--sun);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border-radius: 7px;
  padding: 2px 6px 2px 4px;
  font-size: 0.72rem;
  text-align: left;
  width: 100%;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s, transform 0.2s var(--spring);
}
.entry-chip:hover { background: var(--accent-soft); color: var(--accent-strong); transform: scale(1.03); }
.entry-chip .chip-mood { flex-shrink: 0; font-size: 0.9rem; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-chip .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 기분 달력: 칸마다 그날 기분을 크게 + 기분 색 배경 */
.day[data-mood="excited"] { --mood-bg: var(--m-excited); }
.day[data-mood="sad"] { --mood-bg: var(--m-sad); }
.day[data-mood="tired"] { --mood-bg: var(--m-tired); }
.day[data-mood="passion"] { --mood-bg: var(--m-passion); }
.day[data-mood="sleepy"] { --mood-bg: var(--m-sleepy); }
.day[data-mood="calm"] { --mood-bg: var(--m-calm); }
.day[data-mood="custom"] { --mood-bg: var(--m-custom); }

.mood-view .day { position: relative; align-items: center; }
.mood-view .day-head { align-self: stretch; }
.mood-view .day:has(.day-more) .holiday-name { padding-right: 22px; } /* +1 표시와 겹치지 않도록 */
.day.has-mood, .day.has-mood:hover { background: var(--mood-bg); }
.day-mood {
  margin: auto;
  transition: transform 0.3s var(--spring);
}
img.day-mood { width: 52%; max-width: 56px; height: auto; aspect-ratio: 1; filter: drop-shadow(0 4px 6px rgba(60, 40, 30, 0.12)); }
.mood-text.day-mood { font-size: 1.5rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day:hover .day-mood { transform: scale(1.08) rotate(-5deg); }
.day-more {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 0.66rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text-dim);
}
.plan-dots { display: flex; gap: 3px; justify-content: center; margin-top: auto; }
.day-mood ~ .plan-dots { margin-top: 0; }
.plan-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.plan-dots i.done { opacity: 0.35; }

/* 일정 칩: 페리윙클색으로 기분 기록과 구분 */
.entry-chip.plan-chip { background: var(--accent-2-soft); color: var(--accent-2); font-weight: 500; box-shadow: none; }
.entry-chip.plan-chip .chip-mood { font-size: 0.7rem; }
.entry-chip.plan-chip:hover { background: var(--accent-2); color: var(--card); }

/* ---------- 왼쪽(달력 + 통계) / 사이드바 ---------- */
.main-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.side { display: flex; flex-direction: column; gap: 24px; }

.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title-row .card-title { margin-bottom: 0; }
.mini-btn {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  transition: background 0.15s, color 0.15s, transform 0.25s var(--spring);
}
.mini-btn:hover { background: var(--accent-2); color: var(--card); transform: translateY(-1px); }

/* ---------- 다가올 일정 ---------- */
.upcoming-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.upcoming-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  text-align: left;
  border-radius: 14px;
  padding: 6px 10px 6px 6px;
  transition: background 0.15s, transform 0.25s var(--spring);
}
.upcoming-item:hover { background: var(--cell); transform: translateX(2px); }
.upcoming-when {
  flex-shrink: 0;
  width: 52px;
  display: flex; flex-direction: column; align-items: center;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  border-radius: 12px;
  padding: 5px 0;
  line-height: 1.2;
}
.upcoming-when b { font-family: var(--font-num); font-weight: 800; font-size: 0.95rem; }
.upcoming-when small { font-size: 0.66rem; font-weight: 700; opacity: 0.85; }
.upcoming-item.is-today .upcoming-when { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.upcoming-body { min-width: 0; display: flex; flex-direction: column; }
.upcoming-body small { color: var(--text-dim); font-size: 0.72rem; }
.upcoming-title { font-weight: 500; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-more {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}
.upcoming-more:hover { background: var(--cell); color: var(--accent-2); }

/* 일정 완료 체크 */
.upcoming-row { display: flex; align-items: center; gap: 4px; }
.upcoming-row .upcoming-item { flex: 1; min-width: 0; }
.plan-check {
  flex-shrink: 0;
  width: 24px; height: 24px;
  margin-right: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  color: transparent;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.25s var(--spring);
}
.plan-check:hover { border-color: var(--accent-2); color: var(--accent-2); }
.plan-check:active { transform: scale(0.85); }
.upcoming-row.done .plan-check { background: var(--accent-2); border-color: var(--accent-2); color: var(--card); animation: pop 0.3s var(--spring); }
.upcoming-row.done .upcoming-title { text-decoration: line-through; color: var(--text-dim); }
.upcoming-row.done .upcoming-when { opacity: 0.55; }

.entry-chip.plan-chip.done .chip-text { text-decoration: line-through; opacity: 0.7; }
.existing-entry.done .ee-text { text-decoration: line-through; color: var(--text-dim); }

/* ---------- 이번 달 통계 ---------- */
.stats-actions { display: flex; align-items: center; gap: 8px; }
.streak-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--butter);
  color: var(--text);
}
/* 넓은 화면: [요약 | 기분 막대 | 일정 완료율] 세 칸, 좁으면 한 줄씩 */
.stats-body {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px 24px;
  align-items: start;
}
.stats-body > .empty-text { grid-column: 1 / -1; }
.stats-summary { display: grid; grid-template-columns: 1fr; gap: 8px; }
.stats-plans { display: flex; flex-direction: column; gap: 12px; }
.stat-tile {
  background: var(--cell);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex; flex-direction: column;
  min-width: 0;
}
.stat-tile b { font-family: var(--font-num); font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile b.top-mood { display: flex; align-items: center; gap: 6px; }
.inline-mood { font-size: 1.3em; flex-shrink: 0; }
.stat-tile small { color: var(--text-dim); font-size: 0.7rem; }

.mood-bars { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.mood-bar { display: grid; grid-template-columns: 22px 42px 1fr 20px; align-items: center; gap: 6px; font-size: 0.78rem; }
.bar-emoji { font-size: 1.15rem; text-align: center; line-height: 1; }
.bar-label { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; border-radius: 999px; background: var(--cell); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); opacity: 0.4; transition: width 0.5s var(--spring); }
.mood-bar.top .bar-fill { opacity: 1; }
.mood-bar.top .bar-label { color: var(--text); font-weight: 700; }
.bar-count { font-family: var(--font-num); font-weight: 700; text-align: right; color: var(--text-dim); }

.plan-rate-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 6px; }
.plan-rate-head b { font-family: var(--font-num); font-weight: 800; color: var(--accent-2); }
.progress { height: 8px; border-radius: 999px; background: var(--accent-2-soft); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent-2); transition: width 0.5s var(--spring); }

.stats-insight {
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ---------- 백업 (헤더 메뉴) ---------- */
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-menu { position: relative; }
.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  line-height: 1;
  transition: border-color 0.15s, transform 0.25s var(--spring);
}
.icon-btn:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.icon-btn[aria-expanded="true"] { border-color: var(--accent-2); background: var(--accent-2-soft); }
.stale-dot {
  position: absolute; top: -3px; right: -3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.header-panel {
  position: absolute;
  top: calc(100% + 10px); right: 0;
  z-index: 50;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 44px -12px rgba(40, 25, 20, 0.25);
  animation: popUp 0.25s var(--spring);
  transform-origin: top right;
}
.header-panel.hidden { display: none; }

/* 테마 색 고르기 */
.accent-panel { width: 340px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 6px 0;
  border-radius: 12px;
  font-size: 0.7rem;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.swatch:hover { background: var(--cell); color: var(--text); }
.swatch-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.swatch:hover .swatch-dot { transform: scale(1.08); }
.swatch[aria-pressed="true"] { color: var(--text); font-weight: 700; }
.swatch[aria-pressed="true"] .swatch-dot { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text); }
.backup-desc { color: var(--text-dim); font-size: 0.8rem; margin: -6px 0 12px; }
.backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.backup-status { font-size: 0.75rem; color: var(--text-dim); margin-top: 10px; text-align: center; }
.backup-status.stale { color: var(--accent-strong); font-weight: 700; }
.backup-status.stale::before { content: "⚠️ "; }

/* ---------- 디데이 ---------- */
.dday-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.dday-form input, .text-input {
  width: 100%;
  background: var(--cell);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.dday-form input::placeholder, .text-input::placeholder { color: var(--text-dim); }
.dday-form input:focus, .text-input:focus {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.dday-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.dday-item {
  position: relative;
  background: linear-gradient(135deg, var(--accent-2-soft), var(--cell));
  border-radius: 18px;
  padding: 14px 16px;
  transition: transform 0.3s var(--spring);
}
.dday-item:hover { transform: translateY(-2px); }
.dday-item.soon { background: linear-gradient(135deg, var(--accent-soft), var(--butter)); }
.dday-item.past { opacity: 0.5; }
.dday-count {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--accent-2);
}
.dday-item.soon .dday-count { color: var(--accent-strong); }
.dday-item.soon .dday-count::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 8px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
.dday-title { font-weight: 500; font-size: 0.92rem; margin-top: 4px; word-break: break-all; padding-right: 24px; }
.dday-date { font-family: var(--font-num); font-weight: 600; font-size: 0.75rem; color: var(--text-dim); }
.dday-delete {
  position: absolute; top: 10px; right: 10px;
  color: var(--text-dim);
  font-size: 0.75rem;
  width: 26px; height: 26px; border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.dday-item:hover .dday-delete, .dday-delete:focus-visible { opacity: 1; }
.dday-delete:hover { color: var(--danger); background: var(--danger-soft); }
@media (hover: none) { .dday-delete { opacity: 1; } }

.empty-text { color: var(--text-dim); font-size: 0.82rem; text-align: center; padding: 14px 0; }
.empty-text::before { content: "🐣"; display: block; font-size: 1.4rem; margin-bottom: 4px; opacity: 0.8; }

/* ---------- 버튼 ---------- */
.btn {
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s, transform 0.25s var(--spring), box-shadow 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { color: var(--text-dim); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--cell); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--card); }
.btn.plan { background: var(--accent-2-soft); color: var(--accent-2); }
.btn.plan:hover { background: var(--accent-2); color: var(--card); }
.btn.star { background: var(--butter); color: var(--text); }
.btn.star:hover { box-shadow: inset 0 0 0 1.5px var(--star); }

/* ---------- 팝업 ---------- */
.modal {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.18s ease;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px -12px rgba(40, 25, 20, 0.28);
  animation: popUp 0.32s var(--spring);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.close-btn { width: 32px; height: 32px; border-radius: 10px; color: var(--text-dim); font-size: 0.85rem; transition: background 0.15s, color 0.15s, transform 0.25s var(--spring); }
.close-btn:hover { background: var(--cell); color: var(--text); transform: rotate(90deg); }

/* 팝업 탭 (기분 · 있었던 일 / 일정) */
.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--cell);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 16px;
}
.tab-btn {
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--card); color: var(--accent-strong); box-shadow: var(--shadow); }
.tab-btn[data-tab="plan"].active { color: var(--accent-2); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.existing-entries { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.existing-entries:empty { display: none; }
.existing-entry {
  display: flex; align-items: center; gap: 10px;
  background: var(--cell);
  border-radius: 14px;
  padding: 8px 8px 8px 12px;
}
.existing-entry.is-plan { background: var(--accent-2-soft); }
.existing-entry .ee-mood { font-size: 1.3rem; flex-shrink: 0; }
.existing-entry .ee-text { flex: 1; min-width: 0; word-break: break-all; font-size: 0.88rem; }
.existing-entry .ee-text small { display: block; color: var(--text-dim); font-size: 0.72rem; }
.existing-entry.featured { box-shadow: inset 0 0 0 1.5px var(--star); }
.existing-entry .ee-star {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, transform 0.25s var(--spring);
}
.existing-entry .ee-star:hover { background: var(--card); color: var(--star); }
.existing-entry .ee-star.on { color: var(--star); animation: pop 0.3s var(--spring); }
.existing-entry .ee-edit,
.existing-entry .ee-delete {
  font-size: 0.75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 8px; flex-shrink: 0;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.existing-entry .ee-edit:hover { background: var(--card); color: var(--accent-2); }
.existing-entry .ee-delete:hover { background: var(--danger-soft); color: var(--danger); }

.edit-badge {
  display: inline-block;
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--accent-2-soft);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
}

/* 월간 카드 미리보기 */
.share-content { max-width: 400px; }
.share-preview {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 9 / 16;
  max-height: 62vh;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--cell);
  overflow: hidden;
}
.share-preview img { width: 100%; height: 100%; object-fit: contain; }
.share-loading { color: var(--text-dim); font-size: 0.85rem; padding: 16px; text-align: center; }
.share-hint { color: var(--text-dim); font-size: 0.75rem; text-align: center; margin-top: 10px; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* 수정/삭제 선택창 */
.action-content { max-width: 340px; text-align: center; }
.action-date { font-family: var(--font-display); color: var(--text-dim); font-size: 0.95rem; margin-bottom: 14px; }
.action-preview {
  display: flex; align-items: center; gap: 14px;
  background: var(--cell);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
}
.action-mood { font-size: 2.6rem; flex-shrink: 0; max-width: 50%; overflow-wrap: anywhere; line-height: 1.2; animation: bounce 2.2s ease-in-out infinite; }
.action-text { min-width: 0; word-break: break-all; }
.action-text small { display: block; color: var(--text-dim); font-size: 0.72rem; }
.action-buttons { display: flex; flex-direction: column; gap: 8px; }
.action-buttons .btn { width: 100%; }

.field-label { display: block; font-size: 0.8rem; color: var(--text-dim); margin: 14px 0 8px; font-weight: 700; }
.required { color: var(--accent); }

.mood-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.mood-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--cell);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 4px 10px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.25s var(--spring);
}
.mood-btn .emoji { font-size: 2rem; line-height: 1; transition: transform 0.25s var(--spring); }
.mood-btn:hover { background: var(--hover); color: var(--text); }
.mood-btn:hover .emoji { transform: scale(1.12) rotate(-6deg); }
.mood-btn.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.mood-btn.selected .emoji { animation: pop 0.35s var(--spring); }

#customMood { margin-top: 8px; }
.hidden { display: none; }

.form-error { color: var(--danger); font-size: 0.8rem; min-height: 1.2em; margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popUp { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.7); } 100% { transform: scale(1); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } 75% { transform: rotate(-4deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.5; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .stats-body { grid-template-columns: 1fr; }
  .stats-summary { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .app { padding: 20px 12px 36px; }
  .app-header { margin-bottom: 20px; }
  .app-header h1 { font-size: 1.35rem; gap: 10px; }
  .app-header h1 .logo { width: 36px; height: 36px; border-radius: 12px; font-size: 1.15rem; }
  .subtitle { font-size: 0.78rem; padding-left: 46px; }
  .card { padding: 14px; border-radius: 18px; }
  .calendar-nav { margin-bottom: 14px; }
  .month-title h2 { font-size: 1.2rem; }
  .nav-btn { width: 34px; height: 34px; font-size: 1.2rem; border-radius: 10px; }
  .weekdays, .calendar-grid { gap: 3px; }
  .weekdays { font-size: 0.7rem; }
  .view-toggle button { padding: 5px 10px; }
  .day { min-height: 66px; padding: 3px; border-radius: 10px; gap: 2px; }
  .day:hover { transform: none; box-shadow: none; }
  .day-number { font-size: 0.72rem; width: 20px; height: 20px; }
  .holiday-name { display: none; } /* 칸이 좁아서 빨간 숫자로만 표시 */

  /* 기분 달력 (휴대폰) */
  img.day-mood { width: 70%; max-width: 36px; }
  .mood-text.day-mood { font-size: 1rem; }
  .day-more { top: 3px; right: 3px; font-size: 0.55rem; padding: 0 4px; }
  .plan-dots i { width: 4px; height: 4px; }

  /* 기록 달력 (휴대폰): 글자 대신 기분 아이콘, 일정은 얇은 막대 */
  .entry-chip { justify-content: center; padding: 0; background: none; box-shadow: none; }
  .entry-chip .chip-mood { font-size: 1.2rem; max-width: 100%; }
  .entry-chip .chip-text { display: none; }
  .entry-chip.plan-chip { height: 5px; border-radius: 3px; background: var(--accent-2); }
  .entry-chip.plan-chip > * { display: none; }
  .entry-chip.plan-chip.done { opacity: 0.35; }
  .mood-options { gap: 6px; }
  .mood-btn { font-size: 0.68rem; padding: 10px 2px 8px; }
  .dday-count { font-size: 1.7rem; }
}

/* ---------- 모노 테마: 흑백 · 반듯한 고딕 · 각진 모서리 · 그림자 없음 ---------- */
/* 기분 이모지만 컬러로 남겨 포인트가 되게 */
:root[data-accent="mono"] {
  --bg: #fafafa;
  --blob-1: transparent;
  --blob-2: transparent;
  --card: #ffffff;
  --cell: #f4f4f5;
  --hover: #ececee;
  --border: #e6e6e8;
  --text: #111113;
  --text-dim: #8b8b92;
  --accent: #111113; --accent-strong: #000000; --on-accent: #ffffff; --accent-soft: #ededef;
  --accent-2: #4b4b52; --accent-2-soft: #ededef;
  --butter: #ededef;
  --star: #111113;
  --danger: #e5484d; --danger-soft: #fdecec;
  --sun: #e5484d;
  --sat: #8b8b92;
  --shadow-sm: none; --shadow: none; --shadow-accent: none;
  --overlay: rgba(0, 0, 0, 0.35);
  --m-excited: #ededef; --m-sad: #ededef; --m-tired: #ededef; --m-passion: #ededef;
  --m-sleepy: #ededef; --m-calm: #ededef; --m-custom: #ededef;
  --font-display: "Inter", "Noto Sans KR", sans-serif;
  --font-num: "Inter", "Noto Sans KR", sans-serif;
  --display-weight: 700;
  --radius: 14px;
  --spring: cubic-bezier(0.2, 0, 0, 1);
}
:root[data-theme="dark"][data-accent="mono"] {
  --bg: #0b0b0c;
  --card: #131315;
  --cell: #1b1b1e;
  --hover: #232327;
  --border: #26262a;
  --text: #f4f4f5;
  --text-dim: #85858c;
  --accent: #f4f4f5; --accent-strong: #ffffff; --on-accent: #0b0b0c; --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-2: #c8c8cd; --accent-2-soft: rgba(255, 255, 255, 0.07);
  --butter: rgba(255, 255, 255, 0.08);
  --star: #f4f4f5;
  --danger: #ff6369; --danger-soft: rgba(255, 99, 105, 0.12);
  --sun: #ff6369;
  --sat: #85858c;
  --overlay: rgba(0, 0, 0, 0.6);
  --m-excited: #222226; --m-sad: #222226; --m-tired: #222226; --m-passion: #222226;
  --m-sleepy: #222226; --m-calm: #222226; --m-custom: #222226;
}

:root[data-accent="mono"] .app-header h1,
:root[data-accent="mono"] .month-title h2,
:root[data-accent="mono"] .card-title,
:root[data-accent="mono"] .modal-header h3 { letter-spacing: -0.03em; }

:root[data-accent="mono"] .day,
:root[data-accent="mono"] .upcoming-item,
:root[data-accent="mono"] .upcoming-when,
:root[data-accent="mono"] .stat-tile,
:root[data-accent="mono"] .existing-entry,
:root[data-accent="mono"] .mood-btn,
:root[data-accent="mono"] .dday-item,
:root[data-accent="mono"] .view-toggle,
:root[data-accent="mono"] .modal-tabs,
:root[data-accent="mono"] .action-preview,
:root[data-accent="mono"] .stats-insight,
:root[data-accent="mono"] .share-preview,
:root[data-accent="mono"] .text-input,
:root[data-accent="mono"] .dday-form input,
:root[data-accent="mono"] .btn,
:root[data-accent="mono"] .nav-btn,
:root[data-accent="mono"] .icon-btn,
:root[data-accent="mono"] .app-header h1 .logo { border-radius: 8px; }
:root[data-accent="mono"] .entry-chip,
:root[data-accent="mono"] .today-btn,
:root[data-accent="mono"] .mini-btn,
:root[data-accent="mono"] .streak-badge,
:root[data-accent="mono"] .view-toggle button,
:root[data-accent="mono"] .tab-btn { border-radius: 5px; }
:root[data-accent="mono"] .modal-content { border-radius: 16px; }
:root[data-accent="mono"] .header-panel { border-radius: 12px; }

/* 오늘은 테두리로, 마우스를 올리면 떠오르는 대신 테두리만 진하게 */
:root[data-accent="mono"] .day.today { box-shadow: inset 0 0 0 1.5px var(--text); }
:root[data-accent="mono"] .day:hover { transform: none; border-color: var(--text-dim); }
:root[data-accent="mono"] .day:hover .day-mood { transform: scale(1.05); }
