:root {
  color-scheme: light;
  --ink: #272420;
  --muted: #6b655f;
  --paper: #f5f1ea;
  --surface: #ffffff;
  --line: #ddd5cb;
  --primary: #7a3f32;
  --primary-dark: #603128;
  --accent: #276b63;
  --accent-soft: #e4f0ed;
  --warm-soft: #f4e5dd;
  --danger: #a43e35;
  --shadow: 0 10px 28px rgba(66, 48, 38, 0.09);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 18px;
}

* {
  box-sizing: border-box;
}

.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;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(122, 63, 50, 0.09), transparent 29rem),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 920px);
  min-height: 100svh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 calc(6.3rem + env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1rem 0.85rem;
}

.brand-kicker {
  margin: 0 0 0.2rem;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 6vw, 2.05rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

h2 {
  margin: 0;
  font-size: 1.32rem;
  letter-spacing: -0.035em;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.install-button {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 800;
}

#app {
  padding: 0 1rem 1.5rem;
  outline: none;
}

.view {
  display: grid;
  gap: 1rem;
}

.surface {
  border: 1px solid rgba(221, 213, 203, 0.9);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
}

.view-heading-text p,
.section-note,
.storage-note,
.empty-state p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.date-nav {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 0.55rem;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  color: var(--ink);
  background: var(--surface);
  font-size: 1.25rem;
  font-weight: 900;
}

.date-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 850;
}

.today-button {
  display: block;
  min-height: 44px;
  margin: 0.55rem auto 0;
  padding: 0.45rem 1rem;
  border: 0;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.filter-row {
  display: flex;
  gap: 0.45rem;
  padding: 0.1rem 0 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.84rem;
  font-weight: 800;
}

.filter-chip.is-active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.schedule-groups {
  display: grid;
  gap: 0.85rem;
}

.schedule-group {
  padding: 0.9rem;
}

.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.group-heading span {
  color: var(--muted);
  font-size: 0.75rem;
}

.event-list {
  display: grid;
  gap: 0.55rem;
}

.event-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  min-height: 68px;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: #fff;
}

.event-card.is-complete {
  background: #f3f5f3;
}

.event-card.is-complete .event-title {
  color: var(--muted);
  text-decoration: line-through;
}

.event-order {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--primary-dark);
  background: var(--warm-soft);
  font-weight: 900;
}

.event-main {
  min-width: 0;
}

.event-title {
  margin: 0;
  font-weight: 850;
  line-height: 1.35;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.14rem 0.5rem;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.complete-control {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
}

.complete-control input {
  width: 25px;
  height: 25px;
  accent-color: var(--accent);
}

.edit-button {
  min-width: 48px;
  min-height: 44px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  color: var(--muted);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.empty-slot {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 0.8rem;
  color: #948d85;
  font-size: 0.8rem;
}

.empty-state {
  padding: 1.4rem 1rem;
  text-align: center;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 52px;
  padding: 0.7rem 1rem;
  border-radius: 0.85rem;
  font-weight: 900;
}

.primary-button {
  border: 1px solid var(--primary);
  color: #fff;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.danger-button {
  border: 1px solid #edcbc8;
  color: var(--danger);
  background: #fff7f6;
}

.full-width {
  width: 100%;
}

.month-panel,
.form-panel,
.year-panel {
  padding: 1rem;
}

.month-header,
.year-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.month-title,
.year-title {
  text-align: center;
  font-size: 1.18rem;
  font-weight: 900;
}

.weekday-row,
.calendar-grid,
.mini-weekdays,
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row span {
  padding: 0.45rem 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.weekday-row span:first-child,
.calendar-day.is-sunday .day-number {
  color: #b0443a;
}

.calendar-day {
  min-width: 0;
  min-height: 62px;
  padding: 0.35rem 0.2rem;
  border: 1px solid #ebe5de;
  color: var(--ink);
  background: #fff;
  text-align: center;
}

.calendar-day:nth-child(7n + 1) {
  border-radius: 0.55rem 0 0 0.55rem;
}

.calendar-day:nth-child(7n) {
  border-radius: 0 0.55rem 0.55rem 0;
}

.calendar-day.is-outside {
  color: #b3ada6;
  background: #faf8f5;
}

.calendar-day.is-selected {
  position: relative;
  z-index: 1;
  border-color: var(--primary);
  outline: 2px solid var(--primary);
}

.calendar-day.is-today .day-number {
  color: #fff;
  background: var(--accent);
}

.day-number {
  display: grid;
  width: 29px;
  height: 29px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 850;
}

.day-count {
  display: block;
  min-height: 1rem;
  margin-top: 0.18rem;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 900;
}

.selected-day-heading {
  margin-bottom: 0.65rem;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.38rem;
}

.field label,
.field-label {
  font-size: 0.84rem;
  font-weight: 850;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 54px;
  padding: 0.7rem 0.8rem;
  border: 1px solid #cfc6bc;
  border-radius: 0.8rem;
  color: var(--ink);
  background: #fff;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(39, 107, 99, 0.3);
  outline-offset: 2px;
}

.checkbox-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
}

.checkbox-row input {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

.form-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.3rem;
}

.storage-note {
  padding: 0.85rem;
  border-radius: 0.8rem;
  background: #f7f5f1;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.mini-month {
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.mini-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-weight: 900;
}

.mini-month-header span:last-child {
  color: var(--primary);
  font-size: 0.67rem;
}

.mini-weekdays span,
.mini-day {
  text-align: center;
  font-size: 0.55rem;
}

.mini-weekdays span {
  color: var(--muted);
  font-weight: 800;
}

.mini-day {
  display: grid;
  min-height: 21px;
  place-items: center;
  border-radius: 50%;
}

.mini-day.has-event {
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 0.45rem 0.55rem calc(0.45rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 -8px 28px rgba(70, 50, 37, 0.08);
}

.nav-button {
  min-height: 58px;
  padding: 0.25rem;
  border: 0;
  border-radius: 0.75rem;
  color: var(--muted);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 800;
}

.nav-button.is-active {
  color: var(--primary);
  background: var(--warm-soft);
}

.nav-icon {
  display: grid;
  width: 31px;
  height: 31px;
  margin: 0 auto 0.18rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 0.65rem;
  font-size: 0.62rem;
  font-weight: 900;
}

.nav-add .nav-icon {
  border: 0;
  color: #fff;
  background: var(--primary);
  font-size: 1.25rem;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 1rem;
  bottom: calc(5.8rem + env(safe-area-inset-bottom));
  left: 1rem;
  max-width: 620px;
  margin: 0 auto;
  padding: 0.8rem 1rem;
  border-radius: 0.85rem;
  color: #fff;
  background: #2d2a27;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
  text-align: center;
  font-size: 0.84rem;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.info-dialog {
  width: min(calc(100% - 2rem), 440px);
  padding: 0;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 25px 70px rgba(25, 20, 16, 0.25);
}

.info-dialog::backdrop {
  background: rgba(32, 27, 23, 0.55);
}

.info-dialog form {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
}

.info-dialog p,
.info-dialog ol {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (min-width: 700px) {
  .app-header,
  #app {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
  }

  .schedule-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-day {
    min-height: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
