/* ========== CSS Reset & Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========== Color System ========== */
:root {
  --container-width: 800px;

  /* Playful palette */
  --sunny-yellow: #fbbf24;
  --sunny-yellow-light: #fef3c7;
  --playful-orange: #fb923c;
  --playful-orange-dark: #ea580c;
  --sky-blue: #38bdf8;
  --sky-blue-light: #e0f2fe;
  --coral-pink: #fb7185;
  --mint-green: #34d399;
  --lavender: #a78bfa;

  /* Back-compat tokens used across existing CSS */
  --coral: var(--playful-orange);
  --coral-light: var(--sunny-yellow-light);
  --coral-hover: var(--playful-orange-dark);

  --red: #dc2626;
  --red-light: #fef2f2;

  --green: #10b981;
  --green-light: #ecfdf5;

  --gray-50: #fafafa;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;

  --white: #ffffff;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --focus-ring: 0 0 0 4px rgba(56, 189, 248, 0.15);

  /* ===== Design Token System ===== */

  /* Spacing scale (8px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  /* Border radius scale */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadow depth system */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.10);
  --shadow-orange: 0 4px 12px rgba(251, 146, 60, 0.25);
  --shadow-blue: 0 4px 12px rgba(56, 189, 248, 0.25);
  --shadow-pink: 0 4px 12px rgba(251, 113, 133, 0.25);
  --shadow-lavender: 0 4px 12px rgba(167, 139, 250, 0.25);

  /* Typography scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Transition tokens */
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Complete gray scale (filling gaps) */
  --gray-400: #a1a1aa;
  --gray-600: #52525b;

  /* Semantic tokens (dark mode ready) */
  --bg-surface: var(--white);
  --bg-surface-raised: var(--white);
  --bg-sunken: var(--gray-50);
  --fg-default: var(--gray-900);
  --fg-muted: var(--gray-500);
  --fg-subtle: var(--gray-400);
  --border-default: var(--gray-200);
  --border-muted: var(--gray-100);

  /* Safe area variables */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Line height scale */
  --leading-tight: 1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;
}

/* ========== Dark Mode ========== */
@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode semantic overrides */
    --bg-surface: #1c1c1e;
    --bg-surface-raised: #2c2c2e;
    --bg-sunken: #141414;
    --fg-default: #f5f5f7;
    --fg-muted: #a1a1a6;
    --fg-subtle: #6e6e73;
    --border-default: #38383a;
    --border-muted: #2c2c2e;

    /* Adjust shadows for dark mode */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.5);

    /* Keep playful colors but slightly muted */
    --white: #1c1c1e;
  }

  body {
    background: linear-gradient(160deg, #1a1a1f 0%, #1f1f24 40%, #1c1c22 100%);
    color: var(--fg-default);
  }

  /* Adjust glassmorphism backgrounds */
  .tab-nav,
  .writing-toolbar,
  .writing-toolbar-bottom,
  .toast {
    background: rgba(28, 28, 30, 0.92);
  }

  /* Dark mode bottom nav enhancement */
  body.app-mode .tab-nav {
    background: linear-gradient(
      180deg,
      rgba(28, 28, 30, 0.88) 0%,
      rgba(28, 28, 30, 0.96) 100%
    );
    box-shadow:
      0 -1px 0 0 rgba(255, 255, 255, 0.06),
      0 -8px 32px rgba(0, 0, 0, 0.4);
  }

  body.app-mode .tab.active {
    background: linear-gradient(135deg,
      rgba(251, 146, 60, 0.2) 0%,
      rgba(251, 113, 133, 0.15) 100%
    );
  }

  /* Form inputs */
  .form-input,
  textarea#entry-content {
    background: var(--bg-surface-raised);
    color: var(--fg-default);
  }

  .form-input::placeholder,
  textarea#entry-content::placeholder {
    color: var(--fg-subtle);
  }
}

/* ========== Body & Background ========== */
body {
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  background: linear-gradient(160deg, #fffcf7 0%, #fefbf6 40%, #f8fafc 100%);
  min-height: 100vh;
  color: var(--gray-900);
  line-height: 1.6;
}

html.preboot .main-card {
  opacity: 0;
  pointer-events: none;
}

/* ========== Layout Containers ========== */
.page-header,
.main-card {
  max-width: var(--container-width);
  margin-left: max(24px, calc((100% - var(--container-width)) / 2));
  margin-right: max(24px, calc((100% - var(--container-width)) / 2));
}

.main-card {
  background: var(--bg-surface);
  margin-top: 0;
  margin-bottom: var(--space-7);
  border-radius: var(--radius-2xl);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: opacity var(--duration-fast) ease;
}

.stack {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
}

.stack > * {
  min-width: 0;
}

.panel {
  padding: 24px;
}

/* ========== Helpers ========== */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.legacy-hidden {
  display: none !important;
}

.details {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--gray-700);
  background: var(--gray-50);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed var(--gray-200);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--gray-500);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.tag-input {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tag-input input {
  flex: 1;
}

.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.auth-divider span {
  padding: 0 4px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .form-group {
  margin-bottom: 0;
}

.auth-link {
  text-align: center;
  margin: 8px 0;
}

.auth-link .btn-link {
  color: var(--playful-orange);
  font-weight: 700;
}

.auth-link .btn-link:hover {
  color: var(--playful-orange-dark);
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 1rem;
  color: var(--gray-600);
}

.auth-footer .btn-link {
  color: var(--playful-orange);
  font-weight: 700;
  padding: 4px 0;
}

.auth-footer .btn-link:hover {
  color: var(--playful-orange-dark);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  font-size: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.btn-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.btn-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.verify-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.verify-actions .btn {
  width: 100%;
}

/* ========== Header ========== */
.page-header {
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.journal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.25);
  color: var(--playful-orange-dark);
}

.journal-badge i {
  font-size: 1.1rem;
  color: var(--sunny-yellow);
}

.page-title {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.page-title .highlight {
  background: linear-gradient(135deg, var(--playful-orange), var(--coral-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 1.05rem;
  color: var(--gray-700);
  margin-top: 4px;
  font-weight: 500;
}

/* ========== App Logo (Memaday branding) ========== */
.app-logo {
  margin-top: 8px;
}

.app-logo .logo-text {
  display: flex;
  align-items: baseline;
  font-family: "Nunito", sans-serif;
  font-size: 3.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

.app-logo .logo-text .stylized-m {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  margin-right: 0.03em;
  transform: translateY(0);
  transform-origin: 50% 50%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.08)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.04));
}

.app-logo .logo-text span {
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
}

/* Memaday letter colors - matches ui/memaday_logo.png */
.app-logo .letter-M {
  color: #f4a261; /* coral/salmon */
}

.app-logo .letter-e1 {
  color: #e9c46a; /* amber/golden */
}

.app-logo .letter-m {
  color: #e9c46a; /* golden yellow */
}

.app-logo .letter-a1 {
  color: #2a9d8f; /* teal green */
}

.app-logo .letter-d {
  color: #87ceeb; /* light blue/cyan */
}

.app-logo .letter-a2 {
  color: #b8b8d1; /* lavender */
}

.app-logo .letter-y {
  color: #9b7bb8; /* purple */
}

.app-logo .tagline {
  font-family: "Nunito", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #8b8b8b; /* gray to match logo */
  letter-spacing: 0.08em;
  margin-top: 6px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 8px; /* Align with .app-logo margin-top */
}

/* ========== Profile Menu ========== */
.profile-menu-container {
  position: relative;
}

.profile-toggle {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  color: var(--gray-600);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-normal) ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1301;
}

.profile-toggle .menu-icon {
  width: 30px;
  height: 20px;
  fill: currentColor;
}

.profile-toggle .menu-icon-close {
  display: none;
  width: 26px;
  height: 26px;
}

.profile-toggle.is-open .menu-icon-hamburger {
  display: none;
}

.profile-toggle.is-open .menu-icon-close {
  display: block;
}

.profile-toggle:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.profile-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.profile-drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  pointer-events: auto;
}

.profile-drawer.hidden {
  display: flex !important;
  pointer-events: none;
}

body.profile-drawer-open {
  overflow: hidden;
}

.profile-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  opacity: 1;
  transition: opacity var(--duration-normal) ease;
}

