@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  --bg: #F7F7F7;
  --card: #FFFFFF;
  --line: #E4E4E4;
  --text: #2B2B2B;
  --sub: #8A8A8A;

  --c-red: #F6D5D5;
  --c-orange: #F8DFC8;
  --c-yellow: #F5EBC0;
  --c-green: #D5EBD3;
  --c-teal: #CDE9E6;
  --c-blue: #D3E1F5;
  --c-purple: #E1D8F3;
  --c-gray: #E6E6E3;

  --g0: #ECEEE8;
  --g1: #D5E6CC;
  --g2: #B4D3A6;
  --g3: #8DB07A;
  --g4: #5F8A52;

  --hour: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { color: var(--line); cursor: default; }
ul { list-style: none; }

[data-color="red"] { background: var(--c-red); }
[data-color="orange"] { background: var(--c-orange); }
[data-color="yellow"] { background: var(--c-yellow); }
[data-color="green"] { background: var(--c-green); }
[data-color="teal"] { background: var(--c-teal); }
[data-color="blue"] { background: var(--c-blue); }
[data-color="purple"] { background: var(--c-purple); }
[data-color="gray"] { background: var(--c-gray); }

[data-level="0"] { background: var(--g0); }
[data-level="1"] { background: var(--g1); }
[data-level="2"] { background: var(--g2); }
[data-level="3"] { background: var(--g3); }
[data-level="4"] { background: var(--g4); }

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 16px)
    calc(env(safe-area-inset-bottom) + 24px) calc(env(safe-area-inset-left) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.spacer { flex: 1; }
.count { color: var(--sub); font-size: 13px; }

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.icon-btn.primary { background: var(--text); color: #FFFFFF; }
.icon-btn[data-small] { width: 30px; height: 36px; }
.icon-btn[data-small] svg { width: 19px; height: 19px; }

/* 상단 줄 */
.top { display: flex; align-items: center; min-height: 44px; }
.logo {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: #FFFFFF;
  border-radius: 6px;
}
.logo svg { width: 20px; height: 20px; stroke-width: 2.5; }

/* 잔디밭 */
.grass { padding: 16px; }
.grass-total { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--sub); }
.grass-total svg { width: 18px; height: 18px; }
.grass-total strong { font-size: 26px; line-height: 1; color: var(--text); }
.grass-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: 14px repeat(7, auto);
  grid-template-columns: auto repeat(var(--n), minmax(0, 1fr));
  gap: 3px;
  font-size: 10px;
  line-height: 1;
  color: var(--sub);
}
.grass-grid > span { align-self: center; padding-right: 3px; }
.grass-grid > .grass-month { min-width: 0; padding: 0; white-space: nowrap; }
.cell { width: 100%; aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center; }
.cell.empty { background: none; }
.cell[aria-current]::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text);
}

/* 날짜 줄 */
.date-row { display: flex; align-items: center; }
.date-label { position: relative; min-width: 0; height: 44px; padding: 0 2px; display: flex; align-items: center; }
.date-label strong { font-size: 17px; white-space: nowrap; }
.date-pick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; }
.date-row > .count { margin-left: 4px; white-space: nowrap; }

/* 카테고리 */
.category { padding: 6px 10px 0 16px; }
.category header { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.category h2 { font-size: 16px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.category header .count { flex: 1; }
.category header .icon-btn + .icon-btn { margin-left: -8px; }
.category ul { border-top: 1px solid var(--line); margin-right: 6px; }
.category ul:empty { border-top: 0; }
.category .icon-btn, .add-row { color: var(--sub); }

.task { display: flex; align-items: center; min-height: 44px; margin-right: -6px; }
.check {
  width: 34px;
  height: 44px;
  flex: none;
  margin: 0 6px 0 -9px;
  display: grid;
  place-items: center;
}
.check::before {
  content: "";
  grid-area: 1 / 1;
  width: 15px;
  height: 15px;
  border: 1px solid #BDBDBD;
  border-radius: 4px;
}
.check svg { grid-area: 1 / 1; width: 11px; height: 11px; stroke-width: 2.5; }
.task-text { flex: 1; min-width: 0; padding: 6px 0; display: flex; flex-direction: column; }
.task-name { overflow-wrap: anywhere; }
.task > .task-name { flex: 1; min-width: 0; padding: 6px 0; font-size: 14px; }
.task-time { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); white-space: nowrap; }
.task > .task-time { flex: none; margin: 0 4px 0 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }
.task.done .task-name { text-decoration: line-through; color: var(--sub); }

.add-row { width: 100%; height: 44px; display: flex; align-items: center; }
.add-row svg { width: 20px; height: 20px; }

.add-category { height: 56px; display: grid; place-items: center; color: var(--sub); border-style: dashed; }

/* 팝업 */
dialog {
  width: min(360px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
}
dialog::backdrop { background: rgba(0, 0, 0, .25); }
.dialog-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.dialog-body footer { display: flex; justify-content: space-between; margin-top: 4px; }
.dialog-body footer:only-child { margin-top: 0; }

.dialog-body input, .dialog-body select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.dialog-body input:focus, .dialog-body select:focus { border-color: var(--sub); }
.dialog-body [aria-invalid="true"] { border-color: var(--text); }
.chips[aria-invalid="true"] .chip { border-color: var(--text); }

.row { display: flex; gap: 8px; }
.field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.field span { flex: none; font-size: 13px; color: var(--sub); }

.colors { display: flex; justify-content: space-between; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }
.swatch[aria-pressed="true"] { outline: 1.5px solid var(--text); outline-offset: 2px; }
.swatch:disabled { background: var(--bg); outline: 0; }

.chips { display: flex; gap: 6px; }
.chips[hidden], .field[hidden] { display: none; }
.chip {
  flex: 1;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--sub);
}
.chip svg { width: 18px; height: 18px; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #FFFFFF; }

.rules li { display: flex; align-items: center; min-height: 48px; }
.rules .icon-btn { color: var(--sub); }

/* 스케줄러 */
.week-label { font-size: 15px; white-space: nowrap; }
.week { --cols: 28px repeat(7, minmax(0, 1fr)); }
.week-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--cols);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  padding: calc(env(safe-area-inset-top) + 8px) 0 8px;
  margin-top: calc(env(safe-area-inset-top) * -1);
}
.week-head span { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--sub); }
.week-head small { font-size: 11px; }
.week-head .is-today { color: var(--text); font-weight: 700; }
.week-body { display: grid; grid-template-columns: var(--cols); overflow: hidden; border-radius: 0 0 14px 14px; }
.week-hours span {
  display: block;
  height: var(--hour);
  padding-top: 2px;
  text-align: center;
  font-size: 10px;
  color: var(--sub);
}
.week-day {
  position: relative;
  height: calc(var(--hour) * 24);
  border-left: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour));
}
.block {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 4px;
  text-align: center;
  line-height: 1.2;
}
.block-name { font-size: 11px; font-weight: 600; max-height: 100%; overflow: hidden; overflow-wrap: anywhere; }
.block-time { display: flex; flex-wrap: wrap; justify-content: center; font-size: 9px; color: #6B6B6B; }
.block.done .block-name { text-decoration: line-through; color: var(--sub); }
