:root {
  color-scheme: light;
  --bg: #fff7e8;
  --panel: rgba(255, 252, 242, 0.88);
  --text: #4a3425;
  --muted: #92735d;
  --primary: #d99045;
  --primary-dark: #9f6434;
  --cream: #fff8df;
  --line: #ead0a6;
  --shadow: 0 20px 60px rgba(116, 75, 39, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 153, 0.7), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(205, 163, 103, 0.32), transparent 30rem),
    linear-gradient(180deg, #fffaf0 0%, var(--bg) 46%, #f8ead2 100%);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

h1, h2, p {
  margin-top: 0;
}

button, input, textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(159, 100, 52, 0.22);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.login-card {
  width: min(440px, 100%);
  margin: 12vh auto 0;
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 32px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(14px);
}

.stack {
  display: grid;
  gap: 14px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: clamp(24px, 4vw, 38px);
  border-radius: 36px;
  background: linear-gradient(135deg, rgba(255, 252, 242, 0.92), rgba(250, 224, 182, 0.78));
  box-shadow: var(--shadow);
}

.hero h1 {
  margin-bottom: 10px;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.subtitle, .muted {
  color: var(--muted);
}

.ghost-button {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: none;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  margin-bottom: 20px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.decorated {
  position: relative;
  overflow: hidden;
}

.lulu-decoration {
  position: absolute;
  z-index: 0;
  width: var(--lulu-size, 82px);
  max-width: 24vw;
  opacity: 0.92;
  pointer-events: none;
  transform: rotate(var(--lulu-rotate, 0deg));
  filter: drop-shadow(0 12px 18px rgba(99, 54, 70, 0.14));
}

.lulu-decoration + *, .decorated > :not(.lulu-decoration) {
  position: relative;
  z-index: 1;
}

.days-panel h2 {
  margin-bottom: 20px;
  font-size: clamp(26px, 5vw, 46px);
}

.settings-form, .card-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.settings-form {
  margin-top: 16px;
}

.card-form {
  grid-template-columns: 1fr 1fr;
}

.floating-form {
  width: min(620px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
}

.wide {
  grid-column: 1 / -1;
}

.quote-panel blockquote {
  margin: 0;
  color: #7a4b28;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.45;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.responsive-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 18px;
  margin-bottom: 24px;
}

.polaroid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: clamp(18px, 3vw, 28px);
}

.polaroid {
  position: relative;
  padding: 14px 14px 22px;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 18px 28px rgba(80, 39, 51, 0.18);
  transform: rotate(var(--tilt, -1deg));
}

.polaroid:nth-child(2n) {
  --tilt: 1.4deg;
}

.polaroid:nth-child(3n) {
  --tilt: -2deg;
}

.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  background: var(--cream);
}

.polaroid h3 {
  margin: 14px 0 6px;
  font-size: 19px;
}

.polaroid .date, .note-date {
  color: var(--muted);
  font-size: 13px;
}

.polaroid p {
  white-space: pre-wrap;
}

.delete-button {
  padding: 8px 12px;
  color: var(--primary-dark);
  background: #fff1d6;
  box-shadow: none;
}

.small-add-button {
  width: fit-content;
  padding: 10px 16px;
  color: var(--primary-dark);
  background: #fff1d6;
  box-shadow: none;
}

.add-tile {
  display: grid;
  place-content: center;
  gap: 6px;
  min-width: 168px;
  min-height: 168px;
  padding: 18px;
  border: 2px dashed var(--line);
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: none;
  text-align: center;
}

.add-tile span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 6px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  font-size: 34px;
  line-height: 1;
}

.add-tile small {
  color: var(--muted);
}

.note-form {
  display: grid;
  gap: 14px;
}

.notes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(14px, 2.5vw, 20px);
}

.note {
  min-height: 180px;
  padding: 18px;
  border: 1px solid #f2d9ab;
  border-radius: 18px;
  background:
    linear-gradient(#fff8d8 1px, transparent 1px) 0 44px / 100% 30px,
    #fffdf1;
  box-shadow: 0 12px 24px rgba(128, 83, 34, 0.12);
}

.note p {
  white-space: pre-wrap;
}

.message, .error {
  min-height: 20px;
  margin: 0;
  color: var(--primary-dark);
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 761px) and (max-width: 1024px) {
  main {
    width: min(100% - 36px, 900px);
  }

  .lulu-decoration {
    width: calc(var(--lulu-size, 82px) * 0.9);
    max-width: 18vw;
  }

  .dashboard {
    grid-template-columns: 1fr 1fr;
  }

  .polaroid-grid, .notes-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .add-tile {
    min-width: 190px;
  }
}

@media (max-width: 760px) {
  main {
    width: min(100% - 20px, 1120px);
    padding-top: 14px;
  }

  .hero, .section-heading {
    display: grid;
  }

  .dashboard, .settings-form, .card-form, .polaroid-grid, .notes-list {
    grid-template-columns: 1fr;
  }

  .responsive-card-row {
    display: grid;
  }

  .add-tile {
    min-height: 118px;
  }

  .lulu-decoration {
    width: calc(var(--lulu-size, 82px) * 0.72);
    max-width: 22vw;
    opacity: 0.78;
  }

  .decorated .lulu-decoration:nth-of-type(n + 3),
  .decorated[data-lulu-zone="polaroid"] .lulu-decoration:nth-of-type(n + 2),
  .decorated[data-lulu-zone="notebook"] .lulu-decoration:nth-of-type(n + 2) {
    display: none;
  }

  .panel, .hero, .login-card {
    padding: 20px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: clamp(34px, 12vw, 48px);
  }

  .polaroid {
    transform: none;
  }
}