.profile-drawer.hidden .profile-drawer-scrim {
  opacity: 0;
}

.profile-drawer-panel {
  position: relative;
  z-index: 1;
  width: min(360px, 100vw);
  height: 100%;
  background: var(--white);
  box-shadow: -12px 0 30px rgba(0, 0, 0, 0.16);
  transform: translateX(0);
  transition: transform var(--duration-normal) ease;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
}

.profile-drawer.hidden .profile-drawer-panel {
  transform: translateX(100%);
}

.profile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-drawer-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
}

.profile-drawer-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-menu-section-label {
  margin: 10px 6px 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--gray-500);
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: background var(--duration-fast) ease;
  text-align: left;
}

.profile-menu-item i {
  font-size: 1.2rem;
  color: var(--gray-500);
}

.profile-menu-item:hover {
  background: var(--gray-100);
}

.profile-menu-item:focus-visible {
  outline: none;
  background: var(--gray-100);
  box-shadow: inset 0 0 0 2px var(--playful-orange);
}

.profile-menu-item-danger {
  color: var(--red);
}

.profile-menu-item-danger i {
  color: var(--red);
}

.profile-menu-item-danger:hover {
  background: var(--red-light);
}

.profile-menu-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 6px 0;
}

/* ========== Profile Panel Header ========== */
.profile-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--gray-300);
  color: var(--gray-600);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-normal) ease;
}

.profile-back i {
  font-size: 1.25rem;
}

.profile-back:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
  color: var(--gray-800);
}

.profile-back:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.profile-panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-normal) ease;
  border: 1.5px solid transparent;
  text-decoration: none;
  background: transparent;
  color: var(--gray-700);
}

.btn i {
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: linear-gradient(135deg, var(--playful-orange), var(--playful-orange-dark));
  color: var(--white);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(251, 146, 60, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(251, 146, 60, 0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--playful-orange-dark);
  border-color: var(--playful-orange);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--sunny-yellow-light);
}

.btn-tertiary {
  background: transparent;
  color: var(--gray-500);
  border-color: var(--gray-300);
  padding: 8px 16px;
}

.btn-tertiary:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-destructive {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}

.btn-destructive:hover:not(:disabled) {
  background: var(--red-light);
}

.btn-google {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-google:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-500);
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.btn-large {
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
}

.google-icon {
  width: 20px;
  height: 20px;
}

/* ========== Small Icon Buttons ========== */
.btn-icon-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.btn-icon-small i {
  font-size: 1.1rem;
}

.btn-icon-small:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-icon-small:active {
  transform: scale(0.95);
}

/* Favorite button specific styling - override old .favorite-button styles */
.btn-icon-small.favorite-button {
  background: transparent;
  border: none;
  color: var(--gray-400);
}

.btn-icon-small.favorite-button:hover {
  color: var(--coral-pink);
  background: rgba(251, 113, 133, 0.1);
}

.btn-icon-small.favorite-button.active,
.btn-icon-small.favorite-button[aria-pressed="true"] {
  background: transparent;
  color: var(--coral-pink);
  border-color: transparent;
}

/* Tag button specific styling */
.btn-icon-small.tag-bubble:hover {
  color: var(--lavender);
  background: rgba(167, 139, 250, 0.1);
}

/* Navigation arrow buttons */
.btn-icon-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.btn-icon-nav i {
  font-size: 1rem;
}

.btn-icon-nav:hover {
  background: var(--gray-100);
  color: var(--playful-orange);
}

.btn-icon-nav:active {
  transform: scale(0.9);
}

/* ========== Sections / Typography ========== */
.section + .section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.section-header .section-title {
  margin-bottom: 0;
}

.section-icon {
  width: clamp(36px, 8vw, 48px);
  height: clamp(36px, 8vw, 48px);
  background: linear-gradient(135deg, var(--lavender), #8b5cf6);
  border-radius: clamp(10px, 2vw, 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.35);
}

.section-icon.google {
  background: linear-gradient(135deg, #4285f4, #34a853);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.section-icon.share {
  background: linear-gradient(135deg, var(--lavender), #8b5cf6);
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.35);
}

.section-icon i {
  font-size: 1.5rem;
  color: var(--white);
}

.section-title {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: clamp(4px, 1vw, 8px);
}

.section-description {
  font-size: 0.95rem;
  color: var(--gray-500);
  margin-bottom: 18px;
}

#auth-panel .section-description {
  margin-left: 56px;
}

.welcome-art {
  text-align: center;
  margin-bottom: 28px;
  font-size: 3rem;
  line-height: 1;
}

#auth-panel .section-header {
  margin-bottom: 12px;
}

/* ========== Divider ========== */
.divider {
  display: flex;
  align-items: center;
  margin: 28px 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gray-200), transparent);
}

.divider span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 0.85rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.divider span i {
  font-size: 1.1rem;
  color: var(--sunny-yellow);
}

/* ========== Forms ========== */
form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: clamp(4px, 1.5vw, 8px);
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
}

.form-label i {
  font-size: 1.1rem;
  color: var(--lavender);
}

.form-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 400;
}

