:root {
  color-scheme: light;
  --primary: #2563eb;
  --primary-container: #dbeafe;
  --on-primary-container: #0b2b66;
  --background: #f7f8fa;
  --surface: #ffffff;
  --surface-variant: #e9edf3;
  --text: #17191c;
  --muted: #717780;
  --outline: #dfe4eb;
  --danger: #c84f63;
  --shadow: 0 18px 50px rgba(21, 34, 60, .12);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { background: #e4e8ef; color: var(--text); font-family: Inter, Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: -.025em; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(37, 99, 235, .24); outline-offset: 2px; }

.site-shell { width: min(100%, 480px); min-height: 100vh; margin: 0 auto; background: var(--background); box-shadow: 0 0 60px rgba(28, 39, 64, .14); }
.main-panel { position: relative; display: flex; min-height: 100vh; flex-direction: column; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 20px 12px; background: var(--background); }
.topbar-copy { min-width: 0; }
.eyebrow { display: block; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.topbar h1 { overflow: hidden; margin: 6px 0 0; font-size: 23px; font-weight: 750; letter-spacing: -.07em; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.search-box { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted); }
.search-box span { font-size: 25px; line-height: 1; }
.search-box input { position: absolute; top: 68px; right: 20px; z-index: 4; display: none; width: calc(100% - 40px); height: 42px; padding: 0 13px; border: 1px solid var(--outline); border-radius: 12px; outline: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 13px; }
.search-box:focus-within { color: var(--primary); }
.search-box:focus-within input, .search-box input:not(:placeholder-shown) { display: block; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; }
.icon-button:hover, .search-box:hover { background: var(--surface-variant); color: var(--primary); }
.primary-button, .secondary-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 6px; border-radius: 11px; font-size: 12px; font-weight: 750; transition: .16s ease; }
.primary-button { padding: 0 15px; background: var(--primary); color: white; box-shadow: 0 8px 18px rgba(37, 99, 235, .2); }
.primary-button:hover { background: #1d4ed8; transform: translateY(-1px); }
.primary-button.compact { min-height: 36px; padding: 0 12px; }
.secondary-button { padding: 0 13px; border: 1px solid var(--outline); background: var(--surface); color: var(--text); }
.secondary-button:hover { border-color: #9db5ff; color: var(--primary); }

.view-root { flex: 1; padding: 0 20px 92px; }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 5px 0 15px; }
.view-heading h2 { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -.055em; }
.view-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.month-switcher { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--outline); border-radius: 11px; background: var(--surface); }
.month-switcher button { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; }
.month-switcher button:hover { background: var(--primary-container); color: var(--primary); }
.month-label { min-width: 73px; color: var(--text); font-size: 10px; font-weight: 750; text-align: center; }

.overview-grid { display: grid; gap: 14px; }
.card { border: 1px solid var(--outline); border-radius: var(--radius-xl); background: var(--surface); box-shadow: 0 5px 18px rgba(38, 54, 83, .04); }
.calendar-card { padding: 14px 10px 12px; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { margin-bottom: 7px; }
.weekday { padding: 0 2px 4px; color: var(--muted); font-size: 10px; font-weight: 650; text-align: center; }
.weekday:first-child { color: var(--danger); }
.calendar-cell { position: relative; min-height: 70px; padding: 5px 3px; border-top: 1px solid var(--outline); border-right: 1px solid var(--outline); }
.calendar-cell:nth-child(7n + 1) { border-left: 1px solid var(--outline); }
.calendar-cell:nth-last-child(-n + 7) { border-bottom: 1px solid var(--outline); }
.calendar-cell.is-outside { background: #f1f3f6; color: #b8bec8; }
.calendar-cell.is-empty:hover { background: var(--primary-container); cursor: pointer; }
.calendar-day { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; color: var(--muted); font-size: 10px; font-weight: 650; }
.calendar-cell.is-today .calendar-day { color: var(--primary); }
.today-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.calendar-photo { position: absolute; inset: 24px 4px 4px; overflow: hidden; border-radius: 8px; background: var(--photo-bg, var(--surface-variant)); background-position: center; background-size: cover; box-shadow: 0 5px 10px rgba(22, 33, 57, .14); transition: transform .16s ease; }
.calendar-photo::after, .feed-photo::after { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 38%, rgba(8, 14, 29, .34)); content: ""; }
.calendar-photo span { position: absolute; right: 4px; bottom: 3px; z-index: 1; color: white; font-size: 8px; font-weight: 750; }
.calendar-photo:hover { transform: scale(1.04); }

.progress-card { padding: 17px; border-color: transparent; background: var(--primary-container); color: var(--on-primary-container); box-shadow: none; }
.progress-card .card-kicker { display: none; }
.progress-card h3 { margin: 0; font-size: 17px; letter-spacing: -.055em; }
.progress-card p { margin: 5px 0 0; color: var(--on-primary-container); opacity: .78; font-size: 11px; line-height: 1.5; }
.progress-copy > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.progress-percent { font-size: 17px; letter-spacing: -.05em; }
.progress-ring { position: static; display: block; width: auto; height: 8px; margin: 14px 0 0; border-radius: 99px; background: rgba(255, 255, 255, .74); }
.progress-ring::after { display: none; }
.progress-ring strong { display: none; }
.progress-ring span { display: none; }
.progress-ring::before { display: block; width: var(--progress); height: 8px; border-radius: inherit; background: var(--primary); content: ""; }
.progress-stats { display: none; }

.section-card { margin-top: 14px; padding: 16px; }
.section-card h3 { margin: 0; font-size: 14px; letter-spacing: -.04em; }
.section-card > p { margin: 5px 0 13px; color: var(--muted); font-size: 10px; }

.feed-list { display: grid; gap: 13px; }
.feed-card { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius-xl); background: var(--surface); box-shadow: 0 5px 18px rgba(38, 54, 83, .04); cursor: pointer; transition: .16s ease; }
.feed-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.feed-photo { position: relative; height: 190px; overflow: hidden; background: var(--photo-bg); background-position: center; background-size: cover; }
.feed-photo .photo-date { position: absolute; right: 12px; bottom: 9px; z-index: 1; color: white; font-size: 10px; font-weight: 700; }
.feed-copy { padding: 14px 15px 15px; }
.feed-date { color: var(--primary); font-size: 10px; font-weight: 750; }
.feed-copy h3 { overflow: hidden; margin: 6px 0 4px; font-size: 16px; font-weight: 750; letter-spacing: -.05em; text-overflow: ellipsis; white-space: nowrap; }
.feed-copy p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.feed-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; color: var(--muted); font-size: 10px; }
.music-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favorite-mark { color: #e9768f; font-size: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric-card { padding: 13px 11px; border: 1px solid transparent; border-radius: var(--radius-lg); background: var(--primary-container); color: var(--on-primary-container); }
.metric-card span { display: block; font-size: 10px; }
.metric-card strong { display: block; margin-top: 6px; font-size: 21px; letter-spacing: -.07em; }
.metric-card small { display: block; overflow: hidden; margin-top: 4px; color: var(--on-primary-container); font-size: 9px; opacity: .7; text-overflow: ellipsis; white-space: nowrap; }
.chart-card { margin-top: 14px; padding: 16px; }
.chart-card h3 { margin: 0; font-size: 14px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 145px; margin-top: 20px; padding: 0 4px; border-bottom: 1px solid var(--outline); }
.bar-wrap { display: flex; flex: 1; height: 100%; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bar { width: min(26px, 70%); min-height: 7px; border-radius: 8px 8px 2px 2px; background: var(--primary); }
.bar-wrap span { color: var(--muted); font-size: 9px; }
.mood-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.mood-chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 9px; border-radius: 99px; background: var(--surface-variant); color: var(--muted); font-size: 10px; }

.archive-layout { display: grid; gap: 13px; }
.archive-panel { padding: 16px; }
.archive-panel h3 { margin: 0; font-size: 15px; }
.archive-panel > p { margin: 5px 0 13px; color: var(--muted); font-size: 10px; }
.count-badge { display: inline-grid; min-width: 21px; height: 21px; margin-left: 3px; place-items: center; border-radius: 50%; background: var(--primary-container); color: var(--primary); font-size: 10px; }
.archive-list { display: grid; gap: 8px; }
.archive-row { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 12px; background: var(--surface-variant); cursor: pointer; }
.archive-row:hover { background: var(--primary-container); }
.archive-thumb { flex: 0 0 auto; width: 49px; height: 49px; border-radius: 9px; background: var(--photo-bg); background-position: center; background-size: cover; }
.archive-row strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.archive-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.archive-empty { padding: 23px 10px; border: 1px dashed var(--outline); border-radius: 13px; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: center; }
.backup-actions { display: grid; gap: 8px; }
.highlight-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.highlight { padding: 11px 8px; border-radius: 12px; background: var(--surface-variant); }
.highlight strong { display: block; font-size: 19px; }
.highlight span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }

.empty-state { display: grid; min-height: 220px; place-items: center; padding: 25px; border: 1px dashed var(--outline); border-radius: var(--radius-xl); background: var(--surface); text-align: center; }
.empty-state .empty-icon { display: grid; width: 47px; height: 47px; margin: 0 auto 12px; place-items: center; border-radius: 15px; background: var(--primary-container); color: var(--primary); font-size: 24px; }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { margin: 6px 0 15px; color: var(--muted); font-size: 11px; }

.mobile-nav { position: fixed; bottom: 0; z-index: 20; display: grid; width: min(100%, 480px); grid-template-columns: repeat(5, 1fr); padding: 7px 7px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--outline); background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); }
.mobile-nav .nav-item { display: grid; gap: 3px; justify-items: center; padding: 6px 2px; border-radius: 11px; background: transparent; color: var(--muted); font-size: 9px; text-align: center; }
.mobile-nav .nav-item:hover { background: var(--surface-variant); }
.mobile-nav .nav-item.is-active { background: var(--primary-container); color: var(--primary); }
.mobile-nav .nav-item.nav-add { margin: 0 4px; background: var(--text); color: white; box-shadow: 0 7px 15px rgba(23, 25, 28, .2); }
.mobile-nav .nav-icon { font-size: 18px; line-height: 1; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 14px; background: rgba(19, 26, 41, .58); backdrop-filter: blur(5px); }
.modal { width: min(100%, 440px); max-height: calc(100vh - 28px); overflow: auto; border: 1px solid var(--outline); border-radius: 23px; background: var(--surface); box-shadow: 0 25px 70px rgba(8, 15, 30, .25); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 19px 18px 13px; }
.modal-head h2 { margin: 0; font-size: 19px; letter-spacing: -.06em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.close-button { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 10px; background: var(--surface-variant); color: var(--muted); font-size: 19px; }
.detail-body { display: grid; gap: 0; }
.detail-photo { min-height: 255px; background: var(--photo-bg); background-position: center; background-size: cover; }
.detail-copy { padding: 18px; }
.detail-copy .feed-date { font-size: 10px; }
.detail-copy h2 { margin: 7px 0 7px; font-size: 23px; letter-spacing: -.06em; }
.detail-copy .story { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.detail-music { display: flex; align-items: center; gap: 9px; margin-top: 16px; padding: 11px; border-radius: 12px; background: var(--surface-variant); }
.detail-music .music-art { display: grid; width: 33px; height: 33px; place-items: center; border-radius: 9px; background: var(--text); color: white; }
.detail-music strong { display: block; font-size: 11px; }
.detail-music span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.detail-actions { display: flex; gap: 7px; margin-top: 16px; }
.detail-actions button { flex: 1; }

.editor-form { padding: 0 18px 18px; }
.editor-layout { display: grid; gap: 13px; }
.upload-box { position: relative; display: grid; min-height: 175px; place-items: center; overflow: hidden; border: 1px dashed #9db5ff; border-radius: 16px; background: var(--primary-container); color: var(--primary); text-align: center; cursor: pointer; }
.upload-box.has-photo { border-style: solid; background: var(--photo-bg); background-position: center; background-size: cover; color: white; }
.upload-box.has-photo::after { position: absolute; inset: 0; background: rgba(8, 13, 25, .25); content: ""; }
.upload-box-content { position: relative; z-index: 1; padding: 12px; }
.upload-box strong { display: block; font-size: 12px; }
.upload-box span { display: block; margin-top: 5px; font-size: 10px; }
.form-fields { display: grid; gap: 9px; }
.form-field { display: grid; gap: 4px; }
.form-field label { color: var(--muted); font-size: 10px; font-weight: 750; }
.form-field input, .form-field textarea, .form-field select { width: 100%; border: 1px solid var(--outline); border-radius: 10px; outline: 0; background: var(--background); color: var(--text); font-size: 12px; }
.form-field input, .form-field select { height: 37px; padding: 0 9px; }
.form-field textarea { min-height: 85px; padding: 9px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: #9db5ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 14px; }
.form-error { min-height: 15px; margin-top: 8px; color: var(--danger); font-size: 10px; }

body[data-theme="dark"] { color-scheme: dark; --background: #101216; --surface: #181b20; --surface-variant: #2a2f37; --text: #f4f5f7; --muted: #a8adb5; --outline: #343a44; --primary-container: #124b9c; --on-primary-container: #d9e7ff; }
body[data-theme="dark"] { background: #080a0d; }
body[data-theme="dark"] .site-shell { box-shadow: 0 0 70px rgba(0, 0, 0, .38); }
body[data-theme="dark"] .calendar-cell.is-outside { background: #15181d; }
body[data-theme="dark"] .mobile-nav { background: rgba(24, 27, 32, .94); }

@media (max-width: 480px) {
  body { background: var(--background); }
  .site-shell { width: 100%; box-shadow: none; }
}
