:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: #202b24;
  background: #f5f6ef;
  --green: #2f5847;
  --green-soft: #ddeddf;
  --ink: #173c31;
  --secondary: #4f6157;
  --line: #dce4da;
  --surface: #fff;
  --gold: #8a5618;
  --holiday: #a33143;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; line-height: 1.6; }
a { color: var(--ink); text-underline-offset: 0.2em; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #a35e18; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul { margin: 0; }

.site-header {
  background: #fffdf6;
  border-bottom: 1px solid var(--line);
  padding: 14px max(24px, calc((100% - 1088px) / 2));
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; text-decoration: none; }
.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--green);
  border-radius: 4px;
  background: linear-gradient(var(--green) 0 28%, transparent 28% 100%);
}
main { max-width: 1136px; margin: 0 auto; padding: 34px 24px 45px; }
.intro { margin-bottom: 20px; }
.intro h1 { font-size: clamp(2rem, 5.5vw, 3.35rem); line-height: 1.15; color: var(--ink); letter-spacing: -0.055em; }
.intro p { color: var(--secondary); margin-top: 12px; }

.date-form, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.date-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content;
  gap: 10px 12px;
  align-items: end;
  padding: 18px 22px 14px;
  margin-bottom: 18px;
}
.date-field { min-width: 0; }
.date-field label { display: block; font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; color: var(--ink); }
.date-field input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #adbcb0;
  border-radius: 9px;
  background: #fff;
  color: #202b24;
}
.date-field input[aria-invalid="true"] { border-color: #a03226; }
.primary {
  min-height: 46px;
  border: 1px solid var(--green);
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-weight: 750;
  padding: 0 22px;
}
.primary:hover { background: #214335; }
.form-note, .form-error { grid-column: 1 / -1; font-size: 0.875rem; }
.form-note { color: var(--secondary); }
.form-error { color: #981f1b; font-weight: 650; }

.results { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { min-width: 0; padding: 21px; }
.panel h2 { font-size: 1.4rem; color: var(--ink); letter-spacing: -0.035em; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.calendar-controls { display: flex; gap: 6px; flex-shrink: 0; }
.calendar-controls button {
  min-height: 40px;
  background: #f8fbf7;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.875rem;
}
.calendar-controls button:disabled { color: #75827a; background: #f4f5f3; }
.calendar-controls button:not(:disabled):hover { background: var(--green-soft); }
.month-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 4px; text-align: center; }
.month-table th { color: var(--secondary); font-size: 0.875rem; }
.month-table th:first-child, .month-table th:last-child { color: var(--gold); }
.month-table td { padding: 0; height: 45px; }
.day {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 43px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #f5f7f3;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.day.both { background: var(--green); color: #fff; }
.day.lucky { background: var(--green-soft); color: var(--ink); }
.day.weekend { background: #f7eddd; color: #744713; }
.day.outside-range { background: transparent; color: #707e74; }
.day.highlighted { box-shadow: inset 0 0 0 2px #eebf78; }
.holiday-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--holiday);
  box-shadow: 0 0 0 1px #fff;
}
.legend { list-style: none; padding: 11px 0 0; display: flex; flex-wrap: wrap; gap: 6px 15px; color: var(--secondary); }
.legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; }
.legend-mark { width: 12px; height: 12px; border-radius: 3px; }
.legend-mark.both { background: var(--green); }
.legend-mark.lucky { background: var(--green-soft); border: 1px solid #b6c9b8; }
.legend-mark.weekend { background: #f7eddd; border: 1px solid #dcc5a6; }
.legend-mark.holiday { width: 8px; height: 8px; margin-inline: 2px; border-radius: 50%; background: var(--holiday); }
.month-holidays { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.875rem; }
.month-holidays h3 { font-size: 0.875rem; color: var(--ink); }
.month-holidays ul { list-style: none; padding: 5px 0 0; display: grid; gap: 4px; }
.month-holidays li { display: flex; flex-wrap: wrap; gap: 2px 9px; }
.month-holidays time { color: var(--holiday); font-weight: 700; }

.result-header p { color: var(--secondary); font-variant-numeric: tabular-nums; font-size: 0.875rem; margin-top: 3px; }
.matches { border-radius: 12px; background: #edf5ed; padding: 13px; margin-top: 14px; }
.matches h3, summary { font-size: 0.95rem; font-weight: 750; color: var(--ink); }
.matches .count, summary .count { float: right; }
.count { border-radius: 0.45em; background: #e2ece0; padding: 1px 8px; font-size: 0.875rem; }
.matches .count { color: white; background: var(--green); }
.date-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.date-list:not(:empty) { margin-top: 9px; }
.date-list button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 6px 9px;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.date-list button:hover { border-color: var(--green); }
.date-list:empty { display: none; }
details { margin-top: 10px; border-top: 1px solid var(--line); padding: 9px 0 0; }
summary { min-height: 36px; cursor: pointer; }
.empty, #no-matches { margin-top: 7px; font-size: 0.875rem; color: var(--secondary); }
.sources { color: var(--secondary); margin: 19px 2px 0; font-size: 0.875rem; }
.sources p + p { margin-top: 5px; }
.sources a { display: inline-block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  main { padding: 23px 16px 30px; }
  .site-header { padding: 12px 16px; }
  .date-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  .primary { grid-column: 1 / -1; width: 100%; }
  .results { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .date-results { grid-row: 1; }
  .panel { padding: 14px; }
  .calendar-header h2 { font-size: 1.2rem; }
  .month-table { border-spacing: 3px; }
  .month-table td { height: 38px; }
  .day { min-height: 37px; }
}