.form-input,
input,
select,
textarea {
  width: 100%;
  padding: clamp(10px, 2.5vw, 14px) clamp(12px, 3vw, 18px);
  border-radius: clamp(10px, 2vw, 14px);
  border: 2px solid var(--gray-200);
  font-size: 1rem;
  background: var(--white);
  font-family: inherit;
  color: var(--gray-900);
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--sky-blue);
  box-shadow: var(--focus-ring);
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--gray-500);
}

.input-group {
  display: flex;
  gap: 12px;
}

.input-group .form-input,
.input-group input {
  flex: 1;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 46px;
}

button.password-toggle {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 999px;
  color: var(--gray-500);
  cursor: pointer;
}

button.password-toggle:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-700);
}

button.password-toggle svg {
  width: 20px;
  height: 20px;
}

button.password-toggle .eye-closed {
  display: none;
}

button.password-toggle[data-visible="true"] .eye-open {
  display: none;
}

button.password-toggle[data-visible="true"] .eye-closed {
  display: block;
}

/* ========== Tabs ========== */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-500);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.tab i {
  font-size: 1.2rem;
}

.tab:hover {
  background: var(--white);
  color: var(--gray-700);
}

.tab.active {
  background: var(--white);
  color: var(--playful-orange-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Share tab is hidden - feature not ready */
#tab-button-share,
#tab-panel-share {
  display: none !important;
}

.tab.active i {
  color: var(--playful-orange);
}

.tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ========== Tab Panels ========== */
.tab-panels {
  width: 100%;
  overflow: hidden;
}

.tab-panel {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ========== Entry Tab ========== */
.entry-content {
  padding: 24px;
}

.entry-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.entry-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-700);
}

.entry-date i {
  font-size: 1.2rem;
  color: var(--sky-blue);
}

.entry-actions-inline {
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-muted);
  transition: color var(--duration-normal) ease;
}

.save-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--gray-300);
  transition: background var(--duration-normal) ease;
}

.save-status[data-state="typing"]::before {
  background: var(--sunny-yellow);
}

.save-status[data-state="saving"]::before {
  background: var(--sky-blue);
  animation: save-pulse 1s ease infinite;
}

.save-status[data-state="saved"]::before {
  background: var(--mint-green);
  animation: save-pop 300ms var(--easing-spring);
}

.save-status[data-state="error"]::before {
  background: var(--red);
}

.save-status[data-state="error"] {
  color: var(--red);
}

@keyframes save-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

@keyframes save-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Legacy .favorite-button styles - kept for animation on .active state */
.favorite-button {
  background: var(--white);
  color: var(--coral-pink);
  border-color: var(--coral-pink);
  transition: background var(--duration-normal) ease,
              color var(--duration-normal) ease,
              transform var(--duration-normal) ease;
}

.favorite-button:hover:not(:disabled) {
  background: #fff1f2;
}

.favorite-button.active {
  background: var(--coral-pink);
  color: var(--white);
  border-color: var(--coral-pink);
}

.favorite-button.active i {
  animation: heart-pop 400ms var(--easing-spring);
}

@keyframes heart-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes tab-icon-bounce {
  0% { transform: scale(1) translateY(0); }
  40% { transform: scale(1.15) translateY(-2px); }
  70% { transform: scale(0.95) translateY(1px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes content-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heart-burst {
  0% { transform: scale(1); }
  25% { transform: scale(1.4); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.tag-bubble {
  background: var(--white);
  color: var(--lavender);
  border-color: var(--lavender);
}

.tag-bubble:hover:not(:disabled) {
  background: #f5f3ff;
}

.entry-textarea,
textarea#entry-content {
  width: 100%;
  min-height: 260px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-default);
  padding: var(--space-5);
  font-size: var(--text-base);
  resize: vertical;
  background: var(--bg-surface);
  line-height: 1.7;
  transition: border-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease,
              min-height var(--duration-slow) ease;
}

.entry-textarea:hover:not(:focus),
textarea#entry-content:hover:not(:focus) {
  border-color: var(--gray-300);
}

.entry-textarea:focus,
textarea#entry-content:focus {
  outline: none;
  border-color: var(--sky-blue);
  box-shadow: var(--focus-ring);
  min-height: 340px;
}

.entry-textarea::placeholder,
textarea#entry-content::placeholder {
  color: var(--fg-subtle);
  transition: opacity var(--duration-normal) ease;
}

.entry-textarea:focus::placeholder,
textarea#entry-content:focus::placeholder {
  opacity: 0.6;
}

.fun-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--sunny-yellow-light), #fef9c3);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
}

.fun-prompt i {
  font-size: 1.3rem;
  color: var(--sunny-yellow);
}

.photos-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--bg-sunken);
  border-radius: var(--radius-lg);
  gap: var(--space-4);
  flex-wrap: wrap;
  border: 2px dashed transparent;
  transition: border-color var(--duration-normal) ease,
              background var(--duration-normal) ease;
}

.photos-section.drag-over {
  border-color: var(--sky-blue);
  background: var(--sky-blue-light);
}

.photos-section.drag-over .photos-icon {
  transform: scale(1.1);
}

.photos-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.photos-icon {
  width: 48px;
  height: 48px;
  background: var(--sky-blue-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-normal) var(--easing-spring);
}

.photos-icon i {
  font-size: 1.5rem;
  color: var(--sky-blue);
}

.photos-text .photos-label {
  font-weight: 700;
  color: var(--gray-900);
}

.photos-text .photos-empty {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 0;
}

.photos-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
}

.photos-empty {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.photo-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Tag menu + photos (existing app components) */
.tag-menu {
  margin-top: 12px;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  box-shadow: var(--shadow);
}

.tag-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tag-menu-list {
  display: grid;
  gap: 8px;
}

.tag-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-900);
  font-weight: 500;
}

.tag-menu-item.active {
  border-color: rgba(251, 146, 60, 0.55);
  background: rgba(251, 146, 60, 0.1);
  color: var(--playful-orange-dark);
}

.tag-menu-check {
  font-size: 0.9rem;
}

.tag-menu-input {
  display: flex;
  gap: 8px;
  align-items: center;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.photo-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
  box-shadow: var(--shadow-md);
  transform: rotate(0deg);
  transition: transform var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}

.photo-card:hover {
  box-shadow: var(--shadow-lg);
}

.photo-card.tilt-left {
  transform: rotate(-1.4deg);
}
.photo-card.tilt-right {
  transform: rotate(1.2deg);
}
.photo-card.tilt-none {
  transform: rotate(0.3deg);
}

.photo-card img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: var(--gray-200);
}

.photo-card input {
  font-size: 0.9rem;
  padding: 10px 12px;
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.photo-card-actions {
  display: flex;
  justify-content: flex-end;
}

button.photo-delete {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 999px;
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(220, 38, 38, 0.4);
}

button.photo-delete:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08);
}

