:root {
  color-scheme: light;
  --bg: #f7f2ff;
  --card: rgba(255, 255, 255, .9);
  --text: #21172f;
  --muted: #7c728b;
  --primary: #7c3aed;
  --primary-2: #ec4899;
  --line: #ece4f8;
  --danger: #e5484d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(236, 72, 153, .2), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(124, 58, 237, .2), transparent 36%),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

#app {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px calc(28px + var(--safe-bottom));
}

.hero, .section-title, .compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero { margin: 8px 4px 22px; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .04em;
}
h1 { margin: 0; font-size: 34px; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
p { margin: 0; }

.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 17px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 28px rgba(124, 58, 237, .28);
  font-size: 23px;
  font-weight: 850;
}

.card {
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(62, 42, 94, .08);
  backdrop-filter: blur(22px);
}

.composer { padding: 18px; }
.compose-head { align-items: flex-start; margin-bottom: 14px; }
.compose-head p { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.45; }

.ghost-button {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(124, 58, 237, .1);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  padding: 15px;
  border: 0;
  border-radius: 18px;
  outline: 0;
  color: var(--text);
  background: #f5efff;
  font-size: 17px;
  line-height: 1.65;
}
textarea::placeholder { color: #b2a8c0; }
textarea:focus { box-shadow: 0 0 0 3px rgba(124, 58, 237, .13); }

.primary-button {
  width: 100%;
  margin-top: 14px;
  padding: 17px;
  border: 0;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 28px rgba(124, 58, 237, .24);
  font-size: 17px;
  font-weight: 850;
}

.history-section { margin-top: 24px; }
.section-title { margin: 0 4px 14px; }
.section-title span {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(124, 58, 237, .1);
  font-size: 13px;
  font-weight: 800;
}

.entries-list { display: grid; gap: 12px; }
.entry-card {
  padding: 16px;
  border-radius: 22px;
  background: white;
  box-shadow: 0 8px 22px rgba(62, 42, 94, .06);
}
.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}
.entry-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.7;
}
.delete-button {
  flex: 0 0 auto;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  color: #a29aac;
  background: #f6f0ff;
}
.empty-state {
  padding: 58px 24px;
  border-radius: 24px;
  color: var(--muted);
  background: rgba(255,255,255,.55);
  text-align: center;
}
.empty-state span { display: block; margin-bottom: 12px; font-size: 46px; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); }

.toast {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: calc(28px + var(--safe-bottom));
  left: 20px;
  max-width: 440px;
  margin: auto;
  padding: 13px 17px;
  border-radius: 15px;
  color: white;
  background: rgba(33, 23, 47, .92);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
  text-align: center;
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translateY(0); }

dialog {
  width: min(calc(100% - 40px), 370px);
  padding: 22px;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
dialog::backdrop { background: rgba(25, 15, 38, .35); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 7px; }
dialog p { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.dialog-actions button { padding: 12px; border: 0; border-radius: 12px; background: #efeff5; font-weight: 780; }
.dialog-actions .danger { color: white; background: var(--danger); }

@media (min-width: 700px) {
  #app { padding-top: 36px; }
}
