:root {
  --ink: #39252c;
  --muted: #806d73;
  --paper: #fff4f7;
  --card: #fffafb;
  --line: #efdde2;
  --green: #a64f69;
  --green-soft: #f8e3e9;
  --morning: #e4a72e;
  --evening: #f0a184;
  --night: #172034;
  --off: #e7a9bc;
  --other: #4f8b73;
  --font-sans: Manrope, "Noto Sans KR", sans-serif;
  --font-korean: "Gowun Dodum", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
html, body { width: 100%; overflow-x: hidden; touch-action: pan-y; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -4%, rgba(255, 209, 221, .72), transparent 31rem),
    radial-gradient(circle at 96% 24%, rgba(247, 220, 230, .48), transparent 25rem),
    linear-gradient(180deg, #fff7f9 0%, var(--paper) 55%, #fceef2 100%);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; touch-action: manipulation; }
button { color: inherit; }

.app-shell { width: min(100%, 920px); margin: 0 auto; padding: 17px 18px 120px; }
.topbar, .calendar-toolbar, .section-heading, .sheet-header { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { margin: 0 0 3px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-family: var(--font-korean); font-size: 25px; font-weight: 400; line-height: 1.15; }
h2 { font-size: 20px; }
.title-heart { color: #d96c8b; font-size: .72em; vertical-align: .08em; }
.today-button { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,250,251,.82); padding: 9px 16px; font-weight: 700; cursor: pointer; }

.couple-dday { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-top: 11px; padding: 9px 14px; border: 1px solid rgba(255,255,255,.88); border-radius: 18px; background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(253,224,233,.78)); box-shadow: 0 7px 22px rgba(154,72,97,.08); }
.heart-mark { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #e88ca5, #c95476); box-shadow: 0 4px 11px rgba(189,74,107,.2); font-size: 14px; }
.dday-copy p, .start-date span { margin: 0; color: var(--muted); font-family: var(--font-korean); font-size: 11px; }
.dday-copy strong { display: block; margin-top: 0; color: #a63f60; font-size: 18px; line-height: 1.05; letter-spacing: -.04em; }
.start-date { text-align: right; }
.start-date span, .start-date time { display: block; }
.start-date time { margin-top: 3px; color: #7f5360; font-size: 11px; font-weight: 700; }

.calendar-card { margin-top: 14px; padding: 16px 10px 12px; border: 1px solid rgba(255,255,255,.86); border-radius: 28px; background: rgba(255,250,252,.9); box-shadow: 0 18px 50px rgba(127,65,84,.1); backdrop-filter: blur(10px); }
.calendar-toolbar { padding: 2px 4px 15px; }
.icon-button, .close-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #faedf1; font-size: 20px; cursor: pointer; }
.month-title { border: 0; background: transparent; font-size: 19px; font-weight: 800; cursor: pointer; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekdays { padding: 0 3px 8px; color: #8b918d; font-size: 11px; text-align: center; }
.weekdays span:first-child { color: #c16a64; }
.calendar-grid { gap: 3px; }
.day-cell { position: relative; display: flex; min-width: 0; min-height: 82px; padding: 6px 2px 4px; border: 0; border-radius: 13px; background: transparent; flex-direction: column; align-items: stretch; justify-content: flex-start; text-align: center; cursor: pointer; transition: background .15s, transform .15s; overflow: visible; }
.day-cell:active { transform: scale(.96); }
.day-number { display: grid; width: 27px; min-width: 27px; max-width: 27px; height: 27px; min-height: 27px; max-height: 27px; aspect-ratio: 1 / 1; flex: 0 0 27px; margin: 0 auto 5px; padding: 0; place-items: center; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 27px; }
.day-cell.outside .day-number { color: #c3c7c4; }
.day-cell.sunday:not(.outside) .day-number { color: #b95f59; }
.day-cell.selected { background: var(--green-soft); }
.day-cell.selected .day-number { color: #fff; background: var(--green); }
.day-cell.today:not(.selected) .day-number { border: 1.5px solid var(--green); }
.calendar-events { display: grid; width: 100%; min-width: 0; min-height: 31px; align-content: start; gap: 2px; }
.event-row-placeholder { display: block; width: 100%; height: 12px; }
.event-bar { position: relative; z-index: 1; display: block; width: 100%; min-width: 0; height: 14px; min-height: 14px; padding: 3px 3px; border-radius: 4px; color: #fff; font-size: 7px; font-style: normal; font-weight: 800; line-height: 8px; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.event-bar.morning { color: #573a04; background: #f4c45e; }
.event-bar.evening { color: #683624; background: var(--evening); }
.event-bar.night { background: var(--night); }
.event-bar.off { color: #743e50; background: var(--off); }
.event-bar.other { color: #4b4650; background: var(--event-color, var(--other)); }
.event-bar:not(.other) { text-align: center; }
.event-bar.other.joins-left { width: calc(100% + 5px); margin-left: -5px; padding-left: 5px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.event-bar.other.joins-right { width: calc(100% + 5px); margin-right: -5px; padding-right: 5px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.event-bar.other.joins-left.joins-right { width: calc(100% + 10px); }
.more-count { display: block; padding-right: 2px; color: var(--muted); font-size: 7px; font-weight: 700; line-height: 1.1; text-align: right; white-space: nowrap; }

.agenda-section { margin-top: 27px; padding: 0 3px; overflow: hidden; }
.event-count { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 800; }
.swipe-hint { margin: 7px 0 0; color: #ad8d97; font-family: var(--font-korean); font-size: 10px; text-align: center; }
.swipe-hint span { padding: 0 4px; color: var(--green); }
.agenda-list { display: grid; gap: 10px; min-height: 106px; margin-top: 8px; touch-action: pan-y; }
.agenda-list.slide-from-right { animation: agendaFromRight .22s ease-out; }
.agenda-list.slide-from-left { animation: agendaFromLeft .22s ease-out; }
@keyframes agendaFromRight { from { transform: translateX(24px); opacity: .35; } }
@keyframes agendaFromLeft { from { transform: translateX(-24px); opacity: .35; } }
.agenda-item { display: grid; grid-template-columns: 5px 1fr auto; gap: 13px; align-items: center; padding: 15px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 5px 20px rgba(127,65,84,.05); }
.agenda-bar { width: 5px; height: 38px; border-radius: 6px; }
.agenda-bar.morning { background: var(--morning); }.agenda-bar.evening { background: var(--evening); }.agenda-bar.night { background: var(--night); }.agenda-bar.off { background: var(--off); }.agenda-bar.other { background: var(--other); }
.agenda-item h3 { margin: 0 0 4px; font-size: 15px; }
.agenda-item p { margin: 0; color: var(--muted); font-size: 12px; }
.agenda-note { margin-top: 5px !important; color: #4c5651 !important; font-family: var(--font-korean); font-size: 13px !important; }
.delete-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #9a5d57; background: #faf0ef; cursor: pointer; }
.empty-state { padding: 33px 15px; border: 1px dashed #d9dcd5; border-radius: 20px; color: var(--muted); text-align: center; }
.empty-state span { display: block; margin-bottom: 8px; color: #9aa59f; font-size: 24px; }

.fab { position: fixed; right: max(20px, calc((100vw - 920px) / 2 + 22px)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 10; border: 0; border-radius: 999px; color: white; background: var(--green); padding: 14px 21px; box-shadow: 0 10px 30px rgba(31,101,77,.3); font-weight: 800; cursor: pointer; }
.fab span { margin-right: 4px; font-size: 18px; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(13,23,18,.43); backdrop-filter: blur(2px); }
.bottom-sheet { position: fixed; right: 0; bottom: 0; left: 0; z-index: 21; max-height: 76vh; max-height: 76dvh; overflow-y: auto; padding: 7px 16px calc(13px + env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; background: #fffafb; box-shadow: 0 -20px 60px rgba(82,38,52,.2); animation: rise .22s ease-out; touch-action: pan-y; }
@keyframes rise { from { transform: translateY(35px); opacity: .5; } }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 8px; border-radius: 4px; background: #d9ddd9; }
.sheet-header { max-width: 600px; margin: 0 auto 10px; }
.sheet-header h2 { font-size: 21px; }
.close-button { font-size: 27px; line-height: 1; }
form { max-width: 600px; margin: 0 auto; }
.range-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: #f8ebef; }
.range-option { padding: 10px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; cursor: pointer; }
.range-option.active { color: var(--green); background: white; box-shadow: 0 2px 7px rgba(20,40,30,.08); }
.date-fields, .time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.date-fields:has(label[hidden]) { grid-template-columns: 1fr; }
.quick-swipe-zone { display: grid; grid-template-columns: 32px 1fr 32px; gap: 7px; align-items: center; margin-top: 11px; padding: 10px 8px; border: 1px dashed #e1b9c5; border-radius: 15px; color: var(--green); background: linear-gradient(90deg, #fff8fa, #fbe6ed, #fff8fa); text-align: center; touch-action: pan-y; user-select: none; }
.quick-swipe-zone div { min-width: 0; }
.quick-swipe-zone strong, .quick-swipe-zone small { display: block; }
.quick-swipe-zone strong { font-size: 13px; }
.quick-swipe-zone small { margin-top: 2px; color: #9a7581; font-family: var(--font-korean); font-size: 10px; }
.swipe-arrow { font-size: 27px; font-weight: 500; }
.bottom-sheet.saving { pointer-events: none; }
.bottom-sheet.saving .quick-swipe-zone { opacity: .55; }
.bottom-sheet.swipe-disabled .quick-swipe-zone { opacity: .48; }
#eventForm.quick-next { animation: quickFromRight .22s ease-out; }
#eventForm.quick-prev { animation: quickFromLeft .22s ease-out; }
@keyframes quickFromRight { from { transform: translateX(18px); opacity: .55; } }
@keyframes quickFromLeft { from { transform: translateX(-18px); opacity: .55; } }
label, legend { color: #4d5651; font-size: 12px; font-weight: 700; }
input[type="date"], input[type="time"], input[type="text"], textarea { width: 100%; margin-top: 6px; padding: 12px 13px; border: 1px solid #ead9de; border-radius: 12px; outline: none; background: #fffafb; font-size: 14px; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,101,77,.1); }
fieldset { margin: 11px 0 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.type-card { position: relative; min-width: 0; padding: 7px 4px 6px; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: center; cursor: pointer; }
.type-card input { position: absolute; opacity: 0; }
.type-card:has(input:checked) { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.type-card.morning { color: #a46f09; }.type-card.evening { color: #b84d29; }.type-card.night { color: #40558f; }.type-card.off { color: #b95879; }.type-card.other { color: #347059; }
.type-icon, .type-card strong, .type-card small { display: block; }
.type-icon { height: 17px; font-size: 15px; }.type-card strong { margin-top: 1px; font-size: 12px; }.type-card small { margin-top: 1px; font-size: 8px; font-weight: 600; white-space: nowrap; }
.other-fields { margin-top: 15px; padding: 14px; border-radius: 16px; background: #fbeff3; }
.other-fields .time-fields { margin-top: 10px; }
.color-picker { margin-top: 10px; }
.color-options { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.color-option { position: relative; cursor: pointer; }
.color-option input { position: absolute; opacity: 0; }
.color-option span, .custom-color-option { display: block; width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px #ead9de; }
.color-option input:checked + span { box-shadow: 0 0 0 2px var(--green); transform: scale(.9); }
.custom-color-option { position: relative; display: grid; place-items: center; overflow: hidden; color: #7e6870; background: var(--custom-color, conic-gradient(#FAF1D6, #FAD4AE, #FDAFAB, #FADEE1, #D9F1F1, #B6E3E9, #FAF1D6)); cursor: pointer; }
.custom-color-option input { position: absolute; inset: -8px; width: 45px; height: 45px; opacity: 0; cursor: pointer; }
.custom-color-option span { position: relative; z-index: 1; font-size: 17px; pointer-events: none; }
label span { color: #929993; font-weight: 500; }
.note-field { display: block; margin-top: 9px; }
textarea { resize: vertical; }
.form-error { min-height: 17px; margin: 9px 2px 2px; color: #b34239; font-size: 12px; }
.submit-button { width: 100%; padding: 14px; border: 0; border-radius: 14px; color: #fff; background: var(--green); font-weight: 800; cursor: pointer; }
.submit-button:disabled { opacity: .6; }
.toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; z-index: 50; transform: translate(-50%, 15px); padding: 11px 17px; border-radius: 999px; color: white; background: #26332d; opacity: 0; pointer-events: none; transition: .2s; font-size: 13px; white-space: nowrap; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
[hidden] { display: none !important; }

@media (max-width: 679px) {
  .eyebrow { margin-bottom: 1px; }
  .calendar-card { padding-top: 12px; padding-bottom: 8px; }
  .calendar-toolbar { padding-bottom: 9px; }
  .weekdays { padding-bottom: 4px; }
  .day-cell { min-height: 70px; padding-top: 3px; padding-bottom: 2px; }
  .day-number { width: 24px; min-width: 24px; max-width: 24px; height: 24px; min-height: 24px; max-height: 24px; flex-basis: 24px; margin-bottom: 2px; font-size: 11px; line-height: 24px; }
  .calendar-events { gap: 1px; }
  .event-bar { height: 12px; min-height: 12px; padding-top: 2px; padding-bottom: 2px; line-height: 8px; }
  .event-row-placeholder { height: 12px; }
  input[type="date"], input[type="time"], input[type="text"], textarea { font-size: 16px; }
  textarea { min-height: 54px; }
  .bottom-sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

@media (min-width: 680px) {
  .app-shell { padding-top: 28px; }
  .calendar-card { padding: 22px; }
  .day-cell { min-height: 105px; padding: 7px 4px 5px; }
  .event-bar { height: 19px; min-height: 19px; padding: 4px 5px; font-size: 10px; line-height: 11px; }
  .event-row-placeholder { height: 19px; }
  .more-count { font-size: 9px; }
  .bottom-sheet { right: 50%; left: auto; width: 650px; max-height: 78vh; transform: translateX(50%); border-radius: 28px 28px 0 0; }
  @keyframes rise { from { transform: translate(50%, 35px); opacity: .5; } }
}

@media (max-width: 370px) {
  .app-shell { padding-right: 10px; padding-left: 10px; }
  .day-cell { min-height: 68px; }
  .type-card small { font-size: 7px; }
  .couple-dday { gap: 9px; padding-right: 12px; padding-left: 12px; }
  .start-date time { font-size: 10px; }
}