/* ========== Blog Tab ========== */
.blog-content {
  padding: 24px;
}

.blog-status {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.blog-entries {
  display: grid;
  gap: 16px;
}

.blog-entry {
  background: var(--bg-sunken);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: transform var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}

.blog-entry:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.blog-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.blog-entry-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-entry-favorite i {
  font-size: 1.2rem;
  color: var(--coral-pink);
}

.blog-entry-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
}

.blog-entry-date i {
  font-size: 1.2rem;
  color: var(--sky-blue);
}

.blog-entry-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
}

/* Blog edit button - blue */
.blog-edit-btn {
  color: var(--sky-blue);
}

.blog-edit-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--sky-blue);
}

/* Blog expand/collapse toggle - orange */
.blog-entry-toggle {
  color: var(--playful-orange);
}

.blog-entry-toggle:hover {
  background: rgba(251, 146, 60, 0.1);
  color: var(--playful-orange);
}

.blog-entry-text {
  font-size: 1rem;
  color: var(--gray-700);
  line-height: 1.7;
}

.blog-entry-text p + p {
  margin-top: 12px;
}

.blog-entry-preview {
  font-size: 0.95rem;
  color: var(--gray-700);
}

/* Toggle button icons are handled via JS with ph-caret-up/down */

.blog-entry-photos,
.photo-gallery {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.blog-entry-photos img {
  border-radius: 12px;
  object-fit: cover;
  width: 150px;
  height: 150px;
  background: var(--gray-200);
}

.blog-thumb {
  width: 86px;
  height: 86px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--gray-200);
}

.blog-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* Collapse behavior (existing app) */
.blog-entry:not(.collapsed)[data-has-content="true"] .blog-entry-preview {
  display: none;
}

.blog-entry.collapsed .blog-entry-content,
.blog-entry.collapsed .blog-entry-photos {
  display: none;
}

.blog-entry-content {
  display: none;
}

.blog-entry:not(.collapsed) .blog-entry-content {
  display: block;
  margin-top: 12px;
  white-space: pre-wrap;
  font-size: 1rem;
  color: var(--gray-700);
  line-height: 1.7;
}

/* ========== Calendar Tab ========== */
.calendar-content {
  padding: clamp(12px, 4vw, 24px);
  overflow: hidden;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.calendar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: clamp(12px, 3vw, 20px);
}

.calendar-nav-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-month {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0;
}

.calendar-month i {
  font-size: 1.3rem;
  color: var(--playful-orange);
}

/* Keep old .calendar-nav for backwards compat */
.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(2px, 0.5vw, 4px);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.calendar-weekday,
.weekday-label {
  text-align: center;
  padding: 12px 4px;
  font-size: clamp(0.65rem, 2.5vw, 0.8rem);
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-width: 0;
  overflow: hidden;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1;
  border-radius: clamp(8px, 2vw, 14px);
  border: none;
  padding: 0;
  text-align: center;
  background: transparent;
  cursor: pointer;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: clamp(0.75rem, 3vw, 1rem);
  color: var(--gray-700);
  transition: all 0.2s ease;
  overflow: hidden;
}

.calendar-day.muted {
  color: var(--gray-300);
  background: transparent;
}

.calendar-day.active {
  color: var(--playful-orange-dark);
  background: var(--sunny-yellow-light);
}

.calendar-day.has-entry {
  color: var(--playful-orange-dark);
  background: var(--sunny-yellow-light);
}

.calendar-day.has-entry:hover:not(.muted):not(.today) {
  background: var(--sunny-yellow);
  color: var(--white);
}

.calendar-day.today {
  background: linear-gradient(135deg, var(--sky-blue), #0ea5e9);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.calendar-day:hover:not(.muted):not(.today) {
  background: var(--gray-100);
  transform: scale(1.05);
  box-shadow: none;
}

.calendar-day.active:hover:not(.muted):not(.today) {
  background: var(--sunny-yellow);
  color: var(--white);
}

.calendar-day.today:hover:not(.muted) {
  transform: scale(1.1);
}

.calendar-legend {
  display: flex;
  gap: clamp(12px, 3vw, 24px);
  margin-top: clamp(12px, 4vw, 28px);
  padding-top: clamp(12px, 3vw, 20px);
  border-top: 2px dashed var(--gray-200);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
}

.legend-dot {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-dot.entry {
  background: var(--sunny-yellow-light);
}

.legend-dot.entry i {
  color: var(--playful-orange);
  font-size: 1rem;
}

.legend-dot.today {
  background: linear-gradient(135deg, var(--sky-blue), #0ea5e9);
}

.legend-dot.today i {
  color: var(--white);
  font-size: 1rem;
}

/* ========== Search Tab ========== */
.search-content {
  padding: clamp(12px, 4vw, 24px);
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 3vw, 16px);
}

/* Ensure date inputs match text inputs */
input[type="date"] {
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  accent-color: var(--coral-pink);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--gray-600);
  cursor: pointer;
}

.checkbox-label i {
  font-size: 1rem;
  color: var(--coral-pink);
}

.search-results {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

/* ========== Share Tab ========== */
.share-content {
  padding: 24px;
}

.share-links-list {
  margin-top: 32px;
}

.share-links-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.share-link-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.share-link-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.share-link-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.share-link-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.share-link-status.inactive {
  background: rgba(220, 38, 38, 0.1);
  color: var(--red);
}

.share-link-status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.share-link-meta {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.share-link-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.8rem;
  color: var(--gray-500);
  background: var(--white);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  word-break: break-all;
  margin: 12px 0;
}

.share-link-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

#toggle-deactivated-links {
  margin-top: 16px;
  color: var(--gray-500);
}

.deactivated-links-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--gray-200);
}

.deactivated-links-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 16px;
}

/* ========== Reminders/Notifications Tab ========== */
.reminders-content {
  padding: 24px;
}

.radio-group {
  display: grid;
  gap: 12px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.radio-input {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: var(--white);
}

.radio-input:checked {
  border-color: var(--coral);
}

.radio-input:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--coral);
  border-radius: 50%;
}

.radio-input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.radio-label {
  font-size: 1rem;
  color: var(--gray-700);
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

#notifications-status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  border-left: 4px solid rgba(224, 122, 95, 0.6);
  background: var(--coral-light);
  color: var(--gray-700);
}

#notifications-status[data-tone="error"] {
  border-left-color: rgba(220, 38, 38, 0.7);
  background: var(--red-light);
  color: var(--red);
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: var(--space-4);
  right: var(--space-4);
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  max-width: 520px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  border-left-width: 4px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  color: var(--fg-default);
  z-index: 3000;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--duration-normal) ease, transform var(--duration-normal) ease;
}

