* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-1: #12040c;
  --bg-2: #2a0c1e;
  --pixel-shadow: rgba(255, 255, 255, 0.04);
  --text: #fff4f8;
  --border: rgba(255, 221, 232, 0.18);
  --muted: rgba(255, 244, 248, 0.75);
  --shadow: 0 16px 40px rgba(0,0,0,0.25);
}

html, body {
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 120, 180, 0.12), transparent 22%),
    radial-gradient(circle at 80% 30%, rgba(255, 170, 210, 0.10), transparent 24%),
    radial-gradient(circle at 30% 80%, rgba(255, 120, 180, 0.08), transparent 18%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  position: relative;
}

.pixel-layer,
.mist-layer,
.sparkle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.pixel-layer {
  background-image:
    linear-gradient(var(--pixel-shadow) 1px, transparent 1px),
    linear-gradient(90deg, var(--pixel-shadow) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.7;
  image-rendering: pixelated;
}

.mist-layer::before,
.mist-layer::after {
  content: "";
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: floatMist 12s ease-in-out infinite alternate;
}

.mist-layer::before {
  top: -10%;
  left: -10%;
  background: rgba(255, 120, 180, 0.18);
}

.mist-layer::after {
  right: -10%;
  bottom: -10%;
  background: rgba(255, 180, 220, 0.12);
  animation-delay: 2s;
}

.sparkle-layer {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.8) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255,192,203,0.65) 0 1px, transparent 1.6px);
  background-size: 160px 160px, 220px 220px;
  background-position: 0 0, 60px 90px;
  opacity: 0.45;
  animation: sparkleMove 20s linear infinite;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1000px, calc(100% - 20px));
  margin: 0 auto;
  padding: 14px 0 24px;
}

.hero-card,
.panel,
.modal-card {
  background: rgba(255, 244, 248, 0.08);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.compact-hero {
  padding: 16px 18px;
  margin-bottom: 18px;
}

.compact-hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.layout-grid.single-layout {
  display: block;
  margin-bottom: 18px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.calendar-topbar,
.modal-topbar,
.events-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.calendar-topbar {
  margin-bottom: 16px;
}

.events-header-row {
  margin-bottom: 10px;
}

#monthLabel {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  text-align: center;
}

.ghost-btn,
.primary-btn,
.danger-btn,
.heart-button,
select {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, filter 0.2s ease;
}

.ghost-btn {
  min-width: 46px;
  min-height: 46px;
  background: rgba(255, 244, 248, 0.08);
  color: var(--text);
}

.filter-btn {
  min-width: unset;
  padding: 0 14px;
}

.small-btn {
  min-width: 38px;
  min-height: 38px;
}

.primary-btn {
  background: linear-gradient(135deg, #ff4f9a, #ff7db8);
  color: white;
  padding: 12px 16px;
  font-weight: 700;
}

.danger-btn {
  background: rgba(255, 105, 135, 0.16);
  color: #ffdbe7;
  padding: 8px 12px;
}

.ghost-btn:hover,
.primary-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-weekdays {
  margin-bottom: 10px;
  color: #ffd7e7;
  font-size: 0.9rem;
  text-align: center;
}

.calendar-day {
  min-height: 84px;
  border-radius: 18px;
  border: 1px solid rgba(255, 220, 230, 0.1);
  background: rgba(255, 244, 248, 0.05);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  justify-content: flex-start;
  cursor: pointer;
}

.calendar-day:hover {
  background: rgba(255, 244, 248, 0.1);
}

.calendar-day.other-month {
  opacity: 0.38;
}

.calendar-day.today {
  outline: 2px solid rgba(255, 113, 167, 0.7);
}

.calendar-day.selected {
  background: rgba(255, 79, 154, 0.15);
  border-color: rgba(255, 79, 154, 0.3);
}

.day-number {
  font-weight: 700;
}

.day-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff86bb;
}

.filter-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 244, 248, 0.05);
  border: 1px solid rgba(255, 221, 232, 0.10);
}

.hidden-filter {
  display: none;
}

.filter-panel label,
.stack-form label {
  display: grid;
  gap: 7px;
  color: #ffe1ec;
  font-size: 0.95rem;
}

.stack-form {
  display: grid;
  gap: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 221, 232, 0.14);
  background: rgba(255, 244, 248, 0.08);
  color: white;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #ffd7e7 50%), linear-gradient(135deg, #ffd7e7 50%, transparent 50%);
  background-position: calc(100% - 22px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

select option {
  background: #2a0c1e;
  color: #fff4f8;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 244, 248, 0.55);
}

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

.empty-state,
.event-desc,
.event-time,
.modal-date-text,
.autosave-text {
  color: var(--muted);
  line-height: 1.6;
}

.event-item {
  display: grid;
  gap: 8px;
  background: rgba(255, 244, 248, 0.07);
  border: 1px solid rgba(255, 221, 232, 0.12);
  border-radius: 18px;
  padding: 14px;
}

.event-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.love-note-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.note-scene {
  width: 100%;
  display: grid;
  place-items: center;
}

.content-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.heart-button {
  background: transparent;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.heart-button:focus,
.heart-button:focus-visible,
.heart-button:active {
  outline: none;
  box-shadow: none;
}

.heart-button:hover {
  transform: scale(1.06);
  filter: drop-shadow(0 0 20px rgba(255, 90, 140, 0.45));
}

.main-image {
  display: block;
  width: min(48vw, 180px);
  height: auto;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}

.heart-img {
  position: relative;
  left: 8px;
}

.hint {
  font-size: 1rem;
  letter-spacing: 0.08em;
  opacity: 0.9;
  animation: pulseText 2s ease-in-out infinite;
}

.love-note-editor {
  width: 100%;
}

.hidden-inline-note {
  display: none;
}

#loveNoteInputInline {
  min-height: 220px;
  resize: vertical;
  text-align: center;
  font-size: 1rem;
  line-height: 1.7;
}

.autosave-text {
  margin-top: 8px;
  text-align: center;
  font-size: 0.92rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 0, 6, 0.58);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 18px;
}

.modal-topbar {
  margin-bottom: 10px;
}

@keyframes floatMist {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, -20px) scale(1.1); }
}

@keyframes sparkleMove {
  from { transform: translateY(0); }
  to { transform: translateY(-40px); }
}

@keyframes pulseText {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 900px) {
  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100%, calc(100% - 12px));
    padding: 8px 0 16px;
  }

  .hero-card,
  .panel,
  .modal-card {
    border-radius: 20px;
  }

  .hero-card,
  .panel,
  .modal-card {
    padding: 16px;
  }

  .calendar-day {
    min-height: 50px;
    padding: 8px 6px;
  }

  .calendar-weekdays {
    font-size: 0.8rem;
  }

  .day-number {
    font-size: 0.92rem;
  }

  .main-image {
    width: min(58vw, 170px);
  }

  .heart-img {
    left: 10px;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  #loveNoteInputInline {
    min-height: 180px;
  }
}
