:root {
  color-scheme: light;
  --bg: #f8f2ec;
  --paper: #fffdf9;
  --ink: #2b2723;
  --muted: #7a7068;
  --line: #e7ddd2;
  --rose: #d75d74;
  --rose-deep: #a83d51;
  --leaf: #8eb69c;
  --sky: #84aecd;
  --shadow: 0 24px 70px rgba(72, 52, 38, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(248, 242, 236, 0.92), rgba(255, 252, 247, 0.96)),
    radial-gradient(circle at 72% 18%, rgba(142, 182, 156, 0.28), transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(132, 174, 205, 0.22), transparent 32%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

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

button {
  cursor: pointer;
}

.page {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.invite {
  min-height: calc(100vh - 42px);
  display: grid;
  place-items: center;
}

.invite-card {
  width: 100%;
  min-height: min(620px, calc(100vh - 42px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 8vw, 62px) 22px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 253, 249, 0.96), rgba(250, 239, 230, 0.9)),
    linear-gradient(180deg, #ffffff, #f9eee4);
  box-shadow: var(--shadow);
  text-align: center;
}

.small-date {
  margin: 0 0 18px;
  color: var(--rose-deep);
  font-size: 0.86rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(3.2rem, 15vw, 6.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.note {
  max-width: 320px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.answer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(330px, 100%);
  margin-top: 34px;
}

.answer-button,
.primary-action,
.secondary-action,
.text-action {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
}

.answer-button {
  border: 1px solid var(--line);
}

.answer-button.yes,
.primary-action {
  border: 0;
  background: var(--rose);
  color: #fff;
}

.answer-button.soft,
.secondary-action {
  background: var(--paper);
  color: var(--ink);
}

.schedule-link {
  margin-top: 26px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.schedule-panel {
  padding: 0 0 28px;
}

.schedule-panel[hidden] {
  display: none;
}

.panel-inner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 14px 38px rgba(72, 52, 38, 0.1);
  padding: clamp(18px, 5vw, 30px);
}

.panel-title p {
  margin: 0 0 8px;
  color: var(--rose-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.panel-title h2 {
  margin: 0 0 20px;
  font-size: 1.55rem;
  line-height: 1.28;
}

.calendar-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.calendar-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  padding: 12px;
}

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

.calendar-weekdays {
  gap: 4px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.calendar-grid {
  gap: 6px;
}

.day-button {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.day-button.is-muted {
  color: #beb1a7;
}

.day-button.is-today {
  border-color: rgba(132, 174, 205, 0.65);
}

.day-button.is-selected {
  background: var(--rose);
  color: #fff;
}

.day-button.has-plan::after {
  content: "";
  position: absolute;
  bottom: 7px;
  left: 50%;
  width: 5px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--leaf);
}

.day-button.has-plan.personal-plan::after {
  background: var(--sky);
}

.day-button.is-selected.has-plan::after {
  background: #fff;
}

.empty-date-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 16px;
  padding: 4px 2px 0;
}

.empty-date-state[hidden] {
  display: none;
}

.empty-date-state p {
  margin: 0;
  color: var(--rose-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-date-state strong {
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
}

.selected-date-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.78);
  padding: 16px;
}

.selected-date-card[hidden] {
  display: none;
}

.selected-date-card p {
  margin: 0 0 7px;
  color: var(--rose-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.selected-date-card h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  line-height: 1.3;
}

.preview-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.preview-list div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
}

dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

dd {
  margin: 0;
  line-height: 1.55;
}

.edit-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.edit-form[hidden],
.actions[hidden] {
  display: none;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(215, 93, 116, 0.15);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.primary-action,
.secondary-action,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.secondary-action {
  border: 1px solid var(--line);
}

.text-action {
  color: var(--rose-deep);
  background: transparent;
}

.wish-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.wish-heading p {
  margin: 0 0 6px;
  color: var(--rose-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.wish-heading h2 {
  margin: 0;
  font-size: 1.28rem;
}

.small-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 13px;
  font-weight: 800;
}

.wish-list {
  display: grid;
  gap: 8px;
}

.wish-empty {
  margin: 0;
  border: 1px dashed #d6c7ba;
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.7);
  color: var(--muted);
  padding: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.wish-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  padding: 12px;
  text-align: left;
}

.wish-item strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.wish-item.is-active {
  border-color: rgba(215, 93, 116, 0.7);
  box-shadow: 0 0 0 3px rgba(215, 93, 116, 0.12);
}

.wish-editor {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.wish-editor[hidden] {
  display: none;
}

.photo-box {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 190px;
  border: 1px dashed #d6c7ba;
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(132, 174, 205, 0.16), rgba(215, 93, 116, 0.12)),
    #fffefa;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.photo-box img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  border-radius: 6px;
}

.file-label input {
  padding: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  width: min(360px, calc(100% - 32px));
  min-height: 46px;
  transform: translate(-50%, 80px);
  border-radius: 8px;
  background: rgba(43, 39, 35, 0.94);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  opacity: 0;
  transition: 0.22s ease;
  text-align: center;
  pointer-events: none;
}

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

@media (max-width: 520px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .invite-card {
    min-height: calc(100vh - 38px);
  }

  .answer-row,
  .form-row {
    grid-template-columns: 1fr;
  }

  .wish-heading {
    align-items: flex-start;
  }

  .calendar-card {
    padding: 9px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .day-button {
    font-size: 0.9rem;
  }

  .preview-list div {
    grid-template-columns: 52px minmax(0, 1fr);
  }
}