/* Move toast above bottom nav on mobile */
@media (max-width: 640px) {
  body.app-mode .toast {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast[data-tone="info"] {
  border-left-color: rgba(224, 122, 95, 0.65);
}

.toast[data-tone="error"] {
  border-left-color: rgba(220, 38, 38, 0.65);
}

/* ========== Writing Mode Toolbars ========== */
.writing-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.92) 100%
  );
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-100%);
  transition: transform 250ms var(--easing-default);
}

body.writing-mode .writing-toolbar {
  transform: translateY(0);
}

/* Done button - pill-shaped with sky-blue accent */
.writing-toolbar .btn-tertiary {
  background: linear-gradient(135deg, var(--sky-blue-light), rgba(56, 189, 248, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--sky-blue);
  font-weight: 700;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--easing-spring);
}

.writing-toolbar .btn-tertiary:active {
  transform: scale(0.95);
  background: rgba(56, 189, 248, 0.2);
}

/* Animated save status with color dot */
.writing-toolbar .writing-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writing-toolbar .writing-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--gray-300);
  flex-shrink: 0;
  transition: all var(--duration-normal) ease;
}

.writing-toolbar .writing-status[data-state="typing"]::before {
  background: var(--sunny-yellow);
  animation: status-pulse 1.2s ease-in-out infinite;
}

.writing-toolbar .writing-status[data-state="saving"]::before {
  background: var(--sky-blue);
  animation: status-dot-spin 800ms linear infinite;
}

.writing-toolbar .writing-status[data-state="saved"]::before {
  background: var(--mint-green);
  animation: status-pop 300ms var(--easing-spring);
}

.writing-toolbar .writing-status[data-state="error"]::before {
  background: var(--red);
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes status-dot-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes status-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.writing-toolbar-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.94) 100%
  );
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.05);
  transform: translateY(100%);
  transition: transform 250ms var(--easing-default);
}

body.writing-mode .writing-toolbar-bottom {
  transform: translateY(0);
}

/* Photo button in bottom toolbar */
.writing-toolbar-bottom .btn-primary {
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-6);
  min-height: 48px;
}

.writing-toolbar-bottom .btn-primary:active {
  transform: scale(0.95);
}

.writing-toolbar-bottom .btn-primary i {
  transition: transform var(--duration-normal) var(--easing-spring);
}

.writing-toolbar-bottom .btn-primary:active i {
  transform: rotate(-12deg) scale(1.1);
}

/* Smooth fade-out for header/nav in writing mode */
body.writing-mode .page-header,
body.writing-mode .tab-nav {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) ease;
}

body.writing-mode .main-card {
  max-width: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

body.writing-mode #app-panel {
  padding-top: 72px;
  padding-bottom: 72px;
}

body.writing-mode .entry-header,
body.writing-mode .photos-section {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  transition: opacity var(--duration-normal) ease,
              max-height var(--duration-normal) ease;
}

body.writing-mode textarea#entry-content {
  min-height: calc(100vh - 160px);
  resize: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: var(--space-4);
  font-size: 18px;
  line-height: 1.8;
  background: transparent;
  caret-color: var(--playful-orange);
}

body.writing-mode textarea#entry-content:focus {
  box-shadow: none;
  border-color: transparent;
}

