:root {
  --primary: #cc785c;
  --primary-active: #a9583e;
  --canvas: #faf9f5;
  --surface-soft: #f5f0e8;
  --surface-card: #efe9de;
  --ink: #141413;
  --body: #3d3d3a;
  --muted: #6c6a64;
  --hairline: #e6dfd8;
  --error: #c64545;
  --danger: #8f2f2f;
  --on-primary: #ffffff;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-soft: 0 1px 3px rgba(20, 20, 19, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--body);
  background: var(--canvas);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

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

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  font-size: 42px;
  line-height: 1.1;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
}

p {
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 249, 245, 0.92);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(12px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 32px, 980px);
  min-height: 64px;
  margin: 0 auto;
}

.topbar__leading {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar__back {
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}

.brand__logo {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.auth-panel__logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.page {
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  padding: 48px 0 72px;
}

.page--narrow {
  width: min(100% - 32px, 760px);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-header__actions,
.form-actions,
.diary-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.button--icon {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.button > [data-lucide] {
  display: inline-grid;
  place-items: center;
  line-height: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button--primary {
  color: var(--on-primary);
  background: var(--primary);
}

.button--primary:active {
  background: var(--primary-active);
}

.button--secondary,
.button--ghost {
  color: var(--ink);
  background: var(--canvas);
  border-color: var(--hairline);
}

.button--danger {
  color: var(--danger);
  background: var(--canvas);
  border-color: rgba(143, 47, 47, 0.24);
}

.button--small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.button--block {
  width: 100%;
}

.status-line {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.diary-reminder {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 18px;
  align-items: center;
  margin: -8px 0 22px;
  padding: 20px 24px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}

.diary-reminder__title {
  grid-column: 1;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
}

.diary-reminder__body {
  grid-column: 1;
  color: var(--muted);
}

.diary-reminder__action {
  grid-column: 2;
  grid-row: 1 / 3;
}

.pull-indicator {
  position: fixed;
  top: 78px;
  left: 50%;
  z-index: 20;
  transform: translate(-50%, -16px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  transition: opacity 120ms ease, transform 120ms ease;
}

.pull-indicator--visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.diary-list {
  display: grid;
  gap: 14px;
}

.diary-card,
.empty-state,
.message-panel,
.editor,
.auth-panel {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}

.diary-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 18px;
  padding: 24px;
}

.diary-card__meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.diary-card__title {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.diary-card__summary {
  display: -webkit-box;
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--body);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

.diary-card__actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 8px;
}

.empty-state,
.message-panel {
  padding: 32px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.empty-state[hidden],
.end-note[hidden] {
  display: none;
}

.load-more {
  height: 1px;
}

.end-note {
  margin-top: 22px;
  color: var(--muted);
  text-align: center;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-panel {
  width: min(100%, 420px);
  padding: 32px;
}

.auth-panel h1 {
  margin: 8px 0 24px;
  font-size: 34px;
}

.form,
.editor {
  display: grid;
  gap: 18px;
}

.editor {
  padding: 28px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}
.date-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.date-shortcuts .button.is-active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}

.input,
.textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  outline: none;
}

.input {
  min-height: 44px;
  padding: 10px 13px;
}

.textarea {
  min-height: 360px;
  padding: 14px;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.16);
}

.input--error {
  border-color: var(--error);
}

.field__error,
.notice--error {
  color: var(--error);
}

.field__error {
  font-size: 14px;
  font-weight: 500;
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.danger-zone {
  margin-top: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.message-panel {
  display: grid;
  justify-items: start;
  gap: 16px;
}

@media (max-width: 720px) {
  h1 {
    font-size: 34px;
  }

  .topbar__inner,
  .page,
  .page--narrow {
    width: min(100% - 24px, 980px);
  }

  .page {
    padding: 32px 0 56px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .page-header__actions,
  .form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .page-header__actions .button,
  .form-actions .button {
    width: 100%;
  }

  .diary-card,
  .diary-reminder,
  .editor,
  .auth-panel,
  .empty-state,
  .message-panel {
    padding: 20px;
  }

  .diary-card__actions {
    display: flex;
  }

  .diary-card__actions form {
    width: auto;
  }

  .diary-reminder {
    grid-template-columns: 1fr;
  }

  .diary-reminder__action {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .textarea {
    min-height: 300px;
  }
}

@media (max-width: 420px) {
  .page-header__actions,
  .form-actions {
    grid-template-columns: 1fr;
  }
}
