:root {
  --paper: #fafaf7;
  --surface: #ffffff;
  --ink: #22312b;
  --muted: #6d7771;
  --line: #e5e9e4;
  --mint: #6ec6b6;
  --mint-soft: #e7f7f2;
  --coral: #ff8a7a;
  --coral-soft: #fff0ed;
  --blue: #6aa7d8;
  --blue-soft: #edf6ff;
  --lavender: #a892d8;
  --lavender-soft: #f4efff;
  --yellow: #f2c96d;
  --yellow-soft: #fff7de;
  --shadow: 0 16px 42px rgba(32, 49, 43, 0.09);
  --radius: 14px;
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(231, 247, 242, 0.8), rgba(250, 250, 247, 0) 220px),
    var(--paper);
  position: relative;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(94px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  color: var(--mint);
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.date-line {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(32, 49, 43, 0.06);
}

.ghost-button {
  padding: 0 14px;
  font-weight: 750;
}

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
}

.hero {
  background:
    linear-gradient(135deg, rgba(110, 198, 182, 0.16), rgba(255, 138, 122, 0.13)),
    var(--surface);
  border: 1px solid rgba(110, 198, 182, 0.28);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hero-title {
  margin: 0;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: 0;
}

.hero-summary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.child-row,
.segmented,
.quick-grid,
.summary-grid,
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.child-row::-webkit-scrollbar,
.segmented::-webkit-scrollbar,
.quick-grid::-webkit-scrollbar,
.summary-grid::-webkit-scrollbar,
.filter-row::-webkit-scrollbar {
  display: none;
}

.chip,
.segment {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 780;
  font-size: 14px;
}

.chip.active,
.segment.active {
  border-color: transparent;
  color: #16312b;
  background: var(--mint-soft);
}

.summary-grid {
  margin: 16px 0;
}

.summary-card {
  flex: 1 0 128px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--surface);
  min-height: 90px;
}

.summary-card strong {
  display: block;
  font-size: 22px;
  margin-top: 8px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.section {
  margin: 20px 0 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.small-link {
  background: transparent;
  color: var(--blue);
  font-weight: 800;
  padding: 6px 0;
}

.list {
  display: grid;
  gap: 10px;
}

.event-card,
.source-card,
.day-card,
.review-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 10px 26px rgba(32, 49, 43, 0.05);
}

.event-card.review {
  border-color: rgba(255, 138, 122, 0.45);
  background: linear-gradient(0deg, var(--coral-soft), var(--surface) 48%);
}

.event-top,
.source-top,
.day-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.event-time {
  color: var(--muted);
  font-weight: 850;
  font-size: 13px;
  white-space: nowrap;
}

.event-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.meta-row,
.tag-row,
.prep-list,
.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 27px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 820;
  background: var(--blue-soft);
  color: #245477;
}

.tag.coral {
  color: #8b362b;
  background: var(--coral-soft);
}

.tag.mint {
  color: #235e53;
  background: var(--mint-soft);
}

.tag.lavender {
  color: #4d3f78;
  background: var(--lavender-soft);
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 8px 10px;
  background: #f5f6f2;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 760;
  font-size: 13px;
}

.check-pill.done {
  color: var(--muted);
  text-decoration: line-through;
  background: #f0f2ee;
}

.check-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid #cbd3cc;
  color: transparent;
}

.check-pill.done .check-dot {
  background: var(--mint);
  border-color: var(--mint);
  color: white;
}

.empty {
  border: 1px dashed #cfd8d0;
  border-radius: var(--radius);
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.62);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr 74px 1fr 1fr;
  gap: 4px;
  width: min(100%, 460px);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(229, 233, 228, 0.9);
}

.nav-button {
  min-height: 52px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.nav-button.active {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.add-button {
  width: 62px;
  height: 62px;
  border-radius: 21px;
  background: var(--ink);
  color: white;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 16px 36px rgba(34, 49, 43, 0.24);
  align-self: center;
  justify-self: center;
  transform: translateY(-18px);
}

.sheet-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(34, 49, 43, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.sheet-backdrop.open,
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet,
.modal {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  width: min(100%, 460px);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 -20px 60px rgba(34, 49, 43, 0.2);
}

.sheet {
  bottom: 0;
  border-radius: 28px 28px 0 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: min(88vh, 760px);
  overflow-y: auto;
  translate: 0 105%;
  transition: translate 190ms ease;
}

.sheet.open {
  translate: 0 0;
}

.drag-handle {
  width: 46px;
  height: 5px;
  background: #d4dbd4;
  border-radius: 999px;
  margin: 0 auto 16px;
}

.modal {
  top: 50%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 24px;
  padding: 18px;
  translate: 0 -46%;
  opacity: 0;
  pointer-events: none;
  transition:
    translate 160ms ease,
    opacity 160ms ease;
}

.modal.open {
  translate: 0 -50%;
  opacity: 1;
  pointer-events: auto;
}

.option-grid {
  display: grid;
  gap: 9px;
  margin: 14px 0;
}

.option-button {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
}

.option-button.active {
  border-color: rgba(110, 198, 182, 0.7);
  background: var(--mint-soft);
}

.option-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--blue-soft);
  color: #235477;
  font-weight: 900;
}

.option-button strong {
  display: block;
  font-size: 15px;
}

.option-button span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  outline: none;
}

.field textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid .field.full {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 48px;
  border-radius: 14px;
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  background: var(--ink);
  color: white;
}

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

.danger-button {
  background: var(--coral-soft);
  color: #8b362b;
  border: 1px solid rgba(255, 138, 122, 0.45);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.button-row.single {
  grid-template-columns: 1fr;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.weekday {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  padding: 4px 0;
}

.day-cell {
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  align-content: space-between;
  justify-items: center;
  padding: 7px 4px;
  color: var(--ink);
  min-width: 0;
}

.day-cell.muted {
  opacity: 0.36;
}

.day-cell.today {
  border-color: rgba(110, 198, 182, 0.8);
  background: var(--mint-soft);
}

.day-cell.selected {
  background: var(--ink);
  color: white;
}

.day-number {
  font-size: 13px;
  font-weight: 900;
}

.dot-row {
  display: flex;
  gap: 3px;
  min-height: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.dot.review {
  background: var(--coral);
}

.source-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 10px;
}

.notice {
  border-radius: var(--radius);
  padding: 13px;
  background: var(--yellow-soft);
  border: 1px solid rgba(242, 201, 109, 0.5);
  color: #755c1e;
  font-size: 13px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(18px);
  z-index: 70;
  width: min(calc(100% - 32px), 420px);
  padding: 13px 15px;
  border-radius: 14px;
  color: white;
  background: rgba(34, 49, 43, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  body {
    background:
      linear-gradient(90deg, #f5f8f4, #fafaf7 35%, #f5f8f4);
  }

  .app-shell {
    min-height: calc(100vh - 28px);
    margin-top: 14px;
    margin-bottom: 14px;
    border-radius: 32px;
    box-shadow: 0 24px 70px rgba(34, 49, 43, 0.13);
    overflow: hidden;
  }

  .bottom-nav {
    border-radius: 26px 26px 0 0;
  }
}