body.writing-mode textarea#entry-content::placeholder {
  color: var(--gray-300);
  font-style: italic;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 640px) {
  .page-header {
    padding: 16px 0;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  .header-right {
    flex-shrink: 0;
  }

  .profile-toggle {
    width: clamp(36px, 10vw, 48px);
    height: clamp(36px, 10vw, 48px);
  }

  .profile-toggle .menu-icon {
    width: clamp(22px, 6.5vw, 30px);
    height: clamp(14px, 4.5vw, 20px);
  }

  .profile-drawer-panel {
    width: 100vw;
    border-radius: 0;
  }

  .page-title {
    font-size: 2rem;
  }

  .app-logo .logo-text {
    font-size: 2.75rem;
  }

  .app-logo .tagline {
    font-size: 0.85rem;
  }

  .main-card {
    margin: 0 16px 16px;
    border-radius: 20px;
    max-width: none;
  }

  .page-header,
  .main-card {
    margin-left: 16px;
    margin-right: 16px;
  }

  /* Bottom navigation for mobile - Premium glassmorphism */
  body.app-mode .tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-top: none;
    border-bottom: none;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    z-index: 100;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.88) 0%,
      rgba(255, 255, 255, 0.96) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
      0 -1px 0 0 rgba(0, 0, 0, 0.04),
      0 -8px 32px rgba(0, 0, 0, 0.08);
    gap: 0;
  }

  body.app-mode .tab {
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    min-width: 48px;
    min-height: 48px;
    border-radius: var(--radius-md);
    position: relative;
    transition: transform 50ms ease, background var(--duration-normal) ease;
  }

  /* Active tab indicator with gradient pill */
  body.app-mode .tab.active {
    background: linear-gradient(135deg,
      rgba(251, 146, 60, 0.12) 0%,
      rgba(251, 113, 133, 0.08) 100%
    );
  }

  body.app-mode .tab.active::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--playful-orange), var(--coral-pink));
    box-shadow: 0 0 8px rgba(251, 146, 60, 0.5);
  }

  /* Tab press state */
  body.app-mode .tab:active:not(:disabled) {
    transform: scale(0.92);
  }

  body.app-mode .tab i {
    font-size: 1.4rem;
    transition: transform var(--duration-normal) var(--easing-spring);
  }

  /* Tab icon bounce on active */
  body.app-mode .tab.active i {
    animation: tab-icon-bounce 400ms var(--easing-spring);
  }

  body.app-mode .tab span {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
  }

  /* Content padding to prevent bottom nav overlap */
  body.app-mode .main-card {
    margin-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  /* Header scrolls with content on mobile */
  body.app-mode .page-header {
    position: relative;
  }

  /* Mobile typography - optimized for readability */
  body {
    font-size: 17px; /* Prevents iOS zoom, optimal mobile reading */
    -webkit-text-size-adjust: 100%;
  }

  textarea#entry-content {
    font-size: 17px; /* Prevents iOS zoom on focus */
    line-height: 1.75;
    letter-spacing: -0.01em;
  }

  .blog-entry-content,
  .blog-entry-text {
    font-size: 17px;
    line-height: 1.75;
  }

  .section-title {
    font-size: 1.25rem;
    letter-spacing: -0.02em;
  }

  .section + .section {
    margin-top: var(--space-5);
  }

  /* Enhanced touch targets - 48px minimum (above Apple's 44px) */
  .btn,
  .tab,
  .calendar-day,
  .blog-entry-toggle,
  .tag-menu-item,
  .checkbox-group label,
  .radio-option {
    min-height: 48px;
    min-width: 48px;
  }

  /* Expanded touch areas with pseudo-elements */
  .calendar-day {
    position: relative;
  }

  .calendar-day::before {
    content: '';
    position: absolute;
    inset: -4px;
    z-index: -1;
  }

  /* Form inputs - larger touch targets */
  .form-input,
  input,
  select,
  textarea {
    min-height: 52px;
    padding: var(--space-4);
  }

  /* Tag menu items - comfortable tap area */
  .tag-menu-item {
    min-height: 52px;
    padding: var(--space-3) var(--space-4);
  }

  /* Checkbox/radio touch area - balanced for touch while not oversized */
  .checkbox-input,
  .radio-input {
    width: 20px;
    height: 20px;
  }

  .checkbox-label,
  .radio-label {
    padding: var(--space-2) 0;
    font-size: 0.9rem;
  }

  /* Writing mode: hide bottom nav */
  body.writing-mode .tab-nav {
    display: none;
  }

  /* Non-app mode tabs (auth screens) keep original styling */
  .tab-nav {
    padding: 12px 16px;
    gap: 2px;
  }

  .tab {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .tab span {
    display: none;
  }

  /* Content areas - let clamp() handle fluid padding, only override non-responsive areas */
  .share-content,
  .reminders-content,
  .panel {
    padding: 16px;
  }

  /* Date row stacks vertically on mobile - gap handled by clamp() */
  .date-row {
    grid-template-columns: 1fr;
  }

  /* Calendar header stays centered with inline nav on mobile */
  .calendar-month {
    font-size: 1rem;
  }

  .calendar-month i {
    font-size: 1.1rem;
  }

  .calendar-day {
    font-size: 0.85rem;
    border-radius: 12px;
  }

  .calendar-weekday,
  .weekday-label {
    padding: 6px 2px;
    font-size: 0.65rem;
  }

  /* Calendar legend stacks vertically on mobile */
  .calendar-legend {
    flex-direction: column;
  }

  .blog-entry {
    border-radius: 20px;
    padding: 16px;
    overflow: hidden;
  }

  .blog-entry-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .blog-entry-header-left {
    flex: 1;
    min-width: 0;
  }

  .blog-entry-date {
    font-size: 0.9rem;
  }

  .blog-entry-photos {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 8px;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .blog-entry-photos img {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
  }

  .share-link-card {
    padding: 16px;
  }

  .share-link-header {
    flex-direction: column;
    gap: 8px;
  }

  .share-link-actions {
    flex-direction: column;
  }

  .share-link-actions .btn {
    width: 100%;
  }

  .button-group {
    flex-direction: column;
  }

  .button-group .btn {
    width: 100%;
  }

  /* ===== Mobile Animations & Transitions ===== */

  /* Tab panel transitions */
  .tab-panel {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity var(--duration-normal) ease,
                transform var(--duration-normal) ease;
    will-change: opacity, transform;
  }

  .tab-panel:not(.hidden) {
    opacity: 1;
    transform: translateX(0);
  }

  /* Staggered content reveal */
  .tab-panel:not(.hidden) .section,
  .tab-panel:not(.hidden) .blog-entry,
  .tab-panel:not(.hidden) .calendar-header,
  .tab-panel:not(.hidden) .calendar-grid {
    animation: content-reveal 300ms var(--easing-default) backwards;
  }

  .tab-panel:not(.hidden) .blog-entry:nth-child(1) { animation-delay: 50ms; }
  .tab-panel:not(.hidden) .blog-entry:nth-child(2) { animation-delay: 100ms; }
  .tab-panel:not(.hidden) .blog-entry:nth-child(3) { animation-delay: 150ms; }
  .tab-panel:not(.hidden) .blog-entry:nth-child(4) { animation-delay: 200ms; }
  .tab-panel:not(.hidden) .blog-entry:nth-child(5) { animation-delay: 250ms; }

  /* Button press feedback */
  .btn:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 50ms ease;
  }

  /* Calendar day tap ripple */
  .calendar-day::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, var(--sunny-yellow) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: transform 300ms ease, opacity 300ms ease;
    border-radius: inherit;
    pointer-events: none;
  }

  .calendar-day:active::after {
    opacity: 0.3;
    transform: scale(2);
  }

  /* Enhanced heart favorite animation */
  .favorite-button.active i {
    animation: heart-burst 500ms var(--easing-spring);
  }

  /* Photo card lift on touch */
  .photo-card:active {
    transform: rotate(0deg) scale(1.02) translateY(-4px);
    box-shadow: var(--shadow-xl);
    transition: all 150ms var(--easing-spring);
  }

  /* Blog entry photos horizontal scroll snap */
  .blog-entry-photos {
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--space-4);
  }

  .blog-entry-photos img {
    scroll-snap-align: start;
  }

  /* ===== Safe Area Handling ===== */

  /* Page header respects notch */
  .page-header {
    padding-left: max(var(--space-4), var(--safe-left));
    padding-right: max(var(--space-4), var(--safe-right));
  }

  /* Main card side margins */
  .main-card {
    margin-left: max(var(--space-4), var(--safe-left));
    margin-right: max(var(--space-4), var(--safe-right));
  }

  /* Toast positioning with safe area */
  body.app-mode .toast {
    left: max(var(--space-4), var(--safe-left));
    right: max(var(--space-4), var(--safe-right));
  }
}

/* Landscape orientation adjustments */
@media (max-width: 640px) and (orientation: landscape) {
  body.app-mode .tab-nav {
    padding-left: calc(var(--space-2) + var(--safe-left));
    padding-right: calc(var(--space-2) + var(--safe-right));
  }

  .page-header {
    padding-top: var(--space-3);
  }

  /* Reduce writing mode padding in landscape */
  body.writing-mode #app-panel {
    padding-top: 56px;
    padding-bottom: 56px;
  }
}

