@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');
@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --paper: #fffdf8;
  --ink: #26221d;
  --ink-2: #5d554b;
  --ink-3: #8f8678;
  --line: #e7dfcf;
  --green: #7ab52f;
  --green-deep: #4f7f17;
  --green-soft: #eef6e1;
  --red: #c4462b;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(38, 34, 29, .04), 0 12px 32px -18px rgba(38, 34, 29, .28);
  --sans: 'Pretendard Variable', Pretendard, 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --serif: 'Gowun Batang', 'Noto Serif KR', serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: light; } }
:root[data-theme="dark"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 18px; line-height: 1.6;
  letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--green-deep); }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* 상단 */
.topbar { padding: 28px 0 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.brand { display: flex; flex-direction: column; }
.brand .eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .28em; color: var(--green); }
.brand h1 { margin: 2px 0 0; font-family: var(--serif); font-weight: 700; font-size: clamp(36px, 8vw, 52px); line-height: 1.05; letter-spacing: -0.02em; }
.brand .sub { margin-top: 6px; font-size: 15px; color: var(--ink-3); }

/* 날짜 이동 */
.datebar { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; flex-wrap: wrap; }
.datebar .big { font-size: clamp(26px, 5.4vw, 34px); font-weight: 800; letter-spacing: -0.03em; flex: 1 1 auto; min-width: 0; }
.datebar .big small { font-size: .62em; font-weight: 600; color: var(--green-deep); margin-left: 8px; }
.iconbtn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; box-shadow: var(--shadow); }
.iconbtn:hover { border-color: var(--green); }
.iconbtn svg { width: 22px; height: 22px; }
.pill { height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 16px; box-shadow: var(--shadow); }
.pill.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.datepick { position: relative; }
.datepick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* 주간 띠 */
.week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.day { border: 1px solid var(--line); background: var(--paper); border-radius: 16px; padding: 10px 4px 12px; text-align: center; position: relative; transition: transform .15s; }
.day:hover { transform: translateY(-2px); }
.day .dw { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.day .dd { font-size: 24px; font-weight: 800; line-height: 1.2; }
.day .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); }
.day.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.day.on .dw { color: #cfc8bb; }
.day.today:not(.on) { border-color: var(--green); border-width: 2px; }

/* 데일리 카드 */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: clamp(20px, 4vw, 34px); }
.card-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.card-head .eyebrow { font-size: 13px; letter-spacing: .28em; color: var(--green); font-weight: 700; }
.card-head .title { font-family: var(--serif); font-size: clamp(30px, 6.5vw, 42px); font-weight: 700; line-height: 1.1; }
.card-head .date { text-align: right; flex-shrink: 0; }
.card-head .date .d { font-size: clamp(18px, 4vw, 24px); font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; margin-top: 6px; background: var(--green); color: #fff; font-weight: 700; font-size: 15px; padding: 4px 14px; border-radius: 999px; }

.wx { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 16px; background: var(--green-soft); border: 1px solid #dcebc6; border-radius: 16px; padding: 12px 16px; font-size: 17px; }
.wx svg { width: 34px; height: 26px; flex-shrink: 0; }
.wx b { font-size: 19px; }
.wx .sep { width: 1px; height: 18px; background: #c9dcab; }
.wx .src { margin-left: auto; font-size: 13px; color: var(--ink-3); }

.tag { display: inline-block; margin-top: 16px; padding: 4px 14px; border-radius: 999px; background: #fdeef0; color: #c2415a; font-weight: 800; font-size: 15px; letter-spacing: .04em; }
.tray { margin: 18px 0 6px; }
.tray svg { width: 100%; height: auto; display: block; }

.sec-title { font-size: 15px; font-weight: 800; letter-spacing: .14em; color: var(--green-deep); margin: 22px 0 8px; }
.mainlist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.mainlist li { font-size: clamp(19px, 4.2vw, 22px); font-weight: 600; padding: 4px 14px; border-radius: 12px; background: #f5f0e5; }
.mainlist li.hero { background: var(--ink); color: #fff; font-weight: 800; }
.mainlist li.muted { color: var(--ink-3); background: #f3efe7; font-weight: 500; }

.extras { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: 18px; }
.extras dt { color: var(--ink-3); font-weight: 600; }
.extras dd { margin: 0; font-weight: 600; }
.origin { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); line-height: 1.7; white-space: pre-line; }
.weeknote { margin-top: 10px; font-size: 13.5px; color: var(--ink-3); white-space: pre-line; }
.actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.empty { text-align: center; padding: 48px 12px; }
.empty .em { font-size: 52px; line-height: 1; }
.empty h2 { font-size: 26px; margin: 14px 0 6px; letter-spacing: -0.02em; }
.empty p { color: var(--ink-2); margin: 0; font-size: 17px; }

.footer { text-align: center; color: var(--ink-3); font-size: 14px; padding: 28px 0 40px; }
.footer a { color: var(--ink-3); }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(20, 18, 15, .78); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal.open { display: flex; }
.modal img { max-width: 100%; max-height: 86vh; border-radius: 12px; background: #fff; }
.modal .close { position: absolute; top: 14px; right: 14px; background: #fff; border: 0; border-radius: 999px; padding: 8px 16px; font-weight: 700; }

.skeleton { height: 420px; border-radius: var(--radius); background: linear-gradient(90deg, #efe9dc, #f7f2e8, #efe9dc); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* 관리 화면 */
.admin .card + .card { margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field label { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.field input[type=text], .field input[type=password], .field input[type=date], .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; font-size: 17px; outline: none;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px #e3f1cf; }
.help { font-size: 13.5px; color: var(--ink-3); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.daycard h3 { margin: 0; font-size: 22px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.daycard h3 .chip { font-size: 14px; background: var(--green-soft); color: var(--green-deep); padding: 2px 10px; border-radius: 999px; }
.daygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.daygrid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; margin-left: auto; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 16px; display: none; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
.toast.show { display: block; }
.toast.err { background: var(--red); }
.weeks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.weeks button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 15px; font-weight: 600; }
.weeks button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.preview { margin-top: 12px; }
.preview img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.mini-tray { margin-top: 12px; border: 1px dashed var(--line); border-radius: 14px; padding: 8px; background: #fffdf8; }
.savebar { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(247,243,234,0), var(--bg) 30%); padding: 18px 0 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.danger { color: var(--red); border-color: #f0c9bf; }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .week { gap: 6px; }
  .day .dd { font-size: 21px; }
  .extras { grid-template-columns: 1fr; gap: 2px; }
  .extras dd { margin-bottom: 10px; }
  .daygrid { grid-template-columns: 1fr; }
  .wx .src { margin-left: 0; width: 100%; }
  .iconbtn, .pill { height: 44px; }
  .iconbtn { width: 44px; }
  .datebar .big { flex-basis: 100%; }
  .datebar .pill.primary { flex: 1; }
}
