.journal-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.journal-view {
  display: block;
  position: static;
  width: 100%;
  max-width: none;
  flex: 1 0 auto;
}

.journal-layout > .site-footer {
  flex-shrink: 0;
  width: 100%;
  margin-top: 0;
}

.journal-dialog {
  margin: auto;
  max-height: calc(100vh - 2rem);
}

.journal-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.journal-dialog[open] {
  animation: journalDialogIn 0.2s ease-out;
}

@keyframes journalDialogIn {
  from {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.journal-entry-form textarea {
  resize: vertical;
  min-height: 10rem;
}

.journal-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.journal-page-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  border-radius: 9999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.journal-page-action-icon {
  font-size: 0.6875rem;
  line-height: 1;
}

.journal-page-action-edit:hover {
  border-color: hsl(var(--primary) / 0.35);
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
}

.journal-page-action-btn:hover {
  background: hsl(var(--muted));
}

.journal-page-action-danger {
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.25);
  background: hsl(var(--destructive) / 0.04);
}

.journal-page-action-danger:hover {
  background: hsl(var(--destructive) / 0.12);
}

.journal-page-action-add {
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
}

.journal-page-action-add:hover {
  background: hsl(var(--primary) / 0.92);
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.journal-add-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 9999px;
  padding: 0.6rem 1.15rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  box-shadow: 0 10px 24px -14px hsl(var(--primary));
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.journal-add-page-btn:hover {
  background: hsl(var(--primary) / 0.92);
  transform: translateY(-1px);
}

.journal-add-page-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.2);
  font-size: 0.8125rem;
  line-height: 1;
  font-weight: 700;
}

.journal-add-page-btn--standalone {
  margin-top: 0.25rem;
}

.journal-view .features-menu__icon {
  width: 1.125rem;
  height: 1.125rem;
}

.journal-howto-icon {
  display: inline-block;
  font-size: 0.875rem;
  margin-right: 0.125rem;
}

@media (max-width: 640px) {
  .journal-dialog {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .journal-entry-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .journal-entry-form > .p-6.border-t {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: hsl(var(--card));
    box-shadow: 0 -8px 24px -12px rgb(0 0 0 / 0.18);
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .journal-entry-form > .max-h-\[60vh\] {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