/* ========== Desktop Enhancements ========== */
@media (min-width: 641px) {
  /* ===== Header & Navigation Polish ===== */

  .page-header {
    padding: 32px 0 24px;
    position: relative;
  }

  /* Subtle gradient border under header */
  .page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg,
      var(--sunny-yellow) 0%,
      var(--playful-orange) 50%,
      var(--coral-pink) 100%
    );
    border-radius: var(--radius-full);
    opacity: 0.6;
  }

  /* Logo hover animations */
  .app-logo .logo-text {
    font-size: 4rem;
    letter-spacing: -0.02em;
  }

  .app-logo .logo-text span {
    display: inline-block;
    transition: transform var(--duration-normal) var(--easing-spring);
  }

  .app-logo .logo-text .stylized-m {
    display: inline-block;
    transition: transform var(--duration-normal) var(--easing-spring);
  }

  /* Memaday letter hover animations */
  .app-logo:hover .stylized-m { transform: translateY(-2px) rotate(-2deg); }
  .app-logo:hover .letter-e1 { transform: translateY(-3px) rotate(1deg); }
  .app-logo:hover .letter-m { transform: translateY(-2px) rotate(2deg); }
  .app-logo:hover .letter-a1 { transform: translateY(-4px); }
  .app-logo:hover .letter-d { transform: translateY(-3px) rotate(-1deg); }
  .app-logo:hover .letter-a2 { transform: translateY(-2px) rotate(2deg); }
  .app-logo:hover .letter-y { transform: translateY(-3px) rotate(-2deg); }

  .app-logo .tagline {
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    margin-top: 8px;
    transition: letter-spacing var(--duration-slow) ease;
  }

  .app-logo:hover .tagline {
    letter-spacing: 0.18em;
  }

  /* Journal badge refinement */
  .journal-badge {
    padding: 8px 18px;
    border-radius: 24px;
    font-size: 0.9rem;
    box-shadow:
      0 2px 8px rgba(251, 191, 36, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all var(--duration-normal) ease;
  }

  .journal-badge:hover {
    transform: translateY(-1px);
    box-shadow:
      0 4px 12px rgba(251, 191, 36, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  /* Tab navigation premium styling */
  .tab-nav {
    padding: 12px 24px;
    gap: 6px;
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 100%);
    border-bottom: 1px solid var(--gray-200);
  }

  .tab {
    padding: 12px 20px;
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    position: relative;
    transition:
      background var(--duration-normal) ease,
      color var(--duration-normal) ease,
      transform var(--duration-fast) ease;
  }

  .tab i {
    font-size: 1.25rem;
    transition: transform var(--duration-normal) var(--easing-spring);
  }

  .tab:hover:not(.active) {
    background: var(--white);
    color: var(--gray-700);
    transform: translateY(-1px);
  }

  .tab:hover:not(.active) i {
    transform: scale(1.1);
  }

  .tab.active {
    background: var(--white);
    color: var(--playful-orange-dark);
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.06),
      0 0 0 1px rgba(251, 146, 60, 0.1);
  }

  .tab.active i {
    color: var(--playful-orange);
    animation: tab-icon-pop 300ms var(--easing-spring);
  }

  /* Keyboard focus ring enhancement */
  .tab:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 2px var(--white),
      0 0 0 4px var(--sky-blue);
  }

  /* Keyboard shortcut hints on tab hover */
  .tab[data-tab="entry"]:hover::after,
  .tab[data-tab="blog"]:hover::after,
  .tab[data-tab="calendar"]:hover::after,
  .tab[data-tab="search"]:hover::after {
    position: absolute;
    top: -8px;
    right: -4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gray-400);
    background: var(--white);
    padding: 2px 5px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity var(--duration-normal) ease, transform var(--duration-normal) ease;
  }
  .tab[data-tab="entry"]:hover::after { content: '1'; opacity: 1; transform: translateY(0); }
  .tab[data-tab="blog"]:hover::after { content: '2'; opacity: 1; transform: translateY(0); }
  .tab[data-tab="calendar"]:hover::after { content: '3'; opacity: 1; transform: translateY(0); }
  .tab[data-tab="search"]:hover::after { content: '4'; opacity: 1; transform: translateY(0); }

  /* ===== Card Hover States ===== */

  /* Main card entrance animation */
  .main-card {
    animation: card-entrance 500ms var(--easing-default);
  }

  /* Blog entry cards */
  .blog-entry {
    position: relative;
    border: 1px solid transparent;
    transition:
      transform var(--duration-normal) var(--easing-default),
      box-shadow var(--duration-normal) ease,
      border-color var(--duration-normal) ease;
  }

  .blog-entry::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg,
      rgba(251, 146, 60, 0.05) 0%,
      rgba(56, 189, 248, 0.05) 100%
    );
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
    pointer-events: none;
  }

  .blog-entry:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(251, 146, 60, 0.15);
  }

  .blog-entry:hover::before {
    opacity: 1;
  }

  /* Photo cards with 3D tilt effect */
  .photo-card {
    transition:
      transform var(--duration-normal) var(--easing-spring),
      box-shadow var(--duration-normal) ease;
    transform-style: preserve-3d;
  }

  .photo-card:hover {
    transform: translateY(-6px) rotateX(2deg) rotateY(-2deg);
    box-shadow:
      var(--shadow-xl),
      0 20px 40px rgba(0, 0, 0, 0.08);
  }

  .photo-card:hover img {
    transform: scale(1.02);
  }

  .photo-card img {
    transition: transform var(--duration-slow) ease;
  }

  /* Share link cards */
  .share-link-card {
    transition:
      transform var(--duration-normal) ease,
      box-shadow var(--duration-normal) ease,
      border-color var(--duration-normal) ease;
  }

  .share-link-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--lavender);
  }

  /* ===== Button Micro-interactions ===== */

  /* Primary button with glow effect */
  .btn-primary {
    position: relative;
    overflow: hidden;
  }

  .btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.2) 0%,
      transparent 50%,
      transparent 100%
    );
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
  }

  .btn-primary:hover:not(:disabled)::before {
    opacity: 1;
  }

  .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
      0 8px 20px rgba(251, 146, 60, 0.4),
      0 0 0 1px rgba(251, 146, 60, 0.2);
  }

  .btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(251, 146, 60, 0.3);
  }

  /* Secondary button */
  .btn-secondary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }

  /* Tertiary button underline animation */
  .btn-tertiary {
    position: relative;
  }

  .btn-tertiary::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform var(--duration-normal) ease;
  }

  .btn-tertiary:hover:not(:disabled)::after {
    transform: scaleX(1);
  }

  /* Icon button hover */
  .btn i {
    transition: transform var(--duration-normal) var(--easing-spring);
  }

  .btn:hover:not(:disabled) i {
    transform: scale(1.1);
  }

  /* Favorite button heart animation */
  .favorite-button:hover:not(:disabled) i {
    animation: heart-beat 600ms ease infinite;
  }

  .favorite-button.active:hover:not(:disabled) i {
    animation: none;
    transform: scale(1.1);
  }

  /* ===== Form Interactions ===== */

  /* Input hover state */
  .form-input:hover:not(:focus):not(:disabled),
  input:hover:not(:focus):not(:disabled),
  select:hover:not(:focus):not(:disabled),
  textarea:hover:not(:focus):not(:disabled) {
    border-color: var(--gray-300);
    background: var(--gray-50);
  }

  /* Focus state with glow */
  .form-input:focus,
  input:focus,
  select:focus,
  textarea:focus {
    border-color: var(--sky-blue);
    box-shadow:
      0 0 0 4px rgba(56, 189, 248, 0.12),
      inset 0 1px 2px rgba(0, 0, 0, 0.04);
    background: var(--white);
  }

  /* Placeholder animation */
  .form-input::placeholder,
  input::placeholder,
  textarea::placeholder {
    transition:
      opacity var(--duration-normal) ease,
      transform var(--duration-normal) ease;
  }

  .form-input:focus::placeholder,
  input:focus::placeholder,
  textarea:focus::placeholder {
    opacity: 0.5;
    transform: translateX(4px);
  }

  /* Entry textarea expand on focus */
  textarea#entry-content {
    transition:
      border-color var(--duration-normal) ease,
      box-shadow var(--duration-normal) ease,
      min-height var(--duration-slow) var(--easing-default);
  }

  textarea#entry-content:focus {
    min-height: 400px;
  }

  /* ===== Panel Transitions ===== */

  /* Tab panel transitions */
  .tab-panel {
    animation: panel-enter 400ms var(--easing-default);
  }

  .tab-panel.hidden {
    display: none;
  }

  /* Staggered content animation */
  .tab-panel > * {
    animation: content-stagger 400ms var(--easing-default) both;
  }

  .tab-panel > *:nth-child(1) { animation-delay: 0ms; }
  .tab-panel > *:nth-child(2) { animation-delay: 50ms; }
  .tab-panel > *:nth-child(3) { animation-delay: 100ms; }
  .tab-panel > *:nth-child(4) { animation-delay: 150ms; }

  /* Blog entry staggered entrance */
  .blog-entry {
    animation: entry-appear 400ms var(--easing-default) both;
  }

  .blog-entry:nth-child(1) { animation-delay: 0ms; }
  .blog-entry:nth-child(2) { animation-delay: 50ms; }
  .blog-entry:nth-child(3) { animation-delay: 100ms; }
  .blog-entry:nth-child(4) { animation-delay: 150ms; }
  .blog-entry:nth-child(5) { animation-delay: 200ms; }
  .blog-entry:nth-child(6) { animation-delay: 250ms; }
  .blog-entry:nth-child(7) { animation-delay: 300ms; }

  /* Enhanced focus-visible states */
  *:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 2px var(--bg-surface),
      0 0 0 4px var(--sky-blue);
  }

  /* Photo grid */
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
  }

  /* Blog photo gallery hover */
  .blog-entry-photos img {
    transition:
      transform var(--duration-normal) ease,
      box-shadow var(--duration-normal) ease;
    cursor: pointer;
  }

  .blog-entry-photos img:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
    z-index: 10;
    position: relative;
  }
}

/* Desktop animations */
@keyframes card-entrance {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tab-icon-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes content-stagger {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes entry-appear {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.15); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
}

/* ========== Extra-Large Screen Enhancements (1200px+) ========== */
@media (min-width: 1200px) {
  /* Generous typography for large displays */
  body {
    font-size: 18px;
    line-height: 1.7;
  }

  .app-logo .logo-text {
    font-size: 4.5rem;
  }

  .app-logo .tagline {
    font-size: 1.2rem;
    letter-spacing: 0.14em;
  }

  /* More breathing room for content */
  .entry-content,
  .blog-content,
  .calendar-content,
  .search-content {
    padding: 32px;
  }

  /* Larger textarea for comfortable writing */
  textarea#entry-content {
    font-size: 18px;
    line-height: 1.8;
    min-height: 320px;
  }

  textarea#entry-content:focus {
    min-height: 480px;
  }

  /* Blog entry text */
  .blog-entry-content,
  .blog-entry-text {
    font-size: 18px;
    line-height: 1.8;
  }

  /* Section titles */
  .section-title {
    font-size: 1.5rem;
  }

  /* Calendar cells slightly larger */
  .calendar-day {
    font-size: 1rem;
  }
}

/* ========== Skeleton Loading States ========== */
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-100) 0%,
    var(--gray-50) 50%,
    var(--gray-100) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

/* Blog entry skeleton */
.blog-entry-skeleton {
  background: var(--bg-sunken);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.blog-entry-skeleton .skeleton-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.blog-entry-skeleton .skeleton-date {
  width: 120px;
  height: 24px;
}

.blog-entry-skeleton .skeleton-buttons {
  display: flex;
  gap: 12px;
}

.blog-entry-skeleton .skeleton-button {
  width: 80px;
  height: 36px;
  border-radius: var(--radius-md);
}

/* Photo skeleton */
.photo-skeleton {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
}

/* Button loading state */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spinner-rotate 0.8s linear infinite;
}

.btn-primary.loading::after {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* ========== Photo Lightbox ========== */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-slow) ease,
    visibility var(--duration-slow) ease;
}

.photo-lightbox.open {
  opacity: 1;
  visibility: visible;
}

.photo-lightbox .lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.photo-lightbox .lightbox-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 48px;
}

.photo-lightbox .lightbox-image {
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform var(--duration-slow) var(--easing-spring);
}

.photo-lightbox.open .lightbox-image {
  transform: scale(1);
}

.photo-lightbox .lightbox-close,
.photo-lightbox .lightbox-prev,
.photo-lightbox .lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    background var(--duration-normal) ease,
    transform var(--duration-normal) ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox .lightbox-close:hover,
.photo-lightbox .lightbox-prev:hover,
.photo-lightbox .lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.photo-lightbox .lightbox-close:disabled,
.photo-lightbox .lightbox-prev:disabled,
.photo-lightbox .lightbox-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.photo-lightbox .lightbox-close {
  top: 24px;
  right: 24px;
}

.photo-lightbox .lightbox-prev {
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.photo-lightbox .lightbox-next {
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.photo-lightbox .lightbox-prev:hover,
.photo-lightbox .lightbox-next:hover {
  transform: translateY(-50%) scale(1.1);
}

.photo-lightbox .lightbox-close i,
.photo-lightbox .lightbox-prev i,
.photo-lightbox .lightbox-next i {
  font-size: 1.5rem;
}

.photo-lightbox .lightbox-caption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  font-size: var(--text-sm);
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  max-width: 80%;
  text-align: center;
}

/* Mobile lightbox adjustments */
@media (max-width: 640px) {
  .photo-lightbox .lightbox-content {
    padding: 16px;
  }

  .photo-lightbox .lightbox-close {
    top: calc(16px + var(--safe-top));
    right: 16px;
  }

  .photo-lightbox .lightbox-prev {
    left: 8px;
  }

  .photo-lightbox .lightbox-next {
    right: 8px;
  }

  .photo-lightbox .lightbox-caption {
    bottom: calc(16px + var(--safe-bottom));
  }
}
